diff --git a/mp/src/utils/sapi51/Bin/SAPI51ListBox.ocx b/mp/src/utils/sapi51/Bin/SAPI51ListBox.ocx new file mode 100644 index 00000000..cf95b595 Binary files /dev/null and b/mp/src/utils/sapi51/Bin/SAPI51ListBox.ocx differ diff --git a/mp/src/utils/sapi51/Docs/Help/sapi.chm b/mp/src/utils/sapi51/Docs/Help/sapi.chm new file mode 100644 index 00000000..49c84bfa Binary files /dev/null and b/mp/src/utils/sapi51/Docs/Help/sapi.chm differ diff --git a/mp/src/utils/sapi51/IDL/sapi.idl b/mp/src/utils/sapi51/IDL/sapi.idl new file mode 100644 index 00000000..130efbda --- /dev/null +++ b/mp/src/utils/sapi51/IDL/sapi.idl @@ -0,0 +1,2197 @@ +/**************************************************************************** +* sapi.idl +* +* This is the interface definition file for the Microsoft Speech API +* Version 5.0. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +//--- Compiler Directive ---------------------------------------------------- +cpp_quote("#pragma warning(disable:4201) // Allow nameless structs/unions") + +//--- Includes -------------------------------------------------------------- +import "oaidl.idl"; +import "ocidl.idl"; + +//--- Locally scoped define for LANGID +#ifndef LANGID +#define LANGID WORD +#endif + +//--- Link with sapi.lib +cpp_quote("#pragma comment(lib, \"sapi.lib\")") + +//--- Forward and External Declarations ------------------------------------- + +cpp_quote("#if 0") // Ignore our definition in the .H file +typedef [restricted, hidden] struct WAVEFORMATEX +{ + WORD wFormatTag; /* format type */ + WORD nChannels; /* number of channels (i.e. mono, stereo...) */ + DWORD nSamplesPerSec; /* sample rate */ + DWORD nAvgBytesPerSec; /* for buffer estimation */ + WORD nBlockAlign; /* block size of data */ + WORD wBitsPerSample; /* Number of bits per sample of mono data */ + WORD cbSize; /* The count in bytes of the size of + extra information (after cbSize) */ + +} WAVEFORMATEX; +cpp_quote("#else") +cpp_quote("#include ") +cpp_quote("#endif") + + +//--- Notifications +interface ISpNotifySource; +interface ISpNotifySink; +interface ISpNotifyTranslator; + +//--- Object tokens +interface ISpDataKey; +interface ISpObjectTokenCategory; +interface ISpObjectToken; +interface IEnumSpObjectTokens; +interface ISpObjectWithToken; + +//--- Resource management +interface ISpResourceManager; + +//--- Speech specific events +interface ISpEventSource; +interface ISpEventSink; + +//--- Audio streams +interface ISpStreamFormat; +interface ISpStream; +interface ISpStreamFormatConverter; +interface ISpAudio; +interface ISpMMSysAudio; +interface ISpTranscript; + + +//--- TTS interface +interface ISpVoice; + +//--- SR interfaces +interface ISpRecoResult; +interface ISpRecoContext; +interface ISpRecognizer; +interface ISpProperties; + +//--- Lexicon interfaces +interface ISpLexicon; + +//--- Phone Converter +interface ISpPhoneConverter; + +//--- Phrase interface +interface ISpPhrase; + +// +//--- Constants ------------------------------------------------------------- +// + +//--- DataKey locations +typedef [hidden] enum SPDATAKEYLOCATION +{ + SPDKL_DefaultLocation = 0, + SPDKL_CurrentUser = 1, + SPDKL_LocalMachine = 2, + SPDKL_CurrentConfig = 5 +} SPDATAKEYLOCATION; + +//--- TokenUI constants +cpp_quote("#define SPDUI_EngineProperties L\"EngineProperties\"") +cpp_quote("#define SPDUI_AddRemoveWord L\"AddRemoveWord\"") +cpp_quote("#define SPDUI_UserTraining L\"UserTraining\"") +cpp_quote("#define SPDUI_MicTraining L\"MicTraining\"") +cpp_quote("#define SPDUI_RecoProfileProperties L\"RecoProfileProperties\"") +cpp_quote("#define SPDUI_AudioProperties L\"AudioProperties\"") +cpp_quote("#define SPDUI_AudioVolume L\"AudioVolume\"") + +//--- Data formats - these are used by the CSpStreamFormat class in sphelper.h +typedef [hidden] enum SPSTREAMFORMAT +{ + SPSF_Default = -1, + SPSF_NoAssignedFormat = 0, // Similar to GUID_NULL + SPSF_Text, + SPSF_NonStandardFormat, // Non-SAPI 5.1 standard format with no WAVEFORMATEX description + SPSF_ExtendedAudioFormat, // Non-SAPI 5.1 standard format but has WAVEFORMATEX description + // Standard PCM wave formats + SPSF_8kHz8BitMono, + SPSF_8kHz8BitStereo, + SPSF_8kHz16BitMono, + SPSF_8kHz16BitStereo, + SPSF_11kHz8BitMono, + SPSF_11kHz8BitStereo, + SPSF_11kHz16BitMono, + SPSF_11kHz16BitStereo, + SPSF_12kHz8BitMono, + SPSF_12kHz8BitStereo, + SPSF_12kHz16BitMono, + SPSF_12kHz16BitStereo, + SPSF_16kHz8BitMono, + SPSF_16kHz8BitStereo, + SPSF_16kHz16BitMono, + SPSF_16kHz16BitStereo, + SPSF_22kHz8BitMono, + SPSF_22kHz8BitStereo, + SPSF_22kHz16BitMono, + SPSF_22kHz16BitStereo, + SPSF_24kHz8BitMono, + SPSF_24kHz8BitStereo, + SPSF_24kHz16BitMono, + SPSF_24kHz16BitStereo, + SPSF_32kHz8BitMono, + SPSF_32kHz8BitStereo, + SPSF_32kHz16BitMono, + SPSF_32kHz16BitStereo, + SPSF_44kHz8BitMono, + SPSF_44kHz8BitStereo, + SPSF_44kHz16BitMono, + SPSF_44kHz16BitStereo, + SPSF_48kHz8BitMono, + SPSF_48kHz8BitStereo, + SPSF_48kHz16BitMono, + SPSF_48kHz16BitStereo, + // TrueSpeech format + SPSF_TrueSpeech_8kHz1BitMono, + // A-Law formats + SPSF_CCITT_ALaw_8kHzMono, + SPSF_CCITT_ALaw_8kHzStereo, + SPSF_CCITT_ALaw_11kHzMono, + SPSF_CCITT_ALaw_11kHzStereo, + SPSF_CCITT_ALaw_22kHzMono, + SPSF_CCITT_ALaw_22kHzStereo, + SPSF_CCITT_ALaw_44kHzMono, + SPSF_CCITT_ALaw_44kHzStereo, + // u-Law formats + SPSF_CCITT_uLaw_8kHzMono, + SPSF_CCITT_uLaw_8kHzStereo, + SPSF_CCITT_uLaw_11kHzMono, + SPSF_CCITT_uLaw_11kHzStereo, + SPSF_CCITT_uLaw_22kHzMono, + SPSF_CCITT_uLaw_22kHzStereo, + SPSF_CCITT_uLaw_44kHzMono, + SPSF_CCITT_uLaw_44kHzStereo, + // ADPCM formats + SPSF_ADPCM_8kHzMono, + SPSF_ADPCM_8kHzStereo, + SPSF_ADPCM_11kHzMono, + SPSF_ADPCM_11kHzStereo, + SPSF_ADPCM_22kHzMono, + SPSF_ADPCM_22kHzStereo, + SPSF_ADPCM_44kHzMono, + SPSF_ADPCM_44kHzStereo, + // GSM 6.10 formats + SPSF_GSM610_8kHzMono, + SPSF_GSM610_11kHzMono, + SPSF_GSM610_22kHzMono, + SPSF_GSM610_44kHzMono, + SPSF_NUM_FORMATS +} SPSTREAMFORMAT; + +cpp_quote("EXTERN_C const GUID SPDFID_Text;") +cpp_quote("EXTERN_C const GUID SPDFID_WaveFormatEx;") + +//--- Root of registry entries for speech use +cpp_quote("#define SPREG_USER_ROOT L\"HKEY_CURRENT_USER\\\\SOFTWARE\\\\Microsoft\\\\Speech\"") +cpp_quote("#define SPREG_LOCAL_MACHINE_ROOT L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\"") + +//--- Categories for speech resource management +cpp_quote("#define SPCAT_AUDIOOUT L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioOutput\"") +cpp_quote("#define SPCAT_AUDIOIN L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioInput\"") +cpp_quote("#define SPCAT_VOICES L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\Voices\"") +cpp_quote("#define SPCAT_RECOGNIZERS L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\Recognizers\"") +cpp_quote("#define SPCAT_APPLEXICONS L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AppLexicons\"") +cpp_quote("#define SPCAT_PHONECONVERTERS L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\PhoneConverters\"") +cpp_quote("#define SPCAT_RECOPROFILES L\"HKEY_CURRENT_USER\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\RecoProfiles\"") + +//--- Specific token ids of interest +cpp_quote("#define SPMMSYS_AUDIO_IN_TOKEN_ID L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioInput\\\\TokenEnums\\\\MMAudioIn\\\\\"") +cpp_quote("#define SPMMSYS_AUDIO_OUT_TOKEN_ID L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioOutput\\\\TokenEnums\\\\MMAudioOut\\\\\"") +cpp_quote("#define SPCURRENT_USER_LEXICON_TOKEN_ID L\"HKEY_CURRENT_USER\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\CurrentUserLexicon\"") + +//--- Standard token values +cpp_quote("#define SPTOKENVALUE_CLSID L\"CLSID\"") +cpp_quote("#define SPTOKENKEY_FILES L\"Files\"") +cpp_quote("#define SPTOKENKEY_UI L\"UI\"") +cpp_quote("#define SPTOKENKEY_ATTRIBUTES L\"Attributes\"") + +//--- Standard voice category values +cpp_quote("#define SPVOICECATEGORY_TTSRATE L\"DefaultTTSRate\"") + +//--- Standard SR Engine properties +cpp_quote("#define SPPROP_RESOURCE_USAGE L\"ResourceUsage\"") +cpp_quote("#define SPPROP_HIGH_CONFIDENCE_THRESHOLD L\"HighConfidenceThreshold\"") +cpp_quote("#define SPPROP_NORMAL_CONFIDENCE_THRESHOLD L\"NormalConfidenceThreshold\"") +cpp_quote("#define SPPROP_LOW_CONFIDENCE_THRESHOLD L\"LowConfidenceThreshold\"") +cpp_quote("#define SPPROP_RESPONSE_SPEED L\"ResponseSpeed\"") +cpp_quote("#define SPPROP_COMPLEX_RESPONSE_SPEED L\"ComplexResponseSpeed\"") +cpp_quote("#define SPPROP_ADAPTATION_ON L\"AdaptationOn\"") + +//--- Standard SAPI Recognition Topics +cpp_quote("#define SPTOPIC_SPELLING L\"Spelling\"") + +// CFG Wildcard token +cpp_quote("#define SPWILDCARD L\"...\"") + +// CFG Dication token +cpp_quote("#define SPDICTATION L\"*\"") +cpp_quote("#define SPINFDICTATION L\"*+\"") + +// CFG confidence scores +const signed char SP_LOW_CONFIDENCE = -1; +const signed char SP_NORMAL_CONFIDENCE = 0; +const signed char SP_HIGH_CONFIDENCE = +1; + +// CFG default weight +const float DEFAULT_WEIGHT = 1.0; + +// Lexicon word and pronunciation limits +const ULONG SP_MAX_WORD_LENGTH = 128; +const ULONG SP_MAX_PRON_LENGTH = 384; + +// +//--- Interface definitions ------------------------------------------------- +// + +//--- ISpNotifyCallback ----------------------------------------------------- + +cpp_quote("#if defined(__cplusplus)") +cpp_quote("interface ISpNotifyCallback") +cpp_quote("{") +cpp_quote("virtual HRESULT STDMETHODCALLTYPE NotifyCallback(") +cpp_quote(" WPARAM wParam,") +cpp_quote(" LPARAM lParam) = 0;") +cpp_quote("};") +cpp_quote("#else") +typedef void * ISpNotifyCallback; +cpp_quote("#endif") + +cpp_quote("#if 0") +typedef void * SPNOTIFYCALLBACK; +cpp_quote("#else") +cpp_quote("typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam);") +cpp_quote("#endif") + +//--- ISpNotifySource ------------------------------------------------------- +[ + object, + uuid(5EFF4AEF-8487-11D2-961C-00C04F8EE628), + helpstring("ISpNotifySource Interface"), + pointer_default(unique), + restricted +] +interface ISpNotifySource : IUnknown +{ + HRESULT SetNotifySink([in] ISpNotifySink * pNotifySink); + [local] HRESULT SetNotifyWindowMessage( + [in] HWND hWnd, + [in] UINT Msg, + [in] WPARAM wParam, + [in] LPARAM lParam); + [local] HRESULT SetNotifyCallbackFunction( + [in] SPNOTIFYCALLBACK * pfnCallback, + [in] WPARAM wParam, + [in] LPARAM lParam); + [local] HRESULT SetNotifyCallbackInterface( + [in] ISpNotifyCallback * pSpCallback, + [in] WPARAM wParam, + [in] LPARAM lParam); + [local] HRESULT SetNotifyWin32Event(void); + [local] HRESULT WaitForNotifyEvent([in] DWORD dwMilliseconds); + [local] HANDLE GetNotifyEventHandle(); +} + +//--- ISpNotifySink --------------------------------------------------------- +[ + object, + uuid(259684DC-37C3-11D2-9603-00C04F8EE628), + helpstring("ISpNotifySink Interface"), + pointer_default(unique), + restricted +] +interface ISpNotifySink : IUnknown +{ + HRESULT Notify(void); +} + + +//--- ISpNotifyTranslator --------------------------------------------------- +[ + object, + uuid(ACA16614-5D3D-11D2-960E-00C04F8EE628), + helpstring("ISpNotifyTranslator Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpNotifyTranslator : ISpNotifySink +{ + HRESULT InitWindowMessage( + [in] HWND hWnd, + [in] UINT Msg, + [in] WPARAM wParam, + [in] LPARAM lParam); + HRESULT InitCallback( + [in] SPNOTIFYCALLBACK * pfnCallback, + [in] WPARAM wParam, + [in] LPARAM lParam); + HRESULT InitSpNotifyCallback( + [in] ISpNotifyCallback * pSpCallback, + [in] WPARAM wParam, + [in] LPARAM lParam); + + HRESULT InitWin32Event( + HANDLE hEvent, + BOOL fCloseHandleOnRelease); + HRESULT Wait([in] DWORD dwMilliseconds); + HANDLE GetEventHandle(); +} + + +//--- ISpDataKey ------------------------------------------------------------ +[ + object, + uuid(14056581-E16C-11D2-BB90-00C04F8EE6C0), + helpstring("ISpDataKey Interface"), + pointer_default(unique), + restricted +] +interface ISpDataKey : IUnknown +{ + HRESULT SetData( const WCHAR * pszValueName, ULONG cbData, const BYTE * pData); + HRESULT GetData( const WCHAR * pszValueName, ULONG * pcbData, BYTE * pData); + HRESULT SetStringValue( const WCHAR * pszValueName, const WCHAR * pszValue ); + HRESULT GetStringValue( const WCHAR * pszValueName, WCHAR ** ppszValue); + HRESULT SetDWORD(const WCHAR * pszValueName, DWORD dwValue ); + HRESULT GetDWORD(const WCHAR * pszValueName, DWORD *pdwValue ); + HRESULT OpenKey(const WCHAR * pszSubKeyName, ISpDataKey ** ppSubKey); + HRESULT CreateKey(const WCHAR * pszSubKey, ISpDataKey ** ppSubKey); + HRESULT DeleteKey(const WCHAR * pszSubKey); + HRESULT DeleteValue(const WCHAR * pszValueName); + HRESULT EnumKeys(ULONG Index, WCHAR ** ppszSubKeyName); + HRESULT EnumValues(ULONG Index, WCHAR ** ppszValueName); +}; + +//--- ISpRegDataKey --------------------------------------------------------- +[ + object, + uuid(92A66E2B-C830-4149-83DF-6FC2BA1E7A5B), + helpstring("ISpRegDataKey"), + pointer_default(unique), + restricted +] +interface ISpRegDataKey : ISpDataKey +{ + [local] HRESULT SetKey([in] HKEY hkey, [in] BOOL fReadOnly); +} + +//--- ISpObjectTokenCategory ------------------------------------------------ +[ + object, + uuid(2D3D3845-39AF-4850-BBF9-40B49780011D), + helpstring("ISpObjectTokenCategory"), + pointer_default(unique), + restricted +] +interface ISpObjectTokenCategory : ISpDataKey +{ + HRESULT SetId([in] const WCHAR * pszCategoryId, BOOL fCreateIfNotExist); + HRESULT GetId([out] WCHAR ** ppszCoMemCategoryId); + HRESULT GetDataKey(SPDATAKEYLOCATION spdkl, ISpDataKey ** ppDataKey); + + HRESULT EnumTokens( + [in, string] const WCHAR * pzsReqAttribs, + [in, string] const WCHAR * pszOptAttribs, + [out] IEnumSpObjectTokens ** ppEnum); + + HRESULT SetDefaultTokenId([in] const WCHAR * pszTokenId); + HRESULT GetDefaultTokenId([out] WCHAR ** ppszCoMemTokenId); +}; + +//--- ISpObjectToken -------------------------------------------------------- +[ + object, + uuid(14056589-E16C-11D2-BB90-00C04F8EE6C0), + helpstring("ISpObjectToken Interface"), + pointer_default(unique), + restricted +] +interface ISpObjectToken : ISpDataKey +{ + HRESULT SetId(const WCHAR * pszCategoryId, const WCHAR * pszTokenId, BOOL fCreateIfNotExist); + HRESULT GetId(WCHAR ** ppszCoMemTokenId); + HRESULT GetCategory(ISpObjectTokenCategory ** ppTokenCategory); + + HRESULT CreateInstance( + [in] IUnknown * pUnkOuter, + [in] DWORD dwClsContext, + [in] REFIID riid, + [out, iid_is(riid)] void ** ppvObject); + + HRESULT GetStorageFileName( + [in] REFCLSID clsidCaller, + [in] const WCHAR * pszValueName, + [in] const WCHAR * pszFileNameSpecifier, + [in] ULONG nFolder, // Same as SHGetFolderPath -- If non-zero, must set CSIDL_FLAG_CREATE + [out] WCHAR ** ppszFilePath); + HRESULT RemoveStorageFileName( + [in] REFCLSID clsidCaller, + [in] const WCHAR * pszKeyName, + [in] BOOL fDeleteFile); + + HRESULT Remove(const CLSID * pclsidCaller); + + [local] HRESULT IsUISupported( + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [in] IUnknown * punkObject, + [out] BOOL *pfSupported); + [local] HRESULT DisplayUI( + [in] HWND hwndParent, + [in] const WCHAR * pszTitle, + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [in] IUnknown * punkObject); + HRESULT MatchesAttributes( + [in] const WCHAR * pszAttributes, + [out] BOOL *pfMatches); +}; + +[ + object, + uuid(B8AAB0CF-346F-49D8-9499-C8B03F161D51), + helpstring("ISpObjectTokenInit Interface"), + pointer_default(unique), + restricted +] +interface ISpObjectTokenInit : ISpObjectToken +{ + HRESULT InitFromDataKey( + [in] const WCHAR * pszCategoryId, + [in] const WCHAR * pszTokenId, + [in] ISpDataKey * pDataKey); +}; + +//--- IEnumSpObjectTokens --------------------------------------------------- +// This interface is used to enumerate speech object tokens + +[ + object, + uuid(06B64F9E-7FDA-11D2-B4F2-00C04F797396), + helpstring("IEnumSpObjectTokens Interface"), + pointer_default(unique), + restricted +] +interface IEnumSpObjectTokens : IUnknown +{ + HRESULT Next([in] ULONG celt, + [out, size_is(celt), length_is(*pceltFetched)] ISpObjectToken ** pelt, + [out] ULONG *pceltFetched); + HRESULT Skip([in] ULONG celt); + + HRESULT Reset(void); + HRESULT Clone([out] IEnumSpObjectTokens **ppEnum); + + HRESULT Item([in] ULONG Index, [out] ISpObjectToken ** ppToken); + + HRESULT GetCount([out] ULONG* pCount); +}; + +//--- ISpObjectWithToken ---------------------------------------------------- +[ + object, + uuid(5B559F40-E952-11D2-BB91-00C04F8EE6C0), + helpstring("ISpObjectWithToken Interface"), + pointer_default(unique), + restricted +] +interface ISpObjectWithToken : IUnknown +{ + HRESULT SetObjectToken(ISpObjectToken * pToken); + HRESULT GetObjectToken(ISpObjectToken ** ppToken); +}; + +//--- ISpResourceManager ---------------------------------------------------- +[ + object, + uuid(93384E18-5014-43D5-ADBB-A78E055926BD), + helpstring("ISpResourceManager Interface"), + pointer_default(unique), + restricted +] +#ifdef _WIN32_WCE +interface ISpResourceManager : IUnknown //IServiceProvider +#else +interface ISpResourceManager : IServiceProvider +#endif // _WIN32_WCE +{ + HRESULT SetObject( + [in] REFGUID guidServiceId, + [in] IUnknown *pUnkObject); + HRESULT GetObject( + [in] REFGUID guidServiceId, + [in] REFCLSID ObjectCLSID, + [in] REFIID ObjectIID, + [in] BOOL fReleaseWhenLastExternalRefReleased, + [out, iid_is(ObjectIID)] void** ppObject); +}; + +//--- ISpEventSource -------------------------------------------------------- +typedef [hidden] enum SPEVENTLPARAMTYPE +{ + SPET_LPARAM_IS_UNDEFINED = 0, + SPET_LPARAM_IS_TOKEN, + SPET_LPARAM_IS_OBJECT, + SPET_LPARAM_IS_POINTER, + SPET_LPARAM_IS_STRING, +} SPEVENTLPARAMTYPE; + +typedef [hidden] enum SPEVENTENUM +{ + SPEI_UNDEFINED = 0, + + //--- TTS engine + SPEI_START_INPUT_STREAM = 1, + SPEI_END_INPUT_STREAM = 2, + SPEI_VOICE_CHANGE = 3, // LPARAM_IS_TOKEN + SPEI_TTS_BOOKMARK = 4, // LPARAM_IS_STRING + SPEI_WORD_BOUNDARY = 5, + SPEI_PHONEME = 6, + SPEI_SENTENCE_BOUNDARY = 7, + SPEI_VISEME = 8, + SPEI_TTS_AUDIO_LEVEL = 9, // wParam contains current output audio level + + //--- Engine vendors use these reserved bits + SPEI_TTS_PRIVATE = 15, + + SPEI_MIN_TTS = 1, + SPEI_MAX_TTS = 15, + + //--- Speech Recognition + SPEI_END_SR_STREAM = 34, // LPARAM contains HRESULT, WPARAM contains flags (SPESF_xxx) + SPEI_SOUND_START = 35, + SPEI_SOUND_END = 36, + SPEI_PHRASE_START = 37, + SPEI_RECOGNITION = 38, + SPEI_HYPOTHESIS = 39, + SPEI_SR_BOOKMARK = 40, + SPEI_PROPERTY_NUM_CHANGE = 41, // LPARAM points to a string, WPARAM is the attrib value + SPEI_PROPERTY_STRING_CHANGE= 42, // LPARAM pointer to buffer. Two concatinated null terminated strings. + SPEI_FALSE_RECOGNITION = 43, // apparent speech with no valid recognition + SPEI_INTERFERENCE = 44, // LPARAM is any combination of SPINTERFERENCE flags + SPEI_REQUEST_UI = 45, // LPARAM is string. + SPEI_RECO_STATE_CHANGE = 46, // wParam contains new reco state + SPEI_ADAPTATION = 47, // we are now ready to accept the adaptation buffer + SPEI_START_SR_STREAM = 48, + SPEI_RECO_OTHER_CONTEXT = 49, // Phrase finished and recognized, but for other context + SPEI_SR_AUDIO_LEVEL = 50, // wParam contains current input audio level + + //--- Engine vendors use these reserved bits + SPEI_SR_PRIVATE = 52, + + SPEI_MIN_SR = 34, + SPEI_MAX_SR = 52, + + SPEI_RESERVED1 = 30, // do not use + SPEI_RESERVED2 = 33, // do not use + SPEI_RESERVED3 = 63 // do not use +} SPEVENTENUM; + +cpp_quote("#define SPFEI_FLAGCHECK ( (1ui64 << SPEI_RESERVED1) | (1ui64 << SPEI_RESERVED2) )") + +cpp_quote("#define SPFEI_ALL_TTS_EVENTS (0x000000000000FFFEui64 | SPFEI_FLAGCHECK)") +cpp_quote("#define SPFEI_ALL_SR_EVENTS (0x001FFFFC00000000ui64 | SPFEI_FLAGCHECK)") +cpp_quote("#define SPFEI_ALL_EVENTS 0xEFFFFFFFFFFFFFFFui64") + +// The SPFEI macro converts an SPEVENTENUM event value into a 64-bit value. +// Multiple values can then be OR-ed together and passed to SetInterest. +cpp_quote("#define SPFEI(SPEI_ord) ((1ui64 << SPEI_ord) | SPFEI_FLAGCHECK)") + +// SPEVENT is defined 2 ways, because the current version of MIDL does not allow enumerations +// to be used as bit fields. So we define eEventId and elParamType as int bitfields for MIDL +// and redefine them as their appropriate enumerations for C++ +cpp_quote("#if 0") +typedef [restricted, hidden] struct SPEVENT +{ + WORD eEventId; //SPEVENTENUM + WORD elParamType; //SPEVENTLPARAMTYPE + ULONG ulStreamNum; // Input stream number this event is associated with + ULONGLONG ullAudioStreamOffset; + WPARAM wParam; + LPARAM lParam; +} SPEVENT; + +typedef [restricted, hidden] struct SPSERIALIZEDEVENT +{ + WORD eEventId; //SPEVENTENUM + WORD elParamType; //SPEVENTLPARAMTYPE + ULONG ulStreamNum; // Input stream number this event is associated with + ULONGLONG ullAudioStreamOffset; + ULONG SerializedwParam; + LONG SerializedlParam; +} SPSERIALIZEDEVENT; + +typedef [restricted, hidden] struct SPSERIALIZEDEVENT64 +{ + WORD eEventId; //SPEVENTENUM + WORD elParamType; //SPEVENTLPARAMTYPE + ULONG ulStreamNum; // Input stream number this event is associated with + ULONGLONG ullAudioStreamOffset; + ULONGLONG SerializedwParam; + LONGLONG SerializedlParam; +} SPSERIALIZEDEVENT64; + +cpp_quote("#else") +cpp_quote("typedef struct SPEVENT") +cpp_quote("{") +cpp_quote(" SPEVENTENUM eEventId : 16;") +cpp_quote(" SPEVENTLPARAMTYPE elParamType : 16;") +cpp_quote(" ULONG ulStreamNum;") +cpp_quote(" ULONGLONG ullAudioStreamOffset;") +cpp_quote(" WPARAM wParam;") +cpp_quote(" LPARAM lParam;") +cpp_quote("} SPEVENT;") +cpp_quote("typedef struct SPSERIALIZEDEVENT") +cpp_quote("{") +cpp_quote(" SPEVENTENUM eEventId : 16;") +cpp_quote(" SPEVENTLPARAMTYPE elParamType : 16;") +cpp_quote(" ULONG ulStreamNum;") +cpp_quote(" ULONGLONG ullAudioStreamOffset;") +cpp_quote(" ULONG SerializedwParam;") +cpp_quote(" LONG SerializedlParam;") +cpp_quote("} SPSERIALIZEDEVENT;") +cpp_quote("typedef struct SPSERIALIZEDEVENT64") +cpp_quote("{") +cpp_quote(" SPEVENTENUM eEventId : 16;") +cpp_quote(" SPEVENTLPARAMTYPE elParamType : 16;") +cpp_quote(" ULONG ulStreamNum;") +cpp_quote(" ULONGLONG ullAudioStreamOffset;") +cpp_quote(" ULONGLONG SerializedwParam;") +cpp_quote(" LONGLONG SerializedlParam;") +cpp_quote("} SPSERIALIZEDEVENT64;") +cpp_quote("#endif") + +//--- Types of interference +typedef [hidden] enum SPINTERFERENCE +{ + SPINTERFERENCE_NONE = 0, + SPINTERFERENCE_NOISE, + SPINTERFERENCE_NOSIGNAL, + SPINTERFERENCE_TOOLOUD, + SPINTERFERENCE_TOOQUIET, + SPINTERFERENCE_TOOFAST, + SPINTERFERENCE_TOOSLOW +} SPINTERFERENCE; + +//--- Flags for END_SR_STREAM event (in WPARAM) +typedef [hidden] enum SPENDSRSTREAMFLAGS +{ + SPESF_NONE = 0, + SPESF_STREAM_RELEASED = (1 << 0) +} SPENDSRSTREAMFLAGS; + +//--- Viseme features +typedef [hidden] enum SPVFEATURE +{ + SPVFEATURE_STRESSED = (1L << 0), + SPVFEATURE_EMPHASIS = (1L << 1) +} SPVFEATURE; + + +//--- Viseme event groups +typedef [hidden] enum SPVISEMES +{ + // English examples + //------------------ + SP_VISEME_0 = 0, // Silence + SP_VISEME_1, // AE, AX, AH + SP_VISEME_2, // AA + SP_VISEME_3, // AO + SP_VISEME_4, // EY, EH, UH + SP_VISEME_5, // ER + SP_VISEME_6, // y, IY, IH, IX + SP_VISEME_7, // w, UW + SP_VISEME_8, // OW + SP_VISEME_9, // AW + SP_VISEME_10, // OY + SP_VISEME_11, // AY + SP_VISEME_12, // h + SP_VISEME_13, // r + SP_VISEME_14, // l + SP_VISEME_15, // s, z + SP_VISEME_16, // SH, CH, JH, ZH + SP_VISEME_17, // TH, DH + SP_VISEME_18, // f, v + SP_VISEME_19, // d, t, n + SP_VISEME_20, // k, g, NG + SP_VISEME_21, // p, b, m +} SPVISEMES; + +typedef [restricted, hidden] struct SPEVENTSOURCEINFO +{ + ULONGLONG ullEventInterest; + ULONGLONG ullQueuedInterest; + ULONG ulCount; +} SPEVENTSOURCEINFO; + +[ + object, + uuid(BE7A9CCE-5F9E-11D2-960F-00C04F8EE628), + helpstring("ISpEventSource Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpEventSource : ISpNotifySource +{ + // It is neccessary to use the SPFEI macro to convert the + // SPEVENTENUM values into ULONGULONG values. + HRESULT SetInterest( + [in] ULONGLONG ullEventInterest, + [in] ULONGLONG ullQueuedInterest); + + HRESULT GetEvents( + [in] ULONG ulCount, + [out, size_is(ulCount)] SPEVENT* pEventArray, + [out] ULONG *pulFetched); + + HRESULT GetInfo([out] SPEVENTSOURCEINFO * pInfo); +}; + +//--- ISpEventSink --------------------------------------------------------- +[ + object, + uuid(BE7A9CC9-5F9E-11D2-960F-00C04F8EE628), + helpstring("ISpEventSink Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpEventSink : IUnknown +{ + HRESULT AddEvents([in] const SPEVENT* pEventArray, [in] ULONG ulCount); + HRESULT GetEventInterest([out] ULONGLONG * pullEventInterest); +}; + + +//--- ISpStreamFormat ------------------------------------------------------- +[ + object, + uuid(BED530BE-2606-4F4D-A1C0-54C5CDA5566F), + helpstring("ISpStreamFormat Interface"), + pointer_default(unique), + restricted +] +interface ISpStreamFormat : IStream +{ + HRESULT GetFormat(GUID * pguidFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); +} + +typedef [hidden] enum SPFILEMODE +{ + SPFM_OPEN_READONLY, // Open existing file, read-only + SPFM_OPEN_READWRITE, // (Not supported for wav files) Open existing file, read-write + SPFM_CREATE, // (Not supported for wav files) Open file if exists, else create if does not exist (opens read-write) + SPFM_CREATE_ALWAYS, // Create file even if file exists. Destroys old file. + SPFM_NUM_MODES // Used for limit checking +} SPFILEMODE; + +//--- ISpStream ------------------------------------------------------------- + +[ + object, + uuid(12E3CCA9-7518-44C5-A5E7-BA5A79CB929E), + helpstring("ISpStream Interface"), + pointer_default(unique), + restricted +] +interface ISpStream : ISpStreamFormat +{ + HRESULT SetBaseStream(IStream * pStream, REFGUID rguidFormat, const WAVEFORMATEX * pWaveFormatEx); + HRESULT GetBaseStream(IStream ** ppStream); + HRESULT BindToFile(const WCHAR * pszFileName, SPFILEMODE eMode, + const GUID * pFormatId, const WAVEFORMATEX * pWaveFormatEx, + ULONGLONG ullEventInterest); + HRESULT Close(); +} + +//--- ISpStreamFormatConverter ---------------------------------------------- +[ + object, + uuid(678A932C-EA71-4446-9B41-78FDA6280A29), + helpstring("ISpStreamFormatConverter Interface"), + pointer_default(unique), + restricted +] +interface ISpStreamFormatConverter : ISpStreamFormat +{ + HRESULT SetBaseStream( + [in] ISpStreamFormat * pStream, + [in] BOOL fSetFormatToBaseStreamFormat, // If true, then format of format converter stream + [in] BOOL fWriteToBaseStream ); // will be set to same format as bass stream + // (set up as a pass-through). If pStream == NULL + // and this is set to TRUE, then format of stream is reset + HRESULT GetBaseStream([out] ISpStreamFormat **ppStream); + + HRESULT SetFormat([in] REFGUID rguidFormatIdOfConvertedStream, [in] const WAVEFORMATEX * pWaveFormatExOfConvertedStream); + // Note: GetFormat method of ISpStreamFormat returns the format of the converted stream. + + HRESULT ResetSeekPosition(); + + HRESULT ScaleConvertedToBaseOffset( + [in] ULONGLONG ullOffsetConvertedStream, + [out] ULONGLONG * pullOffsetBaseStream); + + HRESULT ScaleBaseToConvertedOffset( + [in] ULONGLONG ullOffsetBaseStream, + [out] ULONGLONG * pullOffsetConvertedStream); +}; + +//--- ISpAudio -------------------------------------------------------------- + +typedef [hidden] enum _SPAUDIOSTATE +{ + SPAS_CLOSED, + SPAS_STOP, + SPAS_PAUSE, + SPAS_RUN +} SPAUDIOSTATE; + +typedef [restricted, hidden] struct SPAUDIOSTATUS +{ + long cbFreeBuffSpace; + ULONG cbNonBlockingIO; + SPAUDIOSTATE State; + ULONGLONG CurSeekPos; + ULONGLONG CurDevicePos; + DWORD dwReserved1; + DWORD dwReserved2; +} SPAUDIOSTATUS; + +typedef [restricted, hidden] struct SPAUDIOBUFFERINFO +{ + ULONG ulMsMinNotification; + ULONG ulMsBufferSize; + ULONG ulMsEventBias; +} SPAUDIOBUFFERINFO; + +[ + object, + uuid(C05C768F-FAE8-4EC2-8E07-338321C12452), + helpstring("ISpAudio Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpAudio : ISpStreamFormat +{ + HRESULT SetState([in] SPAUDIOSTATE NewState, [in]ULONGLONG ullReserved ); + HRESULT SetFormat([in] REFGUID rguidFmtId, [in] const WAVEFORMATEX * pWaveFormatEx); + HRESULT GetStatus([out] SPAUDIOSTATUS * pStatus); + HRESULT SetBufferInfo([in] const SPAUDIOBUFFERINFO * pBuffInfo); + HRESULT GetBufferInfo([out] SPAUDIOBUFFERINFO * pBuffInfo); + HRESULT GetDefaultFormat([out] GUID * pFormatId, [out] WAVEFORMATEX ** ppCoMemWaveFormatEx); + HANDLE EventHandle(); + HRESULT GetVolumeLevel([out] ULONG *pLevel); + HRESULT SetVolumeLevel([in] ULONG Level); + HRESULT GetBufferNotifySize([out] ULONG *pcbSize); + HRESULT SetBufferNotifySize([in] ULONG cbSize); +}; + +//--- ISpMMSysAudio --------------------------------------------------------- +[ + object, + uuid(15806F6E-1D70-4B48-98E6-3B1A007509AB), + helpstring("ISpMMSysAudio Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpMMSysAudio : ISpAudio +{ + HRESULT GetDeviceId([out] UINT * puDeviceId); + HRESULT SetDeviceId([in] UINT uDeviceId); + HRESULT GetMMHandle(void ** pHandle); + HRESULT GetLineId([out] UINT *puLineId); + HRESULT SetLineId([in] UINT uLineId); +}; + +//--- ISpTranscript --------------------------------------------------------- +[ + object, + uuid(10F63BCE-201A-11D3-AC70-00C04F8EE6C0), + helpstring("ISpTranscript Interface"), + pointer_default(unique), + restricted +] +interface ISpTranscript : IUnknown +{ + HRESULT GetTranscript([out, string] WCHAR ** ppszTranscript); + HRESULT AppendTranscript([in, string] const WCHAR * pszTranscript); +}; + +//--- Structures used by ISpPhrase interface -------------------------------- + +typedef [hidden] enum SPDISPLYATTRIBUTES +{ + SPAF_ONE_TRAILING_SPACE = 0x02, + SPAF_TWO_TRAILING_SPACES = 0x04, + SPAF_CONSUME_LEADING_SPACES = 0x08, + SPAF_ALL = 0x0F +} SPDISPLAYATTRIBUTES; + +typedef unsigned short SPPHONEID; + +typedef [restricted, hidden] struct SPPHRASEELEMENT +{ + ULONG ulAudioTimeOffset; + ULONG ulAudioSizeTime; // In 100ns units + ULONG ulAudioStreamOffset; + ULONG ulAudioSizeBytes; + ULONG ulRetainedStreamOffset; + ULONG ulRetainedSizeBytes; + const WCHAR * pszDisplayText; + const WCHAR * pszLexicalForm; + const SPPHONEID * pszPronunciation; + BYTE bDisplayAttributes; + signed char RequiredConfidence; + signed char ActualConfidence; + BYTE Reserved; + float SREngineConfidence; +} SPPHRASEELEMENT; + +typedef [restricted, hidden] struct SPPHRASERULE SPPHRASERULE; + +[hidden] struct SPPHRASERULE +{ + const WCHAR * pszName; + ULONG ulId; + ULONG ulFirstElement; + ULONG ulCountOfElements; + const SPPHRASERULE * pNextSibling; + const SPPHRASERULE * pFirstChild; + float SREngineConfidence; + signed char Confidence; +}; + + +typedef [restricted, hidden] struct SPPHRASEPROPERTY SPPHRASEPROPERTY; + +[hidden] struct SPPHRASEPROPERTY +{ + const WCHAR * pszName; + ULONG ulId; + const WCHAR * pszValue; + VARIANT vValue; // Will be VT_BOOL, VT_I4, VT_R4, VT_R8, or VT_BYREF (only for dynamic grammars) + ULONG ulFirstElement; + ULONG ulCountOfElements; + const SPPHRASEPROPERTY* pNextSibling; + const SPPHRASEPROPERTY* pFirstChild; + float SREngineConfidence; + signed char Confidence; +}; + +typedef [restricted, hidden] struct SPPHRASEREPLACEMENT +{ + BYTE bDisplayAttributes; + const WCHAR * pszReplacementText; + ULONG ulFirstElement; + ULONG ulCountOfElements; +} SPPHRASEREPLACEMENT; + +typedef [restricted, hidden] struct SPPHRASE +{ + ULONG cbSize; // Size of structure + LANGID LangID; + WORD wReserved; + ULONGLONG ullGrammarID; + ULONGLONG ftStartTime; + ULONGLONG ullAudioStreamPosition; + ULONG ulAudioSizeBytes; + ULONG ulRetainedSizeBytes; + ULONG ulAudioSizeTime; // In 100ns units + SPPHRASERULE Rule; + const SPPHRASEPROPERTY* pProperties; + const SPPHRASEELEMENT * pElements; + ULONG cReplacements; + const SPPHRASEREPLACEMENT * pReplacements; + GUID SREngineID; + ULONG ulSREnginePrivateDataSize; + const BYTE * pSREnginePrivateData; +} SPPHRASE; + + +//--- Serialized phrase + +typedef [restricted, hidden] struct SPSERIALIZEDPHRASE +{ + ULONG ulSerializedSize; // Size of structure in bytes +} SPSERIALIZEDPHRASE; + + + +typedef [hidden] enum SPVALUETYPE +{ + SPDF_PROPERTY = 0x00000001, + SPDF_REPLACEMENT = 0x00000002, + SPDF_RULE = 0x00000004, + SPDF_DISPLAYTEXT = 0x00000008, + SPDF_LEXICALFORM = 0x00000010, + SPDF_PRONUNCIATION = 0x00000020, + SPDF_AUDIO = 0x00000040, + SPDF_ALTERNATES = 0x00000080, + SPDF_ALL = 0x000000FF +} SPVALUETYPE; + + +// Binary grammar public declaration + +typedef [hidden] struct SPBINARYGRAMMAR +{ + ULONG ulTotalSerializedSize; +} SPBINARYGRAMMAR; + +// Possible arguments for methods that take phrase element start and count + +typedef [hidden] enum SPPHRASERNG +{ + SPPR_ALL_ELEMENTS = -1 +} SPPHRASERNG; +cpp_quote("#define SP_GETWHOLEPHRASE SPPR_ALL_ELEMENTS") +cpp_quote("#define SPRR_ALL_ELEMENTS SPPR_ALL_ELEMENTS") + +cpp_quote("#if 0") +typedef void * SPSTATEHANDLE; +cpp_quote("#else") +cpp_quote("DECLARE_HANDLE(SPSTATEHANDLE);") +cpp_quote("#endif") + + + + +typedef [hidden] enum SPRECOEVENTFLAGS +{ + SPREF_AutoPause = (1 << 0), + SPREF_Emulated = (1 << 1) +} SPRECOEVENTFLAGS; + + + +//--- ISpLexicon ------------------------------------------------------------ +typedef [hidden] enum SPPARTOFSPEECH +{ + //--- SAPI5 public POS category values (bits 28-31) + SPPS_NotOverriden = -1, + SPPS_Unknown = 0, + SPPS_Noun = 0x1000, + SPPS_Verb = 0x2000, + SPPS_Modifier = 0x3000, + SPPS_Function = 0x4000, + SPPS_Interjection = 0x5000 +} SPPARTOFSPEECH; + +typedef [hidden] enum SPLEXICONTYPE +{ + eLEXTYPE_USER = (1L << 0), + eLEXTYPE_APP = (1L << 1), + eLEXTYPE_RESERVED1 = (1L << 2), + eLEXTYPE_RESERVED2 = (1L << 3), + eLEXTYPE_RESERVED3 = (1L << 4), + eLEXTYPE_RESERVED4 = (1L << 5), + eLEXTYPE_RESERVED5 = (1L << 6), + eLEXTYPE_RESERVED6 = (1L << 7), + eLEXTYPE_RESERVED7 = (1L << 8), + eLEXTYPE_RESERVED8 = (1L << 9), + eLEXTYPE_RESERVED9 = (1L << 10), + eLEXTYPE_RESERVED10 = (1L << 11), + eLEXTYPE_PRIVATE1 = (1L << 12), + eLEXTYPE_PRIVATE2 = (1L << 13), + eLEXTYPE_PRIVATE3 = (1L << 14), + eLEXTYPE_PRIVATE4 = (1L << 15), + eLEXTYPE_PRIVATE5 = (1L << 16), + eLEXTYPE_PRIVATE6 = (1L << 17), + eLEXTYPE_PRIVATE7 = (1L << 18), + eLEXTYPE_PRIVATE8 = (1L << 19), + eLEXTYPE_PRIVATE9 = (1L << 20), + eLEXTYPE_PRIVATE10 = (1L << 21), + eLEXTYPE_PRIVATE11 = (1L << 22), + eLEXTYPE_PRIVATE12 = (1L << 23), + eLEXTYPE_PRIVATE13 = (1L << 24), + eLEXTYPE_PRIVATE14 = (1L << 25), + eLEXTYPE_PRIVATE15 = (1L << 26), + eLEXTYPE_PRIVATE16 = (1L << 27), + eLEXTYPE_PRIVATE17 = (1L << 28), + eLEXTYPE_PRIVATE18 = (1L << 29), + eLEXTYPE_PRIVATE19 = (1L << 30), + eLEXTYPE_PRIVATE20 = (1L << 31), +} SPLEXICONTYPE; + +typedef [hidden] enum SPWORDTYPE +{ + eWORDTYPE_ADDED = (1L << 0), + eWORDTYPE_DELETED = (1L << 1) +} SPWORDTYPE; + +typedef [restricted, hidden] struct SPWORDPRONUNCIATION +{ + struct SPWORDPRONUNCIATION * pNextWordPronunciation; + SPLEXICONTYPE eLexiconType; + LANGID LangID; + WORD wReserved; + SPPARTOFSPEECH ePartOfSpeech; + SPPHONEID szPronunciation[1]; +} SPWORDPRONUNCIATION; + +typedef [restricted, hidden] struct SPWORDPRONUNCIATIONLIST +{ + ULONG ulSize; + BYTE * pvBuffer; + SPWORDPRONUNCIATION * pFirstWordPronunciation; +} SPWORDPRONUNCIATIONLIST; + +typedef [restricted, hidden] struct SPWORD +{ + struct SPWORD * pNextWord; + LANGID LangID; + WORD wReserved; + SPWORDTYPE eWordType; + WCHAR * pszWord; + SPWORDPRONUNCIATION * pFirstWordPronunciation; +} SPWORD; + +typedef [restricted, hidden] struct SPWORDLIST +{ + ULONG ulSize; + BYTE * pvBuffer; + SPWORD * pFirstWord; +} SPWORDLIST; + +[ + object, + uuid(DA41A7C2-5383-4DB2-916B-6C1719E3DB58), + helpstring("ISpLexicon Interface"), + pointer_default(unique), + restricted +] +interface ISpLexicon : IUnknown +{ + HRESULT GetPronunciations( + [in] const WCHAR * pszWord, + [in] LANGID LangID, + [in] DWORD dwFlags, + [in, out] SPWORDPRONUNCIATIONLIST * pWordPronunciationList + ); + HRESULT AddPronunciation( + [in] const WCHAR * pszWord, + [in] LANGID LangID, + [in] SPPARTOFSPEECH ePartOfSpeech, + [in] const SPPHONEID * pszPronunciation + ); + HRESULT RemovePronunciation( + [in] const WCHAR * pszWord, + [in] LANGID LangID, + [in] SPPARTOFSPEECH ePartOfSpeech, + [in] const SPPHONEID * pszPronunciation + ); + + HRESULT GetGeneration(DWORD *pdwGeneration); + HRESULT GetGenerationChange( + [in] DWORD dwFlags, + [in, out] DWORD *pdwGeneration, + [in, out] SPWORDLIST * pWordList + ); + + HRESULT GetWords( + [in] DWORD dwFlags, + [in, out] DWORD *pdwGeneration, + [in, out] DWORD * pdwCookie, + [in, out] SPWORDLIST *pWordList + ); +}; + +[ + object, + uuid(8565572F-C094-41CC-B56E-10BD9C3FF044), + + helpstring("ISpContainerLexicon Interface"), + pointer_default(unique), + restricted +] +interface ISpContainerLexicon : ISpLexicon +{ + HRESULT AddLexicon([in] ISpLexicon *pAddLexicon, [in] DWORD dwFlags); +}; + +//--- ISpPhoneConverter ----------------------------------------------------- +[ + object, + uuid(8445C581-0CAC-4A38-ABFE-9B2CE2826455), + helpstring("ISpPhoneConverter Interface"), + pointer_default(unique), + restricted +] +interface ISpPhoneConverter : ISpObjectWithToken +{ + HRESULT PhoneToId([in] const WCHAR * pszPhone, [out] SPPHONEID * pId); + HRESULT IdToPhone([in] const SPPHONEID * pId, [out] WCHAR * pszPhone); +}; + +//--- ISpVoice -------------------------------------------------------------- +// These structures maintain the absolute state of the voice relative to +// the voice's baseline XML state. +typedef [restricted, hidden] struct SPVPITCH +{ + long MiddleAdj; + long RangeAdj; +} SPVPITCH; + +typedef [hidden] enum SPVACTIONS +{ + SPVA_Speak = 0, + SPVA_Silence, + SPVA_Pronounce, + SPVA_Bookmark, + SPVA_SpellOut, + SPVA_Section, + SPVA_ParseUnknownTag +} SPVACTIONS; + +typedef [restricted, hidden] struct SPVCONTEXT +{ + LPCWSTR pCategory; + LPCWSTR pBefore; + LPCWSTR pAfter; +} SPVCONTEXT; + +typedef [restricted, hidden] struct SPVSTATE +{ + //--- Action + SPVACTIONS eAction; + + //--- Running state values + LANGID LangID; + WORD wReserved; + long EmphAdj; + long RateAdj; + ULONG Volume; + SPVPITCH PitchAdj; + ULONG SilenceMSecs; + SPPHONEID* pPhoneIds; // NULL terminated array of phone ids + SPPARTOFSPEECH ePartOfSpeech; + SPVCONTEXT Context; +} SPVSTATE; + +typedef [hidden] enum SPRUNSTATE +{ + SPRS_DONE = (1L << 0), // The voice is done rendering all queued phrases + SPRS_IS_SPEAKING = (1L << 1) // The SpVoice currently has the audio queue claimed +} SPRUNSTATE; + +typedef [hidden] enum SPVLIMITS +{ + SPMIN_VOLUME = 0, + SPMAX_VOLUME = 100, + SPMIN_RATE = -10, + SPMAX_RATE = 10 +} SPVLIMITS; + +typedef [hidden] enum SPVPRIORITY +{ + SPVPRI_NORMAL = 0, + SPVPRI_ALERT = (1L << 0), + SPVPRI_OVER = (1L << 1) +} SPVPRIORITY; + +typedef [restricted, hidden] struct SPVOICESTATUS +{ + ULONG ulCurrentStream; // Current stream being rendered + ULONG ulLastStreamQueued; // Number of the last stream queued + HRESULT hrLastResult; // Result of last speak + DWORD dwRunningState; // SPRUNSTATE + ULONG ulInputWordPos; // Input position of current word being rendered + ULONG ulInputWordLen; // Length of current word being rendered + ULONG ulInputSentPos; // Input position of current sentence being rendered + ULONG ulInputSentLen; // Length of current sentence being rendered + LONG lBookmarkId; // Current bookmark converted to a long integer + SPPHONEID PhonemeId; // Current phoneme id + SPVISEMES VisemeId; // Current viseme + DWORD dwReserved1; // Reserved for future expansion + DWORD dwReserved2; // Reserved for future expansion +} SPVOICESTATUS; + +typedef [hidden] enum SPEAKFLAGS +{ + //--- SpVoice flags + SPF_DEFAULT = 0, // Synchronous, no purge, xml auto detect + SPF_ASYNC = (1L << 0), // Asynchronous call + SPF_PURGEBEFORESPEAK = (1L << 1), // Purge current data prior to speaking this + SPF_IS_FILENAME = (1L << 2), // The string passed to Speak() is a file name + SPF_IS_XML = (1L << 3), // The input text will be parsed for XML markup + SPF_IS_NOT_XML = (1L << 4), // The input text will not be parsed for XML markup + SPF_PERSIST_XML = (1L << 5), // Persists XML global state changes + + //--- Normalizer flags + SPF_NLP_SPEAK_PUNC = (1L << 6), // The normalization processor should speak the punctuation + + //--- Masks + SPF_NLP_MASK = (SPF_NLP_SPEAK_PUNC), + SPF_VOICE_MASK = (SPF_ASYNC|SPF_PURGEBEFORESPEAK|SPF_IS_FILENAME|SPF_IS_XML|SPF_IS_NOT_XML|SPF_NLP_MASK|SPF_PERSIST_XML), + SPF_UNUSED_FLAGS = ~(SPF_VOICE_MASK) +} SPEAKFLAGS; + +[ + object, + uuid(6C44DF74-72B9-4992-A1EC-EF996E0422D4), + helpstring("ISpVoice Interface"), + pointer_default(unique), + restricted +] +interface ISpVoice : ISpEventSource +{ + HRESULT SetOutput( [in] IUnknown * pUnkOutput, [in]BOOL fAllowFormatChanges ); + HRESULT GetOutputObjectToken( [out] ISpObjectToken ** ppObjectToken ); + HRESULT GetOutputStream( [out] ISpStreamFormat ** ppStream ); + + HRESULT Pause( void ); + HRESULT Resume( void ); + + HRESULT SetVoice([in] ISpObjectToken *pToken); + HRESULT GetVoice([out] ISpObjectToken **ppToken); + + HRESULT Speak( + [in, string] const WCHAR* pwcs, + [in] DWORD dwFlags, + [out] ULONG * pulStreamNumber); + HRESULT SpeakStream( + [in] IStream* pStream, // If not ISpStreamFormat supported then SPDFID_Text assumed + [in] DWORD dwFlags, + [out] ULONG * pulStreamNumber); + + HRESULT GetStatus( + [out] SPVOICESTATUS *pStatus, + [out, string] WCHAR ** ppszLastBookmark); + + HRESULT Skip( [in,string]WCHAR* pItemType, [in]long lNumItems, [out]ULONG* pulNumSkipped ); + + HRESULT SetPriority([in] SPVPRIORITY ePriority ); + HRESULT GetPriority([out] SPVPRIORITY* pePriority ); + + HRESULT SetAlertBoundary( [in] SPEVENTENUM eBoundary ); + HRESULT GetAlertBoundary( [out] SPEVENTENUM* peBoundary ); + + HRESULT SetRate([in] long RateAdjust ); + HRESULT GetRate([out] long* pRateAdjust); + + HRESULT SetVolume([in] USHORT usVolume); + HRESULT GetVolume([out] USHORT* pusVolume); + + HRESULT WaitUntilDone([in] ULONG msTimeout); + + HRESULT SetSyncSpeakTimeout([in] ULONG msTimeout); + HRESULT GetSyncSpeakTimeout([out] ULONG * pmsTimeout); + + [local] HANDLE SpeakCompleteEvent(); + + [local] HRESULT IsUISupported( + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [out] BOOL *pfSupported); + [local] HRESULT DisplayUI( + [in] HWND hwndParent, + [in] const WCHAR * pszTitle, + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData); + +}; + + +//--- ISpPhrase interface --------------------------------------------------- +[ + object, + uuid(1A5C0354-B621-4b5a-8791-D306ED379E53), + local, + helpstring("ISpPhrase Interface"), + pointer_default(unique), + restricted +] +interface ISpPhrase : IUnknown +{ + HRESULT GetPhrase([out] SPPHRASE ** ppCoMemPhrase); + HRESULT GetSerializedPhrase([out] SPSERIALIZEDPHRASE ** ppCoMemPhrase); + HRESULT GetText([in] ULONG ulStart, [in] ULONG ulCount, [in] BOOL fUseTextReplacements, + [out] WCHAR ** ppszCoMemText, [out] BYTE * pbDisplayAttributes); + HRESULT Discard([in] DWORD dwValueTypes); +}; + +[ + object, + uuid(8FCEBC98-4E49-4067-9C6C-D86A0E092E3D), + local, + helpstring("ISpPhraseAlt Interface"), + pointer_default(unique), + restricted +] +interface ISpPhraseAlt : ISpPhrase +{ + HRESULT GetAltInfo(ISpPhrase **ppParent, ULONG *pulStartElementInParent, ULONG *pcElementsInParent, + ULONG *pcElementsInAlt); + HRESULT Commit(); +}; + + + +//--- ISpRecoResult --------------------------------------------------------- +typedef [restricted, hidden] struct SPRECORESULTTIMES +{ + FILETIME ftStreamTime; // GetSystemTimeAsFileTime() at start of result + // UTC time as number of 100-nanosecond intervals + // since January 1, 1601 + ULONGLONG ullLength; // length in 100ns units + DWORD dwTickCount; // GetTickCount() at start of result + // milliseconds that have elapsed since the + // system was started. + ULONGLONG ullStart; // 100ns units since start of stream +} SPRECORESULTTIMES; + + +typedef [hidden] struct SPSERIALIZEDRESULT +{ + ULONG ulSerializedSize; // Count in bytes (including this ULONG) of the entire phrase +} SPSERIALIZEDRESULT; + + +[ + object, + uuid(20B053BE-E235-43cd-9A2A-8D17A48B7842), + helpstring("ISpRecoResult Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpRecoResult : ISpPhrase +{ + HRESULT GetResultTimes([out] SPRECORESULTTIMES *pTimes); + + HRESULT GetAlternates( + [in] ULONG ulStartElement, + [in] ULONG cElements, + [in] ULONG ulRequestCount, + [out] ISpPhraseAlt **ppPhrases, + [out] ULONG *pcPhrasesReturned); + + HRESULT GetAudio( + [in] ULONG ulStartElement, + [in] ULONG cElements, + [out] ISpStreamFormat **ppStream); + HRESULT SpeakAudio( + [in] ULONG ulStartElement, + [in] ULONG cElements, + [in] DWORD dwFlags, + [out] ULONG * pulStreamNumber); + + HRESULT Serialize([out] SPSERIALIZEDRESULT ** ppCoMemSerializedResult); + + HRESULT ScaleAudio([in] const GUID * pAudioFormatId, [in] const WAVEFORMATEX *pWaveFormatEx); + + HRESULT GetRecoContext([out] ISpRecoContext ** ppRecoContext); +}; + + + +typedef [hidden] struct tagSPTEXTSELECTIONINFO +{ + ULONG ulStartActiveOffset; + ULONG cchActiveChars; + ULONG ulStartSelection; + ULONG cchSelection; +} SPTEXTSELECTIONINFO; + + +typedef [hidden] enum SPWORDPRONOUNCEABLE +{ + SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = 0, + SPWP_UNKNOWN_WORD_PRONOUNCEABLE = 1, + SPWP_KNOWN_WORD_PRONOUNCEABLE = 2 +} SPWORDPRONOUNCEABLE; + + +typedef [hidden] enum SPGRAMMARSTATE +{ + SPGS_DISABLED = 0, + SPGS_ENABLED = 1, + SPGS_EXCLUSIVE = 3 +} SPGRAMMARSTATE; + + +typedef [hidden] enum SPCONTEXTSTATE +{ + SPCS_DISABLED = 0, + SPCS_ENABLED = 1, +} SPCONTEXTSTATE; + + +typedef [hidden] enum SPRULESTATE +{ + SPRS_INACTIVE = 0, + SPRS_ACTIVE = 1, + SPRS_ACTIVE_WITH_AUTO_PAUSE = 3 +} SPRULESTATE; + +const ULONGLONG SP_STREAMPOS_ASAP = 0; +const ULONGLONG SP_STREAMPOS_REALTIME = -1; + + + +// Special transition types used only by AddRuleTransition + +cpp_quote("#define SPRULETRANS_TEXTBUFFER (SPSTATEHANDLE)(-1)") +cpp_quote("#define SPRULETRANS_WILDCARD (SPSTATEHANDLE)(-2)") +cpp_quote("#define SPRULETRANS_DICTATION (SPSTATEHANDLE)(-3)") + + +typedef [hidden] enum SPGRAMMARWORDTYPE +{ + SPWT_DISPLAY, + SPWT_LEXICAL, + SPWT_PRONUNCIATION +} SPGRAMMARWORDTYPE; + +typedef [hidden] struct tagSPPROPERTYINFO +{ + const WCHAR * pszName; + ULONG ulId; + const WCHAR * pszValue; + VARIANT vValue; // Must be VT_BOOL, VT_I4, VT_R4, VT_R8, or VT_BYREF (only for dynamic grammars) +} SPPROPERTYINFO; + +typedef [hidden] enum SPCFGRULEATTRIBUTES +{ + SPRAF_TopLevel = (1 << 0), + SPRAF_Active = (1 << 1), + SPRAF_Export = (1 << 2), + SPRAF_Import = (1 << 3), + SPRAF_Interpreter = (1 << 4), + SPRAF_Dynamic = (1 << 5), + // The following flag is only valid at run-time as part of a rule state and + // is not valid to pass as part of a rule definition. + SPRAF_AutoPause = (1 << 16) +} SPCFGRULEATTRIBUTES; + + +[ + object, + uuid(8137828F-591A-4A42-BE58-49EA7EBAAC68), + helpstring("ISpGrammarBuilder Interface"), + pointer_default(unique), + restricted, + local +] +interface ISpGrammarBuilder : IUnknown +{ + HRESULT ResetGrammar([in] LANGID NewLanguage); + + HRESULT GetRule([in] const WCHAR * pszRuleName, + [in] DWORD dwRuleId, + [in] DWORD dwAttributes, + [in] BOOL fCreateIfNotExist, + [out] SPSTATEHANDLE * phInitialState); + HRESULT ClearRule(SPSTATEHANDLE hState); + + HRESULT CreateNewState( + SPSTATEHANDLE hState, + SPSTATEHANDLE * phState); + + HRESULT AddWordTransition( + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR * psz, // If NULL then epsilon + const WCHAR * pszSeparators, // If NULL then psz points to a single word, else specifies valid separator characters + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO * pPropInfo); + + HRESULT AddRuleTransition( + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, // Must be the initial state of the rule + float Weight, + const SPPROPERTYINFO * pPropInfo); + + HRESULT AddResource([in] SPSTATEHANDLE hRuleState, // Any state handle in a rule is OK + [in] const WCHAR * pszResourceName, + [in] const WCHAR * pszResourceValue); + + HRESULT Commit(DWORD dwReserved); +}; + + +// --- Options for Load methods on ISpRecoGrammar +typedef [hidden] enum SPLOADOPTIONS +{ + SPLO_STATIC = 0, + SPLO_DYNAMIC = 1 +} SPLOADOPTIONS; + + + +//--- ISpRecoGrammar ------------------------------------------------------- +[ + object, + uuid(2177DB29-7F45-47D0-8554-067E91C80502), + helpstring("ISpRecoGrammar Interface"), + pointer_default(unique), + restricted, + local +] +interface ISpRecoGrammar : ISpGrammarBuilder +{ + HRESULT GetGrammarId([out] ULONGLONG * pullGrammarId); + HRESULT GetRecoContext([out] ISpRecoContext **ppRecoCtxt); + + // Command and control interfaces + HRESULT LoadCmdFromFile([in, string] const WCHAR * pszFileName, [in] SPLOADOPTIONS Options); + HRESULT LoadCmdFromObject([in] REFCLSID rcid, [in, string] const WCHAR * pszGrammarName, [in] SPLOADOPTIONS Options); + HRESULT LoadCmdFromResource([in] HMODULE hModule, + [in, string] const WCHAR * pszResourceName, + [in, string] const WCHAR * pszResourceType, + [in] WORD wLanguage, + [in] SPLOADOPTIONS Options); + HRESULT LoadCmdFromMemory([in] const SPBINARYGRAMMAR * pGrammar, [in] SPLOADOPTIONS Options); + HRESULT LoadCmdFromProprietaryGrammar( + [in] REFGUID rguidParam, + [in, string] const WCHAR * pszStringParam, + [in] const void * pvDataPrarm, + [in] ULONG cbDataSize, + [in] SPLOADOPTIONS Options); + HRESULT SetRuleState([in, string] const WCHAR * pszName, void * pReserved, + [in] SPRULESTATE NewState); + HRESULT SetRuleIdState([in] ULONG ulRuleId, [in] SPRULESTATE NewState); + + + // Dictation / statistical language model + HRESULT LoadDictation([in, string] const WCHAR * pszTopicName, [in] SPLOADOPTIONS Options); + HRESULT UnloadDictation(); + HRESULT SetDictationState([in] SPRULESTATE NewState); + + // Word sequence buffer + HRESULT SetWordSequenceData([in] const WCHAR * pText, [in] ULONG cchText, [in] const SPTEXTSELECTIONINFO * pInfo); + HRESULT SetTextSelection([in] const SPTEXTSELECTIONINFO * pInfo); + + HRESULT IsPronounceable([in, string] const WCHAR * pszWord, [out] SPWORDPRONOUNCEABLE *pWordPronounceable); + + HRESULT SetGrammarState([in] SPGRAMMARSTATE eGrammarState); + + HRESULT SaveCmd([in] IStream * pStream, [out, optional] WCHAR ** ppszCoMemErrorText); + + HRESULT GetGrammarState([out] SPGRAMMARSTATE * peGrammarState); +}; + + + + + +//--- ISpRecoContext -------------------------------------------------------- +typedef [restricted, hidden] struct SPRECOCONTEXTSTATUS +{ + SPINTERFERENCE eInterference; + WCHAR szRequestTypeOfUI[255]; // If first byte null, there is no UI request + DWORD dwReserved1; + DWORD dwReserved2; +} SPRECOCONTEXTSTATUS; + +typedef [hidden] enum SPBOOKMARKOPTIONS +{ + SPBO_NONE = 0, + SPBO_PAUSE = 1 +} SPBOOKMARKOPTIONS; + + +typedef [hidden] enum SPAUDIOOPTIONS +{ + SPAO_NONE = 0, + SPAO_RETAIN_AUDIO = (1 << 0) +} SPAUDIOOPTIONS; + +[ + object, + uuid(F740A62F-7C15-489E-8234-940A33D9272D), + helpstring("ISpRecoContext Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpRecoContext : ISpEventSource +{ + HRESULT GetRecognizer([out] ISpRecognizer ** ppRecognizer); + + HRESULT CreateGrammar([in] ULONGLONG ullGrammarId, [out] ISpRecoGrammar ** ppGrammar); + + HRESULT GetStatus([out] SPRECOCONTEXTSTATUS *pStatus); + + HRESULT GetMaxAlternates([in] ULONG * pcAlternates); + HRESULT SetMaxAlternates([in] ULONG cAlternates); + + HRESULT SetAudioOptions([in] SPAUDIOOPTIONS Options, [in] const GUID *pAudioFormatId, [in] const WAVEFORMATEX *pWaveFormatEx); + HRESULT GetAudioOptions([in] SPAUDIOOPTIONS * pOptions, [out] GUID *pAudioFormatId, [out] WAVEFORMATEX **ppCoMemWFEX); + + HRESULT DeserializeResult( + [in] const SPSERIALIZEDRESULT * pSerializedResult, + [out] ISpRecoResult **ppResult); + + HRESULT Bookmark([in] SPBOOKMARKOPTIONS Options, [in] ULONGLONG ullStreamPosition, [in] LPARAM lparamEvent); + + HRESULT SetAdaptationData([in, string] const WCHAR *pAdaptationData, [in] const ULONG cch); + + HRESULT Pause( DWORD dwReserved ); + HRESULT Resume( DWORD dwReserved ); + + HRESULT SetVoice([in] ISpVoice *pVoice, [in] BOOL fAllowFormatChanges); + HRESULT GetVoice([out] ISpVoice **ppVoice); + HRESULT SetVoicePurgeEvent([in] ULONGLONG ullEventInterest); + HRESULT GetVoicePurgeEvent([out] ULONGLONG *pullEventInterest); + + HRESULT SetContextState([in] SPCONTEXTSTATE eContextState); + HRESULT GetContextState([in] SPCONTEXTSTATE * peContextState); +}; + + +//--- ISpProperties ------------------------------------------------------------ +[ + object, + uuid(5B4FB971-B115-4DE1-AD97-E482E3BF6EE4), + helpstring("ISpProperties Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpProperties : IUnknown +{ + HRESULT SetPropertyNum( [in]const WCHAR* pName, [in]LONG lValue ); + HRESULT GetPropertyNum( [in]const WCHAR* pName, [out]LONG* plValue ); + HRESULT SetPropertyString( [in]const WCHAR* pName, [in]const WCHAR* pValue ); + HRESULT GetPropertyString( [in]const WCHAR* pName, [out]WCHAR** ppCoMemValue ); +}; + +const ULONG SP_MAX_LANGIDS = 20; // Engine can support up to 20 languages at once + +//--- ISpRecognizer --------------------------------------------------------- +typedef [restricted, hidden] struct SPRECOGNIZERSTATUS +{ + SPAUDIOSTATUS AudioStatus; + ULONGLONG ullRecognitionStreamPos; + ULONG ulStreamNumber; + ULONG ulNumActive; + CLSID clsidEngine; + ULONG cLangIDs; + LANGID aLangID[SP_MAX_LANGIDS]; + DWORD dwReserved1; + DWORD dwReserved2; +} SPRECOGNIZERSTATUS; + +typedef [hidden] enum SPWAVEFORMATTYPE +{ + SPWF_INPUT, // WAVEFORMATEX of audio input source + SPWF_SRENGINE // WAVEFORMATEX of the audio received by the SR engine +} SPSTREAMFORMATTYPE; + +typedef [hidden] enum SPRECOSTATE +{ + SPRST_INACTIVE, // Audio deactivated + SPRST_ACTIVE, // Audio running only if one or more rules are active + SPRST_ACTIVE_ALWAYS, // Audio running regardless of rule state + SPRST_INACTIVE_WITH_PURGE, // State will be set to inactive, but all active audio purged + SPRST_NUM_STATES +} SPRECOSTATE; + + + + +[ + object, + uuid(C2B5F241-DAA0-4507-9E16-5A1EAA2B7A5C), + helpstring("ISpRecognizer Interface"), + pointer_default(unique), + restricted +] +interface ISpRecognizer : ISpProperties +{ + HRESULT SetRecognizer([in] ISpObjectToken * pRecognizer); + HRESULT GetRecognizer([out] ISpObjectToken **ppRecognizer); + + HRESULT SetInput([in] IUnknown * pUnkInput, [in] BOOL fAllowFormatChanges); + HRESULT GetInputObjectToken( [out] ISpObjectToken ** ppToken); + + HRESULT GetInputStream( [out] ISpStreamFormat ** ppStream); + HRESULT CreateRecoContext([out] ISpRecoContext ** ppNewCtxt); + + HRESULT GetRecoProfile([out] ISpObjectToken **ppToken); + HRESULT SetRecoProfile([in] ISpObjectToken *pToken); + + HRESULT IsSharedInstance(void); + + HRESULT GetRecoState([out] SPRECOSTATE *pState); + HRESULT SetRecoState([in] SPRECOSTATE NewState); + + HRESULT GetStatus([out] SPRECOGNIZERSTATUS * pStatus); + HRESULT GetFormat([in] SPSTREAMFORMATTYPE WaveFormatType, [out] GUID *pFormatId, [out] WAVEFORMATEX **ppCoMemWFEX); + + [local] HRESULT IsUISupported( + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [out] BOOL *pfSupported); + [local] HRESULT DisplayUI( + [in] HWND hwndParent, + [in] const WCHAR * pszTitle, + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData); + HRESULT EmulateRecognition([in] ISpPhrase *pPhrase); +}; + + + +// +//=== CoClass definitions ===================================================== +// +[ + helpstring("Microsoft Speech Object Library"), + uuid(C866CA3A-32F7-11D2-9602-00C04F8EE628), + version(5.1) +] +library SpeechLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + #include "sapiaut.idl" + + //--- SpNotifyTranslator ------------------------------------------------ + [ + uuid(E2AE5372-5D40-11D2-960E-00C04F8EE628), + helpstring("SpNotify"), + restricted, + hidden + ] + coclass SpNotifyTranslator + { + interface ISpNotifyTranslator; + } + + //--- SpObjectTokenCategory --------------------------------------------- + [ + uuid(A910187F-0C7A-45AC-92CC-59EDAFB77B53), + helpstring("SpObjectTokenCategory Class"), + ] + coclass SpObjectTokenCategory + { + [default] interface ISpeechObjectTokenCategory; + interface ISpObjectTokenCategory; + } + //--- SpObjectToken --------------------------------------------- + [ + uuid(EF411752-3736-4CB4-9C8C-8EF4CCB58EFE), + helpstring("SpObjectToken Class") + ] + coclass SpObjectToken + { + [default] interface ISpeechObjectToken; + interface ISpObjectToken; + } + + //--- SpResourceManager ------------------------------------------------- + [ + uuid(96749373-3391-11D2-9EE3-00C04F797396), + helpstring("SpResourceManger"), + restricted, + hidden + ] + coclass SpResourceManager + { + [default] interface ISpResourceManager; + }; + + //--- SpStreamFormatConverter ------------------------------------------- + [ + uuid(7013943A-E2EC-11D2-A086-00C04F8EF9B5), + helpstring("FormatConverter Class"), + restricted, + hidden + ] + coclass SpStreamFormatConverter + { + [default] interface ISpStreamFormatConverter; + }; + + //--- SpMMAudioEnum ----------------------------------------------------- + [ + uuid(AB1890A0-E91F-11D2-BB91-00C04F8EE6C0), + helpstring("SpMMAudioEnum Class"), + restricted, + hidden + ] + coclass SpMMAudioEnum + { + interface IEnumSpObjectTokens; + }; + + //--- SpMMAudioIn ------------------------------------------------------- + [ + uuid(CF3D2E50-53F2-11D2-960C-00C04F8EE628), + helpstring("SpMMAudioIn Class") + ] + coclass SpMMAudioIn + { + [default] interface ISpeechMMSysAudio; + interface ISpEventSource; + interface ISpEventSink; + interface ISpObjectWithToken; + interface ISpMMSysAudio; + }; + + //--- SpMMAudioOut ------------------------------------------------------ + [ + uuid(A8C680EB-3D32-11D2-9EE7-00C04F797396), + helpstring("SpMMAudioOut Class") + ] + coclass SpMMAudioOut + { + [default] interface ISpeechMMSysAudio; + interface ISpEventSource; + interface ISpEventSink; + interface ISpObjectWithToken; + interface ISpMMSysAudio; + }; + + //--- SpRecPlayAudio ------------------------------------------------- + [ + uuid(FEE225FC-7AFD-45E9-95D0-5A318079D911), + helpstring("SpRecPlayAudio Class"), + restricted, + hidden + ] + coclass SpRecPlayAudio + { + interface ISpObjectWithToken; + interface ISpAudio; + }; + + //--- SpStream ---------------------------------------------------------- + [ + uuid(715D9C59-4442-11D2-9605-00C04F8EE628), + helpstring("SpStream Class"), + restricted, + hidden + ] + coclass SpStream + { + interface ISpStream; + }; + + //--- SpVoice ----------------------------------------------------------- + [ + uuid(96749377-3391-11D2-9EE3-00C04F797396), + helpstring("SpVoice Class") + ] + coclass SpVoice + { + [default] interface ISpeechVoice; + interface ISpVoice; + + [default, source] dispinterface _ISpeechVoiceEvents; + }; + + //--- SpSharedRecoContext ----------------------------------------------- + [ + uuid(47206204-5ECA-11D2-960F-00C04F8EE628), + helpstring("SpSharedRecoContext Class") + ] + coclass SpSharedRecoContext + { + [default] interface ISpeechRecoContext; + interface ISpRecoContext; + + [default, source] dispinterface _ISpeechRecoContextEvents; + }; + + //--- SpInprocRecognizer ------------------------------------------------ + [ + uuid(41B89B6B-9399-11D2-9623-00C04F8EE628), + helpstring("SpInprocRecognizer Class") + ] + coclass SpInprocRecognizer + { + [default] interface ISpeechRecognizer; + interface ISpRecognizer; + }; + + //--- SpSharedRecognizer ---------------------------------------------- + [ + uuid(3BEE4890-4FE9-4A37-8C1E-5E7E12791C1F), + helpstring("SpSharedRecognizer Class") + ] + coclass SpSharedRecognizer + { + [default] interface ISpeechRecognizer; + interface ISpRecognizer; + }; + + //--- SpLexicon ---------------------------------------------------------- + [ + uuid(0655E396-25D0-11D3-9C26-00C04F8EF87C), + helpstring("SpLexicon Class") + ] + coclass SpLexicon + { + [default] interface ISpeechLexicon; + interface ISpLexicon; + }; + + //--- SpUnCompressedLexicon --------------------------------------------------- + [ + uuid(C9E37C15-DF92-4727-85D6-72E5EEB6995A), + helpstring("SpUnCompressedLexicon Class") + ] + coclass SpUnCompressedLexicon + { + [default] interface ISpeechLexicon; + interface ISpLexicon; + interface ISpObjectWithToken; + }; + + //--- SpCompressedLexicon --------------------------------------------------- + [ + uuid(90903716-2F42-11D3-9C26-00C04F8EF87C), + helpstring("SpCompressedLexicon Class"), + restricted, + hidden + ] + coclass SpCompressedLexicon + { + [default] interface ISpLexicon; + interface ISpObjectWithToken; + }; + + //--- SpPhoneConverter ------------------------------------------------ + [ + uuid(9185F743-1143-4C28-86B5-BFF14F20E5C8), + helpstring("SpPhoneConverter Class") + ] + coclass SpPhoneConverter + { + [default] interface ISpeechPhoneConverter; + interface ISpPhoneConverter; + }; + + //--- SpNullPhoneConverter ------------------------------------------------ + [ + uuid(455F24E9-7396-4A16-9715-7C0FDBE3EFE3), + helpstring("SpNullPhoneConverter Class"), + restricted, + hidden + ] + coclass SpNullPhoneConverter + { + [default] interface ISpPhoneConverter; + }; + +#ifdef SAPI_AUTOMATION + + //--- SpTextSelectionInformation ------------------------------------------------ + [ + uuid(0F92030A-CBFD-4AB8-A164-FF5985547FF6), + helpstring("SpTextSelectionInformation Class"), + ] + coclass SpTextSelectionInformation + { + [default] interface ISpeechTextSelectionInformation; + }; + + //--- SpPhraseInfoBuilder ------------------------------------------------ + [ + uuid(C23FC28D-C55F-4720-8B32-91F73C2BD5D1), + helpstring("SpPhraseInfoBuilder Class"), + ] + coclass SpPhraseInfoBuilder + { + [default] interface ISpeechPhraseInfoBuilder; + }; + + //--- SpAudioFormat ------------------------------------------------ + [ + uuid(9EF96870-E160-4792-820D-48CF0649E4EC), + helpstring("SpAudioFormat Class"), + ] + coclass SpAudioFormat + { + [default] interface ISpeechAudioFormat; + }; + + //--- SpWaveFormatEx ------------------------------------------------ + [ + uuid(C79A574C-63BE-44b9-801F-283F87F898BE), + helpstring("SpWaveFormatEx Class"), + ] + coclass SpWaveFormatEx + { + [default] interface ISpeechWaveFormatEx; + }; + + //--- SpInProcRecoContext ----------------------------------------------- + [ + uuid(73AD6842-ACE0-45E8-A4DD-8795881A2C2A), + helpstring("SpInProcRecoContext Class") + ] + coclass SpInProcRecoContext + { + [default] interface ISpeechRecoContext; + interface ISpRecoContext; + + [default, source] dispinterface _ISpeechRecoContextEvents; + }; + + //--- SpCustomStream ------------------------------------------------ + [ + uuid(8DBEF13F-1948-4aa8-8CF0-048EEBED95D8), + helpstring("SpCustomStream Class"), + ] + coclass SpCustomStream + { + [default] interface ISpeechCustomStream; + interface ISpStream; + }; + + //--- SpFileStream ------------------------------------------------ + [ + uuid(947812B3-2AE1-4644-BA86-9E90DED7EC91), + helpstring("SpFileStream Class"), + ] + coclass SpFileStream + { + [default] interface ISpeechFileStream; + interface ISpStream; + }; + + //--- SpMemoryStream ------------------------------------------------ + [ + uuid(5FB7EF7D-DFF4-468a-B6B7-2FCBD188F994), + helpstring("SpMemoryStream Class"), + ] + coclass SpMemoryStream + { + [default] interface ISpeechMemoryStream; + interface ISpStream; + }; + + +#endif // SAPI_AUTOMATION +} + diff --git a/mp/src/utils/sapi51/IDL/sapiaut.idl b/mp/src/utils/sapi51/IDL/sapiaut.idl new file mode 100644 index 00000000..5e7cee76 --- /dev/null +++ b/mp/src/utils/sapi51/IDL/sapiaut.idl @@ -0,0 +1,4847 @@ +/**************************************************************************** +* sapiaut.idl +* +* This is the interface definition file for the Microsoft Speech API +* Version 5.0. +* +* It contains definitions for the Automation layer. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +// Includes +import "oaidl.idl"; +import "ocidl.idl"; + +// Token object declarations +interface ISpeechDataKey; +interface ISpeechObjectToken; // Token object +interface ISpeechObjectTokens; // Collection of Token Objects +interface ISpeechObjectTokenCategory; + +// Audio object declarations +interface ISpeechAudioBufferInfo; +interface ISpeechAudioStatus; +interface ISpeechAudioFormat; +interface ISpeechWaveFormatEx; +interface ISpeechBaseStream; +interface ISpeechFileStream; +interface ISpeechMemoryStream; +interface ISpeechCustomStream; +interface ISpeechAudio; +interface ISpeechMMSysAudio; + +// Voice object declarations +interface ISpeechVoice; +interface ISpeechVoiceStatus; +dispinterface _ISpeechVoiceEvents; + +// Recognizer object declarations +interface ISpeechRecognizer; +interface ISpeechRecognizerStatus; +interface ISpeechRecoContext; +interface ISpeechRecoGrammar; +dispinterface _ISpeechRecoContextEvents; + +// Grammar object declarations +interface ISpeechGrammarRule; +interface ISpeechGrammarRules; +interface ISpeechGrammarRuleState; +interface ISpeechGrammarRuleStateTransition; +interface ISpeechGrammarRuleStateTransitions; +interface ISpeechTextSelectionInformation; + +// RecoResult and phrase object declarations +interface ISpeechRecoResult; +interface ISpeechRecoResultTimes; +interface ISpeechPhraseAlternate; +interface ISpeechPhraseAlternates; +interface ISpeechPhraseInfo; +interface ISpeechPhraseElement; +interface ISpeechPhraseElements; +interface ISpeechPhraseReplacement; +interface ISpeechPhraseReplacements; +interface ISpeechPhraseProperty; +interface ISpeechPhraseProperties; +interface ISpeechPhraseRule; +interface ISpeechPhraseRules; + +// Lexicon declarations +interface ISpeechLexicon; +interface ISpeechLexiconWords; +interface ISpeechLexiconWord; +interface ISpeechLexiconPronunciations; +interface ISpeechLexiconPronunciation; + +typedef long SpeechLanguageId; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// String constants +// +// +// +// +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Line below (#define) is to work around getting these strings just defined in the typelib (Ignore our definition in the .H file) +// Strings will fail to be defined properly in .H unless they have four backslashes ("\\\\") but for being in the typelib +// can't do this and have the strings defined propertly. So for VC just use the existing SAPI defines in SAPI.IDL. +cpp_quote("#define __SpeechStringConstants_MODULE_DEFINED__") + +[ +uuid(E58442E4-0C80-402c-9559-867337A39765) +] +module SpeechStringConstants +{ + //--- Root of registry entries for speech use + const BSTR SpeechRegistryUserRoot = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech"; + const BSTR SpeechRegistryLocalMachineRoot = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech"; + + //--- Object Token Categories for speech resource management + const BSTR SpeechCategoryAudioOut = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioOutput"; + const BSTR SpeechCategoryAudioIn = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput"; + const BSTR SpeechCategoryVoices = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices"; + const BSTR SpeechCategoryRecognizers = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Recognizers"; + const BSTR SpeechCategoryAppLexicons = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AppLexicons"; + const BSTR SpeechCategoryPhoneConverters = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\PhoneConverters"; + const BSTR SpeechCategoryRecoProfiles = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\RecoProfiles"; + + //--- User Lexicon Token Id + const BSTR SpeechTokenIdUserLexicon = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\CurrentUserLexicon"; + + //--- Standard token values + const BSTR SpeechTokenValueCLSID = L"CLSID"; + const BSTR SpeechTokenKeyFiles = L"Files"; + const BSTR SpeechTokenKeyUI = L"UI"; + const BSTR SpeechTokenKeyAttributes = L"Attributes"; + + //--- Standard voice category values + const BSTR SpeechVoiceCategoryTTSRate = L"DefaultTTSRate"; + + //--- Standard SR Engine properties + const BSTR SpeechPropertyResourceUsage = L"ResourceUsage"; + const BSTR SpeechPropertyHighConfidenceThreshold = L"HighConfidenceThreshold"; + const BSTR SpeechPropertyNormalConfidenceThreshold = L"NormalConfidenceThreshold"; + const BSTR SpeechPropertyLowConfidenceThreshold = L"LowConfidenceThreshold"; + const BSTR SpeechPropertyResponseSpeed = L"ResponseSpeed"; + const BSTR SpeechPropertyComplexResponseSpeed = L"ComplexResponseSpeed"; + const BSTR SpeechPropertyAdaptationOn = L"AdaptationOn"; + + //--- Standard SAPI Recognition Topics + const BSTR SpeechDictationTopicSpelling = L"Spelling"; + + //--- Special Tags used in SR grammars + const BSTR SpeechGrammarTagWildcard = L"..."; + const BSTR SpeechGrammarTagDictation = L"*"; + const BSTR SpeechGrammarTagUnlimitedDictation = L"*+"; + + //--- TokenUI constants + const BSTR SpeechEngineProperties = L"EngineProperties"; + const BSTR SpeechAddRemoveWord = L"AddRemoveWord"; + const BSTR SpeechUserTraining = L"UserTraining"; + const BSTR SpeechMicTraining = L"MicTraining"; + const BSTR SpeechRecoProfileProperties = L"RecoProfileProperties"; + const BSTR SpeechAudioProperties = L"AudioProperties"; + const BSTR SpeechAudioVolume = L"AudioVolume"; + + //--- ISpeechVoice::Skip constant + const BSTR SpeechVoiceSkipTypeSentence = L"Sentence"; + + // The SpeechAudioFormat object includes a guid that can be used to set the format to + // a custom value. + const BSTR SpeechAudioFormatGUIDWave = L"{C31ADBAE-527F-4ff5-A230-F62BB61FF70C}"; + const BSTR SpeechAudioFormatGUIDText = L"{7CEEF9F9-3D13-11d2-9EE7-00C04F797396}"; + +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Number Constants +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +[ +uuid(F3E092B2-6BDC-410f-BCB2-4C5ED4424180) +] +module SpeechConstants +{ + const float Speech_Default_Weight = DEFAULT_WEIGHT; + const LONG Speech_Max_Word_Length = SP_MAX_WORD_LENGTH; + const LONG Speech_Max_Pron_Length = SP_MAX_PRON_LENGTH; + const LONG Speech_StreamPos_Asap = SP_STREAMPOS_ASAP; + const LONG Speech_StreamPos_RealTime = SP_STREAMPOS_REALTIME; + const LONG SpeechAllElements = SPPR_ALL_ELEMENTS; +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechDataKey +// SAPI C++ Only Interface Equivalent: ISpDataKey Interface +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechDataKey +{ + DISPID_SDKSetBinaryValue = 1, + DISPID_SDKGetBinaryValue, + DISPID_SDKSetStringValue, + DISPID_SDKGetStringValue, + DISPID_SDKSetLongValue, + DISPID_SDKGetlongValue, + DISPID_SDKOpenKey, + DISPID_SDKCreateKey, + DISPID_SDKDeleteKey, + DISPID_SDKDeleteValue, + DISPID_SDKEnumKeys, + DISPID_SDKEnumValues +} DISPID_SpeechDataKey; + +[ + object, + uuid(CE17C09B-4EFA-44d5-A4C9-59D9585AB0CD), + dual, + helpstring("ISpeechDataKey Interface"), + pointer_default(unique) +] +interface ISpeechDataKey : IDispatch +{ + // Methods + + // SetBinaryValue + // SAPI C++ Only Interface Equivalent: SetData + // + [helpstring("SetBinaryValue"), id(DISPID_SDKSetBinaryValue)] + HRESULT SetBinaryValue( [in]const BSTR ValueName, + [in]VARIANT Value ); + + // GetBinaryValue + // SAPI C++ Only Interface Equivalent: GetData + // + [helpstring("GetBinaryValue"), id(DISPID_SDKGetBinaryValue)] + HRESULT GetBinaryValue( [in]const BSTR ValueName, + [out,retval]VARIANT* Value ); + + // SetStringValue + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SetStringValue"), id(DISPID_SDKSetStringValue)] + HRESULT SetStringValue( [in]const BSTR ValueName, + [in]const BSTR Value ); + + // GetStringValue + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("GetStringValue"), id(DISPID_SDKGetStringValue)] + HRESULT GetStringValue( [in]const BSTR ValueName, + [out,retval]BSTR* Value ); + + // SetLongValue + // SAPI C++ Only Interface Equivalent: SetDWORD + // + [helpstring("SetLongValue"), id(DISPID_SDKSetLongValue)] + HRESULT SetLongValue( [in]const BSTR ValueName, + [in]long Value ); + + // GetLongValue + // SAPI C++ Only Interface Equivalent: GetDWORD + // + [helpstring("GetlongValue"), id(DISPID_SDKGetlongValue)] + HRESULT GetLongValue( [in]const BSTR ValueName, + [out,retval]long* Value ); + + // OpenKey + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("OpenKey"), id(DISPID_SDKOpenKey)] + HRESULT OpenKey( [in]const BSTR SubKeyName, [out,retval]ISpeechDataKey** SubKey ); + + // CreateKey + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("CreateKey"), id(DISPID_SDKCreateKey)] + HRESULT CreateKey( [in]const BSTR SubKeyName, [out,retval]ISpeechDataKey** SubKey ); + + // DeleteKey + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("DeleteKey"), id(DISPID_SDKDeleteKey)] + HRESULT DeleteKey( [in]const BSTR SubKeyName ); + + // DeleteValue + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("DeleteValue"), id(DISPID_SDKDeleteValue)] + HRESULT DeleteValue( [in]const BSTR ValueName ); + + // EnumKeys + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("EnumKeys"), id(DISPID_SDKEnumKeys)] + HRESULT EnumKeys( [in]long Index, [out,retval]BSTR* SubKeyName ); + + // EnumValues + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("EnumValues"), id(DISPID_SDKEnumValues)] + HRESULT EnumValues( [in]long Index, [out,retval]BSTR* ValueName ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechObjectToken +// SAPI C++ Only Interface Equivalent: ISpObjectToken +// Default Property: Id +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechObjectToken +{ + DISPID_SOTId = 1, + DISPID_SOTDataKey, + DISPID_SOTCategory, + DISPID_SOTGetDescription, + DISPID_SOTSetId, + DISPID_SOTGetAttribute, + DISPID_SOTCreateInstance, + DISPID_SOTRemove, + DISPID_SOTGetStorageFileName, + DISPID_SOTRemoveStorageFileName, + DISPID_SOTIsUISupported, + DISPID_SOTDisplayUI, + DISPID_SOTMatchesAttributes +} DISPID_SpeechObjectToken; + +////////////////////////////////// +// +// SpeechDataKeyLocation Enum +// SAPI C++ Only Interface Equivalent: SPDATAKEYLOCATION +// +////////////////////////////////// + +typedef enum SpeechDataKeyLocation +{ + SDKLDefaultLocation = SPDKL_DefaultLocation, + SDKLCurrentUser = SPDKL_CurrentUser, + SDKLLocalMachine = SPDKL_LocalMachine, + SDKLCurrentConfig = SPDKL_CurrentConfig +} SpeechDataKeyLocation; + +#define CLSCTXALL (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER) + +////////////////////////////////// +// +// SpeechTokenContext Enum +// SAPI C++ Only Interface Equivalent: N/A +// +////////////////////////////////// + +typedef enum SpeechTokenContext +{ + STCInprocServer = CLSCTX_INPROC_SERVER, + STCInprocHandler = CLSCTX_INPROC_HANDLER, + STCLocalServer = CLSCTX_LOCAL_SERVER, + STCRemoteServer = CLSCTX_REMOTE_SERVER, + STCAll = CLSCTXALL +} SpeechTokenContext; + +////////////////////////////////// +// +// SpeechTokenShellFolder Enum +// SAPI C++ Only Interface Equivalent: N/A +// +////////////////////////////////// + +// CSIDL_* symbols are from SHLOBJ.H +typedef enum SpeechTokenShellFolder +{ + STSF_AppData = 0x001a, // CSIDL_APPDATA, + STSF_LocalAppData = 0x001c, // CSIDL_LOCAL_APPDATA + STSF_CommonAppData = 0x0023, // CSIDL_COMMON_APPDATA + STSF_FlagCreate = 0x8000 // CSIDL_FLAG_CREATE +} SpeechTokenShellFolder; + +[ + object, + uuid(C74A3ADC-B727-4500-A84A-B526721C8B8C), + dual, + helpstring("ISpeechObjectToken Interface"), + pointer_default(unique) +] +interface ISpeechObjectToken : IDispatch +{ + // Properties + + // Id + // SAPI C++ Only Interface Equivalent: GetId + // Default: N/A + // + [propget, helpstring("Id"), id(DISPID_SOTId)] + HRESULT Id( [out,retval]BSTR* ObjectId ); + + // DataKey + // SAPI C++ Only Interface Equivalent: Inherited from ISpDataKey + // Default: N/A + // + [propget, helpstring("DataKey"), id(DISPID_SOTDataKey), hidden] + HRESULT DataKey( [out,retval]ISpeechDataKey** DataKey ); + + // Category + // SAPI C++ Only Interface Equivalent: GetCategory + // Default: N/A + // + [propget, helpstring("Category"), id(DISPID_SOTCategory)] + HRESULT Category( [out,retval]ISpeechObjectTokenCategory** Category); + + // Methods + + // GetDescription + // SAPI C++ Only Interface Equivalent: New + // + [helpstring("GetDescription"), id(DISPID_SOTGetDescription)] + HRESULT GetDescription( [in,defaultvalue(0)]long Locale, + [out,retval]BSTR* Description ); + + // SetId + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SetId"), hidden, id(DISPID_SOTSetId)] + HRESULT SetId( [in] BSTR Id, + [in, defaultvalue("")] BSTR CategoryID, + [in, defaultvalue(0)]VARIANT_BOOL CreateIfNotExist); + + // GetAttribute + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("GetAttribute"), id(DISPID_SOTGetAttribute)] + HRESULT GetAttribute( [in] BSTR AttributeName, + [out, retval]BSTR* AttributeValue); + + // CreateInstance + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("CreateInstance"), id(DISPID_SOTCreateInstance)] + HRESULT CreateInstance( [in, defaultvalue(NULL)] IUnknown *pUnkOuter, + [in,defaultvalue(STCALL)] SpeechTokenContext ClsContext, + [out, retval]IUnknown **Object); + + // Remove + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Remove"), hidden, id(DISPID_SOTRemove)] + HRESULT Remove( [in]BSTR ObjectStorageCLSID ); + + // GetStorageFileName + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("GetStorageFileName"), hidden, id(DISPID_SOTGetStorageFileName)] + HRESULT GetStorageFileName( [in]BSTR ObjectStorageCLSID, + [in]BSTR KeyName, + [in]BSTR FileName, + [in]SpeechTokenShellFolder Folder, + [out,retval]BSTR* FilePath ); + + // Remove + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("RemoveStorageFileName"), hidden, id(DISPID_SOTRemoveStorageFileName)] + HRESULT RemoveStorageFileName( [in]BSTR ObjectStorageCLSID, + [in]BSTR KeyName, + [in]VARIANT_BOOL DeleteFile); + + // IsUISupported + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("IsUISupported"), hidden, id(DISPID_SOTIsUISupported)] + HRESULT IsUISupported( [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData, + [in, defaultvalue(NULL)]IUnknown* Object, + [out,retval] VARIANT_BOOL *Supported ); + + // DisplayUI + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("DisplayUI"), hidden, id(DISPID_SOTDisplayUI)] + HRESULT DisplayUI( [in]long hWnd, + [in]BSTR Title, + [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData, + [in, defaultvalue(NULL)]IUnknown* Object); + + // MatchesAttributes + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("MatchesAttributes"), id(DISPID_SOTMatchesAttributes)] + HRESULT MatchesAttributes([in]BSTR Attributes, + [out,retval] VARIANT_BOOL* Matches); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechObjectTokens +// SAPI C++ Only Interface Equivalent: IEnumObjectTokens +// Default Property: Item +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechObjectTokens +{ + DISPID_SOTsCount = 1, + DISPID_SOTsItem = DISPID_VALUE, + DISPID_SOTs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechObjectTokens; + +[ + object, + uuid(9285B776-2E7B-4bc0-B53E-580EB6FA967F), + dual, + helpstring("ISpeechObjectTokens Interface"), + pointer_default(unique) +] +interface ISpeechObjectTokens : IDispatch +{ + // Property + + // Count + // SAPI C++ Only Interface Equivalent: GetCount + // + [propget, helpstring("Count"), id(DISPID_SOTsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Item"), id(DISPID_VALUE)] + HRESULT Item([in] long Index, [out, retval]ISpeechObjectToken** Token ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: N/A + // + [propget, helpstring("Enumerates the tokens"), restricted, id(DISPID_NEWENUM)] + HRESULT _NewEnum([out, retval] IUnknown** ppEnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechObjectTokenCategory +// +// SAPI C++ Only Interface Equivalent: ISpObjectTokenCategory +// Default Property: Id +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechObjectTokenCategory +{ + DISPID_SOTCId = 1, + DISPID_SOTCDefault, + DISPID_SOTCSetId, + DISPID_SOTCGetDataKey, + DISPID_SOTCEnumerateTokens, +} DISPID_SpeechObjectTokenCategory; + +[ + object, + uuid(CA7EAC50-2D01-4145-86D4-5AE7D70F4469), + dual, + helpstring("ISpeechObjectTokenCategory Interface"), + pointer_default(unique) +] +interface ISpeechObjectTokenCategory : IDispatch +{ + // Properties + + // Id + // SAPI C++ Only Interface Equivalent: GetId + // + [propget, helpstring("Id"), id(DISPID_SOTCId)] + HRESULT Id([out, retval] BSTR * Id); + + // Default + // SAPI C++ Only Interface Equivalent: Set/GetDefaultTokenId + // + [propput, helpstring("Default"), id(DISPID_SOTCDefault)] + HRESULT Default([in] const BSTR TokenId); + [propget, helpstring("Default"), id(DISPID_SOTCDefault)] + HRESULT Default([out, retval] BSTR * TokenId); + + // Methods + + // SetId + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SetId"), id(DISPID_SOTCSetId)] + HRESULT SetId([in] const BSTR Id, [in, defaultvalue(0)]VARIANT_BOOL CreateIfNotExist); + + // GetDataKey + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("GetDataKey"), hidden, id(DISPID_SOTCGetDataKey)] + HRESULT GetDataKey([in, defaultvalue(SDKLDefaultLocation)]SpeechDataKeyLocation Location, + [out, retval]ISpeechDataKey ** DataKey); + + // EnumerateTokens + // SAPI C++ Only Interface Equivalent: EnumTokens + // + [helpstring("EnumerateTokens"), id(DISPID_SOTCEnumerateTokens)] + HRESULT EnumerateTokens( [in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out, retval]ISpeechObjectTokens** Tokens ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechAudioFormat +// SAPI C++ Only Interface Equivalent: ISpStreamFormat +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////// +// +// SpeechAudioFormatType +// SAPI C++ Only Interface Equivalent: SPSTREAMFORMAT +// +////////////////////////////////// + +typedef enum SpeechAudioFormatType { + [hidden] SAFTDefault = -1, + [hidden] SAFTNoAssignedFormat = 0, + [hidden] SAFTText, + [hidden] SAFTNonStandardFormat, // Non-SAPI 5.0 standard format with no WAVEFORMATEX description + [hidden] SAFTExtendedAudioFormat, // Non-SAPI 5.0 standard format but has WAVEFORMATEX description + // Standard PCM wave formats + SAFT8kHz8BitMono, + SAFT8kHz8BitStereo, + SAFT8kHz16BitMono, + SAFT8kHz16BitStereo, + SAFT11kHz8BitMono, + SAFT11kHz8BitStereo, + SAFT11kHz16BitMono, + SAFT11kHz16BitStereo, + SAFT12kHz8BitMono, + SAFT12kHz8BitStereo, + SAFT12kHz16BitMono, + SAFT12kHz16BitStereo, + SAFT16kHz8BitMono, + SAFT16kHz8BitStereo, + SAFT16kHz16BitMono, + SAFT16kHz16BitStereo, + SAFT22kHz8BitMono, + SAFT22kHz8BitStereo, + SAFT22kHz16BitMono, + SAFT22kHz16BitStereo, + SAFT24kHz8BitMono, + SAFT24kHz8BitStereo, + SAFT24kHz16BitMono, + SAFT24kHz16BitStereo, + SAFT32kHz8BitMono, + SAFT32kHz8BitStereo, + SAFT32kHz16BitMono, + SAFT32kHz16BitStereo, + SAFT44kHz8BitMono, + SAFT44kHz8BitStereo, + SAFT44kHz16BitMono, + SAFT44kHz16BitStereo, + SAFT48kHz8BitMono, + SAFT48kHz8BitStereo, + SAFT48kHz16BitMono, + SAFT48kHz16BitStereo, + // TrueSpeech format + SAFTTrueSpeech_8kHz1BitMono, + // A-Law formats + SAFTCCITT_ALaw_8kHzMono, + SAFTCCITT_ALaw_8kHzStereo, + SAFTCCITT_ALaw_11kHzMono, + SAFTCCITT_ALaw_11kHzStereo, + SAFTCCITT_ALaw_22kHzMono, + SAFTCCITT_ALaw_22kHzStereo, + SAFTCCITT_ALaw_44kHzMono, + SAFTCCITT_ALaw_44kHzStereo, + // u-Law formats + SAFTCCITT_uLaw_8kHzMono, + SAFTCCITT_uLaw_8kHzStereo, + SAFTCCITT_uLaw_11kHzMono, + SAFTCCITT_uLaw_11kHzStereo, + SAFTCCITT_uLaw_22kHzMono, + SAFTCCITT_uLaw_22kHzStereo, + SAFTCCITT_uLaw_44kHzMono, + SAFTCCITT_uLaw_44kHzStereo, + // ADPCM formats + SAFTADPCM_8kHzMono, + SAFTADPCM_8kHzStereo, + SAFTADPCM_11kHzMono, + SAFTADPCM_11kHzStereo, + SAFTADPCM_22kHzMono, + SAFTADPCM_22kHzStereo, + SAFTADPCM_44kHzMono, + SAFTADPCM_44kHzStereo, + // GSM 6.10 formats + SAFTGSM610_8kHzMono, + SAFTGSM610_11kHzMono, + SAFTGSM610_22kHzMono, + SAFTGSM610_44kHzMono, +} SpeechAudioFormatType; + +typedef [hidden] enum DISPID_SpeechAudioFormat +{ + DISPID_SAFType = 1, + DISPID_SAFGuid, + DISPID_SAFGetWaveFormatEx, + DISPID_SAFSetWaveFormatEx +} DISPID_SpeechAudioFormat; + +[ + object, + uuid(E6E9C590-3E18-40e3-8299-061F98BDE7C7), + dual, + helpstring("ISpeechAudioFormat Interface"), + pointer_default(unique) +] +interface ISpeechAudioFormat : IDispatch { + // Properties + + // Type + // SAPI C++ Only Interface Equivalent: + // Default: GetFormat + // + [propget, helpstring("Type"), id(DISPID_SAFType)] + HRESULT Type([out,retval]SpeechAudioFormatType* AudioFormat); + [propput, helpstring("Type"), id(DISPID_SAFType)] + HRESULT Type([in]SpeechAudioFormatType AudioFormat); + + // Guid + // SAPI C++ Only Interface Equivalent: + // Default: N/A (used to be parameter of GetFormat) + // + [propget, hidden, helpstring("Guid"), id(DISPID_SAFGuid)] + HRESULT Guid([out,retval]BSTR* Guid); + [propput, hidden, helpstring("Guid"), id(DISPID_SAFGuid)] + HRESULT Guid([in]BSTR Guid); + + // Methods + + // GetWaveFormatEx + // SAPI C++ Only Interface Equivalent: (used to be parameter of GetFormat) + // + [hidden, helpstring("GetWaveFormatEx"), id(DISPID_SAFGetWaveFormatEx)] + HRESULT GetWaveFormatEx([out,retval]ISpeechWaveFormatEx** WaveFormatEx); + + // GetWaveFormatEx + // SAPI C++ Only Interface Equivalent: (used to be parameter of GetFormat) + // + [hidden, helpstring("SetWaveFormatEx"), id(DISPID_SAFSetWaveFormatEx)] + HRESULT SetWaveFormatEx([in]ISpeechWaveFormatEx* WaveFormatEx); +} + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechBaseStream +// SAPI C++ Only Interface Equivalent: ISpStreamFormat and IStream +// Default Property: Format +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechBaseStream +{ + DISPID_SBSFormat = 1, + DISPID_SBSRead, + DISPID_SBSWrite, + DISPID_SBSSeek +} DISPID_SpeechBaseStream; + +////////////////////////////////// +// +// SpeechStreamSeekPositionType +// SAPI C++ Only Interface Equivalent: N/A +// +////////////////////////////////// + +typedef enum SpeechStreamSeekPositionType +{ + SSSPTRelativeToStart = STREAM_SEEK_SET, + SSSPTRelativeToCurrentPosition = STREAM_SEEK_CUR, + SSSPTRelativeToEnd = STREAM_SEEK_END +} SpeechStreamSeekPositionType; + +[ + object, + uuid(6450336F-7D49-4ced-8097-49D6DEE37294), + dual, + helpstring("ISpeechBaseStream Interface"), + pointer_default(unique) +] +interface ISpeechBaseStream : IDispatch +{ + // Properties + + // Format + // SAPI C++ Only Interface Equivalent: N/A + // Default: N/A + // + [propget, helpstring("Format"), id(DISPID_SBSFormat)] + HRESULT Format([out,retval]ISpeechAudioFormat** AudioFormat); + [propputref, helpstring("Format"), id(DISPID_SBSFormat)] + HRESULT Format([in]ISpeechAudioFormat* AudioFormat); + + // Methods + + + // Read + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("Read"), id(DISPID_SBSRead)] + HRESULT Read([out]VARIANT* Buffer, [in]long NumberOfBytes, [out,retval]long* BytesRead); + + // Write + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("Write"), id(DISPID_SBSWrite)] + HRESULT Write([in]VARIANT Buffer, [out,retval]long* BytesWritten); + + // Seek + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("Seek"), id(DISPID_SBSSeek)] + HRESULT Seek([in]VARIANT Position, [in, defaultvalue(SSSPTRelativeToStart)]SpeechStreamSeekPositionType Origin, [out,retval]VARIANT* NewPosition); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechAudio +// SAPI C++ Only Interface Equivalent: ISpAudio +// Default Property: Volume +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechAudio +{ + DISPID_SAStatus = 200, + DISPID_SABufferInfo, + DISPID_SADefaultFormat, + DISPID_SAVolume, + DISPID_SABufferNotifySize, + DISPID_SAEventHandle, + DISPID_SASetState +} DISPID_SpeechAudio; + +////////////////////////////////// +// +// SpeechAudioState +// SAPI C++ Only Interface Equivalent: _SPAUDIOSTATE +// +////////////////////////////////// + +typedef enum SpeechAudioState +{ + SASClosed = SPAS_CLOSED, + SASStop = SPAS_STOP, + SASPause = SPAS_PAUSE, + SASRun = SPAS_RUN +} SpeechAudioState; + +[ + object, + uuid(CFF8E175-019E-11d3-A08E-00C04F8EF9B5), + dual, + helpstring("ISpeechAudio Interface"), + pointer_default(unique) +] +interface ISpeechAudio : ISpeechBaseStream +{ + // Properties + + // Status + // SAPI C++ Only Interface Equivalent: GetStatus + // Default: N/A + // + [propget, helpstring("Status"), id(DISPID_SAStatus)] + HRESULT Status([out,retval]ISpeechAudioStatus** Status); + + // BufferInfo + // SAPI C++ Only Interface Equivalent: GetBufferInfo + // Default: N/A + // + [propget, helpstring("BufferInfo"), id(DISPID_SABufferInfo)] + HRESULT BufferInfo([out,retval]ISpeechAudioBufferInfo** BufferInfo); + + // DefaultFormat + // SAPI C++ Only Interface Equivalent: GetDefaultFormat + // Default: N/A + // + [propget, helpstring("DefaultFormat"), id(DISPID_SADefaultFormat)] + HRESULT DefaultFormat([out,retval]ISpeechAudioFormat** StreamFormat); + + // Volume + // SAPI C++ Only Interface Equivalent: GetVolumeLevel + // Default: N/A + // + [propget, helpstring("Volume"), id(DISPID_SAVolume)] + HRESULT Volume([out,retval]long* Volume); + [propput, helpstring("Volume"), id(DISPID_SAVolume)] + HRESULT Volume([in]long Volume); + + // BufferNotifySize + // SAPI C++ Only Interface Equivalent: GetBufferNotifySize + // Default: N/A + // + [propget, helpstring("BufferNotifySize"), id(DISPID_SABufferNotifySize)] + HRESULT BufferNotifySize([out,retval]long* BufferNotifySize); + [propput, helpstring("BufferNotifySize"), id(DISPID_SABufferNotifySize)] + HRESULT BufferNotifySize([in]long BufferNotifySize); + + // EventHandle + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, hidden, helpstring("EventHandle"), id(DISPID_SAEventHandle)] + HRESULT EventHandle([out,retval]long* EventHandle); + + // Methods + + // SetState + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SetState"), id(DISPID_SASetState), hidden] + HRESULT SetState([in] SpeechAudioState State); + +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechMMSysAudio +// SAPI C++ Only Interface Equivalent: ISpMMSysAudio +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechMMSysAudio +{ + DISPID_SMSADeviceId = 300, + DISPID_SMSALineId, + DISPID_SMSAMMHandle +} DISPID_SpeechMMSysAudio; + +[ + object, + uuid(3C76AF6D-1FD7-4831-81D1-3B71D5A13C44), + dual, + helpstring("ISpeechMMSysAudio Interface"), + pointer_default(unique) +] +interface ISpeechMMSysAudio : ISpeechAudio +{ + // Properties + + // DeviceId + // SAPI C++ Only Interface Equivalent: Get/SetDeviceId + // Default: N/A + // + [propget, helpstring("DeviceId"), id(DISPID_SMSADeviceId)] + HRESULT DeviceId([out, retval] long* DeviceId); + [propput, helpstring("DeviceId"), id(DISPID_SMSADeviceId)] + HRESULT DeviceId([in] long DeviceId); + + // LineId + // SAPI C++ Only Interface Equivalent: Get/SetLineId + // Default: N/A + // + [propget, helpstring("LineId"), id(DISPID_SMSALineId)] + HRESULT LineId([out, retval] long* LineId); + [propput, helpstring("LineId"), id(DISPID_SMSALineId)] + HRESULT LineId([in] long LineId); + + // MMHandle + // SAPI C++ Only Interface Equivalent: GetMMHandle + // Default: N/A + // + [propget, hidden, helpstring("MMHandle"), id(DISPID_SMSAMMHandle)] + HRESULT MMHandle([out, retval] long* Handle); // 64bit issue? Declared as handle. +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechFileStream +// SAPI C++ Only Interface Equivalent: ISpStream +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechFileStream +{ + DISPID_SFSOpen = 100, + DISPID_SFSClose +} DISPID_SpeechFileStream; + +////////////////////////////////// +// +// SpeechStreamFileMode Enum +// SAPI C++ Only Interface Equivalent: +// +////////////////////////////////// + +typedef enum SpeechStreamFileMode +{ + SSFMOpenForRead = SPFM_OPEN_READONLY, // Open existing file, read-only. + [hidden] SSFMOpenReadWrite = SPFM_OPEN_READWRITE, // (Not supported for wav files) Open existing file, read-write. + [hidden] SSFMCreate = SPFM_CREATE, // (Not supported for wav files) Open file if exists, else create if does not exist (opens read-write) + SSFMCreateForWrite = SPFM_CREATE_ALWAYS, // Create file even if file exists. Destroys old file. +} SpeechStreamFileMode; + +[ + object, + uuid(AF67F125-AB39-4e93-B4A2-CC2E66E182A7), + dual, + helpstring("ISpeechFileStream Interface"), + pointer_default(unique) +] +interface ISpeechFileStream : ISpeechBaseStream +{ + // Properties + + // Methods + + // Open + // SAPI C++ Only Interface Equivalent: BindToFile + // Default: N/A + // + [helpstring("Open"), id(DISPID_SFSOpen)] + HRESULT Open([in] BSTR FileName, + [in, defaultvalue(SSFMOpenForRead)] SpeechStreamFileMode FileMode, + [in, defaultvalue(0)]VARIANT_BOOL DoEvents); + + // Close + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [helpstring("Close"), id(DISPID_SFSClose)] + HRESULT Close(void); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechCustomStream +// SAPI C++ Only Interface Equivalent: ISpStream +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechCustomStream +{ + DISPID_SCSBaseStream = 100 +} DISPID_SpeechCustomStream; + + +[ + object, + uuid(1A9E9F4F-104F-4db8-A115-EFD7FD0C97AE), + dual, + helpstring("ISpeechCustomStream Interface"), + pointer_default(unique) +] +interface ISpeechCustomStream : ISpeechBaseStream +{ + // Properties + + // BaseStream + // SAPI C++ Only Interface Equivalent: ISpStream::Get/SetBaseStream + // Default: N/A + // + [propget, helpstring("BaseStream"), id(DISPID_SCSBaseStream)] + HRESULT BaseStream([out, retval] IUnknown **ppUnkStream); + [propputref, helpstring("BaseStream"), id(DISPID_SCSBaseStream)] + HRESULT BaseStream([in] IUnknown *pUnkStream); + + // Methods +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechMemoryStream +// SAPI C++ Only Interface Equivalent: ISpStream +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechMemoryStream +{ + DISPID_SMSSetData = 100, + DISPID_SMSGetData +} DISPID_SpeechMemoryStream; + +[ + object, + uuid(EEB14B68-808B-4abe-A5EA-B51DA7588008), + dual, + helpstring("ISpeechMemoryStream Interface"), + pointer_default(unique) +] +interface ISpeechMemoryStream : ISpeechBaseStream +{ + // Properties + + // Methods + + // SetData + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("SetData"), id(DISPID_SMSSetData)] + HRESULT SetData([in] VARIANT Data); + + // GetData + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("GetData"), id(DISPID_SMSGetData)] + HRESULT GetData([out, retval] VARIANT* pData); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechAudioStatus +// SAPI C++ Only Interface Equivalent: SPAUDIOSTATUS Struct +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechAudioStatus +{ + DISPID_SASFreeBufferSpace = 1, + DISPID_SASNonBlockingIO, + DISPID_SASState, + DISPID_SASCurrentSeekPosition, + DISPID_SASCurrentDevicePosition +} DISPID_SpeechAudioStatus; + +[ + object, + uuid(C62D9C91-7458-47f6-862D-1EF86FB0B278), + dual, + helpstring("ISpeechAudioStatus Interface"), + pointer_default(unique) +] +interface ISpeechAudioStatus : IDispatch +{ + // Properties + + // FreeBufferSpace + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("FreeBufferSpace"), id(DISPID_SASFreeBufferSpace)] + HRESULT FreeBufferSpace([out,retval]long* FreeBufferSpace); + + // NonBlockingIO + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("NonBlockingIO"), id(DISPID_SASNonBlockingIO)] + HRESULT NonBlockingIO([out,retval]long* NonBlockingIO); + + // State + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("State"), id(DISPID_SASState)] + HRESULT State([out, retval] SpeechAudioState * State); + + // CurrentSeekPosition + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("CurrentSeekPosition"), id(DISPID_SASCurrentSeekPosition)] + HRESULT CurrentSeekPosition([out,retval]VARIANT* CurrentSeekPosition); + + // CurrentDevicePosition + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("CurrentDevicePosition"), id(DISPID_SASCurrentDevicePosition)] + HRESULT CurrentDevicePosition([out,retval]VARIANT* CurrentDevicePosition); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechAudioBufferInfo +// P3. We're not sure what this is for. Should be hidden? +// SAPI C++ Only Interface Equivalent: SPAUDIOBUFFERINFO Struct +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechAudioBufferInfo +{ + DISPID_SABIMinNotification = 1, + DISPID_SABIBufferSize, + DISPID_SABIEventBias +} DISPID_SpeechAudioBufferInfo; + +[ + object, + uuid(11B103D8-1142-4edf-A093-82FB3915F8CC), + dual, + helpstring("ISpeechAudioBufferInfo Interface"), + pointer_default(unique) +] +interface ISpeechAudioBufferInfo : IDispatch +{ + // Properties + + // MinNotification + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("MinNotification"), id(DISPID_SABIMinNotification)] + HRESULT MinNotification([out,retval]long* MinNotification); + [propput, helpstring("MinNotification"), id(DISPID_SABIMinNotification)] + HRESULT MinNotification([in]long MinNotification); + + // BufferSize + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("BufferSize"), id(DISPID_SABIBufferSize)] + HRESULT BufferSize([out,retval]long* BufferSize); + [propput, helpstring("BufferSize"), id(DISPID_SABIBufferSize)] + HRESULT BufferSize([in]long BufferSize); + + // EventBias + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("EventBias"), id(DISPID_SABIEventBias)] + HRESULT EventBias([out,retval]long* EventBias); + [propput, helpstring("EventBias"), id(DISPID_SABIEventBias)] + HRESULT EventBias([in]long EventBias); +} + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechWaveFormatEx +// SAPI C++ Only Interface Equivalent: WAVEFORMATEX Struct +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechWaveFormatEx +{ + DISPID_SWFEFormatTag = 1, + DISPID_SWFEChannels, + DISPID_SWFESamplesPerSec, + DISPID_SWFEAvgBytesPerSec, + DISPID_SWFEBlockAlign, + DISPID_SWFEBitsPerSample, + DISPID_SWFEExtraData +} DISPID_SpeechWaveFormatEx; + +[ + object, + uuid(7A1EF0D5-1581-4741-88E4-209A49F11A10), + dual, + helpstring("ISpeechWaveFormatEx Interface"), + pointer_default(unique) +] +interface ISpeechWaveFormatEx : IDispatch +{ + // Properties + + // FormatTag + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("FormatTag"), id(DISPID_SWFEFormatTag)] + HRESULT FormatTag([out,retval]short* FormatTag); + [propput, helpstring("FormatTag"), id(DISPID_SWFEFormatTag)] + HRESULT FormatTag([in]short FormatTag); + + // Channels + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("Channels"), id(DISPID_SWFEChannels)] + HRESULT Channels([out,retval]short* Channels); + [propput, helpstring("Channels"), id(DISPID_SWFEChannels)] + HRESULT Channels([in]short Channels); + + // SamplesPerSec + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("SamplesPerSec"), id(DISPID_SWFESamplesPerSec)] + HRESULT SamplesPerSec([out,retval]long* SamplesPerSec); + [propput, helpstring("SamplesPerSec"), id(DISPID_SWFESamplesPerSec)] + HRESULT SamplesPerSec([in]long SamplesPerSec); + + // AvgBytesPerSec + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("AvgBytesPerSec"), id(DISPID_SWFEAvgBytesPerSec)] + HRESULT AvgBytesPerSec([out,retval]long* AvgBytesPerSec); + [propput, helpstring("AvgBytesPerSec"), id(DISPID_SWFEAvgBytesPerSec)] + HRESULT AvgBytesPerSec([in]long AvgBytesPerSec); + + // BlockAlign + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("BlockAlign"), id(DISPID_SWFEBlockAlign)] + HRESULT BlockAlign([out,retval]short* BlockAlign); + [propput, helpstring("BlockAlign"), id(DISPID_SWFEBlockAlign)] + HRESULT BlockAlign([in]short BlockAlign); + + // BitsPerSample + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("BitsPerSample"), id(DISPID_SWFEBitsPerSample)] + HRESULT BitsPerSample([out,retval]short* BitsPerSample); + [propput, helpstring("BitsPerSample"), id(DISPID_SWFEBitsPerSample)] + HRESULT BitsPerSample([in]short BitsPerSample); + + // ExtraData + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("ExtraData"), id(DISPID_SWFEExtraData)] + HRESULT ExtraData([out,retval]VARIANT* ExtraData); + [propput, helpstring("ExtraData"), id(DISPID_SWFEExtraData)] + HRESULT ExtraData([in]VARIANT ExtraData); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechVoice +// SAPI C++ Only Interface Equivalent: ISpVoice +// Default Property: Speak +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechVoice +{ + DISPID_SVStatus = 1, + DISPID_SVVoice, + DISPID_SVAudioOutput, + DISPID_SVAudioOutputStream, + DISPID_SVRate, + DISPID_SVVolume, + DISPID_SVAllowAudioOuputFormatChangesOnNextSet, + DISPID_SVEventInterests, + DISPID_SVPriority, + DISPID_SVAlertBoundary, + DISPID_SVSyncronousSpeakTimeout, + DISPID_SVSpeak, + DISPID_SVSpeakStream, + DISPID_SVPause, + DISPID_SVResume, + DISPID_SVSkip, + DISPID_SVGetVoices, + DISPID_SVGetAudioOutputs, + DISPID_SVWaitUntilDone, + DISPID_SVSpeakCompleteEvent, + DISPID_SVIsUISupported, + DISPID_SVDisplayUI +} DISPID_SpeechVoice; + +////////////////////////////////// +// +// SpeechVoicePriority Enum +// SAPI C++ Only Interface Equivalent: SPVPRIORITY +// +////////////////////////////////// + +typedef enum SpeechVoicePriority +{ + SVPNormal = SPVPRI_NORMAL, + SVPAlert = SPVPRI_ALERT, + SVPOver = SPVPRI_OVER +} SpeechVoicePriority; + +////////////////////////////////// +// +// SpeechVoiceSpeakFlags Enum +// SAPI C++ Only Interface Equivalent: SPEAKFLAGS +// +////////////////////////////////// + +typedef enum SpeechVoiceSpeakFlags +{ + //--- SpeechVoice flags + SVSFDefault = SPF_DEFAULT, + SVSFlagsAsync = SPF_ASYNC, + SVSFPurgeBeforeSpeak = SPF_PURGEBEFORESPEAK, + SVSFIsFilename = SPF_IS_FILENAME, + SVSFIsXML = SPF_IS_XML, + SVSFIsNotXML = SPF_IS_NOT_XML, + SVSFPersistXML = SPF_PERSIST_XML, + + //--- Normalizer flags + SVSFNLPSpeakPunc = SPF_NLP_SPEAK_PUNC, + + //--- Masks + SVSFNLPMask = SPF_NLP_MASK, + SVSFVoiceMask = SPF_VOICE_MASK, + SVSFUnusedFlags = SPF_UNUSED_FLAGS +} SpeechVoiceSpeakFlags; + +////////////////////////////////// +// +// SpeechVoiceEvents Enum +// SAPI C++ Only Interface Equivalent: N/A +// +////////////////////////////////// + +typedef enum SpeechVoiceEvents +{ + SVEStartInputStream = (1L << 1), + SVEEndInputStream = (1L << 2), + SVEVoiceChange = (1L << 3), + SVEBookmark = (1L << 4), + SVEWordBoundary = (1L << 5), + SVEPhoneme = (1L << 6), + SVESentenceBoundary = (1L << 7), + SVEViseme = (1L << 8), + SVEAudioLevel = (1L << 9), + SVEPrivate = (1L << 15), + SVEAllEvents = 0x083FE // All TTS events on. +} SpeechVoiceEvents; + +[ + object, + uuid(269316D8-57BD-11D2-9EEE-00C04F797396), + dual, + helpstring("ISpeechVoice Interface"), + pointer_default(unique) +] +interface ISpeechVoice : IDispatch +{ + // Status + // SAPI C++ Only Interface Equivalent: GetStatus + // Default: + // + [propget, helpstring("Status"), id(DISPID_SVStatus)] + HRESULT Status([out, retval] ISpeechVoiceStatus** Status); + + // Voice + // SAPI C++ Only Interface Equivalent: Get/SetVoice + // Default: + // + [propget, helpstring("Voice"), id(DISPID_SVVoice)] + HRESULT Voice([out, retval] ISpeechObjectToken** Voice ); + [propputref, helpstring("Voice"), id(DISPID_SVVoice)] + HRESULT Voice([in]ISpeechObjectToken * Voice ); + + // AudioOutput + // SAPI C++ Only Interface Equivalent: GetOutputObjectTokens/SetOutput + // Default: + // + [propget, helpstring("Gets the audio output object"), id(DISPID_SVAudioOutput)] + HRESULT AudioOutput([out, retval]ISpeechObjectToken** AudioOutput); + [propputref, helpstring("Sets the audio output object"), id(DISPID_SVAudioOutput)] + HRESULT AudioOutput([in]ISpeechObjectToken* AudioOutput); + + // AudioOutputStream + // SAPI C++ Only Interface Equivalent: GetOutputStream/SetOutput + // Default: + // + [propget, helpstring("Gets the audio output stream"), id(DISPID_SVAudioOutputStream)] + HRESULT AudioOutputStream([out, retval]ISpeechBaseStream** AudioOutputStream); + [propputref, helpstring("Sets the audio output stream"), id(DISPID_SVAudioOutputStream)] + HRESULT AudioOutputStream([in]ISpeechBaseStream* AudioOutputStream); + + // Rate + // SAPI C++ Only Interface Equivalent: Get/SetRate + // Default: + // + [propget, helpstring("Rate"), id(DISPID_SVRate)] + HRESULT Rate([out, retval] long* Rate); + [propput, helpstring("Rate"), id(DISPID_SVRate)] + HRESULT Rate([in] long Rate); + + // Volume + // SAPI C++ Only Interface Equivalent: Get/SetVolume + // Default: + // + [propget, helpstring("Volume"), id(DISPID_SVVolume)] + HRESULT Volume([out, retval] long* Volume); + [propput, helpstring("Volume"), id(DISPID_SVVolume)] + HRESULT Volume([in] long Volume); + + // AllowAudioOutputFormatChangesOnNextSet + // SAPI C++ Only Interface Equivalent: N/A (used to be parameter of SetOutput) + // Default: + // + [propput, hidden, helpstring("AllowAudioOutputFormatChangesOnNextSet"), id(DISPID_SVAllowAudioOuputFormatChangesOnNextSet)] + HRESULT AllowAudioOutputFormatChangesOnNextSet([in] VARIANT_BOOL Allow ); + [propget, hidden, helpstring("AllowAudioOutputFormatChangesOnNextSet"), id(DISPID_SVAllowAudioOuputFormatChangesOnNextSet)] + HRESULT AllowAudioOutputFormatChangesOnNextSet([out,retval] VARIANT_BOOL* Allow ); + + // EventInterests + // SAPI C++ Only Interface Equivalent: ISpEventSink::GetEventInterests + // Default: + // + [propget, helpstring("EventInterests"), id(DISPID_SVEventInterests)] + HRESULT EventInterests([out,retval] SpeechVoiceEvents* EventInterestFlags); + [propput, helpstring("EventInterests"), id(DISPID_SVEventInterests)] + HRESULT EventInterests([in] SpeechVoiceEvents EventInterestFlags); + + // Priority + // SAPI C++ Only Interface Equivalent: Get/SetPriority + // Default: + // + [propput, helpstring("Priority"), id(DISPID_SVPriority)] + HRESULT Priority([in] SpeechVoicePriority Priority ); + [propget, helpstring("Priority"), id(DISPID_SVPriority)] + HRESULT Priority([out,retval] SpeechVoicePriority* Priority ); + + // AlertBoundary + // SAPI C++ Only Interface Equivalent: Get/SetAlertBoundary + // Default: + // + [propput, helpstring("AlertBoundary"), id(DISPID_SVAlertBoundary)] + HRESULT AlertBoundary( [in] SpeechVoiceEvents Boundary ); + [propget, helpstring("AlertBoundary"), id(DISPID_SVAlertBoundary)] + HRESULT AlertBoundary( [out,retval] SpeechVoiceEvents* Boundary ); + + // SyncSpeakTimeout + // SAPI C++ Only Interface Equivalent: Get/SetSyncSpeakTimeout + // Default: + // + [propput, helpstring("SyncSpeakTimeout"), id(DISPID_SVSyncronousSpeakTimeout)] + HRESULT SynchronousSpeakTimeout([in] long msTimeout ); + [propget, helpstring("SyncSpeakTimeout"), id(DISPID_SVSyncronousSpeakTimeout)] + HRESULT SynchronousSpeakTimeout([out,retval] long* msTimeout ); + + // Methods + + // Speak + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Speak"), id(DISPID_SVSpeak)] + HRESULT Speak( [in] BSTR Text, + [in, defaultvalue(SPF_DEFAULT)] SpeechVoiceSpeakFlags Flags, + [out, retval]long* StreamNumber ); + + // SpeakStream + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SpeakStream"), id(DISPID_SVSpeakStream)] + HRESULT SpeakStream( [in] ISpeechBaseStream* Stream, + [in, defaultvalue(SPF_DEFAULT)] SpeechVoiceSpeakFlags Flags, + [out, retval]long* StreamNumber ); + + // Pause + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Pauses the voices rendering."), id(DISPID_SVPause)] + HRESULT Pause( void ); + + // Resume + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Resumes the voices rendering."), id(DISPID_SVResume)] + HRESULT Resume( void ); + + // Skip + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Skips rendering the specified number of items."), id(DISPID_SVSkip)] + HRESULT Skip( [in]const BSTR Type, [in]long NumItems, [out,retval]long* NumSkipped ); + + // GetVoices + // SAPI C++ Only Interface Equivalent: IEnumSpObjectTokens + // + [helpstring("GetVoices"), id(DISPID_SVGetVoices)] + HRESULT GetVoices([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + + // GetAudioOutputs + // SAPI C++ Only Interface Equivalent: IEnumSpObjectTokens + // + [helpstring("GetAudioOutputs"), id(DISPID_SVGetAudioOutputs)] + HRESULT GetAudioOutputs([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + + // WaitUntilDone + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("WaitUntilDone"), id(DISPID_SVWaitUntilDone)] + HRESULT WaitUntilDone([in]long msTimeout, [out,retval]VARIANT_BOOL * Done); + + // SpeakCompleteEvent + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SpeakCompleteEvent"), hidden, id(DISPID_SVSpeakCompleteEvent)] + HRESULT SpeakCompleteEvent([out,retval]long* Handle); + + // IsUISupported + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("IsUISupported"), id(DISPID_SVIsUISupported)] + HRESULT IsUISupported( [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData, + [out,retval] VARIANT_BOOL* Supported ); + + // DisplayUI + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("DisplayUI"), id(DISPID_SVDisplayUI)] + HRESULT DisplayUI( [in]long hWndParent, + [in]BSTR Title, + [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechVoiceStatus +// SAPI C++ Only Interface Equivalent: SPVOICESTATUS Struct +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechVoiceStatus +{ + DISPID_SVSCurrentStreamNumber = 1, + DISPID_SVSLastStreamNumberQueued, + DISPID_SVSLastResult, + DISPID_SVSRunningState, + DISPID_SVSInputWordPosition, + DISPID_SVSInputWordLength, + DISPID_SVSInputSentencePosition, + DISPID_SVSInputSentenceLength, + DISPID_SVSLastBookmark, + DISPID_SVSLastBookmarkId, + DISPID_SVSPhonemeId, + DISPID_SVSVisemeId +} DISPID_SpeechVoiceStatus; + +////////////////////////////////// +// +// SpeechRunState Enum +// SAPI C++ Only Interface Equivalent: SPRUNSTATE +// +////////////////////////////////// + +typedef enum SpeechRunState +{ + SRSEDone = SPRS_DONE, // The voice is done rendering all queued phrases + SRSEIsSpeaking = SPRS_IS_SPEAKING // The SpVoice currently has the audio queue claimed +} SpeechRunState; + +[ + object, + uuid(8BE47B07-57F6-11d2-9EEE-00C04F797396), + dual, + helpstring("ISpeechVoiceStatus Interface"), + pointer_default(unique) +] +interface ISpeechVoiceStatus : IDispatch +{ + // CurrentStream + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("CurrentStreamNumber"), id(DISPID_SVSCurrentStreamNumber)] + HRESULT CurrentStreamNumber([out, retval] long* StreamNumber); + + // LastStreamNumberQueued + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("LastStreamNumberQueued"), id(DISPID_SVSLastStreamNumberQueued)] + HRESULT LastStreamNumberQueued([out, retval] long* StreamNumber); + + // LastHResult + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("LastHResult"), id(DISPID_SVSLastResult)] + HRESULT LastHResult([out, retval]long* HResult); + + // RunningState + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("RunningState"), id(DISPID_SVSRunningState)] + HRESULT RunningState([out, retval] SpeechRunState* State); + + // InputWordPosition + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("InputWordPosition"), id(DISPID_SVSInputWordPosition)] + HRESULT InputWordPosition([out, retval] long* Position); + + // InputWordLength + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("InputWordLength"), id(DISPID_SVSInputWordLength)] + HRESULT InputWordLength([out, retval] long* Length); + + // InputSentencePosition + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("InputSentencePosition"), id(DISPID_SVSInputSentencePosition)] + HRESULT InputSentencePosition([out, retval] long* Position); + + // InputSentenceLength + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("InputSentenceLength"), id(DISPID_SVSInputSentenceLength)] + HRESULT InputSentenceLength([out, retval] long* Length); + + // LastBookmark + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("LastBookmark"), id(DISPID_SVSLastBookmark)] + HRESULT LastBookmark([out, retval] BSTR* Bookmark); + + // LastBookmarkId + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("LastBookmarkId"), id(DISPID_SVSLastBookmarkId), hidden] + HRESULT LastBookmarkId([out, retval] long* BookmarkId); + + // PhonemeId + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("PhonemeId"), id(DISPID_SVSPhonemeId)] + HRESULT PhonemeId([out, retval] short* PhoneId); + + // VisemeId + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("VisemeId"), id(DISPID_SVSVisemeId)] + HRESULT VisemeId([out, retval] short* VisemeId); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// _ISpeechVoiceEvents +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////// +// +// SpeechVisemeType Enum +// SAPI C++ Only Interface Equivalent: SPVISEMES +// +////////////////////////////////// + +typedef enum SpeechVisemeType +{ + // English example + SVP_0 = 0, // silence + SVP_1, // ae, ax, ah + SVP_2, // aa + SVP_3, // ao + SVP_4, // ey, eh, uh + SVP_5, // er + SVP_6, // y, iy, ih, ix + SVP_7, // w, uw + SVP_8, // ow + SVP_9, // aw + SVP_10, // oy + SVP_11, // ay + SVP_12, // h + SVP_13, // r + SVP_14, // l + SVP_15, // s, z + SVP_16, // sh, ch, jh, zh + SVP_17, // th, dh + SVP_18, // f, v + SVP_19, // d, t, n + SVP_20, // k, g, ng + SVP_21, // p, b, m +} SpeechVisemeType ; + +////////////////////////////////// +// +// SpeechVisemeFeature Enum +// SAPI C++ Only Interface Equivalent: +// +////////////////////////////////// + +typedef enum SpeechVisemeFeature +{ + SVF_None = 0, + SVF_Stressed = SPVFEATURE_STRESSED, + SVF_Emphasis = SPVFEATURE_EMPHASIS +} SpeechVisemeFeature; + +typedef [hidden] enum DISPID_SpeechVoiceEvent +{ + DISPID_SVEStreamStart = 1, + DISPID_SVEStreamEnd, + DISPID_SVEVoiceChange, + DISPID_SVEBookmark, + DISPID_SVEWord, + DISPID_SVEPhoneme, + DISPID_SVESentenceBoundary, + DISPID_SVEViseme, + DISPID_SVEAudioLevel, + DISPID_SVEEnginePrivate +} DISPID_SpeechVoiceEvent; + +[ + uuid(A372ACD1-3BEF-4bbd-8FFB-CB3E2B416AF8) +] +dispinterface _ISpeechVoiceEvents +{ + properties: + methods: + + // StartStream + // SAPI C++ Only Interface Equivalent: + // + [helpstring("StartStream"), id(DISPID_SVEStreamStart)] + void StartStream([in]long StreamNumber, [in]VARIANT StreamPosition); + + // EndStream + // SAPI C++ Only Interface Equivalent: + // + [helpstring("EndStream"), id(DISPID_SVEStreamEnd)] + void EndStream([in]long StreamNumber, [in]VARIANT StreamPosition); + + // VoiceChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("VoiceChange"), id(DISPID_SVEVoiceChange)] + void VoiceChange([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]ISpeechObjectToken* VoiceObjectToken); + + // Bookmark + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Bookmark"), id(DISPID_SVEBookmark)] + void Bookmark([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]BSTR Bookmark, + [in]long BookmarkId); + + // Word + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Word"), id(DISPID_SVEWord)] + void Word([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long CharacterPosition, + [in]long Length); + + // Sentence + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Sentence"), id(DISPID_SVESentenceBoundary)] + void Sentence([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long CharacterPosition, + [in]long Length); + + // Phoneme + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Phoneme"), id(DISPID_SVEPhoneme)] + void Phoneme([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long Duration, // In milliseconds + [in]short NextPhoneId, + [in]SpeechVisemeFeature Feature, + [in]short CurrentPhoneId); + + // Viseme + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Viseme"), id(DISPID_SVEViseme)] + void Viseme([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long Duration, // In milliseconds + [in]SpeechVisemeType NextVisemeId, + [in]SpeechVisemeFeature Feature, + [in]SpeechVisemeType CurrentVisemeId); + + // AudioLevel + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AudioLevel"), id(DISPID_SVEAudioLevel)] + void AudioLevel([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long AudioLevel); + + // EnginePrivate + // SAPI C++ Only Interface Equivalent: + // + [helpstring("EnginePrivate"), id(DISPID_SVEEnginePrivate)] + void EnginePrivate( [in]long StreamNumber, + [in]long StreamPosition, + [in]VARIANT EngineData); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecognizer +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecognizer +{ + DISPID_SRRecognizer = 1, + DISPID_SRAllowAudioInputFormatChangesOnNextSet, + DISPID_SRAudioInput, + DISPID_SRAudioInputStream, + DISPID_SRIsShared, + DISPID_SRState, + DISPID_SRStatus, + DISPID_SRProfile, + DISPID_SREmulateRecognition, + DISPID_SRCreateRecoContext, + DISPID_SRGetFormat, + DISPID_SRSetPropertyNumber, + DISPID_SRGetPropertyNumber, + DISPID_SRSetPropertyString, + DISPID_SRGetPropertyString, + DISPID_SRIsUISupported, + DISPID_SRDisplayUI, + DISPID_SRGetRecognizers, + DISPID_SVGetAudioInputs, + DISPID_SVGetProfiles +} DISPID_SpeechRecognizer; + +///////////////////////////////////////////////// +// +// SpeechLexiconType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRecognizerState +{ + SRSInactive = SPRST_INACTIVE, + SRSActive = SPRST_ACTIVE, + SRSActiveAlways = SPRST_ACTIVE_ALWAYS, + SRSInactiveWithPurge = SPRST_INACTIVE_WITH_PURGE, +} SpeechRecognizerState; + +///////////////////////////////////////////////// +// +// SpeechDisplayAttributes Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechDisplayAttributes +{ + SDA_No_Trailing_Space = 0, + SDA_One_Trailing_Space = SPAF_ONE_TRAILING_SPACE, + SDA_Two_Trailing_Spaces = SPAF_TWO_TRAILING_SPACES, + SDA_Consume_Leading_Spaces = SPAF_CONSUME_LEADING_SPACES +} SpeechDisplayAttributes; + +///////////////////////////////////////////////// +// +// SpeechFormatType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// +typedef enum SpeechFormatType +{ + SFTInput = SPWF_INPUT, + SFTSREngine = SPWF_SRENGINE +} SpeechFormatType; + +[ + object, + uuid(2D5F1C0C-BD75-4b08-9478-3B11FEA2586C), + dual, + helpstring("ISpeechRecognizer Interface"), + pointer_default(unique) +] +interface ISpeechRecognizer : IDispatch +{ + // Properties + + // Recognizer + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("Recognizer"), id(DISPID_SRRecognizer)] + HRESULT Recognizer( [in]ISpeechObjectToken* Recognizer ); + [propget, helpstring("Recognizer"), id(DISPID_SRRecognizer)] + HRESULT Recognizer( [out,retval]ISpeechObjectToken** Recognizer ); + + // AllowAudioInputFormatChangesOnNextSet + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet"), id(DISPID_SRAllowAudioInputFormatChangesOnNextSet)] + HRESULT AllowAudioInputFormatChangesOnNextSet([in] VARIANT_BOOL Allow ); + [propget, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet"), id(DISPID_SRAllowAudioInputFormatChangesOnNextSet)] + HRESULT AllowAudioInputFormatChangesOnNextSet([out,retval] VARIANT_BOOL* Allow ); + + // AudioInput + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("AudioInput"), id(DISPID_SRAudioInput)] + HRESULT AudioInput( [in,defaultvalue(0)]ISpeechObjectToken* AudioInput ); + [propget, helpstring("AudioInput"), id(DISPID_SRAudioInput)] + HRESULT AudioInput( [out,retval]ISpeechObjectToken** AudioInput ); + + // AudioInputStream + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("AudioInputStream"), id(DISPID_SRAudioInputStream)] + HRESULT AudioInputStream( [in,defaultvalue(0)]ISpeechBaseStream* AudioInputStream ); + [propget, helpstring("AudioInputStream"), id(DISPID_SRAudioInputStream)] + HRESULT AudioInputStream( [out,retval]ISpeechBaseStream** AudioInputStream ); + + // IsShared + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("IsShared"), id(DISPID_SRIsShared)] + HRESULT IsShared( [out,retval]VARIANT_BOOL* Shared ); + + // State + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("State"), id(DISPID_SRState)] + HRESULT State([in] SpeechRecognizerState State ); + [propget, helpstring("State"), id(DISPID_SRState)] + HRESULT State([out,retval] SpeechRecognizerState* State ); + + // Status + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Status"), id(DISPID_SRStatus)] + HRESULT Status([out,retval]ISpeechRecognizerStatus** Status ); + + // Profile + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("Profile"), id(DISPID_SRProfile)] + HRESULT Profile( [in,defaultvalue(0)]ISpeechObjectToken* Profile ); + [propget, helpstring("Profile"), id(DISPID_SRProfile)] + HRESULT Profile( [out,retval]ISpeechObjectToken** Profile ); + + // Methods + + // EmulateRecognition + // SAPI C++ Only Interface Equivalent: + // + // Notes: + // TextElements param: + // * This parameter specifies the elements of the phrase to EmulateRecognition with. + // * If it is a BSTR string then its assumed that the elements in TextElements are assumed to be + // space delimited and you cannot use the DisplayAttributes parameter (it is ignored). + // * If it is an array of BSTR words then you are specifying each element in the phrase and + // you can optionally specify the ElementDisplayAttributes as appropriate. + // * You can specify additional information for each element by using the following syntax on + // each TextElement: "/display_text/lexical_form/pronounciation;". This syntax can be used in both the + // BSTR and the array of BSTRs case. + // ElementDisplayAttributes param: + // * This parameter specifies the SpeechDisplayAttribute to use for each Word element. + // * If it is a NULL pointer, VT_NULL, or VT_EMPTY then SDA_No_Trailing_Space is assumed (default). + // * If it is a BSTR then it can be "" (empty string), " " (space), or " " (double space) + // and we'll pick the appropriate SpeechDispalyAttribute that matches and use this for all text elements. + // * If it is a integer value (VT_I1 to VT_I4) then this value is a SpeechDisplayAttribute value and + // it is used for each element in the Words array for the DisplayAttribute setting. + // and we'll pick the appropriate SpeechDispalyAttribute that matches and use this for all text elements. + // * If it is an array of integer values (VT_I1 to VT_I4) we'll use those values for the SpeechDisplayAttribute + // of each corresponding element in the TextElements array. + // * This parameter is only valid if you are using an array of BSTRs for the TextElements parameter (ignored + // if you pass in BSTR for Words). + // + [helpstring("EmulateRecognition"), id(DISPID_SREmulateRecognition)] + HRESULT EmulateRecognition( [in]VARIANT TextElements, [in, defaultvalue(NULL)]VARIANT* ElementDisplayAttributes, [in, defaultvalue(0)]long LanguageId); + + // CreateRecoContext + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CreateRecoContext"), id(DISPID_SRCreateRecoContext)] + HRESULT CreateRecoContext([out,retval]ISpeechRecoContext** NewContext ); + + // GetFormat + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetFormat"), id(DISPID_SRGetFormat)] + HRESULT GetFormat([in] SpeechFormatType Type, [out,retval]ISpeechAudioFormat** Format ); + + // SetPropertyNumber + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetPropertyNumber"), hidden, id(DISPID_SRSetPropertyNumber)] + HRESULT SetPropertyNumber( [in]const BSTR Name, [in]long Value, [out,retval]VARIANT_BOOL * Supported ); + + // GetPropertyNumber + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetPropertyNumber"), hidden, id(DISPID_SRGetPropertyNumber)] + HRESULT GetPropertyNumber( [in]const BSTR Name, [in,out]long* Value, [out,retval]VARIANT_BOOL * Supported ); + + // SetPropertyString + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetPropertyString"), hidden, id(DISPID_SRSetPropertyString)] + HRESULT SetPropertyString( [in]const BSTR Name, [in]const BSTR Value, [out,retval]VARIANT_BOOL * Supported ); + + // GetPropertyString + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetPropertyString"), hidden, id(DISPID_SRGetPropertyString)] + HRESULT GetPropertyString( [in]const BSTR Name, [in,out]BSTR* Value, [out,retval]VARIANT_BOOL * Supported ); + + // IsUISupported + // SAPI C++ Only Interface Equivalent: + // + [helpstring("IsUISupported"), id(DISPID_SRIsUISupported)] + HRESULT IsUISupported( [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData, + [out,retval] VARIANT_BOOL* Supported ); + + // DisplayUI + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DisplayUI"), id(DISPID_SRDisplayUI)] + HRESULT DisplayUI( [in]long hWndParent, + [in]BSTR Title, + [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData); + + // GetRecognizers + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetRecognizers"), id(DISPID_SRGetRecognizers)] + HRESULT GetRecognizers([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + + // GetAudioOutputs + // SAPI C++ Only Interface Equivalent: IEnumSpObjectTokens + // + [helpstring("GetAudioInputs"), id(DISPID_SVGetAudioInputs)] + HRESULT GetAudioInputs([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + + // GetProfiles + // SAPI C++ Only Interface Equivalent: IEnumSpObjectTokens + // + [helpstring("GetProfiles"), id(DISPID_SVGetProfiles)] + HRESULT GetProfiles([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecognizerStatus +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecognizerStatus +{ + DISPID_SRSAudioStatus = 1, + DISPID_SRSCurrentStreamPosition, + DISPID_SRSCurrentStreamNumber, + DISPID_SRSNumberOfActiveRules, + DISPID_SRSClsidEngine, + DISPID_SRSSupportedLanguages +} DISPID_SpeechRecognizerStatus; + +[ + object, + uuid(BFF9E781-53EC-484e-BB8A-0E1B5551E35C), + dual, + helpstring("ISpeechRecognizerStatus Interface"), + pointer_default(unique) +] +interface ISpeechRecognizerStatus : IDispatch +{ + // Properties + + // AudioStatus + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioStatus"),id(DISPID_SRSAudioStatus)] + HRESULT AudioStatus([out,retval]ISpeechAudioStatus** AudioStatus ); + + // CurrentStreamPosition + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("CurrentStreamPosition"), id(DISPID_SRSCurrentStreamPosition)] + HRESULT CurrentStreamPosition([out,retval]VARIANT* pCurrentStreamPos ); + + // CurrentStreamNumber + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("CurrentStreamNumber"), id(DISPID_SRSCurrentStreamNumber)] + HRESULT CurrentStreamNumber([out,retval]long* StreamNumber ); + + // NumberOfActiveRules + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumberOfActiveRules"), id(DISPID_SRSNumberOfActiveRules)] + HRESULT NumberOfActiveRules([out,retval]long* NumberOfActiveRules ); + + // ClsidEngine + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("ClsidEngine"), id(DISPID_SRSClsidEngine)] + HRESULT ClsidEngine([out,retval]BSTR* ClsidEngine ); + + // SupportedLanguages + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("SupportedLanguages"), id(DISPID_SRSSupportedLanguages)] + HRESULT SupportedLanguages([out,retval]VARIANT* SupportedLanguages ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecoContext +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecoContext +{ + DISPID_SRCRecognizer = 1, + DISPID_SRCAudioInInterferenceStatus, + DISPID_SRCRequestedUIType, + DISPID_SRCVoice, + DISPID_SRAllowVoiceFormatMatchingOnNextSet, + DISPID_SRCVoicePurgeEvent, + DISPID_SRCEventInterests, + DISPID_SRCCmdMaxAlternates, + DISPID_SRCState, + DISPID_SRCRetainedAudio, + DISPID_SRCRetainedAudioFormat, + DISPID_SRCPause, + DISPID_SRCResume, + DISPID_SRCCreateGrammar, + DISPID_SRCCreateResultFromMemory, + DISPID_SRCBookmark, + DISPID_SRCSetAdaptationData +} DISPID_SpeechRecoContext; + +///////////////////////////////////////////////// +// +// SpeechRetainedAudioOptions Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRetainedAudioOptions +{ + SRAONone = SPAO_NONE, + SRAORetainAudio = SPAO_RETAIN_AUDIO +} SpeechRetainedAudioOptions; + +///////////////////////////////////////////////// +// +// SpeechBookmarkOptions Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechBookmarkOptions +{ + SBONone = SPBO_NONE, + SBOPause = SPBO_PAUSE +} SpeechBookmarkOptions; + +///////////////////////////////////////////////// +// +// SpeechInterference Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechInterference +{ + SINone = SPINTERFERENCE_NONE, + SINoise = SPINTERFERENCE_NOISE, + SINoSignal = SPINTERFERENCE_NOSIGNAL, + SITooLoud = SPINTERFERENCE_TOOLOUD, + SITooQuiet = SPINTERFERENCE_TOOQUIET, + SITooFast = SPINTERFERENCE_TOOFAST, + SITooSlow = SPINTERFERENCE_TOOSLOW +} SpeechInterference; + +///////////////////////////////////////////////// +// +// SpeechRecoEvents Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRecoEvents +{ + SREStreamEnd = (1L << 0), // SR engine has reached the end of an input stream + SRESoundStart = (1L << 1), // SR engine has detected the start of non-trivial audio data + SRESoundEnd = (1L << 2), // SR engine has detected the end of non-trivial audio data + SREPhraseStart = (1L << 3), // SR engine has detected the start of a recognizable phrase + SRERecognition = (1L << 4), // SR engine's best hypothesis for the audio data + SREHypothesis = (1L << 5), // SR engine's interim hypothesis for the result of the audio data + SREBookmark = (1L << 6), // SR engine has reached the specified point in the audio stream + SREPropertyNumChange = (1L << 7), // LPARAM points to a string, WPARAM is the attrib value + SREPropertyStringChange = (1L << 8), // LPARAM pointer to buffer. Two concatinated null terminated strings. + SREFalseRecognition = (1L << 9), // apparent speech with no valid recognition + SREInterference = (1L << 10), // LPARAM is any combination of SPINTERFERENCE flags + SRERequestUI = (1L << 11), // LPARAM is string. + SREStateChange = (1L << 12), // wParam contains new reco state + SREAdaptation = (1L << 13), // the adaptation buffer is now ready to be accepted + SREStreamStart = (1L << 14), // SR engine has reached the start of an input stream + SRERecoOtherContext = (1L << 15), // Phrase finished and recognized, but for other context + SREAudioLevel = (1L << 16), // input audio volume level + SREPrivate = (1L << 18), // private engine specific event + SREAllEvents = 0x5FFFF // All Reco events on. +} SpeechRecoEvents; + +///////////////////////////////////////////////// +// +// SpeechRecoContextState Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRecoContextState +{ + SRCS_Disabled = SPCS_DISABLED, + SRCS_Enabled = SPCS_ENABLED +} SpeechRecoContextState; + +[ + object, + uuid(580AA49D-7E1E-4809-B8E2-57DA806104B8), + dual, + helpstring("ISpeechRecoContext Interface"), + pointer_default(unique) +] +interface ISpeechRecoContext : IDispatch +{ + // Properties + + // Recognizer + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Recognizer"), id(DISPID_SRCRecognizer)] + HRESULT Recognizer( [out,retval]ISpeechRecognizer** Recognizer ); + + // AudioInInterferenceStatus + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioInInterferenceStatus"), id(DISPID_SRCAudioInInterferenceStatus)] + HRESULT AudioInputInterferenceStatus( [out,retval]SpeechInterference* Interference ); + + // RequestedUIType + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RequestedUIType"), id(DISPID_SRCRequestedUIType)] + HRESULT RequestedUIType( [out,retval]BSTR* UIType ); + + // Voice + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("Voice"), id(DISPID_SRCVoice)] + HRESULT Voice([in]ISpeechVoice *Voice ); + [propget, helpstring("Voice"), id(DISPID_SRCVoice)] + HRESULT Voice([out,retval]ISpeechVoice **Voice ); + + // AllowVoiceFormatMatchingOnNextSet + // + [propput, hidden, helpstring("AllowVoiceFormatMatchingOnNextSet"), id(DISPID_SRAllowVoiceFormatMatchingOnNextSet)] + HRESULT AllowVoiceFormatMatchingOnNextSet([in] VARIANT_BOOL Allow ); + [propget, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet"), id(DISPID_SRAllowVoiceFormatMatchingOnNextSet)] + HRESULT AllowVoiceFormatMatchingOnNextSet([out,retval] VARIANT_BOOL* pAllow ); + + // VoicePurgeEvent + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("VoicePurgeEvent"), id(DISPID_SRCVoicePurgeEvent)] + HRESULT VoicePurgeEvent( [in]SpeechRecoEvents EventInterest ); + [propget, helpstring("VoicePurgeEvent"), id(DISPID_SRCVoicePurgeEvent)] + HRESULT VoicePurgeEvent( [out,retval]SpeechRecoEvents* EventInterest ); + + // EventInterests + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("EventInterests"), id(DISPID_SRCEventInterests)] + HRESULT EventInterests( [in]SpeechRecoEvents EventInterest ); + [propget, helpstring("EventInterests"), id(DISPID_SRCEventInterests)] + HRESULT EventInterests( [out,retval]SpeechRecoEvents* EventInterest ); + + // CmdMaxAlternates + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("CmdMaxAlternates"), id(DISPID_SRCCmdMaxAlternates)] + HRESULT CmdMaxAlternates([in] long MaxAlternates ); + [propget, helpstring("CmdMaxAlternates"), id(DISPID_SRCCmdMaxAlternates)] + HRESULT CmdMaxAlternates([out,retval] long* MaxAlternates ); + + // State + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("State"), id(DISPID_SRCState)] + HRESULT State([in] SpeechRecoContextState State ); + [propget, helpstring("State"), id(DISPID_SRCState)] + HRESULT State([out,retval] SpeechRecoContextState* State ); + + // RetainedAudio + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("RetainedAudio"), id(DISPID_SRCRetainedAudio)] + HRESULT RetainedAudio([in]SpeechRetainedAudioOptions Option); + [propget, helpstring("RetainedAudio"), id(DISPID_SRCRetainedAudio)] + HRESULT RetainedAudio([out,retval]SpeechRetainedAudioOptions* Option); + + // RetainedAudioFormat + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("RetainedAudioFormat"), id(DISPID_SRCRetainedAudioFormat)] + HRESULT RetainedAudioFormat([in] ISpeechAudioFormat* Format ); + [propget, helpstring("RetainedAudioFormat"), id(DISPID_SRCRetainedAudioFormat)] + HRESULT RetainedAudioFormat([out,retval] ISpeechAudioFormat** Format ); + + // Methods + + // Pause + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Pause"), id(DISPID_SRCPause)] + HRESULT Pause(void); + + // Resume + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Resume"), id(DISPID_SRCResume)] + HRESULT Resume(void); + + // CreateGrammar + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CreateGrammar"), id(DISPID_SRCCreateGrammar)] + HRESULT CreateGrammar( [in, defaultvalue(0)]VARIANT GrammarId, [out,retval]ISpeechRecoGrammar** Grammar ); + + // CreateResultFromMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CreateResultFromMemory"), id(DISPID_SRCCreateResultFromMemory)] + HRESULT CreateResultFromMemory( [in]VARIANT* ResultBlock, [out,retval]ISpeechRecoResult **Result ); + + // Bookmark + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Bookmark"), id(DISPID_SRCBookmark)] + HRESULT Bookmark( [in]SpeechBookmarkOptions Options, [in]VARIANT StreamPos, [in]VARIANT BookmarkId ); + + // SetAdaptationData + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetAdaptationData"), id(DISPID_SRCSetAdaptationData)] + HRESULT SetAdaptationData( [in]BSTR AdaptationString ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecoGrammar +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPIDSPRG +{ + DISPID_SRGId = 1, + DISPID_SRGRecoContext, + DISPID_SRGState, + DISPID_SRGRules, + DISPID_SRGReset, + DISPID_SRGCommit, + DISPID_SRGCmdLoadFromFile, + DISPID_SRGCmdLoadFromObject, + DISPID_SRGCmdLoadFromResource, + DISPID_SRGCmdLoadFromMemory, + DISPID_SRGCmdLoadFromProprietaryGrammar, + DISPID_SRGCmdSetRuleState, + DISPID_SRGCmdSetRuleIdState, + DISPID_SRGDictationLoad, + DISPID_SRGDictationUnload, + DISPID_SRGDictationSetState, + DISPID_SRGSetWordSequenceData, + DISPID_SRGSetTextSelection, + DISPID_SRGIsPronounceable +} DISPIDSPRG; + +///////////////////////////////////////////////// +// +// SpeechLoadOption Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechLoadOption +{ + SLOStatic = SPLO_STATIC, + SLODynamic = SPLO_DYNAMIC +} SpeechLoadOption; + +///////////////////////////////////////////////// +// +// SpeechWordPronounceable Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechWordPronounceable +{ + SWPUnknownWordUnpronounceable = SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, + SWPUnknownWordPronounceable = SPWP_UNKNOWN_WORD_PRONOUNCEABLE, + SWPKnownWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE +} SpeechWordPronounceable; + +///////////////////////////////////////////////// +// +// SpeechGrammarState Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechGrammarState +{ + SGSEnabled = SPGS_ENABLED, + SGSDisabled = SPGS_DISABLED, + SGSExclusive = SPGS_EXCLUSIVE, +} SpeechGrammarState; + +///////////////////////////////////////////////// +// +// SpeechRuleState Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRuleState +{ + SGDSInactive = SPRS_INACTIVE, + SGDSActive = SPRS_ACTIVE, + SGDSActiveWithAutoPause = SPRS_ACTIVE_WITH_AUTO_PAUSE +} SpeechRuleState; + +///////////////////////////////////////////////// +// +// SpeechRuleAttributes Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRuleAttributes +{ + SRATopLevel = SPRAF_TopLevel, + SRADefaultToActive = SPRAF_Active, + SRAExport = SPRAF_Export, + SRAImport = SPRAF_Import, + SRAInterpreter = SPRAF_Interpreter, + SRADynamic = SPRAF_Dynamic +} SpeechRuleAttributes; + +///////////////////////////////////////////////// +// +// SpeechGrammarWordType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechGrammarWordType +{ + SGDisplay = SPWT_DISPLAY, // Not implemented + SGLexical = SPWT_LEXICAL, + SGPronounciation = SPWT_PRONUNCIATION // Not implemented +} SpeechGrammarWordType; + +[ + object, + uuid(B6D6F79F-2158-4e50-B5BC-9A9CCD852A09), + dual, + helpstring("ISpeechRecoGrammar Interface"), + pointer_default(unique) +] +interface ISpeechRecoGrammar : IDispatch +{ + // Properties + + // Id + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Id"), id(DISPID_SRGId)] + HRESULT Id( [out,retval]VARIANT* Id ); + + // RecoContext + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RecoContext"), id(DISPID_SRGRecoContext)] + HRESULT RecoContext( [out,retval] ISpeechRecoContext** RecoContext ); + + // State + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("State"), id(DISPID_SRGState)] + HRESULT State( [in]SpeechGrammarState State ); + [propget, helpstring("State"), id(DISPID_SRGState)] + HRESULT State( [out,retval]SpeechGrammarState* State); + + // Rules + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Rules"), id(DISPID_SRGRules)] + HRESULT Rules( [out,retval]ISpeechGrammarRules** Rules); + + // Methods + + // Reset + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Reset"), id(DISPID_SRGReset)] + HRESULT Reset([in, defaultvalue(0)]SpeechLanguageId NewLanguage); + + // CmdLoadFromFile + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromFile"), id(DISPID_SRGCmdLoadFromFile)] + HRESULT CmdLoadFromFile( [in]const BSTR FileName, [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdLoadFromObject + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromObject"), id(DISPID_SRGCmdLoadFromObject)] + HRESULT CmdLoadFromObject( [in]const BSTR ClassId, + [in]const BSTR GrammarName, + [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdLoadFromResource + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromResource"), id(DISPID_SRGCmdLoadFromResource)] + HRESULT CmdLoadFromResource( [in]long hModule, + [in]VARIANT ResourceName, + [in]VARIANT ResourceType, + [in]SpeechLanguageId LanguageId, + [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdLoadFromMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromMemory"), id(DISPID_SRGCmdLoadFromMemory)] + HRESULT CmdLoadFromMemory( [in] VARIANT GrammarData, [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdLoadFromProprietaryGrammar + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromProprietaryGrammar"), id(DISPID_SRGCmdLoadFromProprietaryGrammar)] + HRESULT CmdLoadFromProprietaryGrammar( [in]const BSTR ProprietaryGuid, + [in]const BSTR ProprietaryString, + [in]VARIANT ProprietaryData, + [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdSetRuleState + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdSetRuleState"), id(DISPID_SRGCmdSetRuleState)] + HRESULT CmdSetRuleState( [in/*, defaultvalue("")*/]const BSTR Name, [in]SpeechRuleState State); + + // CmdSetRuleIdState + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdSetRuleIdState"), id(DISPID_SRGCmdSetRuleIdState)] + HRESULT CmdSetRuleIdState( [in/*, defaultvalue(0)*/]long RuleId, [in]SpeechRuleState State ); + + // DictationLoad + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DictationLoad"), id(DISPID_SRGDictationLoad)] + HRESULT DictationLoad( [in, defaultvalue("")] const BSTR TopicName, [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // DictationUnload + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DictationUnload"), id(DISPID_SRGDictationUnload)] + HRESULT DictationUnload( void ); + + // DictationSetState + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DictationSetState"), id(DISPID_SRGDictationSetState)] + HRESULT DictationSetState( [in]SpeechRuleState State ); + + // SetWordSequenceData + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetWordSequenceData"), id(DISPID_SRGSetWordSequenceData)] + HRESULT SetWordSequenceData( [in]const BSTR Text, [in]long TextLength, [in]ISpeechTextSelectionInformation* Info ); + + // SetTextSelection + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetTextSelection"), id(DISPID_SRGSetTextSelection)] + HRESULT SetTextSelection( [in]ISpeechTextSelectionInformation* Info ); + + // IsPronounceable + // SAPI C++ Only Interface Equivalent: + // + [helpstring("IsPronounceable"), id(DISPID_SRGIsPronounceable)] + HRESULT IsPronounceable( [in]const BSTR Word, [out,retval]SpeechWordPronounceable* WordPronounceable ); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// _ISpeechRecoContextEvents +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecoContextEvents +{ + DISPID_SRCEStartStream = 1, + DISPID_SRCEEndStream, + DISPID_SRCEBookmark, + DISPID_SRCESoundStart, + DISPID_SRCESoundEnd, + DISPID_SRCEPhraseStart, + DISPID_SRCERecognition, + DISPID_SRCEHypothesis, + DISPID_SRCEPropertyNumberChange, + DISPID_SRCEPropertyStringChange, + DISPID_SRCEFalseRecognition, + DISPID_SRCEInterference, + DISPID_SRCERequestUI, + DISPID_SRCERecognizerStateChange, + DISPID_SRCEAdaptation, + DISPID_SRCERecognitionForOtherContext, + DISPID_SRCEAudioLevel, + DISPID_SRCEEnginePrivate +} DISPID_SpeechRecoContextEvents; + +///////////////////////////////////////////////// +// +// SpeechRecognitionType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRecognitionType +{ + SRTStandard = 0, + SRTAutopause = SPREF_AutoPause, + SRTEmulated = SPREF_Emulated +} SpeechRecognitionType; + +[ + uuid(7B8FCB42-0E9D-4f00-A048-7B04D6179D3D) +] +dispinterface _ISpeechRecoContextEvents +{ + properties: + methods: + + // Methods + + // StartStream + // SAPI C++ Only Interface Equivalent: + // + [helpstring("StartStream"), id(DISPID_SRCEStartStream)] + void StartStream([in]long StreamNumber, [in]VARIANT StreamPosition); + + // EndStream + // SAPI C++ Only Interface Equivalent: + // + [helpstring("EndStream"), id(DISPID_SRCEEndStream)] + void EndStream([in]long StreamNumber, [in]VARIANT StreamPosition, [in]VARIANT_BOOL StreamReleased); + + // Bookmark + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Bookmark"), id(DISPID_SRCEBookmark)] + void Bookmark([in]long StreamNumber, [in]VARIANT StreamPosition, [in]VARIANT BookmarkId, [in]SpeechBookmarkOptions Options); + + // SoundStart + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SoundStart"), id(DISPID_SRCESoundStart)] + void SoundStart([in]long StreamNumber, [in]VARIANT StreamPosition); + + // SoundEnd + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SoundEnd"), id(DISPID_SRCESoundEnd)] + void SoundEnd([in]long StreamNumber, [in]VARIANT StreamPosition); + + // PhraseStart + // SAPI C++ Only Interface Equivalent: + // + [helpstring("PhraseStart"), id(DISPID_SRCEPhraseStart)] + void PhraseStart([in]long StreamNumber, [in]VARIANT StreamPosition); + + // Recognition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Recognition"), id(DISPID_SRCERecognition)] + void Recognition([in]long StreamNumber, [in]VARIANT StreamPosition, [in]SpeechRecognitionType RecognitionType, [in]ISpeechRecoResult * Result); + + // Hypothesis + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Hypothesis"), id(DISPID_SRCEHypothesis)] + void Hypothesis([in]long StreamNumber, [in]VARIANT StreamPosition, [in]ISpeechRecoResult* Result); + + // PropertyNumberChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("PropertyNumberChange"), id(DISPID_SRCEPropertyNumberChange)] + void PropertyNumberChange([in]long StreamNumber, [in]VARIANT StreamPosition, [in]BSTR PropertyName, [in]long NewNumberValue); + + // PropertyStringChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("PropertyStringChange"), id(DISPID_SRCEPropertyStringChange)] + void PropertyStringChange([in]long StreamNumber, [in]VARIANT StreamPosition, [in]BSTR PropertyName, [in]BSTR NewStringValue); + + // FalseRecognition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("FalseRecognition"), id(DISPID_SRCEFalseRecognition)] + void FalseRecognition([in]long StreamNumber, [in]VARIANT StreamPosition, [in]ISpeechRecoResult* Result); + + // Interference + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Interference"), id(DISPID_SRCEInterference)] + void Interference([in]long StreamNumber, [in]VARIANT StreamPosition, [in]SpeechInterference Interference); + + // RequestUI + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RequestUI"), id(DISPID_SRCERequestUI)] + void RequestUI([in]long StreamNumber, [in]VARIANT StreamPosition, [in]BSTR UIType); + + // RecognizerStateChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RecognizerStateChange"), id(DISPID_SRCERecognizerStateChange)] + void RecognizerStateChange([in]long StreamNumber, [in]VARIANT StreamPosition, [in]SpeechRecognizerState NewState); + + // Adaption + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Adaptation"), id(DISPID_SRCEAdaptation)] + void Adaptation([in]long StreamNumber, [in]VARIANT StreamPosition); + + // RecognitionForOtherContext + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RecognitionForOtherContext"), id(DISPID_SRCERecognitionForOtherContext)] + void RecognitionForOtherContext([in]long StreamNumber, [in]VARIANT StreamPosition); + + // AudioLevel + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AudioLevel"), id(DISPID_SRCEAudioLevel)] + void AudioLevel([in]long StreamNumber, [in]VARIANT StreamPosition, [in]long AudioLevel); + + // EnginePrivate + // SAPI C++ Only Interface Equivalent: + // + [helpstring("EnginePrivate"), id(DISPID_SRCEEnginePrivate)] + void EnginePrivate([in]long StreamNumber, [in]VARIANT StreamPosition, [in]VARIANT EngineData); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarRule +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRule +{ + DISPID_SGRAttributes = 1, + DISPID_SGRInitialState, + DISPID_SGRName, + DISPID_SGRId, + DISPID_SGRClear, + DISPID_SGRAddResource, + DISPID_SGRAddState +} DISPID_SpeechGrammarRule; + +[ + object, + uuid(AFE719CF-5DD1-44f2-999C-7A399F1CFCCC), + dual, + helpstring("ISpeechGrammarRule Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRule : IDispatch +{ + // Properties + + // RuleAttributes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RuleAttributes"), id(DISPID_SGRAttributes)] + HRESULT Attributes([out, retval] SpeechRuleAttributes* Attributes ); + + // InitialState + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("InitialState"), id(DISPID_SGRInitialState)] + HRESULT InitialState([out, retval] ISpeechGrammarRuleState** State); + + // Name + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Name"), id(DISPID_SGRName)] + HRESULT Name([out, retval] BSTR* Name); + + // Id + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Id"), id(DISPID_SGRId)] + HRESULT Id([out, retval] long* Id); + + // Methods + + // Clear + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Clear"),id(DISPID_SGRClear)] + HRESULT Clear(); + + // AddResource + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddResource"), id(DISPID_SGRAddResource)] + HRESULT AddResource([in]const BSTR ResourceName, [in]const BSTR ResourceValue); + + // AddState + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddState"), id(DISPID_SGRAddState)] + HRESULT AddState([out, retval] ISpeechGrammarRuleState** State); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarRules +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRules +{ + DISPID_SGRsCount = 1, + DISPID_SGRsDynamic, + DISPID_SGRsAdd, + DISPID_SGRsCommit, + DISPID_SGRsCommitAndSave, + DISPID_SGRsFindRule, + DISPID_SGRsItem = DISPID_VALUE, + DISPID_SGRs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechGrammarRules; + +[ + object, + uuid(6FFA3B44-FC2D-40d1-8AFC-32911C7F1AD1), + dual, + helpstring("ISpeechGrammarRules Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRules : IDispatch +{ + // Properties + + // RuleAttributes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SGRsCount)] + HRESULT Count([out, retval] long* Count); + + // FindRule + // SAPI C++ Only Interface Equivalent: + // NOTE: This returns S_OK with NULL Rule if rule is not found. + [helpstring("FindRule"), id(DISPID_SGRsFindRule)] + HRESULT FindRule([in]VARIANT RuleNameOrId, [out, retval]ISpeechGrammarRule** Rule); + + // Item + // SAPI C++ Only Interface Equivalent: + // Default: + // + [id(DISPID_SGRsItem), helpstring("Item")] + HRESULT Item([in] long Index, [out, retval]ISpeechGrammarRule** Rule ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // Default: + // + [id(DISPID_SGRs_NewEnum), propget, helpstring("Enumerates the alternates"), restricted] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); + + // Dynamic + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Dynamic"), id(DISPID_SGRsDynamic)] + HRESULT Dynamic([out, retval] VARIANT_BOOL *Dynamic); + + // Methods + + // Add + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Add"), id(DISPID_SGRsAdd)] + HRESULT Add([in] BSTR RuleName, + [in] SpeechRuleAttributes Attributes, + [in, defaultvalue(0)] long RuleId, + [out, retval] ISpeechGrammarRule** Rule); + + // Commit + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Commit"), id(DISPID_SGRsCommit)] + HRESULT Commit(void); + + // CommitAndSave + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CommitAndSave"), id(DISPID_SGRsCommitAndSave)] + HRESULT CommitAndSave([out] BSTR* ErrorText, [out, retval] VARIANT* SaveStream); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarRuleState +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRuleState +{ + DISPID_SGRSRule = 1, + DISPID_SGRSTransitions, + DISPID_SGRSAddWordTransition, + DISPID_SGRSAddRuleTransition, + DISPID_SGRSAddSpecialTransition +} DISPID_SpeechGrammarRuleState; + +typedef enum SpeechSpecialTransitionType +{ + SSTTWildcard = 1, + SSTTDictation, + SSTTTextBuffer +} SpeechSpecialTransitionType; + +[ + object, + uuid(D4286F2C-EE67-45ae-B928-28D695362EDA), + dual, + helpstring("ISpeechGrammarRuleState Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRuleState : IDispatch +{ + // Properties + + // Rule + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Rule"), id(DISPID_SGRSRule)] + HRESULT Rule([out, retval] ISpeechGrammarRule** Rule); + + // Transitions + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Transitions"), id(DISPID_SGRSTransitions)] + HRESULT Transitions([out, retval] ISpeechGrammarRuleStateTransitions** Transitions); + + // Methods + + // AddWordTransition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddWordTransition"), id(DISPID_SGRSAddWordTransition)] + HRESULT AddWordTransition([in]ISpeechGrammarRuleState* DestState, + [in]const BSTR Words, + [in, defaultvalue(" ")]const BSTR Separators, + [in, defaultvalue(SGLexical)]SpeechGrammarWordType Type, + [in, defaultvalue("")]const BSTR PropertyName, + [in, defaultvalue(0)]long PropertyId, + [in, defaultvalue(0)]VARIANT* PropertyValue, + [in, defaultvalue(1.0)]float Weight); + + // AddRuleTransition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddRuleTransition"), id(DISPID_SGRSAddRuleTransition)] + HRESULT AddRuleTransition([in]ISpeechGrammarRuleState* DestinationState, + [in]ISpeechGrammarRule* Rule, + [in, defaultvalue("")]const BSTR PropertyName, + [in, defaultvalue(0)]long PropertyId, + [in, defaultvalue(0)]VARIANT* PropertyValue, + [in, defaultvalue(1.0)]float Weight); + + // AddSpecialTransition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddSpecialTransition"), id(DISPID_SGRSAddSpecialTransition)] + HRESULT AddSpecialTransition([in]ISpeechGrammarRuleState* DestinationState, + [in]SpeechSpecialTransitionType Type, + [in, defaultvalue("")]const BSTR PropertyName, + [in, defaultvalue(0)]long PropertyId, + [in, defaultvalue(0)]VARIANT* PropertyValue, + [in, defaultvalue(1.0)]float Weight); + +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarStateTransitions +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRuleStateTransitions +{ + DISPID_SGRSTsCount = 1, + DISPID_SGRSTsItem = DISPID_VALUE, + DISPID_SGRSTs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechGrammarRuleStateTransitions; + +[ + object, + uuid(EABCE657-75BC-44a2-AA7F-C56476742963), + dual, + helpstring("ISpeechGrammarRuleStateTransitions Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRuleStateTransitions : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SGRSTsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SGRSTsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechGrammarRuleStateTransition** Transition ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the transitions"), restricted, id(DISPID_SGRSTs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarStateTransition +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRuleStateTransition +{ + DISPID_SGRSTType = 1, + DISPID_SGRSTText, + DISPID_SGRSTRule, + DISPID_SGRSTWeight, + DISPID_SGRSTPropertyName, + DISPID_SGRSTPropertyId, + DISPID_SGRSTPropertyValue, + DISPID_SGRSTNextState +} DISPID_SpeechGrammarRuleStateTransition; + +////////////////////////////////// +// +// SpeechGrammarRuleStateTransitionType Enum +// SAPI C++ Only Interface Equivalent: +// +////////////////////////////////// + +typedef enum SpeechGrammarRuleStateTransitionType +{ + SGRSTTEpsilon = 0, + SGRSTTWord, + SGRSTTRule, + SGRSTTDictation, + SGRSTTWildcard, + SGRSTTTextBuffer +} SpeechGrammarRuleStateTransitionType; + +[ + object, + uuid(CAFD1DB1-41D1-4a06-9863-E2E81DA17A9A), + dual, + helpstring("ISpeechGrammarRuleStateTransition Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRuleStateTransition : IDispatch +{ + // Properties + + // Type + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Type"), id(DISPID_SGRSTType)] + HRESULT Type([out, retval] SpeechGrammarRuleStateTransitionType* Type); + + // Text + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Text"), id(DISPID_SGRSTText)] + HRESULT Text([out, retval] BSTR* Text); + + // Rule + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Rule"), id(DISPID_SGRSTRule)] + HRESULT Rule([out, retval] ISpeechGrammarRule ** Rule); + + // Weight + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Weight"), id(DISPID_SGRSTWeight)] + HRESULT Weight([out, retval] VARIANT * Weight); + + // PropertyName + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("PropertyName"), id(DISPID_SGRSTPropertyName)] + HRESULT PropertyName([out, retval] BSTR * PropertyName); + + // PropertyId + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("PropertyId"), id(DISPID_SGRSTPropertyId)] + HRESULT PropertyId([out, retval] long * PropertyId); + + // PropertyValue + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("PropertyValue"), id(DISPID_SGRSTPropertyValue)] + HRESULT PropertyValue([out, retval] VARIANT * PropertyValue); + + // NextState + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NextState"), id(DISPID_SGRSTNextState)] + HRESULT NextState([out, retval] ISpeechGrammarRuleState ** NextState); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechTextSelectionInformation +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPIDSPTSI +{ + DISPIDSPTSI_ActiveOffset = 1, + DISPIDSPTSI_ActiveLength, + DISPIDSPTSI_SelectionOffset, + DISPIDSPTSI_SelectionLength +} DISPIDSPTSI; + +[ + object, + uuid(3B9C7E7A-6EEE-4DED-9092-11657279ADBE), + dual, + helpstring("ISpeechTextSelectionInformation Interface"), + pointer_default(unique) +] +interface ISpeechTextSelectionInformation : IDispatch +{ + // Properties + + // ActiveOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("ActiveOffset"), id(DISPIDSPTSI_ActiveOffset)] + HRESULT ActiveOffset( [in]long ActiveOffset ); + [propget, helpstring("ActiveOffset"), id(DISPIDSPTSI_ActiveOffset)] + HRESULT ActiveOffset( [out, retval]long* ActiveOffset ); + + // ActiveLength + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("ActiveLength"), id(DISPIDSPTSI_ActiveLength)] + HRESULT ActiveLength( [in]long ActiveLength ); + [propget, helpstring("ActiveLength"), id(DISPIDSPTSI_ActiveLength)] + HRESULT ActiveLength( [out, retval]long* ActiveLength ); + + // SelectionOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("SelectionOffset"), id(DISPIDSPTSI_SelectionOffset)] + HRESULT SelectionOffset( [in]long SelectionOffset ); + [propget, helpstring("SelectionOffset"), id(DISPIDSPTSI_SelectionOffset)] + HRESULT SelectionOffset( [out, retval]long* SelectionOffset ); + + // SelectionLength + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("SelectionLength"), id(DISPIDSPTSI_SelectionLength)] + HRESULT SelectionLength( [in]long SelectionLength ); + [propget, helpstring("SelectionLength"), id(DISPIDSPTSI_SelectionLength)] + HRESULT SelectionLength( [out, retval]long* SelectionLength ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecoResult +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecoResult +{ + DISPID_SRRRecoContext = 1, + DISPID_SRRTimes, + DISPID_SRRAudioFormat, + DISPID_SRRPhraseInfo, + DISPID_SRRAlternates, + DISPID_SRRAudio, + DISPID_SRRSpeakAudio, + DISPID_SRRSaveToMemory, + DISPID_SRRDiscardResultInfo +} DISPID_SpeechRecoResult; + +///////////////////////////////////////////////// +// +// SpeechDiscardType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechDiscardType +{ + SDTProperty = SPDF_PROPERTY, + SDTReplacement = SPDF_REPLACEMENT, + SDTRule = SPDF_RULE, + SDTDisplayText = SPDF_DISPLAYTEXT, + SDTLexicalForm = SPDF_LEXICALFORM, + SDTPronunciation = SPDF_PRONUNCIATION, + SDTAudio = SPDF_AUDIO, + SDTAlternates = SPDF_ALTERNATES, + SDTAll = SPDF_ALL +} SpeechDiscardType; + +[ + object, + uuid(ED2879CF-CED9-4ee6-A534-DE0191D5468D), + dual, + helpstring("ISpeechRecoResult Interface"), + pointer_default(unique) +] +interface ISpeechRecoResult : IDispatch +{ + // Properties + + // RecoContext + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RecoContext"), id(DISPID_SRRRecoContext)] + HRESULT RecoContext( [out,retval]ISpeechRecoContext** RecoContext ); + + // Times + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Times"), id(DISPID_SRRTimes)] + HRESULT Times( [out,retval]ISpeechRecoResultTimes** Times ); + + // AudioFormat + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("AudioFormat"), id(DISPID_SRRAudioFormat)] + HRESULT AudioFormat( [in]ISpeechAudioFormat* Format ); + [propget, helpstring("AudioFormat"), id(DISPID_SRRAudioFormat)] + HRESULT AudioFormat( [out,retval]ISpeechAudioFormat** Format ); + + // PhraseInfo + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("PhraseInfo"), id(DISPID_SRRPhraseInfo)] + HRESULT PhraseInfo( [out,retval]ISpeechPhraseInfo** PhraseInfo ); + + + // Methods + + // Alternates + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Alternates"), id(DISPID_SRRAlternates)] + HRESULT Alternates( [in] long RequestCount, + [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [out,retval] ISpeechPhraseAlternates** Alternates ); + + // Audio + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Audio"), id(DISPID_SRRAudio)] + HRESULT Audio( [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [out,retval] ISpeechMemoryStream **Stream ); + + // SpeakAudio + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SpeakAudio"), id(DISPID_SRRSpeakAudio)] + HRESULT SpeakAudio( [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [in, defaultvalue(SPF_DEFAULT)] SpeechVoiceSpeakFlags Flags, + [out,retval]long* StreamNumber ); + + // SaveToMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SaveToMemory"), id(DISPID_SRRSaveToMemory)] + HRESULT SaveToMemory( [out,retval] VARIANT* ResultBlock ); + + // DiscardResultInfo + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DiscardResultInfo"), id(DISPID_SRRDiscardResultInfo)] + HRESULT DiscardResultInfo( [in]SpeechDiscardType ValueTypes ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseInfoBuilder +// SAPI C++ Only Interface Equivalent: +// This interface corresponds to the ISpPhraseBuilder +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseBuilder +{ + DISPID_SPPBRestorePhraseFromMemory = 1 +} DISPID_SpeechPhraseBuilder ; + +[ + object, + uuid(3B151836-DF3A-4E0A-846C-D2ADC9334333), + dual, + helpstring("ISpeechPhraseInfoBuilder Interface"), + pointer_default(unique) +] +interface ISpeechPhraseInfoBuilder : IDispatch +{ + // Methods + + // RestorePhraseFromMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RestorePhraseFromMemory"), id(DISPID_SPPBRestorePhraseFromMemory)] + HRESULT RestorePhraseFromMemory([in] VARIANT* PhraseInMemory, + [out,retval] ISpeechPhraseInfo **PhraseInfo); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecoResultTimes +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecoResultTimes +{ + DISPID_SRRTStreamTime = 1, + DISPID_SRRTLength, + DISPID_SRRTTickCount, + DISPID_SRRTOffsetFromStart +} DISPID_SpeechRecoResultTimes; + +[ + object, + uuid(62B3B8FB-F6E7-41be-BDCB-056B1C29EFC0), + dual, + helpstring("ISpeechRecoResultTimes Interface"), + pointer_default(unique) +] +interface ISpeechRecoResultTimes : IDispatch +{ + // Properties + + // StreamTime + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("StreamTime"), id(DISPID_SRRTStreamTime)] + HRESULT StreamTime([out,retval]VARIANT* Time ); + + // Length + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Length"), id(DISPID_SRRTLength)] + HRESULT Length([out,retval]VARIANT* Length ); + + // TickCount + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("TickCount"), id(DISPID_SRRTTickCount)] + HRESULT TickCount([out,retval]long* TickCount ); + + // Start + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Start"), id(DISPID_SRRTOffsetFromStart)] + HRESULT OffsetFromStart([out,retval]VARIANT* OffsetFromStart ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseAlternate +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseAlternate +{ + DISPID_SPARecoResult = 1, + DISPID_SPAStartElementInResult, + DISPID_SPANumberOfElementsInResult, + DISPID_SPAPhraseInfo, + DISPID_SPACommit +} DISPID_SpeechPhraseAlternate; + +[ + object, + uuid(27864A2A-2B9F-4cb8-92D3-0D2722FD1E73), + dual, + helpstring("ISpeechPhraseAlternate Interface"), + pointer_default(unique) +] +interface ISpeechPhraseAlternate : IDispatch +{ + // Properties + + // RecoResult + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RecoResult"), id(DISPID_SPARecoResult)] + HRESULT RecoResult( [out,retval]ISpeechRecoResult** RecoResult ); // Was ISpPhrase, is this right? + + // StartElementInResult + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("StartElementInResult"), id(DISPID_SPAStartElementInResult)] + HRESULT StartElementInResult( [out,retval]long* StartElement ); + + // NumberOfElementsInResult + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumberOfElementsInResult"), id(DISPID_SPANumberOfElementsInResult)] + HRESULT NumberOfElementsInResult( [out,retval]long* NumberOfElements ); + + // PhraseInfo + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Phrase"), id(DISPID_SPAPhraseInfo)] + HRESULT PhraseInfo( [out,retval]ISpeechPhraseInfo** PhraseInfo ); + + // Methods + + // Commit + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Commit"), id(DISPID_SPACommit)] + HRESULT Commit( void ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseAlternates +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseAlternates +{ + DISPID_SPAsCount = 1, + DISPID_SPAsItem = DISPID_VALUE, + DISPID_SPAs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseAlternates; + +[ + object, + uuid(B238B6D5-F276-4c3d-A6C1-2974801C3CC2), + dual, + helpstring("ISpeechPhraseAlternates Interface"), + pointer_default(unique) +] +interface ISpeechPhraseAlternates : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPAsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPAsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseAlternate** PhraseAlternate ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the alternates"), restricted, id(DISPID_SPAs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseInfo +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseInfo +{ + DISPID_SPILanguageId = 1, + DISPID_SPIGrammarId, + DISPID_SPIStartTime, + DISPID_SPIAudioStreamPosition, + DISPID_SPIAudioSizeBytes, + DISPID_SPIRetainedSizeBytes, + DISPID_SPIAudioSizeTime, + DISPID_SPIRule, + DISPID_SPIProperties, + DISPID_SPIElements, + DISPID_SPIReplacements, + DISPID_SPIEngineId, + DISPID_SPIEnginePrivateData, + DISPID_SPISaveToMemory, + DISPID_SPIGetText, + DISPID_SPIGetDisplayAttributes +} DISPID_SpeechPhraseInfo; + +[ + object, + uuid(961559CF-4E67-4662-8BF0-D93F1FCD61B3), + dual, + helpstring("ISpeechPhraseInfo Interface"), + pointer_default(unique) +] +interface ISpeechPhraseInfo : IDispatch +{ + // Properties + + // LanguageId + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("LanguageId"), id(DISPID_SPILanguageId)] + HRESULT LanguageId( [out, retval]long* LanguageId ); + + // GrammarId + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("GrammarId"), id(DISPID_SPIGrammarId)] + HRESULT GrammarId( [out, retval]VARIANT* GrammarId ); + + // StartTime + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("StartTime"), id(DISPID_SPIStartTime)] + HRESULT StartTime( [out, retval]VARIANT* StartTime ); + + // AudioStreamPosition + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioStreamPosition"), id(DISPID_SPIAudioStreamPosition)] + HRESULT AudioStreamPosition( [out, retval]VARIANT* AudioStreamPosition ); + + // AudioSizeBytes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioSizeBytes"), id(DISPID_SPIAudioSizeBytes)] + HRESULT AudioSizeBytes( [out, retval]long* pAudioSizeBytes ); + + // RetainedSizeBytes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RetainedSizeBytes"), id(DISPID_SPIRetainedSizeBytes)] + HRESULT RetainedSizeBytes( [out, retval]long* RetainedSizeBytes ); + + // AudioSizeTime + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioSizeTime"), id(DISPID_SPIAudioSizeTime)] + HRESULT AudioSizeTime( [out, retval]long* AudioSizeTime ); + + // Rule + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Rule"), id(DISPID_SPIRule)] + HRESULT Rule( [out, retval]ISpeechPhraseRule** Rule ); + + // Properties + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Properties"), id(DISPID_SPIProperties)] + HRESULT Properties( [out, retval]ISpeechPhraseProperties** Properties ); + + // Elements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Elements"), id(DISPID_SPIElements)] + HRESULT Elements( [out, retval]ISpeechPhraseElements** Elements ); + + // Replacements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Replacements"), id(DISPID_SPIReplacements)] + HRESULT Replacements( [out, retval]ISpeechPhraseReplacements** Replacements ); + + // EngineId + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EngineId"), id(DISPID_SPIEngineId)] + HRESULT EngineId( [out, retval]BSTR* EngineIdGuid ); + + // EnginePrivateData + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EnginePrivateData"), id(DISPID_SPIEnginePrivateData)] + HRESULT EnginePrivateData( [out, retval]VARIANT *PrivateData ); + + // Methods + + // SaveToMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SaveToMemory"), id(DISPID_SPISaveToMemory)] + HRESULT SaveToMemory( [out,retval]VARIANT* PhraseBlock ); + + // GetText + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetText"), id(DISPID_SPIGetText)] + HRESULT GetText( [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [in, defaultvalue(-1)] VARIANT_BOOL UseReplacements, + [out,retval]BSTR* Text ); + + // DisplayAttributes + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DisplayAttributes"), id(DISPID_SPIGetDisplayAttributes)] + HRESULT GetDisplayAttributes( [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [in, defaultvalue(-1)] VARIANT_BOOL UseReplacements, + [out,retval]SpeechDisplayAttributes* DisplayAttributes ); + +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseElement +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseElement +{ + DISPID_SPEAudioTimeOffset = 1, + DISPID_SPEAudioSizeTime, + DISPID_SPEAudioStreamOffset, + DISPID_SPEAudioSizeBytes, + DISPID_SPERetainedStreamOffset, + DISPID_SPERetainedSizeBytes, + DISPID_SPEDisplayText, + DISPID_SPELexicalForm, + DISPID_SPEPronunciation, + DISPID_SPEDisplayAttributes, + DISPID_SPERequiredConfidence, + DISPID_SPEActualConfidence, + DISPID_SPEEngineConfidence +} DISPID_SpeechPhraseElement; + +///////////////////////////////////////////////// +// +// SpeechEngineConfidence Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechEngineConfidence +{ + SECLowConfidence = -1, + SECNormalConfidence = 0, + SECHighConfidence = 1 +} SpeechEngineConfidence; + +[ + object, + uuid(E6176F96-E373-4801-B223-3B62C068C0B4), + dual, + helpstring("ISpeechPhraseElement Interface"), + pointer_default(unique) +] +interface ISpeechPhraseElement : IDispatch +{ + // Properties + + // AudioTimeOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioTimeOffset"), id(DISPID_SPEAudioTimeOffset)] + HRESULT AudioTimeOffset( [out, retval]long* AudioTimeOffset ); + + // AudioSizeTime + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioSizeTime"), id(DISPID_SPEAudioSizeTime)] + HRESULT AudioSizeTime( [out, retval]long* AudioSizeTime ); + + // AudioStreamOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioStreamOffset"), id(DISPID_SPEAudioStreamOffset)] + HRESULT AudioStreamOffset( [out, retval]long* AudioStreamOffset ); + + // AudioSizeBytes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioSizeBytes"), id(DISPID_SPEAudioSizeBytes)] + HRESULT AudioSizeBytes( [out, retval]long* AudioSizeBytes ); + + // RetainedStreamOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RetainedStreamOffset"), id(DISPID_SPERetainedStreamOffset)] + HRESULT RetainedStreamOffset( [out, retval]long* RetainedStreamOffset ); + + // RetainedSizeBytes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RetainedSizeBytes"), id(DISPID_SPERetainedSizeBytes)] + HRESULT RetainedSizeBytes( [out, retval]long* RetainedSizeBytes ); + + // DisplayText + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("DisplayText"), id(DISPID_SPEDisplayText)] + HRESULT DisplayText( [out, retval]BSTR* DisplayText ); + + // LexicalForm + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("LexicalForm"), id(DISPID_SPELexicalForm)] + HRESULT LexicalForm( [out, retval]BSTR* LexicalForm ); + + // Pronunciation + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Pronunciation"), id(DISPID_SPEPronunciation)] + HRESULT Pronunciation( [out, retval]VARIANT* Pronunciation ); + + // DisplayAttributes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("DisplayAttributes"), id(DISPID_SPEDisplayAttributes)] + HRESULT DisplayAttributes( [out, retval]SpeechDisplayAttributes* DisplayAttributes ); + + // RequiredConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RequiredConfidence"), id(DISPID_SPERequiredConfidence)] + HRESULT RequiredConfidence( [out, retval]SpeechEngineConfidence* RequiredConfidence ); + + // ActualConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("ActualConfidence"), id(DISPID_SPEActualConfidence)] + HRESULT ActualConfidence( [out, retval]SpeechEngineConfidence* ActualConfidence ); + + // EngineConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EngineConfidence"), id(DISPID_SPEEngineConfidence)] + HRESULT EngineConfidence( [out, retval]float* EngineConfidence ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseElements +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseElements +{ + DISPID_SPEsCount = 1, + DISPID_SPEsItem = DISPID_VALUE, + DISPID_SPEs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseElements; + +[ + object, + uuid(0626B328-3478-467d-A0B3-D0853B93DDA3), + dual, + helpstring("ISpeechPhraseElements Interface"), + pointer_default(unique) +] +interface ISpeechPhraseElements : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPEsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPEsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseElement** Element ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the tokens"), restricted, id(DISPID_SPEs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseReplacement +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseReplacement +{ + DISPID_SPRDisplayAttributes = 1, + DISPID_SPRText, + DISPID_SPRFirstElement, + DISPID_SPRNumberOfElements +} DISPID_SpeechPhraseReplacement; + +[ + object, + uuid(2890A410-53A7-4fb5-94EC-06D4998E3D02), + dual, + helpstring("ISpeechPhraseReplacement Interface"), + pointer_default(unique) +] +interface ISpeechPhraseReplacement : IDispatch +{ + // Proerties + + // DisplayAttributes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("DisplayAttributes"), id(DISPID_SPRDisplayAttributes)] + HRESULT DisplayAttributes( [out,retval]SpeechDisplayAttributes* DisplayAttributes ); + + // Text + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Text"), id(DISPID_SPRText)] + HRESULT Text( [out, retval]BSTR* Text ); + + // FirstElement + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("FirstElement"), id(DISPID_SPRFirstElement)] + HRESULT FirstElement( [out, retval]long* FirstElement ); + + // NumberOfElements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumElements"), id(DISPID_SPRNumberOfElements)] + HRESULT NumberOfElements( [out, retval]long* NumberOfElements ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseReplacements +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseReplacements +{ + DISPID_SPRsCount = 1, + DISPID_SPRsItem = DISPID_VALUE, + DISPID_SPRs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseReplacements; + +[ + object, + uuid(38BC662F-2257-4525-959E-2069D2596C05), + dual, + helpstring("ISpeechPhraseReplacements Interface"), + pointer_default(unique) +] +interface ISpeechPhraseReplacements : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPRsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPRsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseReplacement** Reps ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the tokens"), restricted, id(DISPID_SPRs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseProperty +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseProperty +{ + DISPID_SPPName = 1, + DISPID_SPPId, + DISPID_SPPValue, + DISPID_SPPFirstElement, + DISPID_SPPNumberOfElements, + DISPID_SPPEngineConfidence, + DISPID_SPPConfidence, + DISPID_SPPParent, + DISPID_SPPChildren +} DISPID_SpeechPhraseProperty; + +[ + object, + uuid(CE563D48-961E-4732-A2E1-378A42B430BE), + dual, + helpstring("ISpeechPhraseProperty Interface"), + pointer_default(unique) +] +interface ISpeechPhraseProperty : IDispatch +{ + // Properties + + // Name + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Name"), id(DISPID_SPPName)] + HRESULT Name( [out, retval]BSTR* Name ); + + // Id + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Id"), id(DISPID_SPPId)] + HRESULT Id( [out, retval]long* Id ); + + // Value + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Value"), id(DISPID_SPPValue)] + HRESULT Value( [out, retval]VARIANT* Value ); + + // FirstElement + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("FirstElement"), id(DISPID_SPPFirstElement)] + HRESULT FirstElement( [out, retval]long* FirstElement ); + + // NumberOfElements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumberOfElements"), id(DISPID_SPPNumberOfElements)] + HRESULT NumberOfElements( [out, retval]long* NumberOfElements ); + + // EngineConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EngineConfidence"), id(DISPID_SPPEngineConfidence)] + HRESULT EngineConfidence( [out, retval]float* Confidence ); + + // Confidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Confidence"), id(DISPID_SPPConfidence)] + HRESULT Confidence( [out, retval]SpeechEngineConfidence* Confidence ); + + // Parent + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Parent"), id(DISPID_SPPParent)] + HRESULT Parent( [out, retval]ISpeechPhraseProperty** ParentProperty ); + + // Children + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Children"), id(DISPID_SPPChildren)] + HRESULT Children( [out, retval]ISpeechPhraseProperties** Children ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseProperties +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseProperties +{ + DISPID_SPPsCount = 1, + DISPID_SPPsItem = DISPID_VALUE, + DISPID_SPPs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseProperties; + +[ + object, + uuid(08166B47-102E-4b23-A599-BDB98DBFD1F4), + dual, + helpstring("ISpeechPhraseProperties Interface"), + pointer_default(unique) +] +interface ISpeechPhraseProperties : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPPsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPPsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseProperty** Property ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the alternates"), restricted, id(DISPID_SPPs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseRule +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseRule +{ + DISPID_SPRuleName = 1, + DISPID_SPRuleId, + DISPID_SPRuleFirstElement, + DISPID_SPRuleNumberOfElements, + DISPID_SPRuleParent, + DISPID_SPRuleChildren, + DISPID_SPRuleConfidence, + DISPID_SPRuleEngineConfidence +} DISPID_SpeechPhraseRule; + +[ + object, + uuid(A7BFE112-A4A0-48d9-B602-C313843F6964), + dual, + helpstring("ISpeechPhraseRule Interface"), + pointer_default(unique) +] +interface ISpeechPhraseRule : IDispatch +{ + // Properties + + // Name + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Name"), id(DISPID_SPRuleName)] + HRESULT Name( [out, retval]BSTR* Name ); + + // Id + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Id"), id(DISPID_SPRuleId)] + HRESULT Id( [out, retval]long* Id ); + + // FirstElement + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("FirstElement"), id(DISPID_SPRuleFirstElement)] + HRESULT FirstElement( [out, retval]long* FirstElement ); + + // NumElements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumElements"), id(DISPID_SPRuleNumberOfElements)] + HRESULT NumberOfElements( [out, retval]long* NumberOfElements ); + + // Parent + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Parent"), id(DISPID_SPRuleParent)] + HRESULT Parent( [out, retval]ISpeechPhraseRule** Parent ); + + // Children + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Children"), id(DISPID_SPRuleChildren)] + HRESULT Children( [out, retval]ISpeechPhraseRules** Children ); + + // Confidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Confidence"), id(DISPID_SPRuleConfidence)] + HRESULT Confidence( [out, retval]SpeechEngineConfidence* ActualConfidence ); + + // EngineConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EngineConfidence"), id(DISPID_SPRuleEngineConfidence)] + HRESULT EngineConfidence( [out, retval]float* EngineConfidence ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseRules +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseRules +{ + DISPID_SPRulesCount = 1, + DISPID_SPRulesItem = DISPID_VALUE, + DISPID_SPRules_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseRules; + +[ + object, + uuid(9047D593-01DD-4b72-81A3-E4A0CA69F407), + dual, + helpstring("ISpeechPhraseRules Interface"), + pointer_default(unique) +] +interface ISpeechPhraseRules : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPRulesCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPRulesItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseRule** Rule ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the Rules"), restricted, id(DISPID_SPRules_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexicon +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechLexicon +{ + DISPID_SLGenerationId = 1, + DISPID_SLGetWords, + DISPID_SLAddPronunciation, + DISPID_SLAddPronunciationByPhoneIds, + DISPID_SLRemovePronunciation, + DISPID_SLRemovePronunciationByPhoneIds, + DISPID_SLGetPronunciations, + DISPID_SLGetGenerationChange +} DISPID_SpeechLexicon; + +///////////////////////////////////////////////// +// +// SpeechLexiconType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechLexiconType { + SLTUser = eLEXTYPE_USER, + SLTApp = eLEXTYPE_APP +} SpeechLexiconType; + +///////////////////////////////////////////////// +// +// SpeechPartOfSpeech Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechPartOfSpeech { +// ?? NotOverriden - what does this do + SPSNotOverriden = SPPS_NotOverriden, + SPSUnknown = SPPS_Unknown, + SPSNoun = SPPS_Noun, + SPSVerb = SPPS_Verb, + SPSModifier = SPPS_Modifier, + SPSFunction = SPPS_Function, + SPSInterjection = SPPS_Interjection +} SpeechPartOfSpeech; + +[ + object, + uuid(3DA7627A-C7AE-4b23-8708-638C50362C25), + dual, + helpstring("ISpeechLexicon Interface"), + pointer_default(unique) +] +interface ISpeechLexicon : IDispatch +{ + // Properties + + // GenerationId + // SAPI C++ Only Interface Equivalent: + // + // + [propget, helpstring("GenerationId"), id(DISPID_SLGenerationId), hidden] + HRESULT GenerationId([out,retval]long* GenerationId ); + + // Methods + + // GetWords + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetWords"), id(DISPID_SLGetWords)] + HRESULT GetWords([in, defaultvalue(eLEXTYPE_USER | eLEXTYPE_APP)]SpeechLexiconType Flags, + [out, defaultvalue(NULL)]long* GenerationID, + [out,retval]ISpeechLexiconWords** Words ); + + + // AddPronunciation + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddPronunciation"), id(DISPID_SLAddPronunciation)] + HRESULT AddPronunciation([in]BSTR bstrWord, + [in]SpeechLanguageId LangId, + [in, defaultvalue(SPSUnknown)]SpeechPartOfSpeech PartOfSpeech, + [in, defaultvalue("")]BSTR bstrPronunciation); + + + // AddPronunciationByPhoneIds + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddPronunciationByPhoneIds"), hidden, id(DISPID_SLAddPronunciationByPhoneIds)] + HRESULT AddPronunciationByPhoneIds([in]BSTR bstrWord, + [in]SpeechLanguageId LangId, + [in, defaultvalue(SPSUnknown)]SpeechPartOfSpeech PartOfSpeech, + [in, defaultvalue(NULL)]VARIANT* PhoneIds); + + + // RemovePronunciation + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RemovePronunciation"), id(DISPID_SLRemovePronunciation)] + HRESULT RemovePronunciation([in]BSTR bstrWord, + [in]SpeechLanguageId LangId, + [in, defaultvalue(SPSUnknown)]SpeechPartOfSpeech PartOfSpeech, + [in, defaultvalue("")]BSTR bstrPronunciation); + + // RemovePronunciationByPhoneIds + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RemovePronunciationByPhoneIds"), hidden, id(DISPID_SLRemovePronunciationByPhoneIds)] + HRESULT RemovePronunciationByPhoneIds([in]BSTR bstrWord, + [in]SpeechLanguageId LangId, + [in, defaultvalue(SPSUnknown)]SpeechPartOfSpeech PartOfSpeech, + [in, defaultvalue(NULL)]VARIANT* PhoneIds); + + // GetPronunciations + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetPronunciations"), id(DISPID_SLGetPronunciations)] + HRESULT GetPronunciations([in]BSTR bstrWord, + [in, defaultvalue(0)]SpeechLanguageId LangId, + [in, defaultvalue(eLEXTYPE_USER | eLEXTYPE_APP)]SpeechLexiconType TypeFlags, + [out,retval]ISpeechLexiconPronunciations** ppPronunciations ); + + // GetGenerationChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetGenerationChange"), id(DISPID_SLGetGenerationChange), hidden] + HRESULT GetGenerationChange([in,out]long* GenerationID, + [out,retval]ISpeechLexiconWords** ppWords); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexiconWords +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechLexiconWords +{ + DISPID_SLWsCount = 1, + DISPID_SLWsItem = DISPID_VALUE, + DISPID_SLWs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechLexiconWords; + +[ + object, + uuid(8D199862-415E-47d5-AC4F-FAA608B424E6), + dual, + helpstring("ISpeechLexiconWords Interface"), + pointer_default(unique) +] +interface ISpeechLexiconWords : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: N/A + // + [id(DISPID_SLWsCount), propget, helpstring("Count")] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_VALUE), helpstring("Item")] + HRESULT Item([in] long Index, [out, retval]ISpeechLexiconWord** Word ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_NEWENUM), propget, helpstring("Enumerates the tokens"), restricted] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexiconWord +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////// +// +// SpeechWordType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechWordType +{ + SWTAdded = eWORDTYPE_ADDED, + SWTDeleted = eWORDTYPE_DELETED +} SpeechWordType; + + +typedef [hidden] enum DISPID_SpeechLexiconWord +{ + DISPID_SLWLangId = 1, + DISPID_SLWType, + DISPID_SLWWord, + DISPID_SLWPronunciations +} DISPID_SpeechLexiconWord; + +[ + object, + uuid(4E5B933C-C9BE-48ed-8842-1EE51BB1D4FF), + dual, + helpstring("ISpeechLexiconWord Interface"), + pointer_default(unique) +] +interface ISpeechLexiconWord : IDispatch +{ + // Properties + + // LangID + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLWLangId), propget] + HRESULT LangId([out,retval]SpeechLanguageId* LangId); + + // Type + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLWType), propget] + HRESULT Type([out,retval]SpeechWordType* WordType); + + // Word + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLWWord), propget] + HRESULT Word([out,retval]BSTR* Word); + + // Pronounciations + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLWPronunciations), propget] + HRESULT Pronunciations([out,retval]ISpeechLexiconPronunciations** Pronunciations); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexiconPronunciations +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechLexiconProns +{ + DISPID_SLPsCount = 1, + DISPID_SLPsItem = DISPID_VALUE, + DISPID_SLPs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechLexiconProns; + +[ + object, + uuid(72829128-5682-4704-A0D4-3E2BB6F2EAD3), + dual, + helpstring("ISpeechLexiconPronunciations Interface"), + pointer_default(unique) +] +interface ISpeechLexiconPronunciations : IDispatch +{ + // Count + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLPsCount), propget, helpstring("Count")] + HRESULT Count([out, retval] long* Count); + + // Item + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_VALUE), helpstring("Item")] + HRESULT Item([in] long Index, [out, retval]ISpeechLexiconPronunciation** Pronunciation ); + + // _NewEnum + // + // + [id(DISPID_NEWENUM), propget, helpstring("Enumerates the tokens"), restricted] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexiconPronunciation +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechLexiconPronunciation +{ + DISPID_SLPType = 1, + DISPID_SLPLangId, + DISPID_SLPPartOfSpeech, + DISPID_SLPPhoneIds, + DISPID_SLPSymbolic, +} DISPID_SpeechLexiconPronunciation; + +[ + object, + uuid(95252C5D-9E43-4f4a-9899-48EE73352F9F), + dual, + helpstring("ISpeechLexiconPronunciation Interface"), + pointer_default(unique) +] +interface ISpeechLexiconPronunciation : IDispatch +{ + // Type + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLPType), propget, helpstring("Type")] + HRESULT Type([out, retval]SpeechLexiconType* LexiconType); + + // LangID + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLPLangId), propget, helpstring("LangId")] + HRESULT LangId([out, retval]SpeechLanguageId* LangId); + + // PartOfSpeech + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLPPartOfSpeech), propget, helpstring("PartOfSpeech")] + HRESULT PartOfSpeech([out, retval]SpeechPartOfSpeech* PartOfSpeech); + + // PhoneIds + // SAPI C++ Only Interface Equivalent: + // Zero terminated string of phoneids + // + [id(DISPID_SLPPhoneIds), propget, helpstring("PhoneIds")] + HRESULT PhoneIds([out, retval]VARIANT* PhoneIds); + + // Symbolic + // SAPI C++ Only Interface Equivalent: + // Zero terminated string of phones + // + [id(DISPID_SLPSymbolic), propget, helpstring("Symbolic")] + HRESULT Symbolic([out, retval]BSTR* Symbolic); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhoneConverter +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhoneConverter +{ + DISPID_SPCLangId = 1, + DISPID_SPCPhoneToId, + DISPID_SPCIdToPhone +} DISPID_SpeechPhoneConverter; + +[ + object, + uuid(C3E4F353-433F-43d6-89A1-6A62A7054C3D), + dual, + helpstring("ISpeechPhoneConverter Interface"), + pointer_default(unique) +] +interface ISpeechPhoneConverter : IDispatch +{ + // Methods + + // LanguageId + // SAPI C++ Only Interface Equivalent: + // This can only be set once, if tried it fails + // + [propget, helpstring("LanguageId"), id(DISPID_SPCLangId)] + HRESULT LanguageId([out,retval]SpeechLanguageId* LanguageId); + [propput, helpstring("LanguageId"), id(DISPID_SPCLangId)] + HRESULT LanguageId([in]SpeechLanguageId LanguageId); + + // PhoneToId + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_SPCPhoneToId), helpstring("PhoneToId")] + HRESULT PhoneToId([in]const BSTR Phonemes, + [out,retval]VARIANT* IdArray); + + // IdToPhone + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_SPCIdToPhone), helpstring("IdToPhone")] + HRESULT IdToPhone([in]const VARIANT IdArray, + [out,retval]BSTR* Phonemes); +} diff --git a/mp/src/utils/sapi51/IDL/sapiddk.idl b/mp/src/utils/sapi51/IDL/sapiddk.idl new file mode 100644 index 00000000..280b010e --- /dev/null +++ b/mp/src/utils/sapi51/IDL/sapiddk.idl @@ -0,0 +1,818 @@ +/**************************************************************************** +* sapiddk.idl +* +* This is the interface definition file for the Microsoft Speech API DLL's +* Version 5.0. +* +* It contains definitions for the DDI layer between SAPI.DLL and both +* TTS and SR engines. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +//--- Includes -------------------------------------------------------------- +import "oaidl.idl"; +import "ocidl.idl"; +import "sapi.idl"; + +//--- Locally scoped define for LANGID +#ifndef LANGID +#define LANGID WORD +#endif + + +//--- ITN Processor +interface ISpITNProcessor; + +//--- Grammar compiler and dynamic manipulation +interface ISpErrorLog; +interface ISpGrammarCompiler; +interface ISpGramCompBackend; + +//--- Phrase builder +interface ISpPhraseBuilder; + +//--- Token String Key Names +cpp_quote("#define SPRECOEXTENSION L\"RecoExtension\"") +cpp_quote("#define SPALTERNATESCLSID L\"AlternatesCLSID\"") + +//--- ISpTokenUI ----------------------------------------------------------- +[ + object, + uuid(F8E690F0-39CB-4843-B8D7-C84696E1119D), + helpstring("ISpTokenUI Interface"), + pointer_default(unique), + restricted +] +interface ISpTokenUI : IUnknown +{ + [local] HRESULT IsUISupported( + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [in] IUnknown * punkObject, + [out] BOOL *pfSupported); + [local] HRESULT DisplayUI( + [in] HWND hwndParent, + [in] const WCHAR * pszTitle, + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [in] ISpObjectToken * pToken, + [in] IUnknown * punkObject); +}; + +//--- ISpObjectTokenEnumBuilder --------------------------------------------- +[ + object, + uuid(06B64F9F-7FDA-11d2-B4F2-00C04F797396), + helpstring("ISpObjectTokensEnumBuilder Interface"), + pointer_default(unique), + restricted +] +interface ISpObjectTokenEnumBuilder : IEnumSpObjectTokens +{ + HRESULT SetAttribs(const WCHAR * pszReqAttribs, const WCHAR * pszOptAttribs); + + HRESULT AddTokens(ULONG cTokens, ISpObjectToken ** pToken); + HRESULT AddTokensFromDataKey(ISpDataKey * pDataKey, const WCHAR * pszSubKey, const WCHAR * pszCategoryId); + HRESULT AddTokensFromTokenEnum(IEnumSpObjectTokens * pTokenEnum); + + HRESULT Sort(const WCHAR * pszTokenIdToListFirst); +}; + +//--- Handles for SR grammars and results +cpp_quote("#if 0") +typedef void * SPWORDHANDLE; +typedef void * SPRULEHANDLE; +typedef void * SPGRAMMARHANDLE; +typedef void * SPRECOCONTEXTHANDLE; +typedef void * SPPHRASERULEHANDLE; +typedef void * SPPHRASEPROPERTYHANDLE; +typedef void * SPTRANSITIONID; +cpp_quote("#else") +cpp_quote("DECLARE_HANDLE(SPWORDHANDLE);") +cpp_quote("DECLARE_HANDLE(SPRULEHANDLE);") +cpp_quote("DECLARE_HANDLE(SPGRAMMARHANDLE);") +cpp_quote("DECLARE_HANDLE(SPRECOCONTEXTHANDLE);") +cpp_quote("DECLARE_HANDLE(SPPHRASERULEHANDLE);") +cpp_quote("DECLARE_HANDLE(SPPHRASEPROPERTYHANDLE);") +cpp_quote("DECLARE_HANDLE(SPTRANSITIONID);") +cpp_quote("#endif") + + +//--- ISpErrorLog ----------------------------------------------------------- +// This interface is used to log error information. + +[ + object, + uuid(F4711347-E608-11d2-A086-00C04F8EF9B5), + helpstring("ISpErrorLog Interface"), + pointer_default(unique), + restricted +] +interface ISpErrorLog : IUnknown +{ + HRESULT AddError( + const long lLineNumber, + HRESULT hr, + const WCHAR * pszDescription, + const WCHAR * pszHelpFile, + DWORD dwHelpContext); +}; + +//--- ISpGrammarCompiler ---------------------------------------------------- + +[ + object, + uuid(B1E29D58-A675-11D2-8302-00C04F8EE6C0), + helpstring("ISpGrammarCompiler Interface"), + pointer_default(unique), + restricted +] +interface ISpGrammarCompiler : IUnknown +{ + HRESULT CompileStream( + IStream * pSource, + IStream * pDest, + IStream * pHeader, + IUnknown * pReserved, + ISpErrorLog * pErrorLog, + [in] DWORD dwFlags); +}; + +[ + object, + uuid(3DDCA27C-665C-4786-9F97-8C90C3488B61), + helpstring("ISpGramCompBackend Interface"), + pointer_default(unique), + restricted +] +interface ISpGramCompBackend : ISpGrammarBuilder +{ + HRESULT SetSaveObjects(IStream * pStream, ISpErrorLog * pErrorLog); + + HRESULT InitFromBinaryGrammar(const SPBINARYGRAMMAR * pBinaryData); +}; + + +//--- ISpITNProcessor ---------------------------------------------------------- +[ + object, + uuid(12D7360F-A1C9-11d3-BC90-00C04F72DF9F), + helpstring("ISpITNProcessor Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpITNProcessor : IUnknown +{ + HRESULT LoadITNGrammar(WCHAR *pszCLSID); + HRESULT ITNPhrase(ISpPhraseBuilder *pPhrase); +}; + + +[ + object, + uuid(88A3342A-0BED-4834-922B-88D43173162F), + local, + helpstring("ISpPhraseBuilder Interface"), + pointer_default(unique), + restricted +] +interface ISpPhraseBuilder : ISpPhrase +{ + HRESULT InitFromPhrase(const SPPHRASE * pPhrase); + HRESULT InitFromSerializedPhrase(const SPSERIALIZEDPHRASE * pPhrase); + HRESULT AddElements(ULONG cElements, const SPPHRASEELEMENT *pElement); + HRESULT AddRules(const SPPHRASERULEHANDLE hParent, const SPPHRASERULE * pRule, SPPHRASERULEHANDLE * phNewRule); + HRESULT AddProperties(const SPPHRASEPROPERTYHANDLE hParent, const SPPHRASEPROPERTY * pProperty, SPPHRASEPROPERTYHANDLE * phNewProperty); + HRESULT AddReplacements(ULONG cReplacements, const SPPHRASEREPLACEMENT * pReplacements); +}; + + + +//--- ISpTask --------------------------------------------------------------- + +cpp_quote("#if defined(__cplusplus)") +cpp_quote("interface ISpTask") +cpp_quote("{") +cpp_quote("virtual HRESULT STDMETHODCALLTYPE Execute(") +cpp_quote(" void *pvTaskData,") +cpp_quote(" volatile const BOOL* pfContinueProcessing) = 0;") +cpp_quote("};") +cpp_quote("#else") +typedef void * ISpTask; +cpp_quote("#endif") + +//--- ISpThreadTask --------------------------------------------------------- + +cpp_quote("#if defined(__cplusplus)") +cpp_quote("interface ISpThreadTask") +cpp_quote("{") +cpp_quote("virtual HRESULT STDMETHODCALLTYPE InitThread(") +cpp_quote(" void * pvTaskData,") +cpp_quote(" HWND hwnd) = 0;") +cpp_quote("virtual HRESULT STDMETHODCALLTYPE ThreadProc(") +cpp_quote(" void *pvTaskData,") +cpp_quote(" HANDLE hExitThreadEvent,") +cpp_quote(" HANDLE hNotifyEvent,") +cpp_quote(" HWND hwndWorker,") +cpp_quote(" volatile const BOOL * pfContinueProcessing) = 0;") +cpp_quote("virtual LRESULT STDMETHODCALLTYPE WindowMessage(") +cpp_quote(" void *pvTaskData,") +cpp_quote(" HWND hWnd,") +cpp_quote(" UINT Msg,") +cpp_quote(" WPARAM wParam,") +cpp_quote(" LPARAM lParam) = 0;") +cpp_quote("};") +cpp_quote("#else") +typedef void * ISpThreadTask; +cpp_quote("#endif") + +//--- ISpThreadControl ------------------------------------------------------ +[ + object, + uuid(A6BE4D73-4403-4358-B22D-0346E23B1764), + helpstring("ISpThreadControl Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpThreadControl : ISpNotifySink +{ + HRESULT StartThread(DWORD dwFlags, HWND * phwnd); + HRESULT WaitForThreadDone( + BOOL fForceStop, + HRESULT * phrThreadResult, + ULONG msTimeOut); + HRESULT TerminateThread(void); + HANDLE ThreadHandle(void); + DWORD ThreadId(void); + HANDLE NotifyEvent(void); + HWND WindowHandle(void); + HANDLE ThreadCompleteEvent(void); + HANDLE ExitThreadEvent(void); +}; + +//--- ISpTaskManager -------------------------------------------------------- +// This interface is used to implement a task managment service provider +// to optimize thread usage. + +typedef [restricted] struct SPTMTHREADINFO +{ + long lPoolSize; // Number of threads in pool (-1 default) + long lPriority; // Priority of threads in pool + ULONG ulConcurrencyLimit; // Number of threads allowed to concurrently execute (0 default) + ULONG ulMaxQuickAllocThreads; // Maximum number of dedicated threads retained +} SPTMTHREADINFO; + +[ + local, + uuid(2BAEEF81-2CA3-4331-98F3-26EC5ABEFB03), + helpstring("ISpTaskManager Interface"), + pointer_default(unique), + restricted +] +interface ISpTaskManager : IUnknown +{ + HRESULT SetThreadPoolInfo([in] const SPTMTHREADINFO* pPoolInfo); + HRESULT GetThreadPoolInfo([out] SPTMTHREADINFO* pPoolInfo); + + HRESULT QueueTask( + [in] ISpTask* pTask, + [in] void* pvTaskData, + [in] HANDLE hCompEvent, + [in, out] DWORD* pdwGroupId, + [out] DWORD* pTaskID); + HRESULT CreateReoccurringTask( + [in] ISpTask* pTask, + [in] void* pvTaskData, + [in] HANDLE hCompEvent, + [out] ISpNotifySink** ppTaskCtrl); + HRESULT CreateThreadControl( + [in] ISpThreadTask* pTask, + [in] void* pvTaskData, + [in] long nPriority, + [out] ISpThreadControl** ppTaskCtrl); + + HRESULT TerminateTask([in] DWORD dwTaskId, [in] ULONG ulWaitPeriod); + HRESULT TerminateTaskGroup([in] DWORD dwGroupId, [in] ULONG ulWaitPeriod); +}; + + +//--- ISpTTSEngineSite ------------------------------------------------------ + +typedef enum SPVSKIPTYPE +{ + SPVST_SENTENCE = (1L << 0) // Skip sentences +} SPVSKIPTYPE; + +typedef enum SPVESACTIONS +{ + SPVES_CONTINUE = 0, + SPVES_ABORT = ( 1L << 0 ), + SPVES_SKIP = ( 1L << 1 ), + SPVES_RATE = ( 1L << 2 ), + SPVES_VOLUME = ( 1L << 3 ) +} SPVESACTIONS; + +[ + object, + local, + uuid(9880499B-CCE9-11d2-B503-00C04F797396), + helpstring("ISpTTSEngineSite Interface"), + pointer_default(unique) +] +interface ISpTTSEngineSite : ISpEventSink +{ + DWORD GetActions( void ); + HRESULT Write( [in]const void* pBuff, [in]ULONG cb, [out]ULONG *pcbWritten ); + HRESULT GetRate( [out]long* pRateAdjust ); + HRESULT GetVolume( [out]USHORT* pusVolume ); + HRESULT GetSkipInfo( [out]SPVSKIPTYPE* peType, [out]long* plNumItems ); + HRESULT CompleteSkip( [in]long ulNumSkipped ); +}; + +//--- ISpTTSEngine ---------------------------------------------------------- + +typedef struct SPVTEXTFRAG +{ + struct SPVTEXTFRAG* pNext; // Next text fragment in list, NULL == end of list + SPVSTATE State; // Current XML attribute state + LPCWSTR pTextStart; + ULONG ulTextLen; + ULONG ulTextSrcOffset; // Original source position of the fragment text +} SPVTEXTFRAG; + +[ + object, + local, + uuid(A74D7C8E-4CC5-4f2f-A6EB-804DEE18500E), + helpstring("ISpTTSEngine Interface"), + pointer_default(unique) +] +interface ISpTTSEngine : IUnknown +{ + HRESULT Speak( [in]DWORD dwSpeakFlags, + [in]REFGUID rguidFormatId, [in]const WAVEFORMATEX * pWaveFormatEx, + [in]const SPVTEXTFRAG* pTextFragList, [in]ISpTTSEngineSite* pOutputSite ); + HRESULT GetOutputFormat( [in] const GUID * pTargetFmtId, [in] const WAVEFORMATEX * pTargetWaveFormatEx, + [out] GUID * pOutputFormatId, [out] WAVEFORMATEX ** ppCoMemOutputWaveFormatEx); +}; + + + +//--- SR Engine data structures ---------------------------------------- + + +typedef [restricted] struct SPWORDENTRY +{ + SPWORDHANDLE hWord; + LANGID LangID; + WCHAR * pszDisplayText; + WCHAR * pszLexicalForm; + SPPHONEID * aPhoneId; + void * pvClientContext; +} SPWORDENTRY; + +typedef [restricted] struct SPRULEENTRY +{ + SPRULEHANDLE hRule; + SPSTATEHANDLE hInitialState; + DWORD Attributes; // SPCFGRULEATTRIBUTES + void * pvClientRuleContext; + void * pvClientGrammarContext; +} SPRULEENTRY; + +typedef enum SPTRANSITIONTYPE +{ + SPTRANSEPSILON, + SPTRANSWORD, + SPTRANSRULE, + SPTRANSTEXTBUF, + SPTRANSWILDCARD, + SPTRANSDICTATION +} SPTRANSITIONTYPE; + +typedef [restricted] struct SPTRANSITIONENTRY +{ + SPTRANSITIONID ID; + SPSTATEHANDLE hNextState; + BYTE Type; // SPTRANSITIONTYPE + char RequiredConfidence; + struct + { + DWORD fHasProperty; // Boolean type + }; + float Weight; + union + { + struct + { + SPSTATEHANDLE hRuleInitialState; // Only if Type == SPTRANSRULE + SPRULEHANDLE hRule; + void * pvClientRuleContext; + }; + struct + { + SPWORDHANDLE hWord; // Only if Type == SPTRANSWORD + void * pvClientWordContext; + }; + struct + { + void * pvGrammarCookie; // Only if Type == SPTRANSTEXTBUF or SPTRANSWILDCARD or SPTRANSDICTATION + }; + }; +} SPTRANSITIONENTRY; + +typedef [restricted] struct SPTRANSITIONPROPERTY +{ + const WCHAR * pszName; + ULONG ulId; + const WCHAR * pszValue; + VARIANT vValue; // Will be VT_BOOL, VT_I4, VT_R4, VT_R8, or VT_BYREF (only for dynamic grammars) +} SPTRANSITIONPROPERTY; + +typedef [restricted] struct SPSTATEINFO +{ + ULONG cAllocatedEntries; + SPTRANSITIONENTRY * pTransitions; + ULONG cEpsilons; + ULONG cRules; + ULONG cWords; + ULONG cSpecialTransitions; +} SPSTATEINFO; + +typedef [restricted] struct SPPATHENTRY +{ + SPTRANSITIONID hTransition; + SPPHRASEELEMENT elem; +} SPPATHENTRY; + + + + + +//--- ISpCFGInterpreterSite ------------------------------------------------- +[ + object, + uuid(6A6FFAD8-78B6-473d-B844-98152E4FB16B), + helpstring("ISpCFGInterpreterSite Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpCFGInterpreterSite : IUnknown +{ + HRESULT AddTextReplacement([in] SPPHRASEREPLACEMENT * pReplace); + HRESULT AddProperty([in] const SPPHRASEPROPERTY *pProperty); + HRESULT GetResourceValue( + [in] const WCHAR *pszResourceName, + [out] WCHAR ** ppCoMemResource); +}; + + +//--- ISpCFGInterpreter ----------------------------------------------------- + +[ + object, + uuid(F3D3F926-11FC-11d3-BB97-00C04F8EE6C0), + helpstring("ISpCFGInterpreter Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpCFGInterpreter : IUnknown +{ + HRESULT InitGrammar( + [in] const WCHAR * pszGrammarName, + [in] const void ** pvGrammarData); + HRESULT Interpret( + [in] ISpPhraseBuilder * pPhrase, + [in] const ULONG ulFirstElement, + [in] const ULONG ulCountOfElements, + [in] ISpCFGInterpreterSite * pSite); +}; + + +typedef enum SPCFGNOTIFY +{ + SPCFGN_ADD, + SPCFGN_REMOVE, + SPCFGN_INVALIDATE, + SPCFGN_ACTIVATE, + SPCFGN_DEACTIVATE +} SPCFGNOTIFY; + +//--- ISpSREngineSite ------------------------------------------------------- + +typedef enum SPRESULTTYPE +{ + SPRT_CFG = 0, + SPRT_SLM = 1, + SPRT_PROPRIETARY = 2, + SPRT_FALSE_RECOGNITION = ( 1L << 2 ) // Flag used to indicate a false recognition +} SPRESULTTYPE; + +typedef struct tagSPPHRASEALT +{ + ISpPhraseBuilder * pPhrase; + ULONG ulStartElementInParent; + ULONG cElementsInParent; + ULONG cElementsInAlternate; + void * pvAltExtra; + ULONG cbAltExtra; +} SPPHRASEALT; + +// Result structure passed from engine to SAPI +typedef struct SPRECORESULTINFO +{ + ULONG cbSize; // Total size of this structure + SPRESULTTYPE eResultType; // Type of result object (CFG, SLM, or Proprietary) + BOOL fHypothesis; // If true then this recognition is a hypothesis + BOOL fProprietaryAutoPause;// This field is only used for SPERT_PROPRIETARY grammars. If true, recognition will pause. + ULONGLONG ullStreamPosStart; // Start and end stream positions of recognition + ULONGLONG ullStreamPosEnd; + SPGRAMMARHANDLE hGrammar; // Required for SPERT_SLM and SPERT_PROPRIETARY else NULL + ULONG ulSizeEngineData; // Size of pvEngineData + void * pvEngineData; // Extra engine specific data + ISpPhraseBuilder* pPhrase; // Pointer to phrase object + SPPHRASEALT* aPhraseAlts; // Alternates array + ULONG ulNumAlts; // Number of alternates in the array +} SPRECORESULTINFO; + +typedef enum SPWORDINFOOPT +{ + SPWIO_NONE = 0, + SPWIO_WANT_TEXT = 1 +} SPWORDINFOOPT; + + +typedef enum SPRULEINFOOPT +{ + SPRIO_NONE = 0, +} SPRULEINFOOPT; + +typedef struct SPPARSEINFO +{ + ULONG cbSize; + SPRULEHANDLE hRule; + ULONGLONG ullAudioStreamPosition; + ULONG ulAudioSize; + ULONG cTransitions; + SPPATHENTRY * pPath; + GUID SREngineID; + ULONG ulSREnginePrivateDataSize; + const BYTE * pSREnginePrivateData; + BOOL fHypothesis; +} SPPARSEINFO; + +[ + object, + uuid(3B414AEC-720C-4883-B9EF-178CD394FB3A), + helpstring("ISpSREngineSite Interface"), + pointer_default(unique), + local +] +interface ISpSREngineSite : IUnknown +{ + HRESULT Read([in] void * pv, [in] ULONG cb, [out] ULONG * pcbRead); + HRESULT DataAvailable(ULONG * pcb); + HRESULT SetBufferNotifySize([in] ULONG cbSize); + HRESULT ParseFromTransitions([in] const SPPARSEINFO * pParseInfo, + [out] ISpPhraseBuilder ** ppNewPhrase); + HRESULT Recognition([in] const SPRECORESULTINFO * pResultInfo); + HRESULT AddEvent([in] const SPEVENT* pEvent, [in] SPRECOCONTEXTHANDLE hSAPIRecoContext); + HRESULT Synchronize([in] ULONGLONG ullProcessedThruPos); + HRESULT GetWordInfo([in, out] SPWORDENTRY * pWordEntry, [in] SPWORDINFOOPT Options); // Caller must fill in hWord. if fWantWordText then caller must CoTaskMemFree the pszWord. + HRESULT SetWordClientContext(SPWORDHANDLE hWord, void * pvClientContext); + HRESULT GetRuleInfo([in, out] SPRULEENTRY * pRuleEntry, [in] SPRULEINFOOPT Options); // Caller must fill in hRule.SPRULEHANDLE hRule, BOOL * pfActive, BOOL *pfAutoPause, SPSTATEHANDLE * phInitialState, void ** ppvClientContext); + HRESULT SetRuleClientContext(SPRULEHANDLE hRule, void * pvClientContext); + HRESULT GetStateInfo(SPSTATEHANDLE hState, SPSTATEINFO * pStateInfo); + HRESULT GetResource( [in] SPRULEHANDLE hRule, [in] const WCHAR *pszResourceName, [out] WCHAR ** ppCoMemResource ); + HRESULT GetTransitionProperty([in] SPTRANSITIONID ID, [out] SPTRANSITIONPROPERTY **ppCoMemProperty); + HRESULT IsAlternate( [in]SPRULEHANDLE hRule, [in]SPRULEHANDLE hAltRule ); + HRESULT GetMaxAlternates( [in]SPRULEHANDLE hRule, [out]ULONG* pulNumAlts ); + HRESULT GetContextMaxAlternates( [in] SPRECOCONTEXTHANDLE hContext, [out] ULONG * pulNumAlts); + HRESULT UpdateRecoPos([in] ULONGLONG ullCurrentRecoPos); +}; + +//--- ISpSREngine ----------------------------------------------------------- +typedef enum SPPROPSRC +{ + SPPROPSRC_RECO_INST, + SPPROPSRC_RECO_CTX, + SPPROPSRC_RECO_GRAMMAR +} SPPROPSRC; + +[ + object, + uuid(2F472991-854B-4465-B613-FBAFB3AD8ED8), + helpstring("ISpSREngine Interface"), + pointer_default(unique), + local +] +interface ISpSREngine : IUnknown +{ + HRESULT SetSite([in] ISpSREngineSite *pSite); + + HRESULT GetInputAudioFormat( + [in] const GUID * pguidSourceFormatId, + [in] const WAVEFORMATEX * pSourceWaveFormatEx, + [out] GUID * pguidDesiredFormatId, + [out] WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx); + + HRESULT RecognizeStream([in] REFGUID rguidFmtId, [in] const WAVEFORMATEX * pWaveFormatEx, + [in] HANDLE hRequestSync, [in] HANDLE hDataAvailable, + [in] HANDLE hExit, [in] BOOL fNewAudioStream, [in] BOOL fRealTimeAudio, + [in] ISpObjectToken * pAudioObjectToken); + + HRESULT SetRecoProfile(ISpObjectToken * pProfile); + + HRESULT OnCreateGrammar([in] void * pvEngineRecoContext, + [in] SPGRAMMARHANDLE hSAPIGrammar, + [out] void ** ppvEngineGrammarContext); + + HRESULT OnDeleteGrammar([in] void * pvEngineGrammar); + + HRESULT LoadProprietaryGrammar( + [in] void * pvEngineGrammar, + [in] REFGUID rguidParam, + [in, string] const WCHAR * pszStringParam, + [in] const void * pvDataParam, + [in] ULONG ulDataSize, + [in] SPLOADOPTIONS Options); // Note for SAPI 5.0 this is always SPLO_NONE + + HRESULT UnloadProprietaryGrammar([in] void * pvEngineGrammar); + + HRESULT SetProprietaryRuleState([in] void * pvEngineGrammar, + [in, string] const WCHAR * pszName, + [in] void * pReserved, + [in] SPRULESTATE NewState, + [out] ULONG * pcRulesChanged); + HRESULT SetProprietaryRuleIdState([in] void * pvEngineGrammar, + [in] DWORD dwRuleId, + [in] SPRULESTATE NewState); + HRESULT LoadSLM([in] void * pvEngineGrammar, [in, string] const WCHAR * pszTopicName); + HRESULT UnloadSLM([in] void * pvEngineGrammar); + HRESULT SetSLMState([in] void * pvEngineGrammar, [in] SPRULESTATE NewState); + HRESULT SetWordSequenceData([in] void * pvEngineGrammar, [in] const WCHAR * pText, [in] ULONG cchText, [in] const SPTEXTSELECTIONINFO * pInfo); + HRESULT SetTextSelection([in] void * pvEngineGrammar, [in] const SPTEXTSELECTIONINFO * pInfo); + HRESULT IsPronounceable([in] void * pvEngineGrammar, [in, string] const WCHAR * pszWord, [out] SPWORDPRONOUNCEABLE *pWordPronounceable); + + HRESULT OnCreateRecoContext( + [in] SPRECOCONTEXTHANDLE hSAPIRecoContext, + [out] void ** ppvEngineContext); + HRESULT OnDeleteRecoContext([in] void * pvEngineContext); + + HRESULT PrivateCall([in] void * pvEngineContext, [in, out] PVOID pCallFrame, [in] ULONG ulCallFrameSize); + + HRESULT SetAdaptationData([in] void * pvEngineContext, const WCHAR *pAdaptationData, const ULONG cch); + + HRESULT SetPropertyNum( [in]SPPROPSRC eSrc, [in]void* pvSrcObj, + [in]const WCHAR* pName, [in]LONG lValue ); + HRESULT GetPropertyNum( [in]SPPROPSRC eSrc, [in]void* pvSrcObj, + [in]const WCHAR* pName, [out]LONG* lValue ); + HRESULT SetPropertyString( [in]SPPROPSRC eSrc, [in]void* pvSrcObj, + [in]const WCHAR* pName, [in]const WCHAR* pValue ); + HRESULT GetPropertyString( [in]SPPROPSRC eSrc, [in]void* pvSrcObj, + [in]const WCHAR* pName, [out]WCHAR** ppCoMemValue ); + + HRESULT SetGrammarState([in] void * pvEngineGrammar, [in] SPGRAMMARSTATE eGrammarState); + + HRESULT WordNotify(SPCFGNOTIFY Action, ULONG cWords, const SPWORDENTRY * pWords); + HRESULT RuleNotify(SPCFGNOTIFY Action, ULONG cRules, const SPRULEENTRY * pRules); + + HRESULT PrivateCallEx([in] void * pvEngineContext, [in] const void * pInCallFrame, [in] ULONG ulInCallFrameSize, + [out] void ** ppvCoMemResponse, [out] ULONG * pulResponseSize); + + HRESULT SetContextState([in] void * pvEngineContext, [in] SPCONTEXTSTATE eContextState); +}; + + +//--- ISpSRAlternates + +typedef struct tagSPPHRASEALTREQUEST +{ + ULONG ulStartElement; + ULONG cElements; + ULONG ulRequestAltCount; + + void * pvResultExtra; + ULONG cbResultExtra; + + ISpPhrase * pPhrase; + ISpRecoContext * pRecoContext; +} SPPHRASEALTREQUEST; + +[ + object, + uuid(FECE8294-2BE1-408f-8E68-2DE377092F0E), + helpstring("ISpSRAlternates Interface"), + pointer_default(unique), + local +] +interface ISpSRAlternates : IUnknown +{ + HRESULT GetAlternates([in] SPPHRASEALTREQUEST * pAltRequest, + [out] SPPHRASEALT **ppAlts, + [out] ULONG *pcAlts); + HRESULT Commit([in] SPPHRASEALTREQUEST * pAltRequest, + [in] SPPHRASEALT * pAlt, + [out] void **ppvResultExtra, + [out] ULONG *pcbResultExtra); +} + +// Interface used by engine specific recoctxt extension object to call into engine +[ + object, + uuid(8E7C791E-4467-11d3-9723-00C04F72DB08), + helpstring("_ISpPrivateEngineCall Interface"), + pointer_default(unique), + local +] +interface _ISpPrivateEngineCall : IUnknown +{ + HRESULT CallEngine([in, out] void * pCallFrame, [in] ULONG ulCallFrameSize); + HRESULT CallEngineEx([in] const void * pInFrame, [in] ULONG ulInFrameSize, + [out] void ** ppCoMemOutFrame, [out] ULONG * pulOutFrameSize); +} + +// +//--- CoClass definitions --------------------------------------------------- +// + +[ + helpstring("Microsoft Speech Object DDK Library"), + uuid(9903F14C-12CE-4c99-9986-2EE3D7D588A8), + version(5.0) +] +library SpeechDDKLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + //--- SpDataKey --------------------------------------------------------- + [ + uuid(D9F6EE60-58C9-458b-88E1-2F908FD7F87C), + helpstring("Data Key") + ] + coclass SpDataKey + { + interface ISpRegDataKey; + [default] interface ISpDataKey; + } + + //--- SpObjectTokenEnum -------------------------------------------------- + [ + uuid(3918D75F-0ACB-41f2-B733-92AA15BCECF6), + helpstring("Object Token Enumerator") + ] + coclass SpObjectTokenEnum + { + interface ISpObjectTokenEnumBuilder; + [default] interface IEnumSpObjectTokens; + } + + //--- SpPhraseBuilder --------------------------------------------------- + [ + uuid(777B6BBD-2FF2-11d3-88FE-00C04F8EF9B5), + helpstring("Phrase Builder Class") + ] + coclass SpPhraseBuilder + { + [default] interface ISpPhraseBuilder; + } + //--- SpITNProcessor ---------------------------------------------------- + [ + uuid(12D73610-A1C9-11d3-BC90-00C04F72DF9F), + helpstring("SpITNProcessor Class"), + restricted + ] + coclass SpITNProcessor + { + [default] interface ISpITNProcessor; + }; + //--- SpGrammarCompiler --------------------------------------------- + [ + uuid(B1E29D59-A675-11D2-8302-00C04F8EE6C0), + helpstring("Microsoft Speech Grammar Compiler") + ] + coclass SpGrammarCompiler + { + [default] interface ISpGrammarCompiler; + }; + + //--- SpGramCompBackend --------------------------------------------- + [ + uuid(DA93E903-C843-11D2-A084-00C04F8EF9B5), + helpstring("Grammar Class"), + restricted + ] + coclass SpGramCompBackend + { + [default] interface ISpGramCompBackend; + }; + +} diff --git a/mp/src/utils/sapi51/Include/Spddkhlp.h b/mp/src/utils/sapi51/Include/Spddkhlp.h new file mode 100644 index 00000000..bc4134a7 --- /dev/null +++ b/mp/src/utils/sapi51/Include/Spddkhlp.h @@ -0,0 +1,854 @@ +/******************************************************************************* +* SPDDKHLP.h * +*------------* +* Description: +* This is the header file for core helper functions implementation. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +*******************************************************************************/ +#ifndef SPDDKHLP_h +#define SPDDKHLP_h + +#ifndef SPHelper_h +#include +#endif + +#include + +#ifndef SPError_h +#include +#endif + +#ifndef SPDebug_h +#include +#endif + +#ifndef _INC_LIMITS +#include +#endif + +#ifndef _INC_CRTDBG +#include +#endif + +#ifndef _INC_MALLOC +#include +#endif + +#ifndef _INC_MMSYSTEM +#include +#endif + +#ifndef __comcat_h__ +#include +#endif + +//=== Constants ============================================================== +#define sp_countof(x) ((sizeof(x) / sizeof(*(x)))) + +#define SP_IS_BAD_WRITE_PTR(p) ( SPIsBadWritePtr( p, sizeof(*(p)) )) +#define SP_IS_BAD_READ_PTR(p) ( SPIsBadReadPtr( p, sizeof(*(p)) )) +#define SP_IS_BAD_CODE_PTR(p) ( ::IsBadCodePtr((FARPROC)(p) ) +#define SP_IS_BAD_INTERFACE_PTR(p) ( SPIsBadInterfacePtr( (p) ) ) +#define SP_IS_BAD_VARIANT_PTR(p) ( SPIsBadVARIANTPtr( (p) ) ) +#define SP_IS_BAD_STRING_PTR(p) ( SPIsBadStringPtr( (p) ) ) + +#define SP_IS_BAD_OPTIONAL_WRITE_PTR(p) ((p) && SPIsBadWritePtr( p, sizeof(*(p)) )) +#define SP_IS_BAD_OPTIONAL_READ_PTR(p) ((p) && SPIsBadReadPtr( p, sizeof(*(p)) )) +#define SP_IS_BAD_OPTIONAL_INTERFACE_PTR(p) ((p) && SPIsBadInterfacePtr(p)) +#define SP_IS_BAD_OPTIONAL_STRING_PTR(p) ((p) && SPIsBadStringPtr(p)) + +//=== Class, Enum, Struct, Template, and Union Declarations ================== + +//=== Inlines ================================================================ + +/*** Pointer validation functions +*/ + +// TODO: Add decent debug output for bad parameters + +inline BOOL SPIsBadStringPtr( const WCHAR * psz, ULONG cMaxChars = 0xFFFF ) +{ + BOOL IsBad = false; + __try + { + do + { + if( *psz++ == 0 ) return IsBad; + } + while( --cMaxChars ); + } + __except( GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ) + { + IsBad = true; + } + + return IsBad; +} + +inline BOOL SPIsBadReadPtr( const void* pMem, UINT Size ) +{ +#ifdef _DEBUG + BOOL bIsBad = ::IsBadReadPtr( pMem, Size ); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ::IsBadReadPtr( pMem, Size ); +#endif +} + +inline BOOL SPIsBadWritePtr( void* pMem, UINT Size ) +{ +#ifdef _DEBUG + BOOL bIsBad = ::IsBadWritePtr( pMem, Size ); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ::IsBadWritePtr( pMem, Size ); +#endif +} + +inline BOOL SPIsBadInterfacePtr( const IUnknown* pUnknown ) +{ +#ifdef _DEBUG + BOOL bIsBad = ( ::IsBadReadPtr( pUnknown, sizeof( *pUnknown ) ) || + ::IsBadCodePtr( (FARPROC)((void**)pUnknown)[0] ))? + (true):(false); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ( ::IsBadReadPtr( pUnknown, sizeof( *pUnknown ) ) || + ::IsBadCodePtr( (FARPROC)((void**)pUnknown)[0] ))? + (true):(false); +#endif +} + +inline BOOL SPIsBadVARIANTPtr( const VARIANT* pVar ) +{ +#ifdef _DEBUG + BOOL bIsBad = ::IsBadReadPtr( pVar, sizeof( *pVar ) ); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ::IsBadReadPtr( pVar, sizeof( *pVar ) ); +#endif +} + +#ifdef __ATLCOM_H__ //--- Only enable these if ATL is being used + +// +// Helper functions can be used to implement GetObjectToken/SetObjectToken for objects that +// support ISpObjectWithToken +// +inline HRESULT SpGenericSetObjectToken(ISpObjectToken * pCallersToken, CComPtr & cpObjToken) +{ + HRESULT hr = S_OK; + if (SP_IS_BAD_INTERFACE_PTR(pCallersToken)) + { + hr = E_INVALIDARG; + } + else + { + if (cpObjToken) + { + hr = SPERR_ALREADY_INITIALIZED; + } + else + { + cpObjToken = pCallersToken; + } + } + return hr; +} + + +inline HRESULT SpGenericGetObjectToken(ISpObjectToken ** ppCallersToken, CComPtr & cpObjToken) +{ + HRESULT hr = S_OK; + if (SP_IS_BAD_WRITE_PTR(ppCallersToken)) + { + hr = E_POINTER; + } + else + { + *ppCallersToken = cpObjToken; + if (*ppCallersToken) + { + (*ppCallersToken)->AddRef(); + } + else + { + hr = S_FALSE; + } + } + return hr; +} + +#endif // __ATLCOM_H__ + + +// +// Helper class for SPSTATEINFO sturcture automatically initializes and cleans up +// the structure + provides a few helper functions. +// +class CSpStateInfo : public SPSTATEINFO +{ +public: + CSpStateInfo() + { + cAllocatedEntries = NULL; + pTransitions = NULL; + } + ~CSpStateInfo() + { + ::CoTaskMemFree(pTransitions); + } + SPTRANSITIONENTRY * FirstEpsilon() + { + return pTransitions; + } + SPTRANSITIONENTRY * FirstRule() + { + return pTransitions + cEpsilons; + } + SPTRANSITIONENTRY * FirstWord() + { + return pTransitions + cEpsilons + cRules; + } + SPTRANSITIONENTRY * FirstSpecialTransition() + { + return pTransitions + cEpsilons + cRules + cWords; + } +}; + + +// +// This basic queue implementation can be used to maintin linked lists of classes. The class T +// must contain the member m_pNext which is used by this template to point to the next element. +// If the bPurgeWhenDeleted is TRUE then all of the elements in the queue will be deleted +// when the queue is deleted, otherwise they will not. +// If bMaintainCount is TRUE then a running count will be maintained, and GetCount() will be +// efficent. If it is FALSE then a running count will not be maintained, and GetCount() will +// be an order N operation. If you do not require a count, then +// + +template class CSpBasicList; + +template +class CSpBasicQueue +{ +public: + T * m_pHead; + T * m_pTail; + ULONG m_cElements; // Warning! Use GetCount() -- Not maintained if bMaintainCount is FALSE. + + CSpBasicQueue() + { + m_pHead = NULL; + if (bMaintainCount) + { + m_cElements = 0; + } + } + + ~CSpBasicQueue() + { + if (bPurgeWhenDeleted) + { + Purge(); + } + } + + HRESULT CreateNode(T ** ppNode) + { + *ppNode = new T; + if (*ppNode) + { + return S_OK; + } + else + { + return E_OUTOFMEMORY; + } + } + + T * GetNext(const T * pNode) + { + return pNode->m_pNext; + } + + + T * Item(ULONG i) + { + T * pNode = m_pHead; + while (pNode && i) + { + i--; + pNode = pNode->m_pNext; + } + return pNode; + } + + void InsertAfter(T * pPrev, T * pNewNode) + { + if (pPrev) + { + pNewNode->m_pNext = pPrev->m_pNext; + pPrev->m_pNext = pNewNode; + if (pNewNode->m_pNext == NULL) + { + m_pTail = pNewNode; + } + if (bMaintainCount) ++m_cElements; + } + else + { + InsertHead(pNewNode); + } + } + + void InsertTail(T * pNode) + { + pNode->m_pNext = NULL; + if (m_pHead) + { + m_pTail->m_pNext = pNode; + } + else + { + m_pHead = pNode; + } + m_pTail = pNode; + if (bMaintainCount) ++m_cElements; + } + + void InsertHead(T * pNode) + { + pNode->m_pNext = m_pHead; + if (m_pHead == NULL) + { + m_pTail = pNode; + } + m_pHead = pNode; + if (bMaintainCount) ++m_cElements; + } + + T * RemoveHead() + { + T * pNode = m_pHead; + if (pNode) + { + m_pHead = pNode->m_pNext; + if (bMaintainCount) --m_cElements; + } + return pNode; + } + + T * RemoveTail() + { + T * pNode = m_pHead; + if (pNode) + { + if (pNode == m_pTail) + { + m_pHead = NULL; + } + else + { + T * pPrev; + do + { + pPrev = pNode; + pNode = pNode->m_pNext; + } while ( pNode != m_pTail ); + pPrev->m_pNext = NULL; + m_pTail = pPrev; + } + if (bMaintainCount) --m_cElements; + } + return pNode; + } + + void Purge() + { + while (m_pHead) + { + T * pDie = m_pHead; + m_pHead = pDie->m_pNext; + delete pDie; + } + if (bMaintainCount) m_cElements = 0; + } + + void ExplicitPurge() + { + T * pDie; + BYTE * pb; + + while (m_pHead) + { + pDie = m_pHead; + m_pHead = pDie->m_pNext; + + pDie->~T(); + + pb = reinterpret_cast(pDie); + delete [] pb; + } + if (bMaintainCount) m_cElements = 0; + } + + + T * GetTail() const + { + if (m_pHead) + { + return m_pTail; + } + return NULL; + } + + T * GetHead() const + { + return m_pHead; + } + + BOOL IsEmpty() const + { + return m_pHead == NULL; + } + + BOOL Remove(T * pNode) + { + if (m_pHead == pNode) + { + m_pHead = pNode->m_pNext; + if (bMaintainCount) --m_cElements; + return TRUE; + } + else + { + T * pCur = m_pHead; + while (pCur) + { + T * pNext = pCur->m_pNext; + if (pNext == pNode) + { + if ((pCur->m_pNext = pNode->m_pNext) == NULL) + { + m_pTail = pCur; + } + if (bMaintainCount) --m_cElements; + return TRUE; + } + pCur = pNext; + } + } + return FALSE; + } + + void MoveAllToHeadOf(CSpBasicQueue & DestQueue) + { + if (m_pHead) + { + m_pTail->m_pNext = DestQueue.m_pHead; + if (DestQueue.m_pHead == NULL) + { + DestQueue.m_pTail = m_pTail; + } + DestQueue.m_pHead = m_pHead; + m_pHead = NULL; + if (bMaintainCount) + { + DestQueue.m_cElements += m_cElements; + m_cElements = 0; + } + } + } + + void MoveAllToList(CSpBasicList & List) + { + if (m_pHead) + { + m_pTail->m_pNext = List.m_pFirst; + List.m_pFirst = m_pHead; + m_pHead = NULL; + } + if (bMaintainCount) + { + m_cElements = 0; + } + } + + BOOL MoveToList(T * pNode, CSpBasicList & List) + { + BOOL bFound = Remove(pNode); + if (bFound) + { + List.AddNode(pNode); + } + return bFound; + } + + ULONG GetCount() const + { + if (bMaintainCount) + { + return m_cElements; + } + else + { + ULONG c = 0; + for (T * pNode = m_pHead; + pNode; + pNode = pNode->m_pNext, c++) {} + return c; + } + } + + // + // The following functions require the class T to implement a static function: + // + // LONG Compare(const T * pElem1, const T * pElem2) + // + // which returns < 0 if pElem1 is less than pElem2, 0 if they are equal, and > 0 if + // pElem1 is greater than pElem2. + // + void InsertSorted(T * pNode) + { + if (m_pHead) + { + if (T::Compare(pNode, m_pTail) >= 0) + { + pNode->m_pNext = NULL; + m_pTail->m_pNext = pNode; + m_pTail = pNode; + } + else + { + // + // We don't have to worry about walking off of the end of the list here since + // we have already checked the tail. + // + T ** ppNext = &m_pHead; + while (T::Compare(pNode, *ppNext) >= 0) + { + ppNext = &((*ppNext)->m_pNext); + } + pNode->m_pNext = *ppNext; + *ppNext = pNode; + } + } + else + { + pNode->m_pNext = NULL; + m_pHead = m_pTail = pNode; + } + if (bMaintainCount) ++m_cElements; + } + + HRESULT InsertSortedUnique(T * pNode) + { + HRESULT hr = S_OK; + if (m_pHead) + { + if (T::Compare(pNode, m_pTail) > 0) + { + pNode->m_pNext = NULL; + m_pTail->m_pNext = pNode; + m_pTail = pNode; + } + else + { + // + // We don't have to worry about walking off of the end of the list here since + // we have already checked the tail. + // + T ** ppNext = &m_pHead; + while (T::Compare(pNode, *ppNext) > 0) + { + ppNext = &((*ppNext)->m_pNext); + } + if (T::Compare(pNode, *ppNext) != 0) + { + pNode->m_pNext = *ppNext; + *ppNext = pNode; + } + else + { + delete pNode; + hr = S_FALSE; + } + } + } + else + { + pNode->m_pNext = NULL; + m_pHead = m_pTail = pNode; + } + if (bMaintainCount) ++m_cElements; + return hr; + } + + // + // These functions must support the "==" operator for the TFIND type. + // + template + T * Find(TFIND & FindVal) const + { + for (T * pNode = m_pHead; pNode && (!(*pNode == FindVal)); pNode = pNode->m_pNext) + {} + return pNode; + } + + template + T * FindNext(const T * pCurNode, TFIND & FindVal) const + { + for (T * pNode = pCurNode->m_pNext; pNode && (!(*pNode == FindVal)); pNode = pNode->m_pNext) + {} + return pNode; + } + + // + // Searches for and removes a single list element + // + template + T * FindAndRemove(TFIND & FindVal) + { + T * pNode = m_pHead; + if (pNode) + { + if (*pNode == FindVal) + { + m_pHead = pNode->m_pNext; + if (bMaintainCount) --m_cElements; + } + else + { + T * pPrev = pNode; + for (pNode = pNode->m_pNext; + pNode; + pPrev = pNode, pNode = pNode->m_pNext) + { + if (*pNode == FindVal) + { + pPrev->m_pNext = pNode->m_pNext; + if (pNode->m_pNext == NULL) + { + m_pTail = pPrev; + } + if (bMaintainCount) --m_cElements; + break; + } + } + } + } + return pNode; + } + + // + // Searches for and deletes all list elements that match + // + template + void FindAndDeleteAll(TFIND & FindVal) + { + T * pNode = m_pHead; + while (pNode && *pNode == FindVal) + { + m_pHead = pNode->m_pNext; + delete pNode; + if (bMaintainCount) --m_cElements; + pNode = m_pHead; + } + T * pPrev = pNode; + while (pNode) + { + T * pNext = pNode->m_pNext; + if (*pNode == FindVal) + { + pPrev->m_pNext = pNext; + delete pNode; + if (bMaintainCount) --m_cElements; + } + else + { + pPrev = pNode; + } + pNode = pNext; + } + m_pTail = pPrev; // Just always set it in case we removed the tail. + } + + +}; + +template +class CSpBasicList +{ +public: + T * m_pFirst; + CSpBasicList() : m_pFirst(NULL) {} + ~CSpBasicList() + { + if (bPurgeWhenDeleted) + { + Purge(); + } + } + + void Purge() + { + while (m_pFirst) + { + T * pNext = m_pFirst->m_pNext; + delete m_pFirst; + m_pFirst = pNext; + } + } + + void ExplicitPurge() + { + T * pDie; + BYTE * pb; + + while (m_pFirst) + { + pDie = m_pFirst; + m_pFirst = pDie->m_pNext; + + pDie->~T(); + + pb = reinterpret_cast(pDie); + delete [] pb; + } + } + + HRESULT RemoveFirstOrAllocateNew(T ** ppNode) + { + if (m_pFirst) + { + *ppNode = m_pFirst; + m_pFirst = m_pFirst->m_pNext; + } + else + { + *ppNode = new T; + if (*ppNode == NULL) + { + return E_OUTOFMEMORY; + } + } + return S_OK; + } + + void AddNode(T * pNode) + { + pNode->m_pNext = m_pFirst; + m_pFirst = pNode; + } + T * GetFirst() + { + return m_pFirst; + } + T * RemoveFirst() + { + T * pNode = m_pFirst; + if (pNode) + { + m_pFirst = pNode->m_pNext; + } + return pNode; + } +}; + +#define STACK_ALLOC(TYPE, COUNT) (TYPE *)_alloca(sizeof(TYPE) * (COUNT)) +#define STACK_ALLOC_AND_ZERO(TYPE, COUNT) (TYPE *)memset(_alloca(sizeof(TYPE) * (COUNT)), 0, (sizeof(TYPE) * (COUNT))) +#define STACK_ALLOC_AND_COPY(TYPE, COUNT, SOURCE) (TYPE *)memcpy(_alloca(sizeof(TYPE) * (COUNT)), (SOURCE), (sizeof(TYPE) * (COUNT))) + +inline HRESULT SpGetSubTokenFromToken( + ISpObjectToken * pToken, + const WCHAR * pszSubKeyName, + ISpObjectToken ** ppToken, + BOOL fCreateIfNotExist = FALSE) +{ + SPDBG_FUNC("SpGetTokenFromDataKey"); + HRESULT hr = S_OK; + + if (SP_IS_BAD_INTERFACE_PTR(pToken) || + SP_IS_BAD_STRING_PTR(pszSubKeyName) || + SP_IS_BAD_WRITE_PTR(ppToken)) + { + hr = E_POINTER; + } + + // First, either create or open the datakey for the new token + CComPtr cpDataKeyForNewToken; + if (SUCCEEDED(hr)) + { + if (fCreateIfNotExist) + { + hr = pToken->CreateKey(pszSubKeyName, &cpDataKeyForNewToken); + } + else + { + hr = pToken->OpenKey(pszSubKeyName, &cpDataKeyForNewToken); + } + } + + // The sub token's category will be the token id of it's parent token + CSpDynamicString dstrCategoryId; + if (SUCCEEDED(hr)) + { + hr = pToken->GetId(&dstrCategoryId); + } + + // The sub token's token id will be it's category id + "\\" the key name + CSpDynamicString dstrTokenId; + if (SUCCEEDED(hr)) + { + dstrTokenId = dstrCategoryId; + dstrTokenId.Append2(L"\\", pszSubKeyName); + } + + // Now create the token and initalize it + CComPtr cpTokenInit; + if (SUCCEEDED(hr)) + { + hr = cpTokenInit.CoCreateInstance(CLSID_SpObjectToken); + } + + if (SUCCEEDED(hr)) + { + hr = cpTokenInit->InitFromDataKey(dstrCategoryId, dstrTokenId, cpDataKeyForNewToken); + } + + if (SUCCEEDED(hr)) + { + *ppToken = cpTokenInit.Detach(); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +template +HRESULT SpCreateObjectFromSubToken(ISpObjectToken * pToken, const WCHAR * pszSubKeyName, T ** ppObject, + IUnknown * pUnkOuter = NULL, DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateObjectFromSubToken"); + HRESULT hr; + + CComPtr cpSubToken; + hr = SpGetSubTokenFromToken(pToken, pszSubKeyName, &cpSubToken); + + if (SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(cpSubToken, ppObject, pUnkOuter, dwClsCtxt); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +#endif /* This must be the last line in the file */ diff --git a/mp/src/utils/sapi51/Include/sapi.h b/mp/src/utils/sapi51/Include/sapi.h new file mode 100644 index 00000000..6412e3da --- /dev/null +++ b/mp/src/utils/sapi51/Include/sapi.h @@ -0,0 +1,25599 @@ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 6.00.0347 */ +/* Compiler settings for sapi.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __sapi_h__ +#define __sapi_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ISpNotifySource_FWD_DEFINED__ +#define __ISpNotifySource_FWD_DEFINED__ +typedef interface ISpNotifySource ISpNotifySource; +#endif /* __ISpNotifySource_FWD_DEFINED__ */ + + +#ifndef __ISpNotifySink_FWD_DEFINED__ +#define __ISpNotifySink_FWD_DEFINED__ +typedef interface ISpNotifySink ISpNotifySink; +#endif /* __ISpNotifySink_FWD_DEFINED__ */ + + +#ifndef __ISpNotifyTranslator_FWD_DEFINED__ +#define __ISpNotifyTranslator_FWD_DEFINED__ +typedef interface ISpNotifyTranslator ISpNotifyTranslator; +#endif /* __ISpNotifyTranslator_FWD_DEFINED__ */ + + +#ifndef __ISpDataKey_FWD_DEFINED__ +#define __ISpDataKey_FWD_DEFINED__ +typedef interface ISpDataKey ISpDataKey; +#endif /* __ISpDataKey_FWD_DEFINED__ */ + + +#ifndef __ISpRegDataKey_FWD_DEFINED__ +#define __ISpRegDataKey_FWD_DEFINED__ +typedef interface ISpRegDataKey ISpRegDataKey; +#endif /* __ISpRegDataKey_FWD_DEFINED__ */ + + +#ifndef __ISpObjectTokenCategory_FWD_DEFINED__ +#define __ISpObjectTokenCategory_FWD_DEFINED__ +typedef interface ISpObjectTokenCategory ISpObjectTokenCategory; +#endif /* __ISpObjectTokenCategory_FWD_DEFINED__ */ + + +#ifndef __ISpObjectToken_FWD_DEFINED__ +#define __ISpObjectToken_FWD_DEFINED__ +typedef interface ISpObjectToken ISpObjectToken; +#endif /* __ISpObjectToken_FWD_DEFINED__ */ + + +#ifndef __ISpObjectTokenInit_FWD_DEFINED__ +#define __ISpObjectTokenInit_FWD_DEFINED__ +typedef interface ISpObjectTokenInit ISpObjectTokenInit; +#endif /* __ISpObjectTokenInit_FWD_DEFINED__ */ + + +#ifndef __IEnumSpObjectTokens_FWD_DEFINED__ +#define __IEnumSpObjectTokens_FWD_DEFINED__ +typedef interface IEnumSpObjectTokens IEnumSpObjectTokens; +#endif /* __IEnumSpObjectTokens_FWD_DEFINED__ */ + + +#ifndef __ISpObjectWithToken_FWD_DEFINED__ +#define __ISpObjectWithToken_FWD_DEFINED__ +typedef interface ISpObjectWithToken ISpObjectWithToken; +#endif /* __ISpObjectWithToken_FWD_DEFINED__ */ + + +#ifndef __ISpResourceManager_FWD_DEFINED__ +#define __ISpResourceManager_FWD_DEFINED__ +typedef interface ISpResourceManager ISpResourceManager; +#endif /* __ISpResourceManager_FWD_DEFINED__ */ + + +#ifndef __ISpEventSource_FWD_DEFINED__ +#define __ISpEventSource_FWD_DEFINED__ +typedef interface ISpEventSource ISpEventSource; +#endif /* __ISpEventSource_FWD_DEFINED__ */ + + +#ifndef __ISpEventSink_FWD_DEFINED__ +#define __ISpEventSink_FWD_DEFINED__ +typedef interface ISpEventSink ISpEventSink; +#endif /* __ISpEventSink_FWD_DEFINED__ */ + + +#ifndef __ISpStreamFormat_FWD_DEFINED__ +#define __ISpStreamFormat_FWD_DEFINED__ +typedef interface ISpStreamFormat ISpStreamFormat; +#endif /* __ISpStreamFormat_FWD_DEFINED__ */ + + +#ifndef __ISpStream_FWD_DEFINED__ +#define __ISpStream_FWD_DEFINED__ +typedef interface ISpStream ISpStream; +#endif /* __ISpStream_FWD_DEFINED__ */ + + +#ifndef __ISpStreamFormatConverter_FWD_DEFINED__ +#define __ISpStreamFormatConverter_FWD_DEFINED__ +typedef interface ISpStreamFormatConverter ISpStreamFormatConverter; +#endif /* __ISpStreamFormatConverter_FWD_DEFINED__ */ + + +#ifndef __ISpAudio_FWD_DEFINED__ +#define __ISpAudio_FWD_DEFINED__ +typedef interface ISpAudio ISpAudio; +#endif /* __ISpAudio_FWD_DEFINED__ */ + + +#ifndef __ISpMMSysAudio_FWD_DEFINED__ +#define __ISpMMSysAudio_FWD_DEFINED__ +typedef interface ISpMMSysAudio ISpMMSysAudio; +#endif /* __ISpMMSysAudio_FWD_DEFINED__ */ + + +#ifndef __ISpTranscript_FWD_DEFINED__ +#define __ISpTranscript_FWD_DEFINED__ +typedef interface ISpTranscript ISpTranscript; +#endif /* __ISpTranscript_FWD_DEFINED__ */ + + +#ifndef __ISpLexicon_FWD_DEFINED__ +#define __ISpLexicon_FWD_DEFINED__ +typedef interface ISpLexicon ISpLexicon; +#endif /* __ISpLexicon_FWD_DEFINED__ */ + + +#ifndef __ISpContainerLexicon_FWD_DEFINED__ +#define __ISpContainerLexicon_FWD_DEFINED__ +typedef interface ISpContainerLexicon ISpContainerLexicon; +#endif /* __ISpContainerLexicon_FWD_DEFINED__ */ + + +#ifndef __ISpPhoneConverter_FWD_DEFINED__ +#define __ISpPhoneConverter_FWD_DEFINED__ +typedef interface ISpPhoneConverter ISpPhoneConverter; +#endif /* __ISpPhoneConverter_FWD_DEFINED__ */ + + +#ifndef __ISpVoice_FWD_DEFINED__ +#define __ISpVoice_FWD_DEFINED__ +typedef interface ISpVoice ISpVoice; +#endif /* __ISpVoice_FWD_DEFINED__ */ + + +#ifndef __ISpPhrase_FWD_DEFINED__ +#define __ISpPhrase_FWD_DEFINED__ +typedef interface ISpPhrase ISpPhrase; +#endif /* __ISpPhrase_FWD_DEFINED__ */ + + +#ifndef __ISpPhraseAlt_FWD_DEFINED__ +#define __ISpPhraseAlt_FWD_DEFINED__ +typedef interface ISpPhraseAlt ISpPhraseAlt; +#endif /* __ISpPhraseAlt_FWD_DEFINED__ */ + + +#ifndef __ISpRecoResult_FWD_DEFINED__ +#define __ISpRecoResult_FWD_DEFINED__ +typedef interface ISpRecoResult ISpRecoResult; +#endif /* __ISpRecoResult_FWD_DEFINED__ */ + + +#ifndef __ISpGrammarBuilder_FWD_DEFINED__ +#define __ISpGrammarBuilder_FWD_DEFINED__ +typedef interface ISpGrammarBuilder ISpGrammarBuilder; +#endif /* __ISpGrammarBuilder_FWD_DEFINED__ */ + + +#ifndef __ISpRecoGrammar_FWD_DEFINED__ +#define __ISpRecoGrammar_FWD_DEFINED__ +typedef interface ISpRecoGrammar ISpRecoGrammar; +#endif /* __ISpRecoGrammar_FWD_DEFINED__ */ + + +#ifndef __ISpRecoContext_FWD_DEFINED__ +#define __ISpRecoContext_FWD_DEFINED__ +typedef interface ISpRecoContext ISpRecoContext; +#endif /* __ISpRecoContext_FWD_DEFINED__ */ + + +#ifndef __ISpProperties_FWD_DEFINED__ +#define __ISpProperties_FWD_DEFINED__ +typedef interface ISpProperties ISpProperties; +#endif /* __ISpProperties_FWD_DEFINED__ */ + + +#ifndef __ISpRecognizer_FWD_DEFINED__ +#define __ISpRecognizer_FWD_DEFINED__ +typedef interface ISpRecognizer ISpRecognizer; +#endif /* __ISpRecognizer_FWD_DEFINED__ */ + + +#ifndef __ISpeechDataKey_FWD_DEFINED__ +#define __ISpeechDataKey_FWD_DEFINED__ +typedef interface ISpeechDataKey ISpeechDataKey; +#endif /* __ISpeechDataKey_FWD_DEFINED__ */ + + +#ifndef __ISpeechObjectToken_FWD_DEFINED__ +#define __ISpeechObjectToken_FWD_DEFINED__ +typedef interface ISpeechObjectToken ISpeechObjectToken; +#endif /* __ISpeechObjectToken_FWD_DEFINED__ */ + + +#ifndef __ISpeechObjectTokens_FWD_DEFINED__ +#define __ISpeechObjectTokens_FWD_DEFINED__ +typedef interface ISpeechObjectTokens ISpeechObjectTokens; +#endif /* __ISpeechObjectTokens_FWD_DEFINED__ */ + + +#ifndef __ISpeechObjectTokenCategory_FWD_DEFINED__ +#define __ISpeechObjectTokenCategory_FWD_DEFINED__ +typedef interface ISpeechObjectTokenCategory ISpeechObjectTokenCategory; +#endif /* __ISpeechObjectTokenCategory_FWD_DEFINED__ */ + + +#ifndef __ISpeechAudioBufferInfo_FWD_DEFINED__ +#define __ISpeechAudioBufferInfo_FWD_DEFINED__ +typedef interface ISpeechAudioBufferInfo ISpeechAudioBufferInfo; +#endif /* __ISpeechAudioBufferInfo_FWD_DEFINED__ */ + + +#ifndef __ISpeechAudioStatus_FWD_DEFINED__ +#define __ISpeechAudioStatus_FWD_DEFINED__ +typedef interface ISpeechAudioStatus ISpeechAudioStatus; +#endif /* __ISpeechAudioStatus_FWD_DEFINED__ */ + + +#ifndef __ISpeechAudioFormat_FWD_DEFINED__ +#define __ISpeechAudioFormat_FWD_DEFINED__ +typedef interface ISpeechAudioFormat ISpeechAudioFormat; +#endif /* __ISpeechAudioFormat_FWD_DEFINED__ */ + + +#ifndef __ISpeechWaveFormatEx_FWD_DEFINED__ +#define __ISpeechWaveFormatEx_FWD_DEFINED__ +typedef interface ISpeechWaveFormatEx ISpeechWaveFormatEx; +#endif /* __ISpeechWaveFormatEx_FWD_DEFINED__ */ + + +#ifndef __ISpeechBaseStream_FWD_DEFINED__ +#define __ISpeechBaseStream_FWD_DEFINED__ +typedef interface ISpeechBaseStream ISpeechBaseStream; +#endif /* __ISpeechBaseStream_FWD_DEFINED__ */ + + +#ifndef __ISpeechFileStream_FWD_DEFINED__ +#define __ISpeechFileStream_FWD_DEFINED__ +typedef interface ISpeechFileStream ISpeechFileStream; +#endif /* __ISpeechFileStream_FWD_DEFINED__ */ + + +#ifndef __ISpeechMemoryStream_FWD_DEFINED__ +#define __ISpeechMemoryStream_FWD_DEFINED__ +typedef interface ISpeechMemoryStream ISpeechMemoryStream; +#endif /* __ISpeechMemoryStream_FWD_DEFINED__ */ + + +#ifndef __ISpeechCustomStream_FWD_DEFINED__ +#define __ISpeechCustomStream_FWD_DEFINED__ +typedef interface ISpeechCustomStream ISpeechCustomStream; +#endif /* __ISpeechCustomStream_FWD_DEFINED__ */ + + +#ifndef __ISpeechAudio_FWD_DEFINED__ +#define __ISpeechAudio_FWD_DEFINED__ +typedef interface ISpeechAudio ISpeechAudio; +#endif /* __ISpeechAudio_FWD_DEFINED__ */ + + +#ifndef __ISpeechMMSysAudio_FWD_DEFINED__ +#define __ISpeechMMSysAudio_FWD_DEFINED__ +typedef interface ISpeechMMSysAudio ISpeechMMSysAudio; +#endif /* __ISpeechMMSysAudio_FWD_DEFINED__ */ + + +#ifndef __ISpeechVoice_FWD_DEFINED__ +#define __ISpeechVoice_FWD_DEFINED__ +typedef interface ISpeechVoice ISpeechVoice; +#endif /* __ISpeechVoice_FWD_DEFINED__ */ + + +#ifndef __ISpeechVoiceStatus_FWD_DEFINED__ +#define __ISpeechVoiceStatus_FWD_DEFINED__ +typedef interface ISpeechVoiceStatus ISpeechVoiceStatus; +#endif /* __ISpeechVoiceStatus_FWD_DEFINED__ */ + + +#ifndef ___ISpeechVoiceEvents_FWD_DEFINED__ +#define ___ISpeechVoiceEvents_FWD_DEFINED__ +typedef interface _ISpeechVoiceEvents _ISpeechVoiceEvents; +#endif /* ___ISpeechVoiceEvents_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecognizer_FWD_DEFINED__ +#define __ISpeechRecognizer_FWD_DEFINED__ +typedef interface ISpeechRecognizer ISpeechRecognizer; +#endif /* __ISpeechRecognizer_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecognizerStatus_FWD_DEFINED__ +#define __ISpeechRecognizerStatus_FWD_DEFINED__ +typedef interface ISpeechRecognizerStatus ISpeechRecognizerStatus; +#endif /* __ISpeechRecognizerStatus_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecoContext_FWD_DEFINED__ +#define __ISpeechRecoContext_FWD_DEFINED__ +typedef interface ISpeechRecoContext ISpeechRecoContext; +#endif /* __ISpeechRecoContext_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecoGrammar_FWD_DEFINED__ +#define __ISpeechRecoGrammar_FWD_DEFINED__ +typedef interface ISpeechRecoGrammar ISpeechRecoGrammar; +#endif /* __ISpeechRecoGrammar_FWD_DEFINED__ */ + + +#ifndef ___ISpeechRecoContextEvents_FWD_DEFINED__ +#define ___ISpeechRecoContextEvents_FWD_DEFINED__ +typedef interface _ISpeechRecoContextEvents _ISpeechRecoContextEvents; +#endif /* ___ISpeechRecoContextEvents_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRule_FWD_DEFINED__ +#define __ISpeechGrammarRule_FWD_DEFINED__ +typedef interface ISpeechGrammarRule ISpeechGrammarRule; +#endif /* __ISpeechGrammarRule_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRules_FWD_DEFINED__ +#define __ISpeechGrammarRules_FWD_DEFINED__ +typedef interface ISpeechGrammarRules ISpeechGrammarRules; +#endif /* __ISpeechGrammarRules_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleState_FWD_DEFINED__ +#define __ISpeechGrammarRuleState_FWD_DEFINED__ +typedef interface ISpeechGrammarRuleState ISpeechGrammarRuleState; +#endif /* __ISpeechGrammarRuleState_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleStateTransition_FWD_DEFINED__ +#define __ISpeechGrammarRuleStateTransition_FWD_DEFINED__ +typedef interface ISpeechGrammarRuleStateTransition ISpeechGrammarRuleStateTransition; +#endif /* __ISpeechGrammarRuleStateTransition_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleStateTransitions_FWD_DEFINED__ +#define __ISpeechGrammarRuleStateTransitions_FWD_DEFINED__ +typedef interface ISpeechGrammarRuleStateTransitions ISpeechGrammarRuleStateTransitions; +#endif /* __ISpeechGrammarRuleStateTransitions_FWD_DEFINED__ */ + + +#ifndef __ISpeechTextSelectionInformation_FWD_DEFINED__ +#define __ISpeechTextSelectionInformation_FWD_DEFINED__ +typedef interface ISpeechTextSelectionInformation ISpeechTextSelectionInformation; +#endif /* __ISpeechTextSelectionInformation_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecoResult_FWD_DEFINED__ +#define __ISpeechRecoResult_FWD_DEFINED__ +typedef interface ISpeechRecoResult ISpeechRecoResult; +#endif /* __ISpeechRecoResult_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecoResultTimes_FWD_DEFINED__ +#define __ISpeechRecoResultTimes_FWD_DEFINED__ +typedef interface ISpeechRecoResultTimes ISpeechRecoResultTimes; +#endif /* __ISpeechRecoResultTimes_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseAlternate_FWD_DEFINED__ +#define __ISpeechPhraseAlternate_FWD_DEFINED__ +typedef interface ISpeechPhraseAlternate ISpeechPhraseAlternate; +#endif /* __ISpeechPhraseAlternate_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseAlternates_FWD_DEFINED__ +#define __ISpeechPhraseAlternates_FWD_DEFINED__ +typedef interface ISpeechPhraseAlternates ISpeechPhraseAlternates; +#endif /* __ISpeechPhraseAlternates_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseInfo_FWD_DEFINED__ +#define __ISpeechPhraseInfo_FWD_DEFINED__ +typedef interface ISpeechPhraseInfo ISpeechPhraseInfo; +#endif /* __ISpeechPhraseInfo_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseElement_FWD_DEFINED__ +#define __ISpeechPhraseElement_FWD_DEFINED__ +typedef interface ISpeechPhraseElement ISpeechPhraseElement; +#endif /* __ISpeechPhraseElement_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseElements_FWD_DEFINED__ +#define __ISpeechPhraseElements_FWD_DEFINED__ +typedef interface ISpeechPhraseElements ISpeechPhraseElements; +#endif /* __ISpeechPhraseElements_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseReplacement_FWD_DEFINED__ +#define __ISpeechPhraseReplacement_FWD_DEFINED__ +typedef interface ISpeechPhraseReplacement ISpeechPhraseReplacement; +#endif /* __ISpeechPhraseReplacement_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseReplacements_FWD_DEFINED__ +#define __ISpeechPhraseReplacements_FWD_DEFINED__ +typedef interface ISpeechPhraseReplacements ISpeechPhraseReplacements; +#endif /* __ISpeechPhraseReplacements_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseProperty_FWD_DEFINED__ +#define __ISpeechPhraseProperty_FWD_DEFINED__ +typedef interface ISpeechPhraseProperty ISpeechPhraseProperty; +#endif /* __ISpeechPhraseProperty_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseProperties_FWD_DEFINED__ +#define __ISpeechPhraseProperties_FWD_DEFINED__ +typedef interface ISpeechPhraseProperties ISpeechPhraseProperties; +#endif /* __ISpeechPhraseProperties_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseRule_FWD_DEFINED__ +#define __ISpeechPhraseRule_FWD_DEFINED__ +typedef interface ISpeechPhraseRule ISpeechPhraseRule; +#endif /* __ISpeechPhraseRule_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseRules_FWD_DEFINED__ +#define __ISpeechPhraseRules_FWD_DEFINED__ +typedef interface ISpeechPhraseRules ISpeechPhraseRules; +#endif /* __ISpeechPhraseRules_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexicon_FWD_DEFINED__ +#define __ISpeechLexicon_FWD_DEFINED__ +typedef interface ISpeechLexicon ISpeechLexicon; +#endif /* __ISpeechLexicon_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexiconWords_FWD_DEFINED__ +#define __ISpeechLexiconWords_FWD_DEFINED__ +typedef interface ISpeechLexiconWords ISpeechLexiconWords; +#endif /* __ISpeechLexiconWords_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexiconWord_FWD_DEFINED__ +#define __ISpeechLexiconWord_FWD_DEFINED__ +typedef interface ISpeechLexiconWord ISpeechLexiconWord; +#endif /* __ISpeechLexiconWord_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexiconPronunciations_FWD_DEFINED__ +#define __ISpeechLexiconPronunciations_FWD_DEFINED__ +typedef interface ISpeechLexiconPronunciations ISpeechLexiconPronunciations; +#endif /* __ISpeechLexiconPronunciations_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexiconPronunciation_FWD_DEFINED__ +#define __ISpeechLexiconPronunciation_FWD_DEFINED__ +typedef interface ISpeechLexiconPronunciation ISpeechLexiconPronunciation; +#endif /* __ISpeechLexiconPronunciation_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseInfoBuilder_FWD_DEFINED__ +#define __ISpeechPhraseInfoBuilder_FWD_DEFINED__ +typedef interface ISpeechPhraseInfoBuilder ISpeechPhraseInfoBuilder; +#endif /* __ISpeechPhraseInfoBuilder_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhoneConverter_FWD_DEFINED__ +#define __ISpeechPhoneConverter_FWD_DEFINED__ +typedef interface ISpeechPhoneConverter ISpeechPhoneConverter; +#endif /* __ISpeechPhoneConverter_FWD_DEFINED__ */ + + +#ifndef __SpNotifyTranslator_FWD_DEFINED__ +#define __SpNotifyTranslator_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpNotifyTranslator SpNotifyTranslator; +#else +typedef struct SpNotifyTranslator SpNotifyTranslator; +#endif /* __cplusplus */ + +#endif /* __SpNotifyTranslator_FWD_DEFINED__ */ + + +#ifndef __SpObjectTokenCategory_FWD_DEFINED__ +#define __SpObjectTokenCategory_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpObjectTokenCategory SpObjectTokenCategory; +#else +typedef struct SpObjectTokenCategory SpObjectTokenCategory; +#endif /* __cplusplus */ + +#endif /* __SpObjectTokenCategory_FWD_DEFINED__ */ + + +#ifndef __SpObjectToken_FWD_DEFINED__ +#define __SpObjectToken_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpObjectToken SpObjectToken; +#else +typedef struct SpObjectToken SpObjectToken; +#endif /* __cplusplus */ + +#endif /* __SpObjectToken_FWD_DEFINED__ */ + + +#ifndef __SpResourceManager_FWD_DEFINED__ +#define __SpResourceManager_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpResourceManager SpResourceManager; +#else +typedef struct SpResourceManager SpResourceManager; +#endif /* __cplusplus */ + +#endif /* __SpResourceManager_FWD_DEFINED__ */ + + +#ifndef __SpStreamFormatConverter_FWD_DEFINED__ +#define __SpStreamFormatConverter_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpStreamFormatConverter SpStreamFormatConverter; +#else +typedef struct SpStreamFormatConverter SpStreamFormatConverter; +#endif /* __cplusplus */ + +#endif /* __SpStreamFormatConverter_FWD_DEFINED__ */ + + +#ifndef __SpMMAudioEnum_FWD_DEFINED__ +#define __SpMMAudioEnum_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpMMAudioEnum SpMMAudioEnum; +#else +typedef struct SpMMAudioEnum SpMMAudioEnum; +#endif /* __cplusplus */ + +#endif /* __SpMMAudioEnum_FWD_DEFINED__ */ + + +#ifndef __SpMMAudioIn_FWD_DEFINED__ +#define __SpMMAudioIn_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpMMAudioIn SpMMAudioIn; +#else +typedef struct SpMMAudioIn SpMMAudioIn; +#endif /* __cplusplus */ + +#endif /* __SpMMAudioIn_FWD_DEFINED__ */ + + +#ifndef __SpMMAudioOut_FWD_DEFINED__ +#define __SpMMAudioOut_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpMMAudioOut SpMMAudioOut; +#else +typedef struct SpMMAudioOut SpMMAudioOut; +#endif /* __cplusplus */ + +#endif /* __SpMMAudioOut_FWD_DEFINED__ */ + + +#ifndef __SpRecPlayAudio_FWD_DEFINED__ +#define __SpRecPlayAudio_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpRecPlayAudio SpRecPlayAudio; +#else +typedef struct SpRecPlayAudio SpRecPlayAudio; +#endif /* __cplusplus */ + +#endif /* __SpRecPlayAudio_FWD_DEFINED__ */ + + +#ifndef __SpStream_FWD_DEFINED__ +#define __SpStream_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpStream SpStream; +#else +typedef struct SpStream SpStream; +#endif /* __cplusplus */ + +#endif /* __SpStream_FWD_DEFINED__ */ + + +#ifndef __SpVoice_FWD_DEFINED__ +#define __SpVoice_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpVoice SpVoice; +#else +typedef struct SpVoice SpVoice; +#endif /* __cplusplus */ + +#endif /* __SpVoice_FWD_DEFINED__ */ + + +#ifndef __SpSharedRecoContext_FWD_DEFINED__ +#define __SpSharedRecoContext_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpSharedRecoContext SpSharedRecoContext; +#else +typedef struct SpSharedRecoContext SpSharedRecoContext; +#endif /* __cplusplus */ + +#endif /* __SpSharedRecoContext_FWD_DEFINED__ */ + + +#ifndef __SpInprocRecognizer_FWD_DEFINED__ +#define __SpInprocRecognizer_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpInprocRecognizer SpInprocRecognizer; +#else +typedef struct SpInprocRecognizer SpInprocRecognizer; +#endif /* __cplusplus */ + +#endif /* __SpInprocRecognizer_FWD_DEFINED__ */ + + +#ifndef __SpSharedRecognizer_FWD_DEFINED__ +#define __SpSharedRecognizer_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpSharedRecognizer SpSharedRecognizer; +#else +typedef struct SpSharedRecognizer SpSharedRecognizer; +#endif /* __cplusplus */ + +#endif /* __SpSharedRecognizer_FWD_DEFINED__ */ + + +#ifndef __SpLexicon_FWD_DEFINED__ +#define __SpLexicon_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpLexicon SpLexicon; +#else +typedef struct SpLexicon SpLexicon; +#endif /* __cplusplus */ + +#endif /* __SpLexicon_FWD_DEFINED__ */ + + +#ifndef __SpUnCompressedLexicon_FWD_DEFINED__ +#define __SpUnCompressedLexicon_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpUnCompressedLexicon SpUnCompressedLexicon; +#else +typedef struct SpUnCompressedLexicon SpUnCompressedLexicon; +#endif /* __cplusplus */ + +#endif /* __SpUnCompressedLexicon_FWD_DEFINED__ */ + + +#ifndef __SpCompressedLexicon_FWD_DEFINED__ +#define __SpCompressedLexicon_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpCompressedLexicon SpCompressedLexicon; +#else +typedef struct SpCompressedLexicon SpCompressedLexicon; +#endif /* __cplusplus */ + +#endif /* __SpCompressedLexicon_FWD_DEFINED__ */ + + +#ifndef __SpPhoneConverter_FWD_DEFINED__ +#define __SpPhoneConverter_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpPhoneConverter SpPhoneConverter; +#else +typedef struct SpPhoneConverter SpPhoneConverter; +#endif /* __cplusplus */ + +#endif /* __SpPhoneConverter_FWD_DEFINED__ */ + + +#ifndef __SpNullPhoneConverter_FWD_DEFINED__ +#define __SpNullPhoneConverter_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpNullPhoneConverter SpNullPhoneConverter; +#else +typedef struct SpNullPhoneConverter SpNullPhoneConverter; +#endif /* __cplusplus */ + +#endif /* __SpNullPhoneConverter_FWD_DEFINED__ */ + + +#ifndef __SpTextSelectionInformation_FWD_DEFINED__ +#define __SpTextSelectionInformation_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpTextSelectionInformation SpTextSelectionInformation; +#else +typedef struct SpTextSelectionInformation SpTextSelectionInformation; +#endif /* __cplusplus */ + +#endif /* __SpTextSelectionInformation_FWD_DEFINED__ */ + + +#ifndef __SpPhraseInfoBuilder_FWD_DEFINED__ +#define __SpPhraseInfoBuilder_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpPhraseInfoBuilder SpPhraseInfoBuilder; +#else +typedef struct SpPhraseInfoBuilder SpPhraseInfoBuilder; +#endif /* __cplusplus */ + +#endif /* __SpPhraseInfoBuilder_FWD_DEFINED__ */ + + +#ifndef __SpAudioFormat_FWD_DEFINED__ +#define __SpAudioFormat_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpAudioFormat SpAudioFormat; +#else +typedef struct SpAudioFormat SpAudioFormat; +#endif /* __cplusplus */ + +#endif /* __SpAudioFormat_FWD_DEFINED__ */ + + +#ifndef __SpWaveFormatEx_FWD_DEFINED__ +#define __SpWaveFormatEx_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpWaveFormatEx SpWaveFormatEx; +#else +typedef struct SpWaveFormatEx SpWaveFormatEx; +#endif /* __cplusplus */ + +#endif /* __SpWaveFormatEx_FWD_DEFINED__ */ + + +#ifndef __SpInProcRecoContext_FWD_DEFINED__ +#define __SpInProcRecoContext_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpInProcRecoContext SpInProcRecoContext; +#else +typedef struct SpInProcRecoContext SpInProcRecoContext; +#endif /* __cplusplus */ + +#endif /* __SpInProcRecoContext_FWD_DEFINED__ */ + + +#ifndef __SpCustomStream_FWD_DEFINED__ +#define __SpCustomStream_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpCustomStream SpCustomStream; +#else +typedef struct SpCustomStream SpCustomStream; +#endif /* __cplusplus */ + +#endif /* __SpCustomStream_FWD_DEFINED__ */ + + +#ifndef __SpFileStream_FWD_DEFINED__ +#define __SpFileStream_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpFileStream SpFileStream; +#else +typedef struct SpFileStream SpFileStream; +#endif /* __cplusplus */ + +#endif /* __SpFileStream_FWD_DEFINED__ */ + + +#ifndef __SpMemoryStream_FWD_DEFINED__ +#define __SpMemoryStream_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpMemoryStream SpMemoryStream; +#else +typedef struct SpMemoryStream SpMemoryStream; +#endif /* __cplusplus */ + +#endif /* __SpMemoryStream_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +void * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void * ); + +/* interface __MIDL_itf_sapi_0000 */ +/* [local] */ + +#pragma warning(disable:4201) // Allow nameless structs/unions +#pragma comment(lib, "sapi.lib") +#if 0 +typedef /* [hidden][restricted] */ struct WAVEFORMATEX + { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + WORD cbSize; + } WAVEFORMATEX; + +#else +#include +#endif + + + + + + + + + + + + + + + + + + + + + + + + + +typedef /* [hidden] */ +enum SPDATAKEYLOCATION + { SPDKL_DefaultLocation = 0, + SPDKL_CurrentUser = 1, + SPDKL_LocalMachine = 2, + SPDKL_CurrentConfig = 5 + } SPDATAKEYLOCATION; + +#define SPDUI_EngineProperties L"EngineProperties" +#define SPDUI_AddRemoveWord L"AddRemoveWord" +#define SPDUI_UserTraining L"UserTraining" +#define SPDUI_MicTraining L"MicTraining" +#define SPDUI_RecoProfileProperties L"RecoProfileProperties" +#define SPDUI_AudioProperties L"AudioProperties" +#define SPDUI_AudioVolume L"AudioVolume" +typedef /* [hidden] */ +enum SPSTREAMFORMAT + { SPSF_Default = -1, + SPSF_NoAssignedFormat = 0, + SPSF_Text = SPSF_NoAssignedFormat + 1, + SPSF_NonStandardFormat = SPSF_Text + 1, + SPSF_ExtendedAudioFormat = SPSF_NonStandardFormat + 1, + SPSF_8kHz8BitMono = SPSF_ExtendedAudioFormat + 1, + SPSF_8kHz8BitStereo = SPSF_8kHz8BitMono + 1, + SPSF_8kHz16BitMono = SPSF_8kHz8BitStereo + 1, + SPSF_8kHz16BitStereo = SPSF_8kHz16BitMono + 1, + SPSF_11kHz8BitMono = SPSF_8kHz16BitStereo + 1, + SPSF_11kHz8BitStereo = SPSF_11kHz8BitMono + 1, + SPSF_11kHz16BitMono = SPSF_11kHz8BitStereo + 1, + SPSF_11kHz16BitStereo = SPSF_11kHz16BitMono + 1, + SPSF_12kHz8BitMono = SPSF_11kHz16BitStereo + 1, + SPSF_12kHz8BitStereo = SPSF_12kHz8BitMono + 1, + SPSF_12kHz16BitMono = SPSF_12kHz8BitStereo + 1, + SPSF_12kHz16BitStereo = SPSF_12kHz16BitMono + 1, + SPSF_16kHz8BitMono = SPSF_12kHz16BitStereo + 1, + SPSF_16kHz8BitStereo = SPSF_16kHz8BitMono + 1, + SPSF_16kHz16BitMono = SPSF_16kHz8BitStereo + 1, + SPSF_16kHz16BitStereo = SPSF_16kHz16BitMono + 1, + SPSF_22kHz8BitMono = SPSF_16kHz16BitStereo + 1, + SPSF_22kHz8BitStereo = SPSF_22kHz8BitMono + 1, + SPSF_22kHz16BitMono = SPSF_22kHz8BitStereo + 1, + SPSF_22kHz16BitStereo = SPSF_22kHz16BitMono + 1, + SPSF_24kHz8BitMono = SPSF_22kHz16BitStereo + 1, + SPSF_24kHz8BitStereo = SPSF_24kHz8BitMono + 1, + SPSF_24kHz16BitMono = SPSF_24kHz8BitStereo + 1, + SPSF_24kHz16BitStereo = SPSF_24kHz16BitMono + 1, + SPSF_32kHz8BitMono = SPSF_24kHz16BitStereo + 1, + SPSF_32kHz8BitStereo = SPSF_32kHz8BitMono + 1, + SPSF_32kHz16BitMono = SPSF_32kHz8BitStereo + 1, + SPSF_32kHz16BitStereo = SPSF_32kHz16BitMono + 1, + SPSF_44kHz8BitMono = SPSF_32kHz16BitStereo + 1, + SPSF_44kHz8BitStereo = SPSF_44kHz8BitMono + 1, + SPSF_44kHz16BitMono = SPSF_44kHz8BitStereo + 1, + SPSF_44kHz16BitStereo = SPSF_44kHz16BitMono + 1, + SPSF_48kHz8BitMono = SPSF_44kHz16BitStereo + 1, + SPSF_48kHz8BitStereo = SPSF_48kHz8BitMono + 1, + SPSF_48kHz16BitMono = SPSF_48kHz8BitStereo + 1, + SPSF_48kHz16BitStereo = SPSF_48kHz16BitMono + 1, + SPSF_TrueSpeech_8kHz1BitMono = SPSF_48kHz16BitStereo + 1, + SPSF_CCITT_ALaw_8kHzMono = SPSF_TrueSpeech_8kHz1BitMono + 1, + SPSF_CCITT_ALaw_8kHzStereo = SPSF_CCITT_ALaw_8kHzMono + 1, + SPSF_CCITT_ALaw_11kHzMono = SPSF_CCITT_ALaw_8kHzStereo + 1, + SPSF_CCITT_ALaw_11kHzStereo = SPSF_CCITT_ALaw_11kHzMono + 1, + SPSF_CCITT_ALaw_22kHzMono = SPSF_CCITT_ALaw_11kHzStereo + 1, + SPSF_CCITT_ALaw_22kHzStereo = SPSF_CCITT_ALaw_22kHzMono + 1, + SPSF_CCITT_ALaw_44kHzMono = SPSF_CCITT_ALaw_22kHzStereo + 1, + SPSF_CCITT_ALaw_44kHzStereo = SPSF_CCITT_ALaw_44kHzMono + 1, + SPSF_CCITT_uLaw_8kHzMono = SPSF_CCITT_ALaw_44kHzStereo + 1, + SPSF_CCITT_uLaw_8kHzStereo = SPSF_CCITT_uLaw_8kHzMono + 1, + SPSF_CCITT_uLaw_11kHzMono = SPSF_CCITT_uLaw_8kHzStereo + 1, + SPSF_CCITT_uLaw_11kHzStereo = SPSF_CCITT_uLaw_11kHzMono + 1, + SPSF_CCITT_uLaw_22kHzMono = SPSF_CCITT_uLaw_11kHzStereo + 1, + SPSF_CCITT_uLaw_22kHzStereo = SPSF_CCITT_uLaw_22kHzMono + 1, + SPSF_CCITT_uLaw_44kHzMono = SPSF_CCITT_uLaw_22kHzStereo + 1, + SPSF_CCITT_uLaw_44kHzStereo = SPSF_CCITT_uLaw_44kHzMono + 1, + SPSF_ADPCM_8kHzMono = SPSF_CCITT_uLaw_44kHzStereo + 1, + SPSF_ADPCM_8kHzStereo = SPSF_ADPCM_8kHzMono + 1, + SPSF_ADPCM_11kHzMono = SPSF_ADPCM_8kHzStereo + 1, + SPSF_ADPCM_11kHzStereo = SPSF_ADPCM_11kHzMono + 1, + SPSF_ADPCM_22kHzMono = SPSF_ADPCM_11kHzStereo + 1, + SPSF_ADPCM_22kHzStereo = SPSF_ADPCM_22kHzMono + 1, + SPSF_ADPCM_44kHzMono = SPSF_ADPCM_22kHzStereo + 1, + SPSF_ADPCM_44kHzStereo = SPSF_ADPCM_44kHzMono + 1, + SPSF_GSM610_8kHzMono = SPSF_ADPCM_44kHzStereo + 1, + SPSF_GSM610_11kHzMono = SPSF_GSM610_8kHzMono + 1, + SPSF_GSM610_22kHzMono = SPSF_GSM610_11kHzMono + 1, + SPSF_GSM610_44kHzMono = SPSF_GSM610_22kHzMono + 1, + SPSF_NUM_FORMATS = SPSF_GSM610_44kHzMono + 1 + } SPSTREAMFORMAT; + +EXTERN_C const GUID SPDFID_Text; +EXTERN_C const GUID SPDFID_WaveFormatEx; +#define SPREG_USER_ROOT L"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech" +#define SPREG_LOCAL_MACHINE_ROOT L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech" +#define SPCAT_AUDIOOUT L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput" +#define SPCAT_AUDIOIN L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput" +#define SPCAT_VOICES L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices" +#define SPCAT_RECOGNIZERS L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Recognizers" +#define SPCAT_APPLEXICONS L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AppLexicons" +#define SPCAT_PHONECONVERTERS L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\PhoneConverters" +#define SPCAT_RECOPROFILES L"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\RecoProfiles" +#define SPMMSYS_AUDIO_IN_TOKEN_ID L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput\\TokenEnums\\MMAudioIn\\" +#define SPMMSYS_AUDIO_OUT_TOKEN_ID L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput\\TokenEnums\\MMAudioOut\\" +#define SPCURRENT_USER_LEXICON_TOKEN_ID L"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserLexicon" +#define SPTOKENVALUE_CLSID L"CLSID" +#define SPTOKENKEY_FILES L"Files" +#define SPTOKENKEY_UI L"UI" +#define SPTOKENKEY_ATTRIBUTES L"Attributes" +#define SPVOICECATEGORY_TTSRATE L"DefaultTTSRate" +#define SPPROP_RESOURCE_USAGE L"ResourceUsage" +#define SPPROP_HIGH_CONFIDENCE_THRESHOLD L"HighConfidenceThreshold" +#define SPPROP_NORMAL_CONFIDENCE_THRESHOLD L"NormalConfidenceThreshold" +#define SPPROP_LOW_CONFIDENCE_THRESHOLD L"LowConfidenceThreshold" +#define SPPROP_RESPONSE_SPEED L"ResponseSpeed" +#define SPPROP_COMPLEX_RESPONSE_SPEED L"ComplexResponseSpeed" +#define SPPROP_ADAPTATION_ON L"AdaptationOn" +#define SPTOPIC_SPELLING L"Spelling" +#define SPWILDCARD L"..." +#define SPDICTATION L"*" +#define SPINFDICTATION L"*+" +#define SP_LOW_CONFIDENCE ( -1 ) + +#define SP_NORMAL_CONFIDENCE ( 0 ) + +#define SP_HIGH_CONFIDENCE ( +1 ) + +#define DEFAULT_WEIGHT ( 1 ) + +#define SP_MAX_WORD_LENGTH ( 128 ) + +#define SP_MAX_PRON_LENGTH ( 384 ) + +#if defined(__cplusplus) +interface ISpNotifyCallback +{ +virtual HRESULT STDMETHODCALLTYPE NotifyCallback( + WPARAM wParam, + LPARAM lParam) = 0; +}; +#else +typedef void *ISpNotifyCallback; + +#endif +#if 0 +typedef void *SPNOTIFYCALLBACK; + +#else +typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam); +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0000_v0_0_s_ifspec; + +#ifndef __ISpNotifySource_INTERFACE_DEFINED__ +#define __ISpNotifySource_INTERFACE_DEFINED__ + +/* interface ISpNotifySource */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpNotifySource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5EFF4AEF-8487-11D2-961C-00C04F8EE628") + ISpNotifySource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetNotifySink( + /* [in] */ ISpNotifySink *pNotifySink) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetNotifyWindowMessage( + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetNotifyCallbackFunction( + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetNotifyCallbackInterface( + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetNotifyWin32Event( void) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE WaitForNotifyEvent( + /* [in] */ DWORD dwMilliseconds) = 0; + + virtual /* [local] */ HANDLE STDMETHODCALLTYPE GetNotifyEventHandle( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpNotifySourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpNotifySource * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpNotifySource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpNotifySource * This); + + HRESULT ( STDMETHODCALLTYPE *SetNotifySink )( + ISpNotifySource * This, + /* [in] */ ISpNotifySink *pNotifySink); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWindowMessage )( + ISpNotifySource * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackFunction )( + ISpNotifySource * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackInterface )( + ISpNotifySource * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWin32Event )( + ISpNotifySource * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForNotifyEvent )( + ISpNotifySource * This, + /* [in] */ DWORD dwMilliseconds); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *GetNotifyEventHandle )( + ISpNotifySource * This); + + END_INTERFACE + } ISpNotifySourceVtbl; + + interface ISpNotifySource + { + CONST_VTBL struct ISpNotifySourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpNotifySource_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpNotifySource_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpNotifySource_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpNotifySource_SetNotifySink(This,pNotifySink) \ + (This)->lpVtbl -> SetNotifySink(This,pNotifySink) + +#define ISpNotifySource_SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpNotifySource_SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) + +#define ISpNotifySource_SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) + +#define ISpNotifySource_SetNotifyWin32Event(This) \ + (This)->lpVtbl -> SetNotifyWin32Event(This) + +#define ISpNotifySource_WaitForNotifyEvent(This,dwMilliseconds) \ + (This)->lpVtbl -> WaitForNotifyEvent(This,dwMilliseconds) + +#define ISpNotifySource_GetNotifyEventHandle(This) \ + (This)->lpVtbl -> GetNotifyEventHandle(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifySink_Proxy( + ISpNotifySource * This, + /* [in] */ ISpNotifySink *pNotifySink); + + +void __RPC_STUB ISpNotifySource_SetNotifySink_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifyWindowMessage_Proxy( + ISpNotifySource * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifySource_SetNotifyWindowMessage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifyCallbackFunction_Proxy( + ISpNotifySource * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifySource_SetNotifyCallbackFunction_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifyCallbackInterface_Proxy( + ISpNotifySource * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifySource_SetNotifyCallbackInterface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifyWin32Event_Proxy( + ISpNotifySource * This); + + +void __RPC_STUB ISpNotifySource_SetNotifyWin32Event_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_WaitForNotifyEvent_Proxy( + ISpNotifySource * This, + /* [in] */ DWORD dwMilliseconds); + + +void __RPC_STUB ISpNotifySource_WaitForNotifyEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HANDLE STDMETHODCALLTYPE ISpNotifySource_GetNotifyEventHandle_Proxy( + ISpNotifySource * This); + + +void __RPC_STUB ISpNotifySource_GetNotifyEventHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpNotifySource_INTERFACE_DEFINED__ */ + + +#ifndef __ISpNotifySink_INTERFACE_DEFINED__ +#define __ISpNotifySink_INTERFACE_DEFINED__ + +/* interface ISpNotifySink */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpNotifySink; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("259684DC-37C3-11D2-9603-00C04F8EE628") + ISpNotifySink : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Notify( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpNotifySinkVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpNotifySink * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpNotifySink * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpNotifySink * This); + + HRESULT ( STDMETHODCALLTYPE *Notify )( + ISpNotifySink * This); + + END_INTERFACE + } ISpNotifySinkVtbl; + + interface ISpNotifySink + { + CONST_VTBL struct ISpNotifySinkVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpNotifySink_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpNotifySink_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpNotifySink_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpNotifySink_Notify(This) \ + (This)->lpVtbl -> Notify(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpNotifySink_Notify_Proxy( + ISpNotifySink * This); + + +void __RPC_STUB ISpNotifySink_Notify_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpNotifySink_INTERFACE_DEFINED__ */ + + +#ifndef __ISpNotifyTranslator_INTERFACE_DEFINED__ +#define __ISpNotifyTranslator_INTERFACE_DEFINED__ + +/* interface ISpNotifyTranslator */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpNotifyTranslator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ACA16614-5D3D-11D2-960E-00C04F8EE628") + ISpNotifyTranslator : public ISpNotifySink + { + public: + virtual HRESULT STDMETHODCALLTYPE InitWindowMessage( + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitCallback( + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitSpNotifyCallback( + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitWin32Event( + HANDLE hEvent, + BOOL fCloseHandleOnRelease) = 0; + + virtual HRESULT STDMETHODCALLTYPE Wait( + /* [in] */ DWORD dwMilliseconds) = 0; + + virtual HANDLE STDMETHODCALLTYPE GetEventHandle( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpNotifyTranslatorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpNotifyTranslator * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpNotifyTranslator * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpNotifyTranslator * This); + + HRESULT ( STDMETHODCALLTYPE *Notify )( + ISpNotifyTranslator * This); + + HRESULT ( STDMETHODCALLTYPE *InitWindowMessage )( + ISpNotifyTranslator * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + HRESULT ( STDMETHODCALLTYPE *InitCallback )( + ISpNotifyTranslator * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + HRESULT ( STDMETHODCALLTYPE *InitSpNotifyCallback )( + ISpNotifyTranslator * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + HRESULT ( STDMETHODCALLTYPE *InitWin32Event )( + ISpNotifyTranslator * This, + HANDLE hEvent, + BOOL fCloseHandleOnRelease); + + HRESULT ( STDMETHODCALLTYPE *Wait )( + ISpNotifyTranslator * This, + /* [in] */ DWORD dwMilliseconds); + + HANDLE ( STDMETHODCALLTYPE *GetEventHandle )( + ISpNotifyTranslator * This); + + END_INTERFACE + } ISpNotifyTranslatorVtbl; + + interface ISpNotifyTranslator + { + CONST_VTBL struct ISpNotifyTranslatorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpNotifyTranslator_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpNotifyTranslator_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpNotifyTranslator_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpNotifyTranslator_Notify(This) \ + (This)->lpVtbl -> Notify(This) + + +#define ISpNotifyTranslator_InitWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> InitWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpNotifyTranslator_InitCallback(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> InitCallback(This,pfnCallback,wParam,lParam) + +#define ISpNotifyTranslator_InitSpNotifyCallback(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> InitSpNotifyCallback(This,pSpCallback,wParam,lParam) + +#define ISpNotifyTranslator_InitWin32Event(This,hEvent,fCloseHandleOnRelease) \ + (This)->lpVtbl -> InitWin32Event(This,hEvent,fCloseHandleOnRelease) + +#define ISpNotifyTranslator_Wait(This,dwMilliseconds) \ + (This)->lpVtbl -> Wait(This,dwMilliseconds) + +#define ISpNotifyTranslator_GetEventHandle(This) \ + (This)->lpVtbl -> GetEventHandle(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_InitWindowMessage_Proxy( + ISpNotifyTranslator * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifyTranslator_InitWindowMessage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_InitCallback_Proxy( + ISpNotifyTranslator * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifyTranslator_InitCallback_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_InitSpNotifyCallback_Proxy( + ISpNotifyTranslator * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifyTranslator_InitSpNotifyCallback_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_InitWin32Event_Proxy( + ISpNotifyTranslator * This, + HANDLE hEvent, + BOOL fCloseHandleOnRelease); + + +void __RPC_STUB ISpNotifyTranslator_InitWin32Event_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_Wait_Proxy( + ISpNotifyTranslator * This, + /* [in] */ DWORD dwMilliseconds); + + +void __RPC_STUB ISpNotifyTranslator_Wait_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpNotifyTranslator_GetEventHandle_Proxy( + ISpNotifyTranslator * This); + + +void __RPC_STUB ISpNotifyTranslator_GetEventHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpNotifyTranslator_INTERFACE_DEFINED__ */ + + +#ifndef __ISpDataKey_INTERFACE_DEFINED__ +#define __ISpDataKey_INTERFACE_DEFINED__ + +/* interface ISpDataKey */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpDataKey; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("14056581-E16C-11D2-BB90-00C04F8EE6C0") + ISpDataKey : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetData( + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetData( + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetStringValue( + const WCHAR *pszValueName, + const WCHAR *pszValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStringValue( + const WCHAR *pszValueName, + WCHAR **ppszValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDWORD( + const WCHAR *pszValueName, + DWORD dwValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDWORD( + const WCHAR *pszValueName, + DWORD *pdwValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenKey( + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateKey( + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeleteKey( + const WCHAR *pszSubKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeleteValue( + const WCHAR *pszValueName) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumKeys( + ULONG Index, + WCHAR **ppszSubKeyName) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumValues( + ULONG Index, + WCHAR **ppszValueName) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpDataKeyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpDataKey * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpDataKey * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpDataKey * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpDataKey * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpDataKey * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpDataKey * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpDataKey * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpDataKey * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpDataKey * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpDataKey * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpDataKey * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpDataKey * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpDataKey * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpDataKey * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpDataKey * This, + ULONG Index, + WCHAR **ppszValueName); + + END_INTERFACE + } ISpDataKeyVtbl; + + interface ISpDataKey + { + CONST_VTBL struct ISpDataKeyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpDataKey_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpDataKey_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpDataKey_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpDataKey_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpDataKey_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpDataKey_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpDataKey_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpDataKey_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpDataKey_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpDataKey_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpDataKey_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpDataKey_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpDataKey_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpDataKey_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpDataKey_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpDataKey_SetData_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + +void __RPC_STUB ISpDataKey_SetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_GetData_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + +void __RPC_STUB ISpDataKey_GetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_SetStringValue_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + +void __RPC_STUB ISpDataKey_SetStringValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_GetStringValue_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + +void __RPC_STUB ISpDataKey_GetStringValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_SetDWORD_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + DWORD dwValue); + + +void __RPC_STUB ISpDataKey_SetDWORD_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_GetDWORD_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + +void __RPC_STUB ISpDataKey_GetDWORD_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_OpenKey_Proxy( + ISpDataKey * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + +void __RPC_STUB ISpDataKey_OpenKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_CreateKey_Proxy( + ISpDataKey * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + +void __RPC_STUB ISpDataKey_CreateKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_DeleteKey_Proxy( + ISpDataKey * This, + const WCHAR *pszSubKey); + + +void __RPC_STUB ISpDataKey_DeleteKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_DeleteValue_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName); + + +void __RPC_STUB ISpDataKey_DeleteValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_EnumKeys_Proxy( + ISpDataKey * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + +void __RPC_STUB ISpDataKey_EnumKeys_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_EnumValues_Proxy( + ISpDataKey * This, + ULONG Index, + WCHAR **ppszValueName); + + +void __RPC_STUB ISpDataKey_EnumValues_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpDataKey_INTERFACE_DEFINED__ */ + + +#ifndef __ISpRegDataKey_INTERFACE_DEFINED__ +#define __ISpRegDataKey_INTERFACE_DEFINED__ + +/* interface ISpRegDataKey */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRegDataKey; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("92A66E2B-C830-4149-83DF-6FC2BA1E7A5B") + ISpRegDataKey : public ISpDataKey + { + public: + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetKey( + /* [in] */ HKEY hkey, + /* [in] */ BOOL fReadOnly) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRegDataKeyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRegDataKey * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRegDataKey * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRegDataKey * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpRegDataKey * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpRegDataKey * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpRegDataKey * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpRegDataKey * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpRegDataKey * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpRegDataKey * This, + ULONG Index, + WCHAR **ppszValueName); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetKey )( + ISpRegDataKey * This, + /* [in] */ HKEY hkey, + /* [in] */ BOOL fReadOnly); + + END_INTERFACE + } ISpRegDataKeyVtbl; + + interface ISpRegDataKey + { + CONST_VTBL struct ISpRegDataKeyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRegDataKey_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRegDataKey_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRegDataKey_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRegDataKey_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpRegDataKey_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpRegDataKey_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpRegDataKey_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpRegDataKey_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpRegDataKey_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpRegDataKey_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpRegDataKey_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpRegDataKey_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpRegDataKey_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpRegDataKey_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpRegDataKey_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + + +#define ISpRegDataKey_SetKey(This,hkey,fReadOnly) \ + (This)->lpVtbl -> SetKey(This,hkey,fReadOnly) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpRegDataKey_SetKey_Proxy( + ISpRegDataKey * This, + /* [in] */ HKEY hkey, + /* [in] */ BOOL fReadOnly); + + +void __RPC_STUB ISpRegDataKey_SetKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRegDataKey_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectTokenCategory_INTERFACE_DEFINED__ +#define __ISpObjectTokenCategory_INTERFACE_DEFINED__ + +/* interface ISpObjectTokenCategory */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectTokenCategory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2D3D3845-39AF-4850-BBF9-40B49780011D") + ISpObjectTokenCategory : public ISpDataKey + { + public: + virtual HRESULT STDMETHODCALLTYPE SetId( + /* [in] */ const WCHAR *pszCategoryId, + BOOL fCreateIfNotExist) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetId( + /* [out] */ WCHAR **ppszCoMemCategoryId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDataKey( + SPDATAKEYLOCATION spdkl, + ISpDataKey **ppDataKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumTokens( + /* [string][in] */ const WCHAR *pzsReqAttribs, + /* [string][in] */ const WCHAR *pszOptAttribs, + /* [out] */ IEnumSpObjectTokens **ppEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDefaultTokenId( + /* [in] */ const WCHAR *pszTokenId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDefaultTokenId( + /* [out] */ WCHAR **ppszCoMemTokenId) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectTokenCategoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectTokenCategory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectTokenCategory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectTokenCategory * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpObjectTokenCategory * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpObjectTokenCategory * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpObjectTokenCategory * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpObjectTokenCategory * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpObjectTokenCategory * This, + ULONG Index, + WCHAR **ppszValueName); + + HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpObjectTokenCategory * This, + /* [in] */ const WCHAR *pszCategoryId, + BOOL fCreateIfNotExist); + + HRESULT ( STDMETHODCALLTYPE *GetId )( + ISpObjectTokenCategory * This, + /* [out] */ WCHAR **ppszCoMemCategoryId); + + HRESULT ( STDMETHODCALLTYPE *GetDataKey )( + ISpObjectTokenCategory * This, + SPDATAKEYLOCATION spdkl, + ISpDataKey **ppDataKey); + + HRESULT ( STDMETHODCALLTYPE *EnumTokens )( + ISpObjectTokenCategory * This, + /* [string][in] */ const WCHAR *pzsReqAttribs, + /* [string][in] */ const WCHAR *pszOptAttribs, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + HRESULT ( STDMETHODCALLTYPE *SetDefaultTokenId )( + ISpObjectTokenCategory * This, + /* [in] */ const WCHAR *pszTokenId); + + HRESULT ( STDMETHODCALLTYPE *GetDefaultTokenId )( + ISpObjectTokenCategory * This, + /* [out] */ WCHAR **ppszCoMemTokenId); + + END_INTERFACE + } ISpObjectTokenCategoryVtbl; + + interface ISpObjectTokenCategory + { + CONST_VTBL struct ISpObjectTokenCategoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectTokenCategory_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectTokenCategory_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectTokenCategory_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectTokenCategory_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpObjectTokenCategory_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpObjectTokenCategory_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpObjectTokenCategory_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpObjectTokenCategory_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpObjectTokenCategory_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpObjectTokenCategory_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpObjectTokenCategory_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpObjectTokenCategory_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpObjectTokenCategory_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpObjectTokenCategory_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpObjectTokenCategory_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + + +#define ISpObjectTokenCategory_SetId(This,pszCategoryId,fCreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,pszCategoryId,fCreateIfNotExist) + +#define ISpObjectTokenCategory_GetId(This,ppszCoMemCategoryId) \ + (This)->lpVtbl -> GetId(This,ppszCoMemCategoryId) + +#define ISpObjectTokenCategory_GetDataKey(This,spdkl,ppDataKey) \ + (This)->lpVtbl -> GetDataKey(This,spdkl,ppDataKey) + +#define ISpObjectTokenCategory_EnumTokens(This,pzsReqAttribs,pszOptAttribs,ppEnum) \ + (This)->lpVtbl -> EnumTokens(This,pzsReqAttribs,pszOptAttribs,ppEnum) + +#define ISpObjectTokenCategory_SetDefaultTokenId(This,pszTokenId) \ + (This)->lpVtbl -> SetDefaultTokenId(This,pszTokenId) + +#define ISpObjectTokenCategory_GetDefaultTokenId(This,ppszCoMemTokenId) \ + (This)->lpVtbl -> GetDefaultTokenId(This,ppszCoMemTokenId) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_SetId_Proxy( + ISpObjectTokenCategory * This, + /* [in] */ const WCHAR *pszCategoryId, + BOOL fCreateIfNotExist); + + +void __RPC_STUB ISpObjectTokenCategory_SetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_GetId_Proxy( + ISpObjectTokenCategory * This, + /* [out] */ WCHAR **ppszCoMemCategoryId); + + +void __RPC_STUB ISpObjectTokenCategory_GetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_GetDataKey_Proxy( + ISpObjectTokenCategory * This, + SPDATAKEYLOCATION spdkl, + ISpDataKey **ppDataKey); + + +void __RPC_STUB ISpObjectTokenCategory_GetDataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_EnumTokens_Proxy( + ISpObjectTokenCategory * This, + /* [string][in] */ const WCHAR *pzsReqAttribs, + /* [string][in] */ const WCHAR *pszOptAttribs, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + +void __RPC_STUB ISpObjectTokenCategory_EnumTokens_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_SetDefaultTokenId_Proxy( + ISpObjectTokenCategory * This, + /* [in] */ const WCHAR *pszTokenId); + + +void __RPC_STUB ISpObjectTokenCategory_SetDefaultTokenId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_GetDefaultTokenId_Proxy( + ISpObjectTokenCategory * This, + /* [out] */ WCHAR **ppszCoMemTokenId); + + +void __RPC_STUB ISpObjectTokenCategory_GetDefaultTokenId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectTokenCategory_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectToken_INTERFACE_DEFINED__ +#define __ISpObjectToken_INTERFACE_DEFINED__ + +/* interface ISpObjectToken */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectToken; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("14056589-E16C-11D2-BB90-00C04F8EE6C0") + ISpObjectToken : public ISpDataKey + { + public: + virtual HRESULT STDMETHODCALLTYPE SetId( + const WCHAR *pszCategoryId, + const WCHAR *pszTokenId, + BOOL fCreateIfNotExist) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetId( + WCHAR **ppszCoMemTokenId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCategory( + ISpObjectTokenCategory **ppTokenCategory) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateInstance( + /* [in] */ IUnknown *pUnkOuter, + /* [in] */ DWORD dwClsContext, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStorageFileName( + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszValueName, + /* [in] */ const WCHAR *pszFileNameSpecifier, + /* [in] */ ULONG nFolder, + /* [out] */ WCHAR **ppszFilePath) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemoveStorageFileName( + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszKeyName, + /* [in] */ BOOL fDeleteFile) = 0; + + virtual HRESULT STDMETHODCALLTYPE Remove( + const CLSID *pclsidCaller) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE MatchesAttributes( + /* [in] */ const WCHAR *pszAttributes, + /* [out] */ BOOL *pfMatches) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectTokenVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectToken * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectToken * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectToken * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpObjectToken * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpObjectToken * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpObjectToken * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpObjectToken * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpObjectToken * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpObjectToken * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpObjectToken * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpObjectToken * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpObjectToken * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpObjectToken * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpObjectToken * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpObjectToken * This, + ULONG Index, + WCHAR **ppszValueName); + + HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpObjectToken * This, + const WCHAR *pszCategoryId, + const WCHAR *pszTokenId, + BOOL fCreateIfNotExist); + + HRESULT ( STDMETHODCALLTYPE *GetId )( + ISpObjectToken * This, + WCHAR **ppszCoMemTokenId); + + HRESULT ( STDMETHODCALLTYPE *GetCategory )( + ISpObjectToken * This, + ISpObjectTokenCategory **ppTokenCategory); + + HRESULT ( STDMETHODCALLTYPE *CreateInstance )( + ISpObjectToken * This, + /* [in] */ IUnknown *pUnkOuter, + /* [in] */ DWORD dwClsContext, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + HRESULT ( STDMETHODCALLTYPE *GetStorageFileName )( + ISpObjectToken * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszValueName, + /* [in] */ const WCHAR *pszFileNameSpecifier, + /* [in] */ ULONG nFolder, + /* [out] */ WCHAR **ppszFilePath); + + HRESULT ( STDMETHODCALLTYPE *RemoveStorageFileName )( + ISpObjectToken * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszKeyName, + /* [in] */ BOOL fDeleteFile); + + HRESULT ( STDMETHODCALLTYPE *Remove )( + ISpObjectToken * This, + const CLSID *pclsidCaller); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpObjectToken * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpObjectToken * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject); + + HRESULT ( STDMETHODCALLTYPE *MatchesAttributes )( + ISpObjectToken * This, + /* [in] */ const WCHAR *pszAttributes, + /* [out] */ BOOL *pfMatches); + + END_INTERFACE + } ISpObjectTokenVtbl; + + interface ISpObjectToken + { + CONST_VTBL struct ISpObjectTokenVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectToken_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectToken_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectToken_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectToken_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpObjectToken_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpObjectToken_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpObjectToken_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpObjectToken_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpObjectToken_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpObjectToken_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpObjectToken_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpObjectToken_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpObjectToken_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpObjectToken_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpObjectToken_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + + +#define ISpObjectToken_SetId(This,pszCategoryId,pszTokenId,fCreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,pszCategoryId,pszTokenId,fCreateIfNotExist) + +#define ISpObjectToken_GetId(This,ppszCoMemTokenId) \ + (This)->lpVtbl -> GetId(This,ppszCoMemTokenId) + +#define ISpObjectToken_GetCategory(This,ppTokenCategory) \ + (This)->lpVtbl -> GetCategory(This,ppTokenCategory) + +#define ISpObjectToken_CreateInstance(This,pUnkOuter,dwClsContext,riid,ppvObject) \ + (This)->lpVtbl -> CreateInstance(This,pUnkOuter,dwClsContext,riid,ppvObject) + +#define ISpObjectToken_GetStorageFileName(This,clsidCaller,pszValueName,pszFileNameSpecifier,nFolder,ppszFilePath) \ + (This)->lpVtbl -> GetStorageFileName(This,clsidCaller,pszValueName,pszFileNameSpecifier,nFolder,ppszFilePath) + +#define ISpObjectToken_RemoveStorageFileName(This,clsidCaller,pszKeyName,fDeleteFile) \ + (This)->lpVtbl -> RemoveStorageFileName(This,clsidCaller,pszKeyName,fDeleteFile) + +#define ISpObjectToken_Remove(This,pclsidCaller) \ + (This)->lpVtbl -> Remove(This,pclsidCaller) + +#define ISpObjectToken_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) + +#define ISpObjectToken_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,punkObject) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,punkObject) + +#define ISpObjectToken_MatchesAttributes(This,pszAttributes,pfMatches) \ + (This)->lpVtbl -> MatchesAttributes(This,pszAttributes,pfMatches) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_SetId_Proxy( + ISpObjectToken * This, + const WCHAR *pszCategoryId, + const WCHAR *pszTokenId, + BOOL fCreateIfNotExist); + + +void __RPC_STUB ISpObjectToken_SetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_GetId_Proxy( + ISpObjectToken * This, + WCHAR **ppszCoMemTokenId); + + +void __RPC_STUB ISpObjectToken_GetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_GetCategory_Proxy( + ISpObjectToken * This, + ISpObjectTokenCategory **ppTokenCategory); + + +void __RPC_STUB ISpObjectToken_GetCategory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_CreateInstance_Proxy( + ISpObjectToken * This, + /* [in] */ IUnknown *pUnkOuter, + /* [in] */ DWORD dwClsContext, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + +void __RPC_STUB ISpObjectToken_CreateInstance_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_GetStorageFileName_Proxy( + ISpObjectToken * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszValueName, + /* [in] */ const WCHAR *pszFileNameSpecifier, + /* [in] */ ULONG nFolder, + /* [out] */ WCHAR **ppszFilePath); + + +void __RPC_STUB ISpObjectToken_GetStorageFileName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_RemoveStorageFileName_Proxy( + ISpObjectToken * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszKeyName, + /* [in] */ BOOL fDeleteFile); + + +void __RPC_STUB ISpObjectToken_RemoveStorageFileName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_Remove_Proxy( + ISpObjectToken * This, + const CLSID *pclsidCaller); + + +void __RPC_STUB ISpObjectToken_Remove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpObjectToken_IsUISupported_Proxy( + ISpObjectToken * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + +void __RPC_STUB ISpObjectToken_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpObjectToken_DisplayUI_Proxy( + ISpObjectToken * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject); + + +void __RPC_STUB ISpObjectToken_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_MatchesAttributes_Proxy( + ISpObjectToken * This, + /* [in] */ const WCHAR *pszAttributes, + /* [out] */ BOOL *pfMatches); + + +void __RPC_STUB ISpObjectToken_MatchesAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectToken_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectTokenInit_INTERFACE_DEFINED__ +#define __ISpObjectTokenInit_INTERFACE_DEFINED__ + +/* interface ISpObjectTokenInit */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectTokenInit; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B8AAB0CF-346F-49D8-9499-C8B03F161D51") + ISpObjectTokenInit : public ISpObjectToken + { + public: + virtual HRESULT STDMETHODCALLTYPE InitFromDataKey( + /* [in] */ const WCHAR *pszCategoryId, + /* [in] */ const WCHAR *pszTokenId, + /* [in] */ ISpDataKey *pDataKey) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectTokenInitVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectTokenInit * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectTokenInit * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectTokenInit * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpObjectTokenInit * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpObjectTokenInit * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpObjectTokenInit * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpObjectTokenInit * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpObjectTokenInit * This, + ULONG Index, + WCHAR **ppszValueName); + + HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpObjectTokenInit * This, + const WCHAR *pszCategoryId, + const WCHAR *pszTokenId, + BOOL fCreateIfNotExist); + + HRESULT ( STDMETHODCALLTYPE *GetId )( + ISpObjectTokenInit * This, + WCHAR **ppszCoMemTokenId); + + HRESULT ( STDMETHODCALLTYPE *GetCategory )( + ISpObjectTokenInit * This, + ISpObjectTokenCategory **ppTokenCategory); + + HRESULT ( STDMETHODCALLTYPE *CreateInstance )( + ISpObjectTokenInit * This, + /* [in] */ IUnknown *pUnkOuter, + /* [in] */ DWORD dwClsContext, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + HRESULT ( STDMETHODCALLTYPE *GetStorageFileName )( + ISpObjectTokenInit * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszValueName, + /* [in] */ const WCHAR *pszFileNameSpecifier, + /* [in] */ ULONG nFolder, + /* [out] */ WCHAR **ppszFilePath); + + HRESULT ( STDMETHODCALLTYPE *RemoveStorageFileName )( + ISpObjectTokenInit * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszKeyName, + /* [in] */ BOOL fDeleteFile); + + HRESULT ( STDMETHODCALLTYPE *Remove )( + ISpObjectTokenInit * This, + const CLSID *pclsidCaller); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpObjectTokenInit * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpObjectTokenInit * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject); + + HRESULT ( STDMETHODCALLTYPE *MatchesAttributes )( + ISpObjectTokenInit * This, + /* [in] */ const WCHAR *pszAttributes, + /* [out] */ BOOL *pfMatches); + + HRESULT ( STDMETHODCALLTYPE *InitFromDataKey )( + ISpObjectTokenInit * This, + /* [in] */ const WCHAR *pszCategoryId, + /* [in] */ const WCHAR *pszTokenId, + /* [in] */ ISpDataKey *pDataKey); + + END_INTERFACE + } ISpObjectTokenInitVtbl; + + interface ISpObjectTokenInit + { + CONST_VTBL struct ISpObjectTokenInitVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectTokenInit_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectTokenInit_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectTokenInit_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectTokenInit_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpObjectTokenInit_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpObjectTokenInit_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpObjectTokenInit_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpObjectTokenInit_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpObjectTokenInit_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpObjectTokenInit_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpObjectTokenInit_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpObjectTokenInit_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpObjectTokenInit_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpObjectTokenInit_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpObjectTokenInit_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + + +#define ISpObjectTokenInit_SetId(This,pszCategoryId,pszTokenId,fCreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,pszCategoryId,pszTokenId,fCreateIfNotExist) + +#define ISpObjectTokenInit_GetId(This,ppszCoMemTokenId) \ + (This)->lpVtbl -> GetId(This,ppszCoMemTokenId) + +#define ISpObjectTokenInit_GetCategory(This,ppTokenCategory) \ + (This)->lpVtbl -> GetCategory(This,ppTokenCategory) + +#define ISpObjectTokenInit_CreateInstance(This,pUnkOuter,dwClsContext,riid,ppvObject) \ + (This)->lpVtbl -> CreateInstance(This,pUnkOuter,dwClsContext,riid,ppvObject) + +#define ISpObjectTokenInit_GetStorageFileName(This,clsidCaller,pszValueName,pszFileNameSpecifier,nFolder,ppszFilePath) \ + (This)->lpVtbl -> GetStorageFileName(This,clsidCaller,pszValueName,pszFileNameSpecifier,nFolder,ppszFilePath) + +#define ISpObjectTokenInit_RemoveStorageFileName(This,clsidCaller,pszKeyName,fDeleteFile) \ + (This)->lpVtbl -> RemoveStorageFileName(This,clsidCaller,pszKeyName,fDeleteFile) + +#define ISpObjectTokenInit_Remove(This,pclsidCaller) \ + (This)->lpVtbl -> Remove(This,pclsidCaller) + +#define ISpObjectTokenInit_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) + +#define ISpObjectTokenInit_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,punkObject) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,punkObject) + +#define ISpObjectTokenInit_MatchesAttributes(This,pszAttributes,pfMatches) \ + (This)->lpVtbl -> MatchesAttributes(This,pszAttributes,pfMatches) + + +#define ISpObjectTokenInit_InitFromDataKey(This,pszCategoryId,pszTokenId,pDataKey) \ + (This)->lpVtbl -> InitFromDataKey(This,pszCategoryId,pszTokenId,pDataKey) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenInit_InitFromDataKey_Proxy( + ISpObjectTokenInit * This, + /* [in] */ const WCHAR *pszCategoryId, + /* [in] */ const WCHAR *pszTokenId, + /* [in] */ ISpDataKey *pDataKey); + + +void __RPC_STUB ISpObjectTokenInit_InitFromDataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectTokenInit_INTERFACE_DEFINED__ */ + + +#ifndef __IEnumSpObjectTokens_INTERFACE_DEFINED__ +#define __IEnumSpObjectTokens_INTERFACE_DEFINED__ + +/* interface IEnumSpObjectTokens */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IEnumSpObjectTokens; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("06B64F9E-7FDA-11D2-B4F2-00C04F797396") + IEnumSpObjectTokens : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ ISpObjectToken **pelt, + /* [out] */ ULONG *pceltFetched) = 0; + + virtual HRESULT STDMETHODCALLTYPE Skip( + /* [in] */ ULONG celt) = 0; + + virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Clone( + /* [out] */ IEnumSpObjectTokens **ppEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE Item( + /* [in] */ ULONG Index, + /* [out] */ ISpObjectToken **ppToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCount( + /* [out] */ ULONG *pCount) = 0; + + }; + +#else /* C style interface */ + + typedef struct IEnumSpObjectTokensVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IEnumSpObjectTokens * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IEnumSpObjectTokens * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IEnumSpObjectTokens * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IEnumSpObjectTokens * This, + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ ISpObjectToken **pelt, + /* [out] */ ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + IEnumSpObjectTokens * This, + /* [in] */ ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + IEnumSpObjectTokens * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + IEnumSpObjectTokens * This, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + HRESULT ( STDMETHODCALLTYPE *Item )( + IEnumSpObjectTokens * This, + /* [in] */ ULONG Index, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *GetCount )( + IEnumSpObjectTokens * This, + /* [out] */ ULONG *pCount); + + END_INTERFACE + } IEnumSpObjectTokensVtbl; + + interface IEnumSpObjectTokens + { + CONST_VTBL struct IEnumSpObjectTokensVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IEnumSpObjectTokens_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IEnumSpObjectTokens_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IEnumSpObjectTokens_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IEnumSpObjectTokens_Next(This,celt,pelt,pceltFetched) \ + (This)->lpVtbl -> Next(This,celt,pelt,pceltFetched) + +#define IEnumSpObjectTokens_Skip(This,celt) \ + (This)->lpVtbl -> Skip(This,celt) + +#define IEnumSpObjectTokens_Reset(This) \ + (This)->lpVtbl -> Reset(This) + +#define IEnumSpObjectTokens_Clone(This,ppEnum) \ + (This)->lpVtbl -> Clone(This,ppEnum) + +#define IEnumSpObjectTokens_Item(This,Index,ppToken) \ + (This)->lpVtbl -> Item(This,Index,ppToken) + +#define IEnumSpObjectTokens_GetCount(This,pCount) \ + (This)->lpVtbl -> GetCount(This,pCount) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Next_Proxy( + IEnumSpObjectTokens * This, + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ ISpObjectToken **pelt, + /* [out] */ ULONG *pceltFetched); + + +void __RPC_STUB IEnumSpObjectTokens_Next_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Skip_Proxy( + IEnumSpObjectTokens * This, + /* [in] */ ULONG celt); + + +void __RPC_STUB IEnumSpObjectTokens_Skip_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Reset_Proxy( + IEnumSpObjectTokens * This); + + +void __RPC_STUB IEnumSpObjectTokens_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Clone_Proxy( + IEnumSpObjectTokens * This, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + +void __RPC_STUB IEnumSpObjectTokens_Clone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Item_Proxy( + IEnumSpObjectTokens * This, + /* [in] */ ULONG Index, + /* [out] */ ISpObjectToken **ppToken); + + +void __RPC_STUB IEnumSpObjectTokens_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_GetCount_Proxy( + IEnumSpObjectTokens * This, + /* [out] */ ULONG *pCount); + + +void __RPC_STUB IEnumSpObjectTokens_GetCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IEnumSpObjectTokens_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectWithToken_INTERFACE_DEFINED__ +#define __ISpObjectWithToken_INTERFACE_DEFINED__ + +/* interface ISpObjectWithToken */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectWithToken; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5B559F40-E952-11D2-BB91-00C04F8EE6C0") + ISpObjectWithToken : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetObjectToken( + ISpObjectToken *pToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetObjectToken( + ISpObjectToken **ppToken) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectWithTokenVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectWithToken * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectWithToken * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectWithToken * This); + + HRESULT ( STDMETHODCALLTYPE *SetObjectToken )( + ISpObjectWithToken * This, + ISpObjectToken *pToken); + + HRESULT ( STDMETHODCALLTYPE *GetObjectToken )( + ISpObjectWithToken * This, + ISpObjectToken **ppToken); + + END_INTERFACE + } ISpObjectWithTokenVtbl; + + interface ISpObjectWithToken + { + CONST_VTBL struct ISpObjectWithTokenVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectWithToken_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectWithToken_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectWithToken_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectWithToken_SetObjectToken(This,pToken) \ + (This)->lpVtbl -> SetObjectToken(This,pToken) + +#define ISpObjectWithToken_GetObjectToken(This,ppToken) \ + (This)->lpVtbl -> GetObjectToken(This,ppToken) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectWithToken_SetObjectToken_Proxy( + ISpObjectWithToken * This, + ISpObjectToken *pToken); + + +void __RPC_STUB ISpObjectWithToken_SetObjectToken_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectWithToken_GetObjectToken_Proxy( + ISpObjectWithToken * This, + ISpObjectToken **ppToken); + + +void __RPC_STUB ISpObjectWithToken_GetObjectToken_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectWithToken_INTERFACE_DEFINED__ */ + + +#ifndef __ISpResourceManager_INTERFACE_DEFINED__ +#define __ISpResourceManager_INTERFACE_DEFINED__ + +/* interface ISpResourceManager */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpResourceManager; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("93384E18-5014-43D5-ADBB-A78E055926BD") + ISpResourceManager : public IServiceProvider + { + public: + virtual HRESULT STDMETHODCALLTYPE SetObject( + /* [in] */ REFGUID guidServiceId, + /* [in] */ IUnknown *pUnkObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetObject( + /* [in] */ REFGUID guidServiceId, + /* [in] */ REFCLSID ObjectCLSID, + /* [in] */ REFIID ObjectIID, + /* [in] */ BOOL fReleaseWhenLastExternalRefReleased, + /* [iid_is][out] */ void **ppObject) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpResourceManagerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpResourceManager * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpResourceManager * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpResourceManager * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *QueryService )( + ISpResourceManager * This, + /* [in] */ REFGUID guidService, + /* [in] */ REFIID riid, + /* [out] */ void **ppvObject); + + HRESULT ( STDMETHODCALLTYPE *SetObject )( + ISpResourceManager * This, + /* [in] */ REFGUID guidServiceId, + /* [in] */ IUnknown *pUnkObject); + + HRESULT ( STDMETHODCALLTYPE *GetObject )( + ISpResourceManager * This, + /* [in] */ REFGUID guidServiceId, + /* [in] */ REFCLSID ObjectCLSID, + /* [in] */ REFIID ObjectIID, + /* [in] */ BOOL fReleaseWhenLastExternalRefReleased, + /* [iid_is][out] */ void **ppObject); + + END_INTERFACE + } ISpResourceManagerVtbl; + + interface ISpResourceManager + { + CONST_VTBL struct ISpResourceManagerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpResourceManager_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpResourceManager_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpResourceManager_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpResourceManager_QueryService(This,guidService,riid,ppvObject) \ + (This)->lpVtbl -> QueryService(This,guidService,riid,ppvObject) + + +#define ISpResourceManager_SetObject(This,guidServiceId,pUnkObject) \ + (This)->lpVtbl -> SetObject(This,guidServiceId,pUnkObject) + +#define ISpResourceManager_GetObject(This,guidServiceId,ObjectCLSID,ObjectIID,fReleaseWhenLastExternalRefReleased,ppObject) \ + (This)->lpVtbl -> GetObject(This,guidServiceId,ObjectCLSID,ObjectIID,fReleaseWhenLastExternalRefReleased,ppObject) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpResourceManager_SetObject_Proxy( + ISpResourceManager * This, + /* [in] */ REFGUID guidServiceId, + /* [in] */ IUnknown *pUnkObject); + + +void __RPC_STUB ISpResourceManager_SetObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpResourceManager_GetObject_Proxy( + ISpResourceManager * This, + /* [in] */ REFGUID guidServiceId, + /* [in] */ REFCLSID ObjectCLSID, + /* [in] */ REFIID ObjectIID, + /* [in] */ BOOL fReleaseWhenLastExternalRefReleased, + /* [iid_is][out] */ void **ppObject); + + +void __RPC_STUB ISpResourceManager_GetObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpResourceManager_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0262 */ +/* [local] */ + +typedef /* [hidden] */ +enum SPEVENTLPARAMTYPE + { SPET_LPARAM_IS_UNDEFINED = 0, + SPET_LPARAM_IS_TOKEN = SPET_LPARAM_IS_UNDEFINED + 1, + SPET_LPARAM_IS_OBJECT = SPET_LPARAM_IS_TOKEN + 1, + SPET_LPARAM_IS_POINTER = SPET_LPARAM_IS_OBJECT + 1, + SPET_LPARAM_IS_STRING = SPET_LPARAM_IS_POINTER + 1 + } SPEVENTLPARAMTYPE; + +typedef /* [hidden] */ +enum SPEVENTENUM + { SPEI_UNDEFINED = 0, + SPEI_START_INPUT_STREAM = 1, + SPEI_END_INPUT_STREAM = 2, + SPEI_VOICE_CHANGE = 3, + SPEI_TTS_BOOKMARK = 4, + SPEI_WORD_BOUNDARY = 5, + SPEI_PHONEME = 6, + SPEI_SENTENCE_BOUNDARY = 7, + SPEI_VISEME = 8, + SPEI_TTS_AUDIO_LEVEL = 9, + SPEI_TTS_PRIVATE = 15, + SPEI_MIN_TTS = 1, + SPEI_MAX_TTS = 15, + SPEI_END_SR_STREAM = 34, + SPEI_SOUND_START = 35, + SPEI_SOUND_END = 36, + SPEI_PHRASE_START = 37, + SPEI_RECOGNITION = 38, + SPEI_HYPOTHESIS = 39, + SPEI_SR_BOOKMARK = 40, + SPEI_PROPERTY_NUM_CHANGE = 41, + SPEI_PROPERTY_STRING_CHANGE = 42, + SPEI_FALSE_RECOGNITION = 43, + SPEI_INTERFERENCE = 44, + SPEI_REQUEST_UI = 45, + SPEI_RECO_STATE_CHANGE = 46, + SPEI_ADAPTATION = 47, + SPEI_START_SR_STREAM = 48, + SPEI_RECO_OTHER_CONTEXT = 49, + SPEI_SR_AUDIO_LEVEL = 50, + SPEI_SR_PRIVATE = 52, + SPEI_MIN_SR = 34, + SPEI_MAX_SR = 52, + SPEI_RESERVED1 = 30, + SPEI_RESERVED2 = 33, + SPEI_RESERVED3 = 63 + } SPEVENTENUM; + +#define SPFEI_FLAGCHECK ( (1ui64 << SPEI_RESERVED1) | (1ui64 << SPEI_RESERVED2) ) +#define SPFEI_ALL_TTS_EVENTS (0x000000000000FFFEui64 | SPFEI_FLAGCHECK) +#define SPFEI_ALL_SR_EVENTS (0x001FFFFC00000000ui64 | SPFEI_FLAGCHECK) +#define SPFEI_ALL_EVENTS 0xEFFFFFFFFFFFFFFFui64 +#define SPFEI(SPEI_ord) ((1ui64 << SPEI_ord) | SPFEI_FLAGCHECK) +#if 0 +typedef /* [hidden][restricted] */ struct SPEVENT + { + WORD eEventId; + WORD elParamType; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + WPARAM wParam; + LPARAM lParam; + } SPEVENT; + +typedef /* [hidden][restricted] */ struct SPSERIALIZEDEVENT + { + WORD eEventId; + WORD elParamType; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + ULONG SerializedwParam; + LONG SerializedlParam; + } SPSERIALIZEDEVENT; + +typedef /* [hidden][restricted] */ struct SPSERIALIZEDEVENT64 + { + WORD eEventId; + WORD elParamType; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + ULONGLONG SerializedwParam; + LONGLONG SerializedlParam; + } SPSERIALIZEDEVENT64; + +#else +typedef struct SPEVENT +{ + SPEVENTENUM eEventId : 16; + SPEVENTLPARAMTYPE elParamType : 16; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + WPARAM wParam; + LPARAM lParam; +} SPEVENT; +typedef struct SPSERIALIZEDEVENT +{ + SPEVENTENUM eEventId : 16; + SPEVENTLPARAMTYPE elParamType : 16; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + ULONG SerializedwParam; + LONG SerializedlParam; +} SPSERIALIZEDEVENT; +typedef struct SPSERIALIZEDEVENT64 +{ + SPEVENTENUM eEventId : 16; + SPEVENTLPARAMTYPE elParamType : 16; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + ULONGLONG SerializedwParam; + LONGLONG SerializedlParam; +} SPSERIALIZEDEVENT64; +#endif +typedef /* [hidden] */ +enum SPINTERFERENCE + { SPINTERFERENCE_NONE = 0, + SPINTERFERENCE_NOISE = SPINTERFERENCE_NONE + 1, + SPINTERFERENCE_NOSIGNAL = SPINTERFERENCE_NOISE + 1, + SPINTERFERENCE_TOOLOUD = SPINTERFERENCE_NOSIGNAL + 1, + SPINTERFERENCE_TOOQUIET = SPINTERFERENCE_TOOLOUD + 1, + SPINTERFERENCE_TOOFAST = SPINTERFERENCE_TOOQUIET + 1, + SPINTERFERENCE_TOOSLOW = SPINTERFERENCE_TOOFAST + 1 + } SPINTERFERENCE; + +typedef /* [hidden] */ +enum SPENDSRSTREAMFLAGS + { SPESF_NONE = 0, + SPESF_STREAM_RELEASED = 1 << 0 + } SPENDSRSTREAMFLAGS; + +typedef /* [hidden] */ +enum SPVFEATURE + { SPVFEATURE_STRESSED = 1L << 0, + SPVFEATURE_EMPHASIS = 1L << 1 + } SPVFEATURE; + +typedef /* [hidden] */ +enum SPVISEMES + { SP_VISEME_0 = 0, + SP_VISEME_1 = SP_VISEME_0 + 1, + SP_VISEME_2 = SP_VISEME_1 + 1, + SP_VISEME_3 = SP_VISEME_2 + 1, + SP_VISEME_4 = SP_VISEME_3 + 1, + SP_VISEME_5 = SP_VISEME_4 + 1, + SP_VISEME_6 = SP_VISEME_5 + 1, + SP_VISEME_7 = SP_VISEME_6 + 1, + SP_VISEME_8 = SP_VISEME_7 + 1, + SP_VISEME_9 = SP_VISEME_8 + 1, + SP_VISEME_10 = SP_VISEME_9 + 1, + SP_VISEME_11 = SP_VISEME_10 + 1, + SP_VISEME_12 = SP_VISEME_11 + 1, + SP_VISEME_13 = SP_VISEME_12 + 1, + SP_VISEME_14 = SP_VISEME_13 + 1, + SP_VISEME_15 = SP_VISEME_14 + 1, + SP_VISEME_16 = SP_VISEME_15 + 1, + SP_VISEME_17 = SP_VISEME_16 + 1, + SP_VISEME_18 = SP_VISEME_17 + 1, + SP_VISEME_19 = SP_VISEME_18 + 1, + SP_VISEME_20 = SP_VISEME_19 + 1, + SP_VISEME_21 = SP_VISEME_20 + 1 + } SPVISEMES; + +typedef /* [hidden][restricted] */ struct SPEVENTSOURCEINFO + { + ULONGLONG ullEventInterest; + ULONGLONG ullQueuedInterest; + ULONG ulCount; + } SPEVENTSOURCEINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0262_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0262_v0_0_s_ifspec; + +#ifndef __ISpEventSource_INTERFACE_DEFINED__ +#define __ISpEventSource_INTERFACE_DEFINED__ + +/* interface ISpEventSource */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpEventSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BE7A9CCE-5F9E-11D2-960F-00C04F8EE628") + ISpEventSource : public ISpNotifySource + { + public: + virtual HRESULT STDMETHODCALLTYPE SetInterest( + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetEvents( + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInfo( + /* [out] */ SPEVENTSOURCEINFO *pInfo) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpEventSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpEventSource * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpEventSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpEventSource * This); + + HRESULT ( STDMETHODCALLTYPE *SetNotifySink )( + ISpEventSource * This, + /* [in] */ ISpNotifySink *pNotifySink); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWindowMessage )( + ISpEventSource * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackFunction )( + ISpEventSource * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackInterface )( + ISpEventSource * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWin32Event )( + ISpEventSource * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForNotifyEvent )( + ISpEventSource * This, + /* [in] */ DWORD dwMilliseconds); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *GetNotifyEventHandle )( + ISpEventSource * This); + + HRESULT ( STDMETHODCALLTYPE *SetInterest )( + ISpEventSource * This, + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest); + + HRESULT ( STDMETHODCALLTYPE *GetEvents )( + ISpEventSource * This, + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched); + + HRESULT ( STDMETHODCALLTYPE *GetInfo )( + ISpEventSource * This, + /* [out] */ SPEVENTSOURCEINFO *pInfo); + + END_INTERFACE + } ISpEventSourceVtbl; + + interface ISpEventSource + { + CONST_VTBL struct ISpEventSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpEventSource_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpEventSource_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpEventSource_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpEventSource_SetNotifySink(This,pNotifySink) \ + (This)->lpVtbl -> SetNotifySink(This,pNotifySink) + +#define ISpEventSource_SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpEventSource_SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) + +#define ISpEventSource_SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) + +#define ISpEventSource_SetNotifyWin32Event(This) \ + (This)->lpVtbl -> SetNotifyWin32Event(This) + +#define ISpEventSource_WaitForNotifyEvent(This,dwMilliseconds) \ + (This)->lpVtbl -> WaitForNotifyEvent(This,dwMilliseconds) + +#define ISpEventSource_GetNotifyEventHandle(This) \ + (This)->lpVtbl -> GetNotifyEventHandle(This) + + +#define ISpEventSource_SetInterest(This,ullEventInterest,ullQueuedInterest) \ + (This)->lpVtbl -> SetInterest(This,ullEventInterest,ullQueuedInterest) + +#define ISpEventSource_GetEvents(This,ulCount,pEventArray,pulFetched) \ + (This)->lpVtbl -> GetEvents(This,ulCount,pEventArray,pulFetched) + +#define ISpEventSource_GetInfo(This,pInfo) \ + (This)->lpVtbl -> GetInfo(This,pInfo) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpEventSource_SetInterest_Proxy( + ISpEventSource * This, + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest); + + +void __RPC_STUB ISpEventSource_SetInterest_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpEventSource_GetEvents_Proxy( + ISpEventSource * This, + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched); + + +void __RPC_STUB ISpEventSource_GetEvents_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpEventSource_GetInfo_Proxy( + ISpEventSource * This, + /* [out] */ SPEVENTSOURCEINFO *pInfo); + + +void __RPC_STUB ISpEventSource_GetInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpEventSource_INTERFACE_DEFINED__ */ + + +#ifndef __ISpEventSink_INTERFACE_DEFINED__ +#define __ISpEventSink_INTERFACE_DEFINED__ + +/* interface ISpEventSink */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpEventSink; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BE7A9CC9-5F9E-11D2-960F-00C04F8EE628") + ISpEventSink : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AddEvents( + /* [in] */ const SPEVENT *pEventArray, + /* [in] */ ULONG ulCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetEventInterest( + /* [out] */ ULONGLONG *pullEventInterest) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpEventSinkVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpEventSink * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpEventSink * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpEventSink * This); + + HRESULT ( STDMETHODCALLTYPE *AddEvents )( + ISpEventSink * This, + /* [in] */ const SPEVENT *pEventArray, + /* [in] */ ULONG ulCount); + + HRESULT ( STDMETHODCALLTYPE *GetEventInterest )( + ISpEventSink * This, + /* [out] */ ULONGLONG *pullEventInterest); + + END_INTERFACE + } ISpEventSinkVtbl; + + interface ISpEventSink + { + CONST_VTBL struct ISpEventSinkVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpEventSink_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpEventSink_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpEventSink_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpEventSink_AddEvents(This,pEventArray,ulCount) \ + (This)->lpVtbl -> AddEvents(This,pEventArray,ulCount) + +#define ISpEventSink_GetEventInterest(This,pullEventInterest) \ + (This)->lpVtbl -> GetEventInterest(This,pullEventInterest) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpEventSink_AddEvents_Proxy( + ISpEventSink * This, + /* [in] */ const SPEVENT *pEventArray, + /* [in] */ ULONG ulCount); + + +void __RPC_STUB ISpEventSink_AddEvents_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpEventSink_GetEventInterest_Proxy( + ISpEventSink * This, + /* [out] */ ULONGLONG *pullEventInterest); + + +void __RPC_STUB ISpEventSink_GetEventInterest_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpEventSink_INTERFACE_DEFINED__ */ + + +#ifndef __ISpStreamFormat_INTERFACE_DEFINED__ +#define __ISpStreamFormat_INTERFACE_DEFINED__ + +/* interface ISpStreamFormat */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpStreamFormat; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BED530BE-2606-4F4D-A1C0-54C5CDA5566F") + ISpStreamFormat : public IStream + { + public: + virtual HRESULT STDMETHODCALLTYPE GetFormat( + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpStreamFormatVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpStreamFormat * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpStreamFormat * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpStreamFormat * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpStreamFormat * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpStreamFormat * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpStreamFormat * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpStreamFormat * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpStreamFormat * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpStreamFormat * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpStreamFormat * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpStreamFormat * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpStreamFormat * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpStreamFormat * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpStreamFormat * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpStreamFormat * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + END_INTERFACE + } ISpStreamFormatVtbl; + + interface ISpStreamFormat + { + CONST_VTBL struct ISpStreamFormatVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpStreamFormat_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpStreamFormat_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpStreamFormat_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpStreamFormat_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpStreamFormat_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpStreamFormat_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpStreamFormat_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpStreamFormat_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpStreamFormat_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpStreamFormat_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpStreamFormat_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpStreamFormat_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpStreamFormat_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpStreamFormat_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpStreamFormat_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpStreamFormat_GetFormat_Proxy( + ISpStreamFormat * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + +void __RPC_STUB ISpStreamFormat_GetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpStreamFormat_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0265 */ +/* [local] */ + +typedef /* [hidden] */ +enum SPFILEMODE + { SPFM_OPEN_READONLY = 0, + SPFM_OPEN_READWRITE = SPFM_OPEN_READONLY + 1, + SPFM_CREATE = SPFM_OPEN_READWRITE + 1, + SPFM_CREATE_ALWAYS = SPFM_CREATE + 1, + SPFM_NUM_MODES = SPFM_CREATE_ALWAYS + 1 + } SPFILEMODE; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0265_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0265_v0_0_s_ifspec; + +#ifndef __ISpStream_INTERFACE_DEFINED__ +#define __ISpStream_INTERFACE_DEFINED__ + +/* interface ISpStream */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("12E3CCA9-7518-44C5-A5E7-BA5A79CB929E") + ISpStream : public ISpStreamFormat + { + public: + virtual HRESULT STDMETHODCALLTYPE SetBaseStream( + IStream *pStream, + REFGUID rguidFormat, + const WAVEFORMATEX *pWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBaseStream( + IStream **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE BindToFile( + const WCHAR *pszFileName, + SPFILEMODE eMode, + const GUID *pFormatId, + const WAVEFORMATEX *pWaveFormatEx, + ULONGLONG ullEventInterest) = 0; + + virtual HRESULT STDMETHODCALLTYPE Close( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpStream * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpStream * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpStream * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpStream * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpStream * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpStream * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpStream * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpStream * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpStream * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpStream * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpStream * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpStream * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpStream * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *SetBaseStream )( + ISpStream * This, + IStream *pStream, + REFGUID rguidFormat, + const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetBaseStream )( + ISpStream * This, + IStream **ppStream); + + HRESULT ( STDMETHODCALLTYPE *BindToFile )( + ISpStream * This, + const WCHAR *pszFileName, + SPFILEMODE eMode, + const GUID *pFormatId, + const WAVEFORMATEX *pWaveFormatEx, + ULONGLONG ullEventInterest); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ISpStream * This); + + END_INTERFACE + } ISpStreamVtbl; + + interface ISpStream + { + CONST_VTBL struct ISpStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpStream_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpStream_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpStream_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpStream_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpStream_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpStream_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpStream_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpStream_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpStream_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpStream_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpStream_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpStream_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + + +#define ISpStream_SetBaseStream(This,pStream,rguidFormat,pWaveFormatEx) \ + (This)->lpVtbl -> SetBaseStream(This,pStream,rguidFormat,pWaveFormatEx) + +#define ISpStream_GetBaseStream(This,ppStream) \ + (This)->lpVtbl -> GetBaseStream(This,ppStream) + +#define ISpStream_BindToFile(This,pszFileName,eMode,pFormatId,pWaveFormatEx,ullEventInterest) \ + (This)->lpVtbl -> BindToFile(This,pszFileName,eMode,pFormatId,pWaveFormatEx,ullEventInterest) + +#define ISpStream_Close(This) \ + (This)->lpVtbl -> Close(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpStream_SetBaseStream_Proxy( + ISpStream * This, + IStream *pStream, + REFGUID rguidFormat, + const WAVEFORMATEX *pWaveFormatEx); + + +void __RPC_STUB ISpStream_SetBaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStream_GetBaseStream_Proxy( + ISpStream * This, + IStream **ppStream); + + +void __RPC_STUB ISpStream_GetBaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStream_BindToFile_Proxy( + ISpStream * This, + const WCHAR *pszFileName, + SPFILEMODE eMode, + const GUID *pFormatId, + const WAVEFORMATEX *pWaveFormatEx, + ULONGLONG ullEventInterest); + + +void __RPC_STUB ISpStream_BindToFile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStream_Close_Proxy( + ISpStream * This); + + +void __RPC_STUB ISpStream_Close_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpStreamFormatConverter_INTERFACE_DEFINED__ +#define __ISpStreamFormatConverter_INTERFACE_DEFINED__ + +/* interface ISpStreamFormatConverter */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpStreamFormatConverter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("678A932C-EA71-4446-9B41-78FDA6280A29") + ISpStreamFormatConverter : public ISpStreamFormat + { + public: + virtual HRESULT STDMETHODCALLTYPE SetBaseStream( + /* [in] */ ISpStreamFormat *pStream, + /* [in] */ BOOL fSetFormatToBaseStreamFormat, + /* [in] */ BOOL fWriteToBaseStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBaseStream( + /* [out] */ ISpStreamFormat **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFormat( + /* [in] */ REFGUID rguidFormatIdOfConvertedStream, + /* [in] */ const WAVEFORMATEX *pWaveFormatExOfConvertedStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE ResetSeekPosition( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScaleConvertedToBaseOffset( + /* [in] */ ULONGLONG ullOffsetConvertedStream, + /* [out] */ ULONGLONG *pullOffsetBaseStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScaleBaseToConvertedOffset( + /* [in] */ ULONGLONG ullOffsetBaseStream, + /* [out] */ ULONGLONG *pullOffsetConvertedStream) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpStreamFormatConverterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpStreamFormatConverter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpStreamFormatConverter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpStreamFormatConverter * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpStreamFormatConverter * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpStreamFormatConverter * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpStreamFormatConverter * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpStreamFormatConverter * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpStreamFormatConverter * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpStreamFormatConverter * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpStreamFormatConverter * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpStreamFormatConverter * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpStreamFormatConverter * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpStreamFormatConverter * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpStreamFormatConverter * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpStreamFormatConverter * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *SetBaseStream )( + ISpStreamFormatConverter * This, + /* [in] */ ISpStreamFormat *pStream, + /* [in] */ BOOL fSetFormatToBaseStreamFormat, + /* [in] */ BOOL fWriteToBaseStream); + + HRESULT ( STDMETHODCALLTYPE *GetBaseStream )( + ISpStreamFormatConverter * This, + /* [out] */ ISpStreamFormat **ppStream); + + HRESULT ( STDMETHODCALLTYPE *SetFormat )( + ISpStreamFormatConverter * This, + /* [in] */ REFGUID rguidFormatIdOfConvertedStream, + /* [in] */ const WAVEFORMATEX *pWaveFormatExOfConvertedStream); + + HRESULT ( STDMETHODCALLTYPE *ResetSeekPosition )( + ISpStreamFormatConverter * This); + + HRESULT ( STDMETHODCALLTYPE *ScaleConvertedToBaseOffset )( + ISpStreamFormatConverter * This, + /* [in] */ ULONGLONG ullOffsetConvertedStream, + /* [out] */ ULONGLONG *pullOffsetBaseStream); + + HRESULT ( STDMETHODCALLTYPE *ScaleBaseToConvertedOffset )( + ISpStreamFormatConverter * This, + /* [in] */ ULONGLONG ullOffsetBaseStream, + /* [out] */ ULONGLONG *pullOffsetConvertedStream); + + END_INTERFACE + } ISpStreamFormatConverterVtbl; + + interface ISpStreamFormatConverter + { + CONST_VTBL struct ISpStreamFormatConverterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpStreamFormatConverter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpStreamFormatConverter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpStreamFormatConverter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpStreamFormatConverter_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpStreamFormatConverter_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpStreamFormatConverter_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpStreamFormatConverter_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpStreamFormatConverter_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpStreamFormatConverter_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpStreamFormatConverter_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpStreamFormatConverter_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpStreamFormatConverter_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpStreamFormatConverter_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpStreamFormatConverter_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpStreamFormatConverter_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + + +#define ISpStreamFormatConverter_SetBaseStream(This,pStream,fSetFormatToBaseStreamFormat,fWriteToBaseStream) \ + (This)->lpVtbl -> SetBaseStream(This,pStream,fSetFormatToBaseStreamFormat,fWriteToBaseStream) + +#define ISpStreamFormatConverter_GetBaseStream(This,ppStream) \ + (This)->lpVtbl -> GetBaseStream(This,ppStream) + +#define ISpStreamFormatConverter_SetFormat(This,rguidFormatIdOfConvertedStream,pWaveFormatExOfConvertedStream) \ + (This)->lpVtbl -> SetFormat(This,rguidFormatIdOfConvertedStream,pWaveFormatExOfConvertedStream) + +#define ISpStreamFormatConverter_ResetSeekPosition(This) \ + (This)->lpVtbl -> ResetSeekPosition(This) + +#define ISpStreamFormatConverter_ScaleConvertedToBaseOffset(This,ullOffsetConvertedStream,pullOffsetBaseStream) \ + (This)->lpVtbl -> ScaleConvertedToBaseOffset(This,ullOffsetConvertedStream,pullOffsetBaseStream) + +#define ISpStreamFormatConverter_ScaleBaseToConvertedOffset(This,ullOffsetBaseStream,pullOffsetConvertedStream) \ + (This)->lpVtbl -> ScaleBaseToConvertedOffset(This,ullOffsetBaseStream,pullOffsetConvertedStream) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_SetBaseStream_Proxy( + ISpStreamFormatConverter * This, + /* [in] */ ISpStreamFormat *pStream, + /* [in] */ BOOL fSetFormatToBaseStreamFormat, + /* [in] */ BOOL fWriteToBaseStream); + + +void __RPC_STUB ISpStreamFormatConverter_SetBaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_GetBaseStream_Proxy( + ISpStreamFormatConverter * This, + /* [out] */ ISpStreamFormat **ppStream); + + +void __RPC_STUB ISpStreamFormatConverter_GetBaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_SetFormat_Proxy( + ISpStreamFormatConverter * This, + /* [in] */ REFGUID rguidFormatIdOfConvertedStream, + /* [in] */ const WAVEFORMATEX *pWaveFormatExOfConvertedStream); + + +void __RPC_STUB ISpStreamFormatConverter_SetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_ResetSeekPosition_Proxy( + ISpStreamFormatConverter * This); + + +void __RPC_STUB ISpStreamFormatConverter_ResetSeekPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_ScaleConvertedToBaseOffset_Proxy( + ISpStreamFormatConverter * This, + /* [in] */ ULONGLONG ullOffsetConvertedStream, + /* [out] */ ULONGLONG *pullOffsetBaseStream); + + +void __RPC_STUB ISpStreamFormatConverter_ScaleConvertedToBaseOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_ScaleBaseToConvertedOffset_Proxy( + ISpStreamFormatConverter * This, + /* [in] */ ULONGLONG ullOffsetBaseStream, + /* [out] */ ULONGLONG *pullOffsetConvertedStream); + + +void __RPC_STUB ISpStreamFormatConverter_ScaleBaseToConvertedOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpStreamFormatConverter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0267 */ +/* [local] */ + +typedef /* [hidden] */ +enum _SPAUDIOSTATE + { SPAS_CLOSED = 0, + SPAS_STOP = SPAS_CLOSED + 1, + SPAS_PAUSE = SPAS_STOP + 1, + SPAS_RUN = SPAS_PAUSE + 1 + } SPAUDIOSTATE; + +typedef /* [hidden][restricted] */ struct SPAUDIOSTATUS + { + long cbFreeBuffSpace; + ULONG cbNonBlockingIO; + SPAUDIOSTATE State; + ULONGLONG CurSeekPos; + ULONGLONG CurDevicePos; + DWORD dwReserved1; + DWORD dwReserved2; + } SPAUDIOSTATUS; + +typedef /* [hidden][restricted] */ struct SPAUDIOBUFFERINFO + { + ULONG ulMsMinNotification; + ULONG ulMsBufferSize; + ULONG ulMsEventBias; + } SPAUDIOBUFFERINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0267_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0267_v0_0_s_ifspec; + +#ifndef __ISpAudio_INTERFACE_DEFINED__ +#define __ISpAudio_INTERFACE_DEFINED__ + +/* interface ISpAudio */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpAudio; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C05C768F-FAE8-4EC2-8E07-338321C12452") + ISpAudio : public ISpStreamFormat + { + public: + virtual HRESULT STDMETHODCALLTYPE SetState( + /* [in] */ SPAUDIOSTATE NewState, + /* [in] */ ULONGLONG ullReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFormat( + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatus( + /* [out] */ SPAUDIOSTATUS *pStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBufferInfo( + /* [in] */ const SPAUDIOBUFFERINFO *pBuffInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferInfo( + /* [out] */ SPAUDIOBUFFERINFO *pBuffInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDefaultFormat( + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWaveFormatEx) = 0; + + virtual HANDLE STDMETHODCALLTYPE EventHandle( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVolumeLevel( + /* [out] */ ULONG *pLevel) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVolumeLevel( + /* [in] */ ULONG Level) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferNotifySize( + /* [out] */ ULONG *pcbSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBufferNotifySize( + /* [in] */ ULONG cbSize) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpAudioVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpAudio * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpAudio * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpAudio * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpAudio * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpAudio * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpAudio * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpAudio * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpAudio * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpAudio * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpAudio * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpAudio * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpAudio * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpAudio * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpAudio * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpAudio * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *SetState )( + ISpAudio * This, + /* [in] */ SPAUDIOSTATE NewState, + /* [in] */ ULONGLONG ullReserved); + + HRESULT ( STDMETHODCALLTYPE *SetFormat )( + ISpAudio * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpAudio * This, + /* [out] */ SPAUDIOSTATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *SetBufferInfo )( + ISpAudio * This, + /* [in] */ const SPAUDIOBUFFERINFO *pBuffInfo); + + HRESULT ( STDMETHODCALLTYPE *GetBufferInfo )( + ISpAudio * This, + /* [out] */ SPAUDIOBUFFERINFO *pBuffInfo); + + HRESULT ( STDMETHODCALLTYPE *GetDefaultFormat )( + ISpAudio * This, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWaveFormatEx); + + HANDLE ( STDMETHODCALLTYPE *EventHandle )( + ISpAudio * This); + + HRESULT ( STDMETHODCALLTYPE *GetVolumeLevel )( + ISpAudio * This, + /* [out] */ ULONG *pLevel); + + HRESULT ( STDMETHODCALLTYPE *SetVolumeLevel )( + ISpAudio * This, + /* [in] */ ULONG Level); + + HRESULT ( STDMETHODCALLTYPE *GetBufferNotifySize )( + ISpAudio * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *SetBufferNotifySize )( + ISpAudio * This, + /* [in] */ ULONG cbSize); + + END_INTERFACE + } ISpAudioVtbl; + + interface ISpAudio + { + CONST_VTBL struct ISpAudioVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpAudio_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpAudio_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpAudio_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpAudio_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpAudio_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpAudio_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpAudio_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpAudio_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpAudio_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpAudio_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpAudio_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpAudio_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpAudio_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpAudio_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpAudio_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + + +#define ISpAudio_SetState(This,NewState,ullReserved) \ + (This)->lpVtbl -> SetState(This,NewState,ullReserved) + +#define ISpAudio_SetFormat(This,rguidFmtId,pWaveFormatEx) \ + (This)->lpVtbl -> SetFormat(This,rguidFmtId,pWaveFormatEx) + +#define ISpAudio_GetStatus(This,pStatus) \ + (This)->lpVtbl -> GetStatus(This,pStatus) + +#define ISpAudio_SetBufferInfo(This,pBuffInfo) \ + (This)->lpVtbl -> SetBufferInfo(This,pBuffInfo) + +#define ISpAudio_GetBufferInfo(This,pBuffInfo) \ + (This)->lpVtbl -> GetBufferInfo(This,pBuffInfo) + +#define ISpAudio_GetDefaultFormat(This,pFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetDefaultFormat(This,pFormatId,ppCoMemWaveFormatEx) + +#define ISpAudio_EventHandle(This) \ + (This)->lpVtbl -> EventHandle(This) + +#define ISpAudio_GetVolumeLevel(This,pLevel) \ + (This)->lpVtbl -> GetVolumeLevel(This,pLevel) + +#define ISpAudio_SetVolumeLevel(This,Level) \ + (This)->lpVtbl -> SetVolumeLevel(This,Level) + +#define ISpAudio_GetBufferNotifySize(This,pcbSize) \ + (This)->lpVtbl -> GetBufferNotifySize(This,pcbSize) + +#define ISpAudio_SetBufferNotifySize(This,cbSize) \ + (This)->lpVtbl -> SetBufferNotifySize(This,cbSize) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetState_Proxy( + ISpAudio * This, + /* [in] */ SPAUDIOSTATE NewState, + /* [in] */ ULONGLONG ullReserved); + + +void __RPC_STUB ISpAudio_SetState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetFormat_Proxy( + ISpAudio * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + +void __RPC_STUB ISpAudio_SetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetStatus_Proxy( + ISpAudio * This, + /* [out] */ SPAUDIOSTATUS *pStatus); + + +void __RPC_STUB ISpAudio_GetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetBufferInfo_Proxy( + ISpAudio * This, + /* [in] */ const SPAUDIOBUFFERINFO *pBuffInfo); + + +void __RPC_STUB ISpAudio_SetBufferInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetBufferInfo_Proxy( + ISpAudio * This, + /* [out] */ SPAUDIOBUFFERINFO *pBuffInfo); + + +void __RPC_STUB ISpAudio_GetBufferInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetDefaultFormat_Proxy( + ISpAudio * This, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWaveFormatEx); + + +void __RPC_STUB ISpAudio_GetDefaultFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpAudio_EventHandle_Proxy( + ISpAudio * This); + + +void __RPC_STUB ISpAudio_EventHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetVolumeLevel_Proxy( + ISpAudio * This, + /* [out] */ ULONG *pLevel); + + +void __RPC_STUB ISpAudio_GetVolumeLevel_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetVolumeLevel_Proxy( + ISpAudio * This, + /* [in] */ ULONG Level); + + +void __RPC_STUB ISpAudio_SetVolumeLevel_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetBufferNotifySize_Proxy( + ISpAudio * This, + /* [out] */ ULONG *pcbSize); + + +void __RPC_STUB ISpAudio_GetBufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetBufferNotifySize_Proxy( + ISpAudio * This, + /* [in] */ ULONG cbSize); + + +void __RPC_STUB ISpAudio_SetBufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpAudio_INTERFACE_DEFINED__ */ + + +#ifndef __ISpMMSysAudio_INTERFACE_DEFINED__ +#define __ISpMMSysAudio_INTERFACE_DEFINED__ + +/* interface ISpMMSysAudio */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpMMSysAudio; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("15806F6E-1D70-4B48-98E6-3B1A007509AB") + ISpMMSysAudio : public ISpAudio + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDeviceId( + /* [out] */ UINT *puDeviceId) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDeviceId( + /* [in] */ UINT uDeviceId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMMHandle( + void **pHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetLineId( + /* [out] */ UINT *puLineId) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetLineId( + /* [in] */ UINT uLineId) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpMMSysAudioVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpMMSysAudio * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpMMSysAudio * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpMMSysAudio * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpMMSysAudio * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpMMSysAudio * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpMMSysAudio * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpMMSysAudio * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpMMSysAudio * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpMMSysAudio * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpMMSysAudio * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpMMSysAudio * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpMMSysAudio * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpMMSysAudio * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpMMSysAudio * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpMMSysAudio * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *SetState )( + ISpMMSysAudio * This, + /* [in] */ SPAUDIOSTATE NewState, + /* [in] */ ULONGLONG ullReserved); + + HRESULT ( STDMETHODCALLTYPE *SetFormat )( + ISpMMSysAudio * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpMMSysAudio * This, + /* [out] */ SPAUDIOSTATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *SetBufferInfo )( + ISpMMSysAudio * This, + /* [in] */ const SPAUDIOBUFFERINFO *pBuffInfo); + + HRESULT ( STDMETHODCALLTYPE *GetBufferInfo )( + ISpMMSysAudio * This, + /* [out] */ SPAUDIOBUFFERINFO *pBuffInfo); + + HRESULT ( STDMETHODCALLTYPE *GetDefaultFormat )( + ISpMMSysAudio * This, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWaveFormatEx); + + HANDLE ( STDMETHODCALLTYPE *EventHandle )( + ISpMMSysAudio * This); + + HRESULT ( STDMETHODCALLTYPE *GetVolumeLevel )( + ISpMMSysAudio * This, + /* [out] */ ULONG *pLevel); + + HRESULT ( STDMETHODCALLTYPE *SetVolumeLevel )( + ISpMMSysAudio * This, + /* [in] */ ULONG Level); + + HRESULT ( STDMETHODCALLTYPE *GetBufferNotifySize )( + ISpMMSysAudio * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *SetBufferNotifySize )( + ISpMMSysAudio * This, + /* [in] */ ULONG cbSize); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceId )( + ISpMMSysAudio * This, + /* [out] */ UINT *puDeviceId); + + HRESULT ( STDMETHODCALLTYPE *SetDeviceId )( + ISpMMSysAudio * This, + /* [in] */ UINT uDeviceId); + + HRESULT ( STDMETHODCALLTYPE *GetMMHandle )( + ISpMMSysAudio * This, + void **pHandle); + + HRESULT ( STDMETHODCALLTYPE *GetLineId )( + ISpMMSysAudio * This, + /* [out] */ UINT *puLineId); + + HRESULT ( STDMETHODCALLTYPE *SetLineId )( + ISpMMSysAudio * This, + /* [in] */ UINT uLineId); + + END_INTERFACE + } ISpMMSysAudioVtbl; + + interface ISpMMSysAudio + { + CONST_VTBL struct ISpMMSysAudioVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpMMSysAudio_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpMMSysAudio_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpMMSysAudio_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpMMSysAudio_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpMMSysAudio_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpMMSysAudio_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpMMSysAudio_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpMMSysAudio_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpMMSysAudio_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpMMSysAudio_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpMMSysAudio_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpMMSysAudio_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpMMSysAudio_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpMMSysAudio_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpMMSysAudio_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + + +#define ISpMMSysAudio_SetState(This,NewState,ullReserved) \ + (This)->lpVtbl -> SetState(This,NewState,ullReserved) + +#define ISpMMSysAudio_SetFormat(This,rguidFmtId,pWaveFormatEx) \ + (This)->lpVtbl -> SetFormat(This,rguidFmtId,pWaveFormatEx) + +#define ISpMMSysAudio_GetStatus(This,pStatus) \ + (This)->lpVtbl -> GetStatus(This,pStatus) + +#define ISpMMSysAudio_SetBufferInfo(This,pBuffInfo) \ + (This)->lpVtbl -> SetBufferInfo(This,pBuffInfo) + +#define ISpMMSysAudio_GetBufferInfo(This,pBuffInfo) \ + (This)->lpVtbl -> GetBufferInfo(This,pBuffInfo) + +#define ISpMMSysAudio_GetDefaultFormat(This,pFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetDefaultFormat(This,pFormatId,ppCoMemWaveFormatEx) + +#define ISpMMSysAudio_EventHandle(This) \ + (This)->lpVtbl -> EventHandle(This) + +#define ISpMMSysAudio_GetVolumeLevel(This,pLevel) \ + (This)->lpVtbl -> GetVolumeLevel(This,pLevel) + +#define ISpMMSysAudio_SetVolumeLevel(This,Level) \ + (This)->lpVtbl -> SetVolumeLevel(This,Level) + +#define ISpMMSysAudio_GetBufferNotifySize(This,pcbSize) \ + (This)->lpVtbl -> GetBufferNotifySize(This,pcbSize) + +#define ISpMMSysAudio_SetBufferNotifySize(This,cbSize) \ + (This)->lpVtbl -> SetBufferNotifySize(This,cbSize) + + +#define ISpMMSysAudio_GetDeviceId(This,puDeviceId) \ + (This)->lpVtbl -> GetDeviceId(This,puDeviceId) + +#define ISpMMSysAudio_SetDeviceId(This,uDeviceId) \ + (This)->lpVtbl -> SetDeviceId(This,uDeviceId) + +#define ISpMMSysAudio_GetMMHandle(This,pHandle) \ + (This)->lpVtbl -> GetMMHandle(This,pHandle) + +#define ISpMMSysAudio_GetLineId(This,puLineId) \ + (This)->lpVtbl -> GetLineId(This,puLineId) + +#define ISpMMSysAudio_SetLineId(This,uLineId) \ + (This)->lpVtbl -> SetLineId(This,uLineId) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_GetDeviceId_Proxy( + ISpMMSysAudio * This, + /* [out] */ UINT *puDeviceId); + + +void __RPC_STUB ISpMMSysAudio_GetDeviceId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_SetDeviceId_Proxy( + ISpMMSysAudio * This, + /* [in] */ UINT uDeviceId); + + +void __RPC_STUB ISpMMSysAudio_SetDeviceId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_GetMMHandle_Proxy( + ISpMMSysAudio * This, + void **pHandle); + + +void __RPC_STUB ISpMMSysAudio_GetMMHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_GetLineId_Proxy( + ISpMMSysAudio * This, + /* [out] */ UINT *puLineId); + + +void __RPC_STUB ISpMMSysAudio_GetLineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_SetLineId_Proxy( + ISpMMSysAudio * This, + /* [in] */ UINT uLineId); + + +void __RPC_STUB ISpMMSysAudio_SetLineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpMMSysAudio_INTERFACE_DEFINED__ */ + + +#ifndef __ISpTranscript_INTERFACE_DEFINED__ +#define __ISpTranscript_INTERFACE_DEFINED__ + +/* interface ISpTranscript */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpTranscript; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("10F63BCE-201A-11D3-AC70-00C04F8EE6C0") + ISpTranscript : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetTranscript( + /* [string][out] */ WCHAR **ppszTranscript) = 0; + + virtual HRESULT STDMETHODCALLTYPE AppendTranscript( + /* [string][in] */ const WCHAR *pszTranscript) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTranscriptVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTranscript * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTranscript * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTranscript * This); + + HRESULT ( STDMETHODCALLTYPE *GetTranscript )( + ISpTranscript * This, + /* [string][out] */ WCHAR **ppszTranscript); + + HRESULT ( STDMETHODCALLTYPE *AppendTranscript )( + ISpTranscript * This, + /* [string][in] */ const WCHAR *pszTranscript); + + END_INTERFACE + } ISpTranscriptVtbl; + + interface ISpTranscript + { + CONST_VTBL struct ISpTranscriptVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTranscript_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTranscript_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTranscript_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTranscript_GetTranscript(This,ppszTranscript) \ + (This)->lpVtbl -> GetTranscript(This,ppszTranscript) + +#define ISpTranscript_AppendTranscript(This,pszTranscript) \ + (This)->lpVtbl -> AppendTranscript(This,pszTranscript) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpTranscript_GetTranscript_Proxy( + ISpTranscript * This, + /* [string][out] */ WCHAR **ppszTranscript); + + +void __RPC_STUB ISpTranscript_GetTranscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTranscript_AppendTranscript_Proxy( + ISpTranscript * This, + /* [string][in] */ const WCHAR *pszTranscript); + + +void __RPC_STUB ISpTranscript_AppendTranscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTranscript_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0270 */ +/* [local] */ + +typedef /* [hidden] */ +enum SPDISPLYATTRIBUTES + { SPAF_ONE_TRAILING_SPACE = 0x2, + SPAF_TWO_TRAILING_SPACES = 0x4, + SPAF_CONSUME_LEADING_SPACES = 0x8, + SPAF_ALL = 0xf + } SPDISPLAYATTRIBUTES; + +typedef unsigned short SPPHONEID; + +typedef /* [hidden][restricted] */ struct SPPHRASEELEMENT + { + ULONG ulAudioTimeOffset; + ULONG ulAudioSizeTime; + ULONG ulAudioStreamOffset; + ULONG ulAudioSizeBytes; + ULONG ulRetainedStreamOffset; + ULONG ulRetainedSizeBytes; + const WCHAR *pszDisplayText; + const WCHAR *pszLexicalForm; + const SPPHONEID *pszPronunciation; + BYTE bDisplayAttributes; + signed char RequiredConfidence; + signed char ActualConfidence; + BYTE Reserved; + float SREngineConfidence; + } SPPHRASEELEMENT; + +typedef /* [hidden][restricted] */ struct SPPHRASERULE SPPHRASERULE; + +/* [hidden] */ struct SPPHRASERULE + { + const WCHAR *pszName; + ULONG ulId; + ULONG ulFirstElement; + ULONG ulCountOfElements; + const SPPHRASERULE *pNextSibling; + const SPPHRASERULE *pFirstChild; + float SREngineConfidence; + signed char Confidence; + } ; +typedef /* [hidden][restricted] */ struct SPPHRASEPROPERTY SPPHRASEPROPERTY; + +/* [hidden] */ struct SPPHRASEPROPERTY + { + const WCHAR *pszName; + ULONG ulId; + const WCHAR *pszValue; + VARIANT vValue; + ULONG ulFirstElement; + ULONG ulCountOfElements; + const SPPHRASEPROPERTY *pNextSibling; + const SPPHRASEPROPERTY *pFirstChild; + float SREngineConfidence; + signed char Confidence; + } ; +typedef /* [hidden][restricted] */ struct SPPHRASEREPLACEMENT + { + BYTE bDisplayAttributes; + const WCHAR *pszReplacementText; + ULONG ulFirstElement; + ULONG ulCountOfElements; + } SPPHRASEREPLACEMENT; + +typedef /* [hidden][restricted] */ struct SPPHRASE + { + ULONG cbSize; + WORD LangID; + WORD wReserved; + ULONGLONG ullGrammarID; + ULONGLONG ftStartTime; + ULONGLONG ullAudioStreamPosition; + ULONG ulAudioSizeBytes; + ULONG ulRetainedSizeBytes; + ULONG ulAudioSizeTime; + SPPHRASERULE Rule; + const SPPHRASEPROPERTY *pProperties; + const SPPHRASEELEMENT *pElements; + ULONG cReplacements; + const SPPHRASEREPLACEMENT *pReplacements; + GUID SREngineID; + ULONG ulSREnginePrivateDataSize; + const BYTE *pSREnginePrivateData; + } SPPHRASE; + +typedef /* [hidden][restricted] */ struct SPSERIALIZEDPHRASE + { + ULONG ulSerializedSize; + } SPSERIALIZEDPHRASE; + +typedef /* [hidden] */ +enum SPVALUETYPE + { SPDF_PROPERTY = 0x1, + SPDF_REPLACEMENT = 0x2, + SPDF_RULE = 0x4, + SPDF_DISPLAYTEXT = 0x8, + SPDF_LEXICALFORM = 0x10, + SPDF_PRONUNCIATION = 0x20, + SPDF_AUDIO = 0x40, + SPDF_ALTERNATES = 0x80, + SPDF_ALL = 0xff + } SPVALUETYPE; + +typedef /* [hidden] */ struct SPBINARYGRAMMAR + { + ULONG ulTotalSerializedSize; + } SPBINARYGRAMMAR; + +typedef /* [hidden] */ +enum SPPHRASERNG + { SPPR_ALL_ELEMENTS = -1 + } SPPHRASERNG; + +#define SP_GETWHOLEPHRASE SPPR_ALL_ELEMENTS +#define SPRR_ALL_ELEMENTS SPPR_ALL_ELEMENTS +#if 0 +typedef void *SPSTATEHANDLE; + +#else +DECLARE_HANDLE(SPSTATEHANDLE); +#endif +typedef /* [hidden] */ +enum SPRECOEVENTFLAGS + { SPREF_AutoPause = 1 << 0, + SPREF_Emulated = 1 << 1 + } SPRECOEVENTFLAGS; + +typedef /* [hidden] */ +enum SPPARTOFSPEECH + { SPPS_NotOverriden = -1, + SPPS_Unknown = 0, + SPPS_Noun = 0x1000, + SPPS_Verb = 0x2000, + SPPS_Modifier = 0x3000, + SPPS_Function = 0x4000, + SPPS_Interjection = 0x5000 + } SPPARTOFSPEECH; + +typedef /* [hidden] */ +enum SPLEXICONTYPE + { eLEXTYPE_USER = 1L << 0, + eLEXTYPE_APP = 1L << 1, + eLEXTYPE_RESERVED1 = 1L << 2, + eLEXTYPE_RESERVED2 = 1L << 3, + eLEXTYPE_RESERVED3 = 1L << 4, + eLEXTYPE_RESERVED4 = 1L << 5, + eLEXTYPE_RESERVED5 = 1L << 6, + eLEXTYPE_RESERVED6 = 1L << 7, + eLEXTYPE_RESERVED7 = 1L << 8, + eLEXTYPE_RESERVED8 = 1L << 9, + eLEXTYPE_RESERVED9 = 1L << 10, + eLEXTYPE_RESERVED10 = 1L << 11, + eLEXTYPE_PRIVATE1 = 1L << 12, + eLEXTYPE_PRIVATE2 = 1L << 13, + eLEXTYPE_PRIVATE3 = 1L << 14, + eLEXTYPE_PRIVATE4 = 1L << 15, + eLEXTYPE_PRIVATE5 = 1L << 16, + eLEXTYPE_PRIVATE6 = 1L << 17, + eLEXTYPE_PRIVATE7 = 1L << 18, + eLEXTYPE_PRIVATE8 = 1L << 19, + eLEXTYPE_PRIVATE9 = 1L << 20, + eLEXTYPE_PRIVATE10 = 1L << 21, + eLEXTYPE_PRIVATE11 = 1L << 22, + eLEXTYPE_PRIVATE12 = 1L << 23, + eLEXTYPE_PRIVATE13 = 1L << 24, + eLEXTYPE_PRIVATE14 = 1L << 25, + eLEXTYPE_PRIVATE15 = 1L << 26, + eLEXTYPE_PRIVATE16 = 1L << 27, + eLEXTYPE_PRIVATE17 = 1L << 28, + eLEXTYPE_PRIVATE18 = 1L << 29, + eLEXTYPE_PRIVATE19 = 1L << 30, + eLEXTYPE_PRIVATE20 = 1L << 31 + } SPLEXICONTYPE; + +typedef /* [hidden] */ +enum SPWORDTYPE + { eWORDTYPE_ADDED = 1L << 0, + eWORDTYPE_DELETED = 1L << 1 + } SPWORDTYPE; + +typedef /* [hidden][restricted] */ struct SPWORDPRONUNCIATION + { + struct SPWORDPRONUNCIATION *pNextWordPronunciation; + SPLEXICONTYPE eLexiconType; + WORD LangID; + WORD wReserved; + SPPARTOFSPEECH ePartOfSpeech; + SPPHONEID szPronunciation[ 1 ]; + } SPWORDPRONUNCIATION; + +typedef /* [hidden][restricted] */ struct SPWORDPRONUNCIATIONLIST + { + ULONG ulSize; + BYTE *pvBuffer; + SPWORDPRONUNCIATION *pFirstWordPronunciation; + } SPWORDPRONUNCIATIONLIST; + +typedef /* [hidden][restricted] */ struct SPWORD + { + struct SPWORD *pNextWord; + WORD LangID; + WORD wReserved; + SPWORDTYPE eWordType; + WCHAR *pszWord; + SPWORDPRONUNCIATION *pFirstWordPronunciation; + } SPWORD; + +typedef /* [hidden][restricted] */ struct SPWORDLIST + { + ULONG ulSize; + BYTE *pvBuffer; + SPWORD *pFirstWord; + } SPWORDLIST; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0270_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0270_v0_0_s_ifspec; + +#ifndef __ISpLexicon_INTERFACE_DEFINED__ +#define __ISpLexicon_INTERFACE_DEFINED__ + +/* interface ISpLexicon */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpLexicon; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DA41A7C2-5383-4DB2-916B-6C1719E3DB58") + ISpLexicon : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetPronunciations( + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ DWORD dwFlags, + /* [out][in] */ SPWORDPRONUNCIATIONLIST *pWordPronunciationList) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddPronunciation( + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemovePronunciation( + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGeneration( + DWORD *pdwGeneration) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGenerationChange( + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ SPWORDLIST *pWordList) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetWords( + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ DWORD *pdwCookie, + /* [out][in] */ SPWORDLIST *pWordList) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpLexiconVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpLexicon * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpLexicon * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpLexicon * This); + + HRESULT ( STDMETHODCALLTYPE *GetPronunciations )( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ DWORD dwFlags, + /* [out][in] */ SPWORDPRONUNCIATIONLIST *pWordPronunciationList); + + HRESULT ( STDMETHODCALLTYPE *AddPronunciation )( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + HRESULT ( STDMETHODCALLTYPE *RemovePronunciation )( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + HRESULT ( STDMETHODCALLTYPE *GetGeneration )( + ISpLexicon * This, + DWORD *pdwGeneration); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationChange )( + ISpLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ SPWORDLIST *pWordList); + + HRESULT ( STDMETHODCALLTYPE *GetWords )( + ISpLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ DWORD *pdwCookie, + /* [out][in] */ SPWORDLIST *pWordList); + + END_INTERFACE + } ISpLexiconVtbl; + + interface ISpLexicon + { + CONST_VTBL struct ISpLexiconVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpLexicon_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpLexicon_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpLexicon_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpLexicon_GetPronunciations(This,pszWord,LangID,dwFlags,pWordPronunciationList) \ + (This)->lpVtbl -> GetPronunciations(This,pszWord,LangID,dwFlags,pWordPronunciationList) + +#define ISpLexicon_AddPronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) \ + (This)->lpVtbl -> AddPronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) + +#define ISpLexicon_RemovePronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) \ + (This)->lpVtbl -> RemovePronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) + +#define ISpLexicon_GetGeneration(This,pdwGeneration) \ + (This)->lpVtbl -> GetGeneration(This,pdwGeneration) + +#define ISpLexicon_GetGenerationChange(This,dwFlags,pdwGeneration,pWordList) \ + (This)->lpVtbl -> GetGenerationChange(This,dwFlags,pdwGeneration,pWordList) + +#define ISpLexicon_GetWords(This,dwFlags,pdwGeneration,pdwCookie,pWordList) \ + (This)->lpVtbl -> GetWords(This,dwFlags,pdwGeneration,pdwCookie,pWordList) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpLexicon_GetPronunciations_Proxy( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ DWORD dwFlags, + /* [out][in] */ SPWORDPRONUNCIATIONLIST *pWordPronunciationList); + + +void __RPC_STUB ISpLexicon_GetPronunciations_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_AddPronunciation_Proxy( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + +void __RPC_STUB ISpLexicon_AddPronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_RemovePronunciation_Proxy( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + +void __RPC_STUB ISpLexicon_RemovePronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_GetGeneration_Proxy( + ISpLexicon * This, + DWORD *pdwGeneration); + + +void __RPC_STUB ISpLexicon_GetGeneration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_GetGenerationChange_Proxy( + ISpLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ SPWORDLIST *pWordList); + + +void __RPC_STUB ISpLexicon_GetGenerationChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_GetWords_Proxy( + ISpLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ DWORD *pdwCookie, + /* [out][in] */ SPWORDLIST *pWordList); + + +void __RPC_STUB ISpLexicon_GetWords_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpLexicon_INTERFACE_DEFINED__ */ + + +#ifndef __ISpContainerLexicon_INTERFACE_DEFINED__ +#define __ISpContainerLexicon_INTERFACE_DEFINED__ + +/* interface ISpContainerLexicon */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpContainerLexicon; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8565572F-C094-41CC-B56E-10BD9C3FF044") + ISpContainerLexicon : public ISpLexicon + { + public: + virtual HRESULT STDMETHODCALLTYPE AddLexicon( + /* [in] */ ISpLexicon *pAddLexicon, + /* [in] */ DWORD dwFlags) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpContainerLexiconVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpContainerLexicon * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpContainerLexicon * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpContainerLexicon * This); + + HRESULT ( STDMETHODCALLTYPE *GetPronunciations )( + ISpContainerLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ DWORD dwFlags, + /* [out][in] */ SPWORDPRONUNCIATIONLIST *pWordPronunciationList); + + HRESULT ( STDMETHODCALLTYPE *AddPronunciation )( + ISpContainerLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + HRESULT ( STDMETHODCALLTYPE *RemovePronunciation )( + ISpContainerLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + HRESULT ( STDMETHODCALLTYPE *GetGeneration )( + ISpContainerLexicon * This, + DWORD *pdwGeneration); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationChange )( + ISpContainerLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ SPWORDLIST *pWordList); + + HRESULT ( STDMETHODCALLTYPE *GetWords )( + ISpContainerLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ DWORD *pdwCookie, + /* [out][in] */ SPWORDLIST *pWordList); + + HRESULT ( STDMETHODCALLTYPE *AddLexicon )( + ISpContainerLexicon * This, + /* [in] */ ISpLexicon *pAddLexicon, + /* [in] */ DWORD dwFlags); + + END_INTERFACE + } ISpContainerLexiconVtbl; + + interface ISpContainerLexicon + { + CONST_VTBL struct ISpContainerLexiconVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpContainerLexicon_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpContainerLexicon_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpContainerLexicon_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpContainerLexicon_GetPronunciations(This,pszWord,LangID,dwFlags,pWordPronunciationList) \ + (This)->lpVtbl -> GetPronunciations(This,pszWord,LangID,dwFlags,pWordPronunciationList) + +#define ISpContainerLexicon_AddPronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) \ + (This)->lpVtbl -> AddPronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) + +#define ISpContainerLexicon_RemovePronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) \ + (This)->lpVtbl -> RemovePronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) + +#define ISpContainerLexicon_GetGeneration(This,pdwGeneration) \ + (This)->lpVtbl -> GetGeneration(This,pdwGeneration) + +#define ISpContainerLexicon_GetGenerationChange(This,dwFlags,pdwGeneration,pWordList) \ + (This)->lpVtbl -> GetGenerationChange(This,dwFlags,pdwGeneration,pWordList) + +#define ISpContainerLexicon_GetWords(This,dwFlags,pdwGeneration,pdwCookie,pWordList) \ + (This)->lpVtbl -> GetWords(This,dwFlags,pdwGeneration,pdwCookie,pWordList) + + +#define ISpContainerLexicon_AddLexicon(This,pAddLexicon,dwFlags) \ + (This)->lpVtbl -> AddLexicon(This,pAddLexicon,dwFlags) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpContainerLexicon_AddLexicon_Proxy( + ISpContainerLexicon * This, + /* [in] */ ISpLexicon *pAddLexicon, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB ISpContainerLexicon_AddLexicon_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpContainerLexicon_INTERFACE_DEFINED__ */ + + +#ifndef __ISpPhoneConverter_INTERFACE_DEFINED__ +#define __ISpPhoneConverter_INTERFACE_DEFINED__ + +/* interface ISpPhoneConverter */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpPhoneConverter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8445C581-0CAC-4A38-ABFE-9B2CE2826455") + ISpPhoneConverter : public ISpObjectWithToken + { + public: + virtual HRESULT STDMETHODCALLTYPE PhoneToId( + /* [in] */ const WCHAR *pszPhone, + /* [out] */ SPPHONEID *pId) = 0; + + virtual HRESULT STDMETHODCALLTYPE IdToPhone( + /* [in] */ const SPPHONEID *pId, + /* [out] */ WCHAR *pszPhone) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPhoneConverterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpPhoneConverter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpPhoneConverter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpPhoneConverter * This); + + HRESULT ( STDMETHODCALLTYPE *SetObjectToken )( + ISpPhoneConverter * This, + ISpObjectToken *pToken); + + HRESULT ( STDMETHODCALLTYPE *GetObjectToken )( + ISpPhoneConverter * This, + ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *PhoneToId )( + ISpPhoneConverter * This, + /* [in] */ const WCHAR *pszPhone, + /* [out] */ SPPHONEID *pId); + + HRESULT ( STDMETHODCALLTYPE *IdToPhone )( + ISpPhoneConverter * This, + /* [in] */ const SPPHONEID *pId, + /* [out] */ WCHAR *pszPhone); + + END_INTERFACE + } ISpPhoneConverterVtbl; + + interface ISpPhoneConverter + { + CONST_VTBL struct ISpPhoneConverterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpPhoneConverter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpPhoneConverter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpPhoneConverter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpPhoneConverter_SetObjectToken(This,pToken) \ + (This)->lpVtbl -> SetObjectToken(This,pToken) + +#define ISpPhoneConverter_GetObjectToken(This,ppToken) \ + (This)->lpVtbl -> GetObjectToken(This,ppToken) + + +#define ISpPhoneConverter_PhoneToId(This,pszPhone,pId) \ + (This)->lpVtbl -> PhoneToId(This,pszPhone,pId) + +#define ISpPhoneConverter_IdToPhone(This,pId,pszPhone) \ + (This)->lpVtbl -> IdToPhone(This,pId,pszPhone) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpPhoneConverter_PhoneToId_Proxy( + ISpPhoneConverter * This, + /* [in] */ const WCHAR *pszPhone, + /* [out] */ SPPHONEID *pId); + + +void __RPC_STUB ISpPhoneConverter_PhoneToId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhoneConverter_IdToPhone_Proxy( + ISpPhoneConverter * This, + /* [in] */ const SPPHONEID *pId, + /* [out] */ WCHAR *pszPhone); + + +void __RPC_STUB ISpPhoneConverter_IdToPhone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpPhoneConverter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0273 */ +/* [local] */ + +typedef /* [hidden][restricted] */ struct SPVPITCH + { + long MiddleAdj; + long RangeAdj; + } SPVPITCH; + +typedef /* [hidden] */ +enum SPVACTIONS + { SPVA_Speak = 0, + SPVA_Silence = SPVA_Speak + 1, + SPVA_Pronounce = SPVA_Silence + 1, + SPVA_Bookmark = SPVA_Pronounce + 1, + SPVA_SpellOut = SPVA_Bookmark + 1, + SPVA_Section = SPVA_SpellOut + 1, + SPVA_ParseUnknownTag = SPVA_Section + 1 + } SPVACTIONS; + +typedef /* [hidden][restricted] */ struct SPVCONTEXT + { + LPCWSTR pCategory; + LPCWSTR pBefore; + LPCWSTR pAfter; + } SPVCONTEXT; + +typedef /* [hidden][restricted] */ struct SPVSTATE + { + SPVACTIONS eAction; + WORD LangID; + WORD wReserved; + long EmphAdj; + long RateAdj; + ULONG Volume; + SPVPITCH PitchAdj; + ULONG SilenceMSecs; + SPPHONEID *pPhoneIds; + SPPARTOFSPEECH ePartOfSpeech; + SPVCONTEXT Context; + } SPVSTATE; + +typedef /* [hidden] */ +enum SPRUNSTATE + { SPRS_DONE = 1L << 0, + SPRS_IS_SPEAKING = 1L << 1 + } SPRUNSTATE; + +typedef /* [hidden] */ +enum SPVLIMITS + { SPMIN_VOLUME = 0, + SPMAX_VOLUME = 100, + SPMIN_RATE = -10, + SPMAX_RATE = 10 + } SPVLIMITS; + +typedef /* [hidden] */ +enum SPVPRIORITY + { SPVPRI_NORMAL = 0, + SPVPRI_ALERT = 1L << 0, + SPVPRI_OVER = 1L << 1 + } SPVPRIORITY; + +typedef /* [hidden][restricted] */ struct SPVOICESTATUS + { + ULONG ulCurrentStream; + ULONG ulLastStreamQueued; + HRESULT hrLastResult; + DWORD dwRunningState; + ULONG ulInputWordPos; + ULONG ulInputWordLen; + ULONG ulInputSentPos; + ULONG ulInputSentLen; + LONG lBookmarkId; + SPPHONEID PhonemeId; + SPVISEMES VisemeId; + DWORD dwReserved1; + DWORD dwReserved2; + } SPVOICESTATUS; + +typedef /* [hidden] */ +enum SPEAKFLAGS + { SPF_DEFAULT = 0, + SPF_ASYNC = 1L << 0, + SPF_PURGEBEFORESPEAK = 1L << 1, + SPF_IS_FILENAME = 1L << 2, + SPF_IS_XML = 1L << 3, + SPF_IS_NOT_XML = 1L << 4, + SPF_PERSIST_XML = 1L << 5, + SPF_NLP_SPEAK_PUNC = 1L << 6, + SPF_NLP_MASK = SPF_NLP_SPEAK_PUNC, + SPF_VOICE_MASK = SPF_ASYNC | SPF_PURGEBEFORESPEAK | SPF_IS_FILENAME | SPF_IS_XML | SPF_IS_NOT_XML | SPF_NLP_MASK | SPF_PERSIST_XML, + SPF_UNUSED_FLAGS = ~SPF_VOICE_MASK + } SPEAKFLAGS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0273_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0273_v0_0_s_ifspec; + +#ifndef __ISpVoice_INTERFACE_DEFINED__ +#define __ISpVoice_INTERFACE_DEFINED__ + +/* interface ISpVoice */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpVoice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6C44DF74-72B9-4992-A1EC-EF996E0422D4") + ISpVoice : public ISpEventSource + { + public: + virtual HRESULT STDMETHODCALLTYPE SetOutput( + /* [in] */ IUnknown *pUnkOutput, + /* [in] */ BOOL fAllowFormatChanges) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOutputObjectToken( + /* [out] */ ISpObjectToken **ppObjectToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOutputStream( + /* [out] */ ISpStreamFormat **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE Pause( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Resume( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVoice( + /* [in] */ ISpObjectToken *pToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVoice( + /* [out] */ ISpObjectToken **ppToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE Speak( + /* [string][in] */ const WCHAR *pwcs, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber) = 0; + + virtual HRESULT STDMETHODCALLTYPE SpeakStream( + /* [in] */ IStream *pStream, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatus( + /* [out] */ SPVOICESTATUS *pStatus, + /* [string][out] */ WCHAR **ppszLastBookmark) = 0; + + virtual HRESULT STDMETHODCALLTYPE Skip( + /* [string][in] */ WCHAR *pItemType, + /* [in] */ long lNumItems, + /* [out] */ ULONG *pulNumSkipped) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPriority( + /* [in] */ SPVPRIORITY ePriority) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPriority( + /* [out] */ SPVPRIORITY *pePriority) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAlertBoundary( + /* [in] */ SPEVENTENUM eBoundary) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAlertBoundary( + /* [out] */ SPEVENTENUM *peBoundary) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRate( + /* [in] */ long RateAdjust) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRate( + /* [out] */ long *pRateAdjust) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVolume( + /* [in] */ USHORT usVolume) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVolume( + /* [out] */ USHORT *pusVolume) = 0; + + virtual HRESULT STDMETHODCALLTYPE WaitUntilDone( + /* [in] */ ULONG msTimeout) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetSyncSpeakTimeout( + /* [in] */ ULONG msTimeout) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSyncSpeakTimeout( + /* [out] */ ULONG *pmsTimeout) = 0; + + virtual /* [local] */ HANDLE STDMETHODCALLTYPE SpeakCompleteEvent( void) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpVoiceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpVoice * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpVoice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpVoice * This); + + HRESULT ( STDMETHODCALLTYPE *SetNotifySink )( + ISpVoice * This, + /* [in] */ ISpNotifySink *pNotifySink); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWindowMessage )( + ISpVoice * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackFunction )( + ISpVoice * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackInterface )( + ISpVoice * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWin32Event )( + ISpVoice * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForNotifyEvent )( + ISpVoice * This, + /* [in] */ DWORD dwMilliseconds); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *GetNotifyEventHandle )( + ISpVoice * This); + + HRESULT ( STDMETHODCALLTYPE *SetInterest )( + ISpVoice * This, + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest); + + HRESULT ( STDMETHODCALLTYPE *GetEvents )( + ISpVoice * This, + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched); + + HRESULT ( STDMETHODCALLTYPE *GetInfo )( + ISpVoice * This, + /* [out] */ SPEVENTSOURCEINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *SetOutput )( + ISpVoice * This, + /* [in] */ IUnknown *pUnkOutput, + /* [in] */ BOOL fAllowFormatChanges); + + HRESULT ( STDMETHODCALLTYPE *GetOutputObjectToken )( + ISpVoice * This, + /* [out] */ ISpObjectToken **ppObjectToken); + + HRESULT ( STDMETHODCALLTYPE *GetOutputStream )( + ISpVoice * This, + /* [out] */ ISpStreamFormat **ppStream); + + HRESULT ( STDMETHODCALLTYPE *Pause )( + ISpVoice * This); + + HRESULT ( STDMETHODCALLTYPE *Resume )( + ISpVoice * This); + + HRESULT ( STDMETHODCALLTYPE *SetVoice )( + ISpVoice * This, + /* [in] */ ISpObjectToken *pToken); + + HRESULT ( STDMETHODCALLTYPE *GetVoice )( + ISpVoice * This, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *Speak )( + ISpVoice * This, + /* [string][in] */ const WCHAR *pwcs, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + HRESULT ( STDMETHODCALLTYPE *SpeakStream )( + ISpVoice * This, + /* [in] */ IStream *pStream, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpVoice * This, + /* [out] */ SPVOICESTATUS *pStatus, + /* [string][out] */ WCHAR **ppszLastBookmark); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + ISpVoice * This, + /* [string][in] */ WCHAR *pItemType, + /* [in] */ long lNumItems, + /* [out] */ ULONG *pulNumSkipped); + + HRESULT ( STDMETHODCALLTYPE *SetPriority )( + ISpVoice * This, + /* [in] */ SPVPRIORITY ePriority); + + HRESULT ( STDMETHODCALLTYPE *GetPriority )( + ISpVoice * This, + /* [out] */ SPVPRIORITY *pePriority); + + HRESULT ( STDMETHODCALLTYPE *SetAlertBoundary )( + ISpVoice * This, + /* [in] */ SPEVENTENUM eBoundary); + + HRESULT ( STDMETHODCALLTYPE *GetAlertBoundary )( + ISpVoice * This, + /* [out] */ SPEVENTENUM *peBoundary); + + HRESULT ( STDMETHODCALLTYPE *SetRate )( + ISpVoice * This, + /* [in] */ long RateAdjust); + + HRESULT ( STDMETHODCALLTYPE *GetRate )( + ISpVoice * This, + /* [out] */ long *pRateAdjust); + + HRESULT ( STDMETHODCALLTYPE *SetVolume )( + ISpVoice * This, + /* [in] */ USHORT usVolume); + + HRESULT ( STDMETHODCALLTYPE *GetVolume )( + ISpVoice * This, + /* [out] */ USHORT *pusVolume); + + HRESULT ( STDMETHODCALLTYPE *WaitUntilDone )( + ISpVoice * This, + /* [in] */ ULONG msTimeout); + + HRESULT ( STDMETHODCALLTYPE *SetSyncSpeakTimeout )( + ISpVoice * This, + /* [in] */ ULONG msTimeout); + + HRESULT ( STDMETHODCALLTYPE *GetSyncSpeakTimeout )( + ISpVoice * This, + /* [out] */ ULONG *pmsTimeout); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *SpeakCompleteEvent )( + ISpVoice * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpVoice * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpVoice * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData); + + END_INTERFACE + } ISpVoiceVtbl; + + interface ISpVoice + { + CONST_VTBL struct ISpVoiceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpVoice_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpVoice_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpVoice_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpVoice_SetNotifySink(This,pNotifySink) \ + (This)->lpVtbl -> SetNotifySink(This,pNotifySink) + +#define ISpVoice_SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpVoice_SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) + +#define ISpVoice_SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) + +#define ISpVoice_SetNotifyWin32Event(This) \ + (This)->lpVtbl -> SetNotifyWin32Event(This) + +#define ISpVoice_WaitForNotifyEvent(This,dwMilliseconds) \ + (This)->lpVtbl -> WaitForNotifyEvent(This,dwMilliseconds) + +#define ISpVoice_GetNotifyEventHandle(This) \ + (This)->lpVtbl -> GetNotifyEventHandle(This) + + +#define ISpVoice_SetInterest(This,ullEventInterest,ullQueuedInterest) \ + (This)->lpVtbl -> SetInterest(This,ullEventInterest,ullQueuedInterest) + +#define ISpVoice_GetEvents(This,ulCount,pEventArray,pulFetched) \ + (This)->lpVtbl -> GetEvents(This,ulCount,pEventArray,pulFetched) + +#define ISpVoice_GetInfo(This,pInfo) \ + (This)->lpVtbl -> GetInfo(This,pInfo) + + +#define ISpVoice_SetOutput(This,pUnkOutput,fAllowFormatChanges) \ + (This)->lpVtbl -> SetOutput(This,pUnkOutput,fAllowFormatChanges) + +#define ISpVoice_GetOutputObjectToken(This,ppObjectToken) \ + (This)->lpVtbl -> GetOutputObjectToken(This,ppObjectToken) + +#define ISpVoice_GetOutputStream(This,ppStream) \ + (This)->lpVtbl -> GetOutputStream(This,ppStream) + +#define ISpVoice_Pause(This) \ + (This)->lpVtbl -> Pause(This) + +#define ISpVoice_Resume(This) \ + (This)->lpVtbl -> Resume(This) + +#define ISpVoice_SetVoice(This,pToken) \ + (This)->lpVtbl -> SetVoice(This,pToken) + +#define ISpVoice_GetVoice(This,ppToken) \ + (This)->lpVtbl -> GetVoice(This,ppToken) + +#define ISpVoice_Speak(This,pwcs,dwFlags,pulStreamNumber) \ + (This)->lpVtbl -> Speak(This,pwcs,dwFlags,pulStreamNumber) + +#define ISpVoice_SpeakStream(This,pStream,dwFlags,pulStreamNumber) \ + (This)->lpVtbl -> SpeakStream(This,pStream,dwFlags,pulStreamNumber) + +#define ISpVoice_GetStatus(This,pStatus,ppszLastBookmark) \ + (This)->lpVtbl -> GetStatus(This,pStatus,ppszLastBookmark) + +#define ISpVoice_Skip(This,pItemType,lNumItems,pulNumSkipped) \ + (This)->lpVtbl -> Skip(This,pItemType,lNumItems,pulNumSkipped) + +#define ISpVoice_SetPriority(This,ePriority) \ + (This)->lpVtbl -> SetPriority(This,ePriority) + +#define ISpVoice_GetPriority(This,pePriority) \ + (This)->lpVtbl -> GetPriority(This,pePriority) + +#define ISpVoice_SetAlertBoundary(This,eBoundary) \ + (This)->lpVtbl -> SetAlertBoundary(This,eBoundary) + +#define ISpVoice_GetAlertBoundary(This,peBoundary) \ + (This)->lpVtbl -> GetAlertBoundary(This,peBoundary) + +#define ISpVoice_SetRate(This,RateAdjust) \ + (This)->lpVtbl -> SetRate(This,RateAdjust) + +#define ISpVoice_GetRate(This,pRateAdjust) \ + (This)->lpVtbl -> GetRate(This,pRateAdjust) + +#define ISpVoice_SetVolume(This,usVolume) \ + (This)->lpVtbl -> SetVolume(This,usVolume) + +#define ISpVoice_GetVolume(This,pusVolume) \ + (This)->lpVtbl -> GetVolume(This,pusVolume) + +#define ISpVoice_WaitUntilDone(This,msTimeout) \ + (This)->lpVtbl -> WaitUntilDone(This,msTimeout) + +#define ISpVoice_SetSyncSpeakTimeout(This,msTimeout) \ + (This)->lpVtbl -> SetSyncSpeakTimeout(This,msTimeout) + +#define ISpVoice_GetSyncSpeakTimeout(This,pmsTimeout) \ + (This)->lpVtbl -> GetSyncSpeakTimeout(This,pmsTimeout) + +#define ISpVoice_SpeakCompleteEvent(This) \ + (This)->lpVtbl -> SpeakCompleteEvent(This) + +#define ISpVoice_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,pfSupported) + +#define ISpVoice_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetOutput_Proxy( + ISpVoice * This, + /* [in] */ IUnknown *pUnkOutput, + /* [in] */ BOOL fAllowFormatChanges); + + +void __RPC_STUB ISpVoice_SetOutput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetOutputObjectToken_Proxy( + ISpVoice * This, + /* [out] */ ISpObjectToken **ppObjectToken); + + +void __RPC_STUB ISpVoice_GetOutputObjectToken_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetOutputStream_Proxy( + ISpVoice * This, + /* [out] */ ISpStreamFormat **ppStream); + + +void __RPC_STUB ISpVoice_GetOutputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_Pause_Proxy( + ISpVoice * This); + + +void __RPC_STUB ISpVoice_Pause_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_Resume_Proxy( + ISpVoice * This); + + +void __RPC_STUB ISpVoice_Resume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetVoice_Proxy( + ISpVoice * This, + /* [in] */ ISpObjectToken *pToken); + + +void __RPC_STUB ISpVoice_SetVoice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetVoice_Proxy( + ISpVoice * This, + /* [out] */ ISpObjectToken **ppToken); + + +void __RPC_STUB ISpVoice_GetVoice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_Speak_Proxy( + ISpVoice * This, + /* [string][in] */ const WCHAR *pwcs, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + +void __RPC_STUB ISpVoice_Speak_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SpeakStream_Proxy( + ISpVoice * This, + /* [in] */ IStream *pStream, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + +void __RPC_STUB ISpVoice_SpeakStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetStatus_Proxy( + ISpVoice * This, + /* [out] */ SPVOICESTATUS *pStatus, + /* [string][out] */ WCHAR **ppszLastBookmark); + + +void __RPC_STUB ISpVoice_GetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_Skip_Proxy( + ISpVoice * This, + /* [string][in] */ WCHAR *pItemType, + /* [in] */ long lNumItems, + /* [out] */ ULONG *pulNumSkipped); + + +void __RPC_STUB ISpVoice_Skip_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetPriority_Proxy( + ISpVoice * This, + /* [in] */ SPVPRIORITY ePriority); + + +void __RPC_STUB ISpVoice_SetPriority_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetPriority_Proxy( + ISpVoice * This, + /* [out] */ SPVPRIORITY *pePriority); + + +void __RPC_STUB ISpVoice_GetPriority_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetAlertBoundary_Proxy( + ISpVoice * This, + /* [in] */ SPEVENTENUM eBoundary); + + +void __RPC_STUB ISpVoice_SetAlertBoundary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetAlertBoundary_Proxy( + ISpVoice * This, + /* [out] */ SPEVENTENUM *peBoundary); + + +void __RPC_STUB ISpVoice_GetAlertBoundary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetRate_Proxy( + ISpVoice * This, + /* [in] */ long RateAdjust); + + +void __RPC_STUB ISpVoice_SetRate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetRate_Proxy( + ISpVoice * This, + /* [out] */ long *pRateAdjust); + + +void __RPC_STUB ISpVoice_GetRate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetVolume_Proxy( + ISpVoice * This, + /* [in] */ USHORT usVolume); + + +void __RPC_STUB ISpVoice_SetVolume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetVolume_Proxy( + ISpVoice * This, + /* [out] */ USHORT *pusVolume); + + +void __RPC_STUB ISpVoice_GetVolume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_WaitUntilDone_Proxy( + ISpVoice * This, + /* [in] */ ULONG msTimeout); + + +void __RPC_STUB ISpVoice_WaitUntilDone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetSyncSpeakTimeout_Proxy( + ISpVoice * This, + /* [in] */ ULONG msTimeout); + + +void __RPC_STUB ISpVoice_SetSyncSpeakTimeout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetSyncSpeakTimeout_Proxy( + ISpVoice * This, + /* [out] */ ULONG *pmsTimeout); + + +void __RPC_STUB ISpVoice_GetSyncSpeakTimeout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HANDLE STDMETHODCALLTYPE ISpVoice_SpeakCompleteEvent_Proxy( + ISpVoice * This); + + +void __RPC_STUB ISpVoice_SpeakCompleteEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpVoice_IsUISupported_Proxy( + ISpVoice * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported); + + +void __RPC_STUB ISpVoice_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpVoice_DisplayUI_Proxy( + ISpVoice * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData); + + +void __RPC_STUB ISpVoice_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpVoice_INTERFACE_DEFINED__ */ + + +#ifndef __ISpPhrase_INTERFACE_DEFINED__ +#define __ISpPhrase_INTERFACE_DEFINED__ + +/* interface ISpPhrase */ +/* [restricted][unique][helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_ISpPhrase; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1A5C0354-B621-4b5a-8791-D306ED379E53") + ISpPhrase : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetPhrase( + /* [out] */ SPPHRASE **ppCoMemPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSerializedPhrase( + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetText( + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes) = 0; + + virtual HRESULT STDMETHODCALLTYPE Discard( + /* [in] */ DWORD dwValueTypes) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPhraseVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpPhrase * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpPhrase * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpPhrase * This); + + HRESULT ( STDMETHODCALLTYPE *GetPhrase )( + ISpPhrase * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetSerializedPhrase )( + ISpPhrase * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpPhrase * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + HRESULT ( STDMETHODCALLTYPE *Discard )( + ISpPhrase * This, + /* [in] */ DWORD dwValueTypes); + + END_INTERFACE + } ISpPhraseVtbl; + + interface ISpPhrase + { + CONST_VTBL struct ISpPhraseVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpPhrase_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpPhrase_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpPhrase_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpPhrase_GetPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetPhrase(This,ppCoMemPhrase) + +#define ISpPhrase_GetSerializedPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetSerializedPhrase(This,ppCoMemPhrase) + +#define ISpPhrase_GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) \ + (This)->lpVtbl -> GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) + +#define ISpPhrase_Discard(This,dwValueTypes) \ + (This)->lpVtbl -> Discard(This,dwValueTypes) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpPhrase_GetPhrase_Proxy( + ISpPhrase * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + +void __RPC_STUB ISpPhrase_GetPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhrase_GetSerializedPhrase_Proxy( + ISpPhrase * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + +void __RPC_STUB ISpPhrase_GetSerializedPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhrase_GetText_Proxy( + ISpPhrase * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + +void __RPC_STUB ISpPhrase_GetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhrase_Discard_Proxy( + ISpPhrase * This, + /* [in] */ DWORD dwValueTypes); + + +void __RPC_STUB ISpPhrase_Discard_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpPhrase_INTERFACE_DEFINED__ */ + + +#ifndef __ISpPhraseAlt_INTERFACE_DEFINED__ +#define __ISpPhraseAlt_INTERFACE_DEFINED__ + +/* interface ISpPhraseAlt */ +/* [restricted][unique][helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_ISpPhraseAlt; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8FCEBC98-4E49-4067-9C6C-D86A0E092E3D") + ISpPhraseAlt : public ISpPhrase + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAltInfo( + ISpPhrase **ppParent, + ULONG *pulStartElementInParent, + ULONG *pcElementsInParent, + ULONG *pcElementsInAlt) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPhraseAltVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpPhraseAlt * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpPhraseAlt * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpPhraseAlt * This); + + HRESULT ( STDMETHODCALLTYPE *GetPhrase )( + ISpPhraseAlt * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetSerializedPhrase )( + ISpPhraseAlt * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpPhraseAlt * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + HRESULT ( STDMETHODCALLTYPE *Discard )( + ISpPhraseAlt * This, + /* [in] */ DWORD dwValueTypes); + + HRESULT ( STDMETHODCALLTYPE *GetAltInfo )( + ISpPhraseAlt * This, + ISpPhrase **ppParent, + ULONG *pulStartElementInParent, + ULONG *pcElementsInParent, + ULONG *pcElementsInAlt); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpPhraseAlt * This); + + END_INTERFACE + } ISpPhraseAltVtbl; + + interface ISpPhraseAlt + { + CONST_VTBL struct ISpPhraseAltVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpPhraseAlt_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpPhraseAlt_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpPhraseAlt_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpPhraseAlt_GetPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetPhrase(This,ppCoMemPhrase) + +#define ISpPhraseAlt_GetSerializedPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetSerializedPhrase(This,ppCoMemPhrase) + +#define ISpPhraseAlt_GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) \ + (This)->lpVtbl -> GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) + +#define ISpPhraseAlt_Discard(This,dwValueTypes) \ + (This)->lpVtbl -> Discard(This,dwValueTypes) + + +#define ISpPhraseAlt_GetAltInfo(This,ppParent,pulStartElementInParent,pcElementsInParent,pcElementsInAlt) \ + (This)->lpVtbl -> GetAltInfo(This,ppParent,pulStartElementInParent,pcElementsInParent,pcElementsInAlt) + +#define ISpPhraseAlt_Commit(This) \ + (This)->lpVtbl -> Commit(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpPhraseAlt_GetAltInfo_Proxy( + ISpPhraseAlt * This, + ISpPhrase **ppParent, + ULONG *pulStartElementInParent, + ULONG *pcElementsInParent, + ULONG *pcElementsInAlt); + + +void __RPC_STUB ISpPhraseAlt_GetAltInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseAlt_Commit_Proxy( + ISpPhraseAlt * This); + + +void __RPC_STUB ISpPhraseAlt_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpPhraseAlt_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0276 */ +/* [local] */ + +typedef /* [hidden][restricted] */ struct SPRECORESULTTIMES + { + FILETIME ftStreamTime; + ULONGLONG ullLength; + DWORD dwTickCount; + ULONGLONG ullStart; + } SPRECORESULTTIMES; + +typedef /* [hidden] */ struct SPSERIALIZEDRESULT + { + ULONG ulSerializedSize; + } SPSERIALIZEDRESULT; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0276_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0276_v0_0_s_ifspec; + +#ifndef __ISpRecoResult_INTERFACE_DEFINED__ +#define __ISpRecoResult_INTERFACE_DEFINED__ + +/* interface ISpRecoResult */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRecoResult; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("20B053BE-E235-43cd-9A2A-8D17A48B7842") + ISpRecoResult : public ISpPhrase + { + public: + virtual HRESULT STDMETHODCALLTYPE GetResultTimes( + /* [out] */ SPRECORESULTTIMES *pTimes) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAlternates( + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ ULONG ulRequestCount, + /* [out] */ ISpPhraseAlt **ppPhrases, + /* [out] */ ULONG *pcPhrasesReturned) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAudio( + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [out] */ ISpStreamFormat **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE SpeakAudio( + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber) = 0; + + virtual HRESULT STDMETHODCALLTYPE Serialize( + /* [out] */ SPSERIALIZEDRESULT **ppCoMemSerializedResult) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScaleAudio( + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecoContext( + /* [out] */ ISpRecoContext **ppRecoContext) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRecoResultVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRecoResult * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRecoResult * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRecoResult * This); + + HRESULT ( STDMETHODCALLTYPE *GetPhrase )( + ISpRecoResult * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetSerializedPhrase )( + ISpRecoResult * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpRecoResult * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + HRESULT ( STDMETHODCALLTYPE *Discard )( + ISpRecoResult * This, + /* [in] */ DWORD dwValueTypes); + + HRESULT ( STDMETHODCALLTYPE *GetResultTimes )( + ISpRecoResult * This, + /* [out] */ SPRECORESULTTIMES *pTimes); + + HRESULT ( STDMETHODCALLTYPE *GetAlternates )( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ ULONG ulRequestCount, + /* [out] */ ISpPhraseAlt **ppPhrases, + /* [out] */ ULONG *pcPhrasesReturned); + + HRESULT ( STDMETHODCALLTYPE *GetAudio )( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [out] */ ISpStreamFormat **ppStream); + + HRESULT ( STDMETHODCALLTYPE *SpeakAudio )( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + HRESULT ( STDMETHODCALLTYPE *Serialize )( + ISpRecoResult * This, + /* [out] */ SPSERIALIZEDRESULT **ppCoMemSerializedResult); + + HRESULT ( STDMETHODCALLTYPE *ScaleAudio )( + ISpRecoResult * This, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetRecoContext )( + ISpRecoResult * This, + /* [out] */ ISpRecoContext **ppRecoContext); + + END_INTERFACE + } ISpRecoResultVtbl; + + interface ISpRecoResult + { + CONST_VTBL struct ISpRecoResultVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRecoResult_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRecoResult_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRecoResult_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRecoResult_GetPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetPhrase(This,ppCoMemPhrase) + +#define ISpRecoResult_GetSerializedPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetSerializedPhrase(This,ppCoMemPhrase) + +#define ISpRecoResult_GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) \ + (This)->lpVtbl -> GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) + +#define ISpRecoResult_Discard(This,dwValueTypes) \ + (This)->lpVtbl -> Discard(This,dwValueTypes) + + +#define ISpRecoResult_GetResultTimes(This,pTimes) \ + (This)->lpVtbl -> GetResultTimes(This,pTimes) + +#define ISpRecoResult_GetAlternates(This,ulStartElement,cElements,ulRequestCount,ppPhrases,pcPhrasesReturned) \ + (This)->lpVtbl -> GetAlternates(This,ulStartElement,cElements,ulRequestCount,ppPhrases,pcPhrasesReturned) + +#define ISpRecoResult_GetAudio(This,ulStartElement,cElements,ppStream) \ + (This)->lpVtbl -> GetAudio(This,ulStartElement,cElements,ppStream) + +#define ISpRecoResult_SpeakAudio(This,ulStartElement,cElements,dwFlags,pulStreamNumber) \ + (This)->lpVtbl -> SpeakAudio(This,ulStartElement,cElements,dwFlags,pulStreamNumber) + +#define ISpRecoResult_Serialize(This,ppCoMemSerializedResult) \ + (This)->lpVtbl -> Serialize(This,ppCoMemSerializedResult) + +#define ISpRecoResult_ScaleAudio(This,pAudioFormatId,pWaveFormatEx) \ + (This)->lpVtbl -> ScaleAudio(This,pAudioFormatId,pWaveFormatEx) + +#define ISpRecoResult_GetRecoContext(This,ppRecoContext) \ + (This)->lpVtbl -> GetRecoContext(This,ppRecoContext) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_GetResultTimes_Proxy( + ISpRecoResult * This, + /* [out] */ SPRECORESULTTIMES *pTimes); + + +void __RPC_STUB ISpRecoResult_GetResultTimes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_GetAlternates_Proxy( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ ULONG ulRequestCount, + /* [out] */ ISpPhraseAlt **ppPhrases, + /* [out] */ ULONG *pcPhrasesReturned); + + +void __RPC_STUB ISpRecoResult_GetAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_GetAudio_Proxy( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [out] */ ISpStreamFormat **ppStream); + + +void __RPC_STUB ISpRecoResult_GetAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_SpeakAudio_Proxy( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + +void __RPC_STUB ISpRecoResult_SpeakAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_Serialize_Proxy( + ISpRecoResult * This, + /* [out] */ SPSERIALIZEDRESULT **ppCoMemSerializedResult); + + +void __RPC_STUB ISpRecoResult_Serialize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_ScaleAudio_Proxy( + ISpRecoResult * This, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + +void __RPC_STUB ISpRecoResult_ScaleAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_GetRecoContext_Proxy( + ISpRecoResult * This, + /* [out] */ ISpRecoContext **ppRecoContext); + + +void __RPC_STUB ISpRecoResult_GetRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRecoResult_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0277 */ +/* [local] */ + +typedef /* [hidden] */ struct tagSPTEXTSELECTIONINFO + { + ULONG ulStartActiveOffset; + ULONG cchActiveChars; + ULONG ulStartSelection; + ULONG cchSelection; + } SPTEXTSELECTIONINFO; + +typedef /* [hidden] */ +enum SPWORDPRONOUNCEABLE + { SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = 0, + SPWP_UNKNOWN_WORD_PRONOUNCEABLE = 1, + SPWP_KNOWN_WORD_PRONOUNCEABLE = 2 + } SPWORDPRONOUNCEABLE; + +typedef /* [hidden] */ +enum SPGRAMMARSTATE + { SPGS_DISABLED = 0, + SPGS_ENABLED = 1, + SPGS_EXCLUSIVE = 3 + } SPGRAMMARSTATE; + +typedef /* [hidden] */ +enum SPCONTEXTSTATE + { SPCS_DISABLED = 0, + SPCS_ENABLED = 1 + } SPCONTEXTSTATE; + +typedef /* [hidden] */ +enum SPRULESTATE + { SPRS_INACTIVE = 0, + SPRS_ACTIVE = 1, + SPRS_ACTIVE_WITH_AUTO_PAUSE = 3 + } SPRULESTATE; + +#define SP_STREAMPOS_ASAP ( 0 ) + +#define SP_STREAMPOS_REALTIME ( -1 ) + +#define SPRULETRANS_TEXTBUFFER (SPSTATEHANDLE)(-1) +#define SPRULETRANS_WILDCARD (SPSTATEHANDLE)(-2) +#define SPRULETRANS_DICTATION (SPSTATEHANDLE)(-3) +typedef /* [hidden] */ +enum SPGRAMMARWORDTYPE + { SPWT_DISPLAY = 0, + SPWT_LEXICAL = SPWT_DISPLAY + 1, + SPWT_PRONUNCIATION = SPWT_LEXICAL + 1 + } SPGRAMMARWORDTYPE; + +typedef /* [hidden] */ struct tagSPPROPERTYINFO + { + const WCHAR *pszName; + ULONG ulId; + const WCHAR *pszValue; + VARIANT vValue; + } SPPROPERTYINFO; + +typedef /* [hidden] */ +enum SPCFGRULEATTRIBUTES + { SPRAF_TopLevel = 1 << 0, + SPRAF_Active = 1 << 1, + SPRAF_Export = 1 << 2, + SPRAF_Import = 1 << 3, + SPRAF_Interpreter = 1 << 4, + SPRAF_Dynamic = 1 << 5, + SPRAF_AutoPause = 1 << 16 + } SPCFGRULEATTRIBUTES; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0277_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0277_v0_0_s_ifspec; + +#ifndef __ISpGrammarBuilder_INTERFACE_DEFINED__ +#define __ISpGrammarBuilder_INTERFACE_DEFINED__ + +/* interface ISpGrammarBuilder */ +/* [local][restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpGrammarBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8137828F-591A-4A42-BE58-49EA7EBAAC68") + ISpGrammarBuilder : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ResetGrammar( + /* [in] */ WORD NewLanguage) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRule( + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState) = 0; + + virtual HRESULT STDMETHODCALLTYPE ClearRule( + SPSTATEHANDLE hState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateNewState( + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddWordTransition( + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddRuleTransition( + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddResource( + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( + DWORD dwReserved) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpGrammarBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpGrammarBuilder * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpGrammarBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpGrammarBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *ResetGrammar )( + ISpGrammarBuilder * This, + /* [in] */ WORD NewLanguage); + + HRESULT ( STDMETHODCALLTYPE *GetRule )( + ISpGrammarBuilder * This, + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState); + + HRESULT ( STDMETHODCALLTYPE *ClearRule )( + ISpGrammarBuilder * This, + SPSTATEHANDLE hState); + + HRESULT ( STDMETHODCALLTYPE *CreateNewState )( + ISpGrammarBuilder * This, + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState); + + HRESULT ( STDMETHODCALLTYPE *AddWordTransition )( + ISpGrammarBuilder * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddRuleTransition )( + ISpGrammarBuilder * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddResource )( + ISpGrammarBuilder * This, + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpGrammarBuilder * This, + DWORD dwReserved); + + END_INTERFACE + } ISpGrammarBuilderVtbl; + + interface ISpGrammarBuilder + { + CONST_VTBL struct ISpGrammarBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpGrammarBuilder_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpGrammarBuilder_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpGrammarBuilder_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpGrammarBuilder_ResetGrammar(This,NewLanguage) \ + (This)->lpVtbl -> ResetGrammar(This,NewLanguage) + +#define ISpGrammarBuilder_GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) \ + (This)->lpVtbl -> GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) + +#define ISpGrammarBuilder_ClearRule(This,hState) \ + (This)->lpVtbl -> ClearRule(This,hState) + +#define ISpGrammarBuilder_CreateNewState(This,hState,phState) \ + (This)->lpVtbl -> CreateNewState(This,hState,phState) + +#define ISpGrammarBuilder_AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) \ + (This)->lpVtbl -> AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) + +#define ISpGrammarBuilder_AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) \ + (This)->lpVtbl -> AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) + +#define ISpGrammarBuilder_AddResource(This,hRuleState,pszResourceName,pszResourceValue) \ + (This)->lpVtbl -> AddResource(This,hRuleState,pszResourceName,pszResourceValue) + +#define ISpGrammarBuilder_Commit(This,dwReserved) \ + (This)->lpVtbl -> Commit(This,dwReserved) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_ResetGrammar_Proxy( + ISpGrammarBuilder * This, + /* [in] */ WORD NewLanguage); + + +void __RPC_STUB ISpGrammarBuilder_ResetGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_GetRule_Proxy( + ISpGrammarBuilder * This, + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState); + + +void __RPC_STUB ISpGrammarBuilder_GetRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_ClearRule_Proxy( + ISpGrammarBuilder * This, + SPSTATEHANDLE hState); + + +void __RPC_STUB ISpGrammarBuilder_ClearRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_CreateNewState_Proxy( + ISpGrammarBuilder * This, + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState); + + +void __RPC_STUB ISpGrammarBuilder_CreateNewState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_AddWordTransition_Proxy( + ISpGrammarBuilder * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + +void __RPC_STUB ISpGrammarBuilder_AddWordTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_AddRuleTransition_Proxy( + ISpGrammarBuilder * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + +void __RPC_STUB ISpGrammarBuilder_AddRuleTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_AddResource_Proxy( + ISpGrammarBuilder * This, + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue); + + +void __RPC_STUB ISpGrammarBuilder_AddResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_Commit_Proxy( + ISpGrammarBuilder * This, + DWORD dwReserved); + + +void __RPC_STUB ISpGrammarBuilder_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpGrammarBuilder_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0278 */ +/* [local] */ + +typedef /* [hidden] */ +enum SPLOADOPTIONS + { SPLO_STATIC = 0, + SPLO_DYNAMIC = 1 + } SPLOADOPTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0278_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0278_v0_0_s_ifspec; + +#ifndef __ISpRecoGrammar_INTERFACE_DEFINED__ +#define __ISpRecoGrammar_INTERFACE_DEFINED__ + +/* interface ISpRecoGrammar */ +/* [local][restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRecoGrammar; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2177DB29-7F45-47D0-8554-067E91C80502") + ISpRecoGrammar : public ISpGrammarBuilder + { + public: + virtual HRESULT STDMETHODCALLTYPE GetGrammarId( + /* [out] */ ULONGLONG *pullGrammarId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecoContext( + /* [out] */ ISpRecoContext **ppRecoCtxt) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromFile( + /* [string][in] */ const WCHAR *pszFileName, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromObject( + /* [in] */ REFCLSID rcid, + /* [string][in] */ const WCHAR *pszGrammarName, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromResource( + /* [in] */ HMODULE hModule, + /* [string][in] */ const WCHAR *pszResourceName, + /* [string][in] */ const WCHAR *pszResourceType, + /* [in] */ WORD wLanguage, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromMemory( + /* [in] */ const SPBINARYGRAMMAR *pGrammar, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromProprietaryGrammar( + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataPrarm, + /* [in] */ ULONG cbDataSize, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRuleState( + /* [string][in] */ const WCHAR *pszName, + void *pReserved, + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRuleIdState( + /* [in] */ ULONG ulRuleId, + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadDictation( + /* [string][in] */ const WCHAR *pszTopicName, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnloadDictation( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDictationState( + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetWordSequenceData( + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTextSelection( + /* [in] */ const SPTEXTSELECTIONINFO *pInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsPronounceable( + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetGrammarState( + /* [in] */ SPGRAMMARSTATE eGrammarState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SaveCmd( + /* [in] */ IStream *pStream, + /* [optional][out] */ WCHAR **ppszCoMemErrorText) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGrammarState( + /* [out] */ SPGRAMMARSTATE *peGrammarState) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRecoGrammarVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRecoGrammar * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRecoGrammar * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRecoGrammar * This); + + HRESULT ( STDMETHODCALLTYPE *ResetGrammar )( + ISpRecoGrammar * This, + /* [in] */ WORD NewLanguage); + + HRESULT ( STDMETHODCALLTYPE *GetRule )( + ISpRecoGrammar * This, + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState); + + HRESULT ( STDMETHODCALLTYPE *ClearRule )( + ISpRecoGrammar * This, + SPSTATEHANDLE hState); + + HRESULT ( STDMETHODCALLTYPE *CreateNewState )( + ISpRecoGrammar * This, + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState); + + HRESULT ( STDMETHODCALLTYPE *AddWordTransition )( + ISpRecoGrammar * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddRuleTransition )( + ISpRecoGrammar * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddResource )( + ISpRecoGrammar * This, + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpRecoGrammar * This, + DWORD dwReserved); + + HRESULT ( STDMETHODCALLTYPE *GetGrammarId )( + ISpRecoGrammar * This, + /* [out] */ ULONGLONG *pullGrammarId); + + HRESULT ( STDMETHODCALLTYPE *GetRecoContext )( + ISpRecoGrammar * This, + /* [out] */ ISpRecoContext **ppRecoCtxt); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromFile )( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszFileName, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromObject )( + ISpRecoGrammar * This, + /* [in] */ REFCLSID rcid, + /* [string][in] */ const WCHAR *pszGrammarName, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromResource )( + ISpRecoGrammar * This, + /* [in] */ HMODULE hModule, + /* [string][in] */ const WCHAR *pszResourceName, + /* [string][in] */ const WCHAR *pszResourceType, + /* [in] */ WORD wLanguage, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromMemory )( + ISpRecoGrammar * This, + /* [in] */ const SPBINARYGRAMMAR *pGrammar, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromProprietaryGrammar )( + ISpRecoGrammar * This, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataPrarm, + /* [in] */ ULONG cbDataSize, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *SetRuleState )( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszName, + void *pReserved, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *SetRuleIdState )( + ISpRecoGrammar * This, + /* [in] */ ULONG ulRuleId, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *LoadDictation )( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszTopicName, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *UnloadDictation )( + ISpRecoGrammar * This); + + HRESULT ( STDMETHODCALLTYPE *SetDictationState )( + ISpRecoGrammar * This, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *SetWordSequenceData )( + ISpRecoGrammar * This, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *SetTextSelection )( + ISpRecoGrammar * This, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *IsPronounceable )( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable); + + HRESULT ( STDMETHODCALLTYPE *SetGrammarState )( + ISpRecoGrammar * This, + /* [in] */ SPGRAMMARSTATE eGrammarState); + + HRESULT ( STDMETHODCALLTYPE *SaveCmd )( + ISpRecoGrammar * This, + /* [in] */ IStream *pStream, + /* [optional][out] */ WCHAR **ppszCoMemErrorText); + + HRESULT ( STDMETHODCALLTYPE *GetGrammarState )( + ISpRecoGrammar * This, + /* [out] */ SPGRAMMARSTATE *peGrammarState); + + END_INTERFACE + } ISpRecoGrammarVtbl; + + interface ISpRecoGrammar + { + CONST_VTBL struct ISpRecoGrammarVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRecoGrammar_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRecoGrammar_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRecoGrammar_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRecoGrammar_ResetGrammar(This,NewLanguage) \ + (This)->lpVtbl -> ResetGrammar(This,NewLanguage) + +#define ISpRecoGrammar_GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) \ + (This)->lpVtbl -> GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) + +#define ISpRecoGrammar_ClearRule(This,hState) \ + (This)->lpVtbl -> ClearRule(This,hState) + +#define ISpRecoGrammar_CreateNewState(This,hState,phState) \ + (This)->lpVtbl -> CreateNewState(This,hState,phState) + +#define ISpRecoGrammar_AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) \ + (This)->lpVtbl -> AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) + +#define ISpRecoGrammar_AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) \ + (This)->lpVtbl -> AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) + +#define ISpRecoGrammar_AddResource(This,hRuleState,pszResourceName,pszResourceValue) \ + (This)->lpVtbl -> AddResource(This,hRuleState,pszResourceName,pszResourceValue) + +#define ISpRecoGrammar_Commit(This,dwReserved) \ + (This)->lpVtbl -> Commit(This,dwReserved) + + +#define ISpRecoGrammar_GetGrammarId(This,pullGrammarId) \ + (This)->lpVtbl -> GetGrammarId(This,pullGrammarId) + +#define ISpRecoGrammar_GetRecoContext(This,ppRecoCtxt) \ + (This)->lpVtbl -> GetRecoContext(This,ppRecoCtxt) + +#define ISpRecoGrammar_LoadCmdFromFile(This,pszFileName,Options) \ + (This)->lpVtbl -> LoadCmdFromFile(This,pszFileName,Options) + +#define ISpRecoGrammar_LoadCmdFromObject(This,rcid,pszGrammarName,Options) \ + (This)->lpVtbl -> LoadCmdFromObject(This,rcid,pszGrammarName,Options) + +#define ISpRecoGrammar_LoadCmdFromResource(This,hModule,pszResourceName,pszResourceType,wLanguage,Options) \ + (This)->lpVtbl -> LoadCmdFromResource(This,hModule,pszResourceName,pszResourceType,wLanguage,Options) + +#define ISpRecoGrammar_LoadCmdFromMemory(This,pGrammar,Options) \ + (This)->lpVtbl -> LoadCmdFromMemory(This,pGrammar,Options) + +#define ISpRecoGrammar_LoadCmdFromProprietaryGrammar(This,rguidParam,pszStringParam,pvDataPrarm,cbDataSize,Options) \ + (This)->lpVtbl -> LoadCmdFromProprietaryGrammar(This,rguidParam,pszStringParam,pvDataPrarm,cbDataSize,Options) + +#define ISpRecoGrammar_SetRuleState(This,pszName,pReserved,NewState) \ + (This)->lpVtbl -> SetRuleState(This,pszName,pReserved,NewState) + +#define ISpRecoGrammar_SetRuleIdState(This,ulRuleId,NewState) \ + (This)->lpVtbl -> SetRuleIdState(This,ulRuleId,NewState) + +#define ISpRecoGrammar_LoadDictation(This,pszTopicName,Options) \ + (This)->lpVtbl -> LoadDictation(This,pszTopicName,Options) + +#define ISpRecoGrammar_UnloadDictation(This) \ + (This)->lpVtbl -> UnloadDictation(This) + +#define ISpRecoGrammar_SetDictationState(This,NewState) \ + (This)->lpVtbl -> SetDictationState(This,NewState) + +#define ISpRecoGrammar_SetWordSequenceData(This,pText,cchText,pInfo) \ + (This)->lpVtbl -> SetWordSequenceData(This,pText,cchText,pInfo) + +#define ISpRecoGrammar_SetTextSelection(This,pInfo) \ + (This)->lpVtbl -> SetTextSelection(This,pInfo) + +#define ISpRecoGrammar_IsPronounceable(This,pszWord,pWordPronounceable) \ + (This)->lpVtbl -> IsPronounceable(This,pszWord,pWordPronounceable) + +#define ISpRecoGrammar_SetGrammarState(This,eGrammarState) \ + (This)->lpVtbl -> SetGrammarState(This,eGrammarState) + +#define ISpRecoGrammar_SaveCmd(This,pStream,ppszCoMemErrorText) \ + (This)->lpVtbl -> SaveCmd(This,pStream,ppszCoMemErrorText) + +#define ISpRecoGrammar_GetGrammarState(This,peGrammarState) \ + (This)->lpVtbl -> GetGrammarState(This,peGrammarState) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_GetGrammarId_Proxy( + ISpRecoGrammar * This, + /* [out] */ ULONGLONG *pullGrammarId); + + +void __RPC_STUB ISpRecoGrammar_GetGrammarId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_GetRecoContext_Proxy( + ISpRecoGrammar * This, + /* [out] */ ISpRecoContext **ppRecoCtxt); + + +void __RPC_STUB ISpRecoGrammar_GetRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromFile_Proxy( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszFileName, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromFile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromObject_Proxy( + ISpRecoGrammar * This, + /* [in] */ REFCLSID rcid, + /* [string][in] */ const WCHAR *pszGrammarName, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromResource_Proxy( + ISpRecoGrammar * This, + /* [in] */ HMODULE hModule, + /* [string][in] */ const WCHAR *pszResourceName, + /* [string][in] */ const WCHAR *pszResourceType, + /* [in] */ WORD wLanguage, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromMemory_Proxy( + ISpRecoGrammar * This, + /* [in] */ const SPBINARYGRAMMAR *pGrammar, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromProprietaryGrammar_Proxy( + ISpRecoGrammar * This, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataPrarm, + /* [in] */ ULONG cbDataSize, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromProprietaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetRuleState_Proxy( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszName, + void *pReserved, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpRecoGrammar_SetRuleState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetRuleIdState_Proxy( + ISpRecoGrammar * This, + /* [in] */ ULONG ulRuleId, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpRecoGrammar_SetRuleIdState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadDictation_Proxy( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszTopicName, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadDictation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_UnloadDictation_Proxy( + ISpRecoGrammar * This); + + +void __RPC_STUB ISpRecoGrammar_UnloadDictation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetDictationState_Proxy( + ISpRecoGrammar * This, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpRecoGrammar_SetDictationState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetWordSequenceData_Proxy( + ISpRecoGrammar * This, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + +void __RPC_STUB ISpRecoGrammar_SetWordSequenceData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetTextSelection_Proxy( + ISpRecoGrammar * This, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + +void __RPC_STUB ISpRecoGrammar_SetTextSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_IsPronounceable_Proxy( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable); + + +void __RPC_STUB ISpRecoGrammar_IsPronounceable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetGrammarState_Proxy( + ISpRecoGrammar * This, + /* [in] */ SPGRAMMARSTATE eGrammarState); + + +void __RPC_STUB ISpRecoGrammar_SetGrammarState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SaveCmd_Proxy( + ISpRecoGrammar * This, + /* [in] */ IStream *pStream, + /* [optional][out] */ WCHAR **ppszCoMemErrorText); + + +void __RPC_STUB ISpRecoGrammar_SaveCmd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_GetGrammarState_Proxy( + ISpRecoGrammar * This, + /* [out] */ SPGRAMMARSTATE *peGrammarState); + + +void __RPC_STUB ISpRecoGrammar_GetGrammarState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRecoGrammar_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0279 */ +/* [local] */ + +typedef /* [hidden][restricted] */ struct SPRECOCONTEXTSTATUS + { + SPINTERFERENCE eInterference; + WCHAR szRequestTypeOfUI[ 255 ]; + DWORD dwReserved1; + DWORD dwReserved2; + } SPRECOCONTEXTSTATUS; + +typedef /* [hidden] */ +enum SPBOOKMARKOPTIONS + { SPBO_NONE = 0, + SPBO_PAUSE = 1 + } SPBOOKMARKOPTIONS; + +typedef /* [hidden] */ +enum SPAUDIOOPTIONS + { SPAO_NONE = 0, + SPAO_RETAIN_AUDIO = 1 << 0 + } SPAUDIOOPTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0279_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0279_v0_0_s_ifspec; + +#ifndef __ISpRecoContext_INTERFACE_DEFINED__ +#define __ISpRecoContext_INTERFACE_DEFINED__ + +/* interface ISpRecoContext */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRecoContext; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F740A62F-7C15-489E-8234-940A33D9272D") + ISpRecoContext : public ISpEventSource + { + public: + virtual HRESULT STDMETHODCALLTYPE GetRecognizer( + /* [out] */ ISpRecognizer **ppRecognizer) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGrammar( + /* [in] */ ULONGLONG ullGrammarId, + /* [out] */ ISpRecoGrammar **ppGrammar) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatus( + /* [out] */ SPRECOCONTEXTSTATUS *pStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMaxAlternates( + /* [in] */ ULONG *pcAlternates) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetMaxAlternates( + /* [in] */ ULONG cAlternates) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioOptions( + /* [in] */ SPAUDIOOPTIONS Options, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAudioOptions( + /* [in] */ SPAUDIOOPTIONS *pOptions, + /* [out] */ GUID *pAudioFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeserializeResult( + /* [in] */ const SPSERIALIZEDRESULT *pSerializedResult, + /* [out] */ ISpRecoResult **ppResult) = 0; + + virtual HRESULT STDMETHODCALLTYPE Bookmark( + /* [in] */ SPBOOKMARKOPTIONS Options, + /* [in] */ ULONGLONG ullStreamPosition, + /* [in] */ LPARAM lparamEvent) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAdaptationData( + /* [string][in] */ const WCHAR *pAdaptationData, + /* [in] */ const ULONG cch) = 0; + + virtual HRESULT STDMETHODCALLTYPE Pause( + DWORD dwReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE Resume( + DWORD dwReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVoice( + /* [in] */ ISpVoice *pVoice, + /* [in] */ BOOL fAllowFormatChanges) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVoice( + /* [out] */ ISpVoice **ppVoice) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVoicePurgeEvent( + /* [in] */ ULONGLONG ullEventInterest) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVoicePurgeEvent( + /* [out] */ ULONGLONG *pullEventInterest) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetContextState( + /* [in] */ SPCONTEXTSTATE eContextState) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetContextState( + /* [in] */ SPCONTEXTSTATE *peContextState) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRecoContextVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRecoContext * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRecoContext * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRecoContext * This); + + HRESULT ( STDMETHODCALLTYPE *SetNotifySink )( + ISpRecoContext * This, + /* [in] */ ISpNotifySink *pNotifySink); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWindowMessage )( + ISpRecoContext * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackFunction )( + ISpRecoContext * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackInterface )( + ISpRecoContext * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWin32Event )( + ISpRecoContext * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForNotifyEvent )( + ISpRecoContext * This, + /* [in] */ DWORD dwMilliseconds); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *GetNotifyEventHandle )( + ISpRecoContext * This); + + HRESULT ( STDMETHODCALLTYPE *SetInterest )( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest); + + HRESULT ( STDMETHODCALLTYPE *GetEvents )( + ISpRecoContext * This, + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched); + + HRESULT ( STDMETHODCALLTYPE *GetInfo )( + ISpRecoContext * This, + /* [out] */ SPEVENTSOURCEINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *GetRecognizer )( + ISpRecoContext * This, + /* [out] */ ISpRecognizer **ppRecognizer); + + HRESULT ( STDMETHODCALLTYPE *CreateGrammar )( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullGrammarId, + /* [out] */ ISpRecoGrammar **ppGrammar); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpRecoContext * This, + /* [out] */ SPRECOCONTEXTSTATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *GetMaxAlternates )( + ISpRecoContext * This, + /* [in] */ ULONG *pcAlternates); + + HRESULT ( STDMETHODCALLTYPE *SetMaxAlternates )( + ISpRecoContext * This, + /* [in] */ ULONG cAlternates); + + HRESULT ( STDMETHODCALLTYPE *SetAudioOptions )( + ISpRecoContext * This, + /* [in] */ SPAUDIOOPTIONS Options, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetAudioOptions )( + ISpRecoContext * This, + /* [in] */ SPAUDIOOPTIONS *pOptions, + /* [out] */ GUID *pAudioFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX); + + HRESULT ( STDMETHODCALLTYPE *DeserializeResult )( + ISpRecoContext * This, + /* [in] */ const SPSERIALIZEDRESULT *pSerializedResult, + /* [out] */ ISpRecoResult **ppResult); + + HRESULT ( STDMETHODCALLTYPE *Bookmark )( + ISpRecoContext * This, + /* [in] */ SPBOOKMARKOPTIONS Options, + /* [in] */ ULONGLONG ullStreamPosition, + /* [in] */ LPARAM lparamEvent); + + HRESULT ( STDMETHODCALLTYPE *SetAdaptationData )( + ISpRecoContext * This, + /* [string][in] */ const WCHAR *pAdaptationData, + /* [in] */ const ULONG cch); + + HRESULT ( STDMETHODCALLTYPE *Pause )( + ISpRecoContext * This, + DWORD dwReserved); + + HRESULT ( STDMETHODCALLTYPE *Resume )( + ISpRecoContext * This, + DWORD dwReserved); + + HRESULT ( STDMETHODCALLTYPE *SetVoice )( + ISpRecoContext * This, + /* [in] */ ISpVoice *pVoice, + /* [in] */ BOOL fAllowFormatChanges); + + HRESULT ( STDMETHODCALLTYPE *GetVoice )( + ISpRecoContext * This, + /* [out] */ ISpVoice **ppVoice); + + HRESULT ( STDMETHODCALLTYPE *SetVoicePurgeEvent )( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullEventInterest); + + HRESULT ( STDMETHODCALLTYPE *GetVoicePurgeEvent )( + ISpRecoContext * This, + /* [out] */ ULONGLONG *pullEventInterest); + + HRESULT ( STDMETHODCALLTYPE *SetContextState )( + ISpRecoContext * This, + /* [in] */ SPCONTEXTSTATE eContextState); + + HRESULT ( STDMETHODCALLTYPE *GetContextState )( + ISpRecoContext * This, + /* [in] */ SPCONTEXTSTATE *peContextState); + + END_INTERFACE + } ISpRecoContextVtbl; + + interface ISpRecoContext + { + CONST_VTBL struct ISpRecoContextVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRecoContext_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRecoContext_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRecoContext_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRecoContext_SetNotifySink(This,pNotifySink) \ + (This)->lpVtbl -> SetNotifySink(This,pNotifySink) + +#define ISpRecoContext_SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpRecoContext_SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) + +#define ISpRecoContext_SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) + +#define ISpRecoContext_SetNotifyWin32Event(This) \ + (This)->lpVtbl -> SetNotifyWin32Event(This) + +#define ISpRecoContext_WaitForNotifyEvent(This,dwMilliseconds) \ + (This)->lpVtbl -> WaitForNotifyEvent(This,dwMilliseconds) + +#define ISpRecoContext_GetNotifyEventHandle(This) \ + (This)->lpVtbl -> GetNotifyEventHandle(This) + + +#define ISpRecoContext_SetInterest(This,ullEventInterest,ullQueuedInterest) \ + (This)->lpVtbl -> SetInterest(This,ullEventInterest,ullQueuedInterest) + +#define ISpRecoContext_GetEvents(This,ulCount,pEventArray,pulFetched) \ + (This)->lpVtbl -> GetEvents(This,ulCount,pEventArray,pulFetched) + +#define ISpRecoContext_GetInfo(This,pInfo) \ + (This)->lpVtbl -> GetInfo(This,pInfo) + + +#define ISpRecoContext_GetRecognizer(This,ppRecognizer) \ + (This)->lpVtbl -> GetRecognizer(This,ppRecognizer) + +#define ISpRecoContext_CreateGrammar(This,ullGrammarId,ppGrammar) \ + (This)->lpVtbl -> CreateGrammar(This,ullGrammarId,ppGrammar) + +#define ISpRecoContext_GetStatus(This,pStatus) \ + (This)->lpVtbl -> GetStatus(This,pStatus) + +#define ISpRecoContext_GetMaxAlternates(This,pcAlternates) \ + (This)->lpVtbl -> GetMaxAlternates(This,pcAlternates) + +#define ISpRecoContext_SetMaxAlternates(This,cAlternates) \ + (This)->lpVtbl -> SetMaxAlternates(This,cAlternates) + +#define ISpRecoContext_SetAudioOptions(This,Options,pAudioFormatId,pWaveFormatEx) \ + (This)->lpVtbl -> SetAudioOptions(This,Options,pAudioFormatId,pWaveFormatEx) + +#define ISpRecoContext_GetAudioOptions(This,pOptions,pAudioFormatId,ppCoMemWFEX) \ + (This)->lpVtbl -> GetAudioOptions(This,pOptions,pAudioFormatId,ppCoMemWFEX) + +#define ISpRecoContext_DeserializeResult(This,pSerializedResult,ppResult) \ + (This)->lpVtbl -> DeserializeResult(This,pSerializedResult,ppResult) + +#define ISpRecoContext_Bookmark(This,Options,ullStreamPosition,lparamEvent) \ + (This)->lpVtbl -> Bookmark(This,Options,ullStreamPosition,lparamEvent) + +#define ISpRecoContext_SetAdaptationData(This,pAdaptationData,cch) \ + (This)->lpVtbl -> SetAdaptationData(This,pAdaptationData,cch) + +#define ISpRecoContext_Pause(This,dwReserved) \ + (This)->lpVtbl -> Pause(This,dwReserved) + +#define ISpRecoContext_Resume(This,dwReserved) \ + (This)->lpVtbl -> Resume(This,dwReserved) + +#define ISpRecoContext_SetVoice(This,pVoice,fAllowFormatChanges) \ + (This)->lpVtbl -> SetVoice(This,pVoice,fAllowFormatChanges) + +#define ISpRecoContext_GetVoice(This,ppVoice) \ + (This)->lpVtbl -> GetVoice(This,ppVoice) + +#define ISpRecoContext_SetVoicePurgeEvent(This,ullEventInterest) \ + (This)->lpVtbl -> SetVoicePurgeEvent(This,ullEventInterest) + +#define ISpRecoContext_GetVoicePurgeEvent(This,pullEventInterest) \ + (This)->lpVtbl -> GetVoicePurgeEvent(This,pullEventInterest) + +#define ISpRecoContext_SetContextState(This,eContextState) \ + (This)->lpVtbl -> SetContextState(This,eContextState) + +#define ISpRecoContext_GetContextState(This,peContextState) \ + (This)->lpVtbl -> GetContextState(This,peContextState) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetRecognizer_Proxy( + ISpRecoContext * This, + /* [out] */ ISpRecognizer **ppRecognizer); + + +void __RPC_STUB ISpRecoContext_GetRecognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_CreateGrammar_Proxy( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullGrammarId, + /* [out] */ ISpRecoGrammar **ppGrammar); + + +void __RPC_STUB ISpRecoContext_CreateGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetStatus_Proxy( + ISpRecoContext * This, + /* [out] */ SPRECOCONTEXTSTATUS *pStatus); + + +void __RPC_STUB ISpRecoContext_GetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetMaxAlternates_Proxy( + ISpRecoContext * This, + /* [in] */ ULONG *pcAlternates); + + +void __RPC_STUB ISpRecoContext_GetMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetMaxAlternates_Proxy( + ISpRecoContext * This, + /* [in] */ ULONG cAlternates); + + +void __RPC_STUB ISpRecoContext_SetMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetAudioOptions_Proxy( + ISpRecoContext * This, + /* [in] */ SPAUDIOOPTIONS Options, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + +void __RPC_STUB ISpRecoContext_SetAudioOptions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetAudioOptions_Proxy( + ISpRecoContext * This, + /* [in] */ SPAUDIOOPTIONS *pOptions, + /* [out] */ GUID *pAudioFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX); + + +void __RPC_STUB ISpRecoContext_GetAudioOptions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_DeserializeResult_Proxy( + ISpRecoContext * This, + /* [in] */ const SPSERIALIZEDRESULT *pSerializedResult, + /* [out] */ ISpRecoResult **ppResult); + + +void __RPC_STUB ISpRecoContext_DeserializeResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_Bookmark_Proxy( + ISpRecoContext * This, + /* [in] */ SPBOOKMARKOPTIONS Options, + /* [in] */ ULONGLONG ullStreamPosition, + /* [in] */ LPARAM lparamEvent); + + +void __RPC_STUB ISpRecoContext_Bookmark_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetAdaptationData_Proxy( + ISpRecoContext * This, + /* [string][in] */ const WCHAR *pAdaptationData, + /* [in] */ const ULONG cch); + + +void __RPC_STUB ISpRecoContext_SetAdaptationData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_Pause_Proxy( + ISpRecoContext * This, + DWORD dwReserved); + + +void __RPC_STUB ISpRecoContext_Pause_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_Resume_Proxy( + ISpRecoContext * This, + DWORD dwReserved); + + +void __RPC_STUB ISpRecoContext_Resume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetVoice_Proxy( + ISpRecoContext * This, + /* [in] */ ISpVoice *pVoice, + /* [in] */ BOOL fAllowFormatChanges); + + +void __RPC_STUB ISpRecoContext_SetVoice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetVoice_Proxy( + ISpRecoContext * This, + /* [out] */ ISpVoice **ppVoice); + + +void __RPC_STUB ISpRecoContext_GetVoice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetVoicePurgeEvent_Proxy( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullEventInterest); + + +void __RPC_STUB ISpRecoContext_SetVoicePurgeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetVoicePurgeEvent_Proxy( + ISpRecoContext * This, + /* [out] */ ULONGLONG *pullEventInterest); + + +void __RPC_STUB ISpRecoContext_GetVoicePurgeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetContextState_Proxy( + ISpRecoContext * This, + /* [in] */ SPCONTEXTSTATE eContextState); + + +void __RPC_STUB ISpRecoContext_SetContextState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetContextState_Proxy( + ISpRecoContext * This, + /* [in] */ SPCONTEXTSTATE *peContextState); + + +void __RPC_STUB ISpRecoContext_GetContextState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRecoContext_INTERFACE_DEFINED__ */ + + +#ifndef __ISpProperties_INTERFACE_DEFINED__ +#define __ISpProperties_INTERFACE_DEFINED__ + +/* interface ISpProperties */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5B4FB971-B115-4DE1-AD97-E482E3BF6EE4") + ISpProperties : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetPropertyNum( + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyNum( + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *plValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPropertyString( + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyString( + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPropertiesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpProperties * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpProperties * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpProperties * This); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyNum )( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyNum )( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *plValue); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyString )( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyString )( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + END_INTERFACE + } ISpPropertiesVtbl; + + interface ISpProperties + { + CONST_VTBL struct ISpPropertiesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpProperties_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpProperties_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpProperties_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpProperties_SetPropertyNum(This,pName,lValue) \ + (This)->lpVtbl -> SetPropertyNum(This,pName,lValue) + +#define ISpProperties_GetPropertyNum(This,pName,plValue) \ + (This)->lpVtbl -> GetPropertyNum(This,pName,plValue) + +#define ISpProperties_SetPropertyString(This,pName,pValue) \ + (This)->lpVtbl -> SetPropertyString(This,pName,pValue) + +#define ISpProperties_GetPropertyString(This,pName,ppCoMemValue) \ + (This)->lpVtbl -> GetPropertyString(This,pName,ppCoMemValue) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpProperties_SetPropertyNum_Proxy( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + +void __RPC_STUB ISpProperties_SetPropertyNum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpProperties_GetPropertyNum_Proxy( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *plValue); + + +void __RPC_STUB ISpProperties_GetPropertyNum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpProperties_SetPropertyString_Proxy( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + +void __RPC_STUB ISpProperties_SetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpProperties_GetPropertyString_Proxy( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + +void __RPC_STUB ISpProperties_GetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpProperties_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0281 */ +/* [local] */ + +#define SP_MAX_LANGIDS ( 20 ) + +typedef /* [hidden][restricted] */ struct SPRECOGNIZERSTATUS + { + SPAUDIOSTATUS AudioStatus; + ULONGLONG ullRecognitionStreamPos; + ULONG ulStreamNumber; + ULONG ulNumActive; + CLSID clsidEngine; + ULONG cLangIDs; + WORD aLangID[ 20 ]; + DWORD dwReserved1; + DWORD dwReserved2; + } SPRECOGNIZERSTATUS; + +typedef /* [hidden] */ +enum SPWAVEFORMATTYPE + { SPWF_INPUT = 0, + SPWF_SRENGINE = SPWF_INPUT + 1 + } SPSTREAMFORMATTYPE; + +typedef /* [hidden] */ +enum SPRECOSTATE + { SPRST_INACTIVE = 0, + SPRST_ACTIVE = SPRST_INACTIVE + 1, + SPRST_ACTIVE_ALWAYS = SPRST_ACTIVE + 1, + SPRST_INACTIVE_WITH_PURGE = SPRST_ACTIVE_ALWAYS + 1, + SPRST_NUM_STATES = SPRST_INACTIVE_WITH_PURGE + 1 + } SPRECOSTATE; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0281_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0281_v0_0_s_ifspec; + +#ifndef __ISpRecognizer_INTERFACE_DEFINED__ +#define __ISpRecognizer_INTERFACE_DEFINED__ + +/* interface ISpRecognizer */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRecognizer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C2B5F241-DAA0-4507-9E16-5A1EAA2B7A5C") + ISpRecognizer : public ISpProperties + { + public: + virtual HRESULT STDMETHODCALLTYPE SetRecognizer( + /* [in] */ ISpObjectToken *pRecognizer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecognizer( + /* [out] */ ISpObjectToken **ppRecognizer) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetInput( + /* [in] */ IUnknown *pUnkInput, + /* [in] */ BOOL fAllowFormatChanges) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInputObjectToken( + /* [out] */ ISpObjectToken **ppToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInputStream( + /* [out] */ ISpStreamFormat **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRecoContext( + /* [out] */ ISpRecoContext **ppNewCtxt) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecoProfile( + /* [out] */ ISpObjectToken **ppToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRecoProfile( + /* [in] */ ISpObjectToken *pToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsSharedInstance( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecoState( + /* [out] */ SPRECOSTATE *pState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRecoState( + /* [in] */ SPRECOSTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatus( + /* [out] */ SPRECOGNIZERSTATUS *pStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFormat( + /* [in] */ SPSTREAMFORMATTYPE WaveFormatType, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData) = 0; + + virtual HRESULT STDMETHODCALLTYPE EmulateRecognition( + /* [in] */ ISpPhrase *pPhrase) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRecognizerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRecognizer * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRecognizer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyNum )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyNum )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *plValue); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyString )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyString )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + HRESULT ( STDMETHODCALLTYPE *SetRecognizer )( + ISpRecognizer * This, + /* [in] */ ISpObjectToken *pRecognizer); + + HRESULT ( STDMETHODCALLTYPE *GetRecognizer )( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppRecognizer); + + HRESULT ( STDMETHODCALLTYPE *SetInput )( + ISpRecognizer * This, + /* [in] */ IUnknown *pUnkInput, + /* [in] */ BOOL fAllowFormatChanges); + + HRESULT ( STDMETHODCALLTYPE *GetInputObjectToken )( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *GetInputStream )( + ISpRecognizer * This, + /* [out] */ ISpStreamFormat **ppStream); + + HRESULT ( STDMETHODCALLTYPE *CreateRecoContext )( + ISpRecognizer * This, + /* [out] */ ISpRecoContext **ppNewCtxt); + + HRESULT ( STDMETHODCALLTYPE *GetRecoProfile )( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *SetRecoProfile )( + ISpRecognizer * This, + /* [in] */ ISpObjectToken *pToken); + + HRESULT ( STDMETHODCALLTYPE *IsSharedInstance )( + ISpRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *GetRecoState )( + ISpRecognizer * This, + /* [out] */ SPRECOSTATE *pState); + + HRESULT ( STDMETHODCALLTYPE *SetRecoState )( + ISpRecognizer * This, + /* [in] */ SPRECOSTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpRecognizer * This, + /* [out] */ SPRECOGNIZERSTATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpRecognizer * This, + /* [in] */ SPSTREAMFORMATTYPE WaveFormatType, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpRecognizer * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData); + + HRESULT ( STDMETHODCALLTYPE *EmulateRecognition )( + ISpRecognizer * This, + /* [in] */ ISpPhrase *pPhrase); + + END_INTERFACE + } ISpRecognizerVtbl; + + interface ISpRecognizer + { + CONST_VTBL struct ISpRecognizerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRecognizer_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRecognizer_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRecognizer_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRecognizer_SetPropertyNum(This,pName,lValue) \ + (This)->lpVtbl -> SetPropertyNum(This,pName,lValue) + +#define ISpRecognizer_GetPropertyNum(This,pName,plValue) \ + (This)->lpVtbl -> GetPropertyNum(This,pName,plValue) + +#define ISpRecognizer_SetPropertyString(This,pName,pValue) \ + (This)->lpVtbl -> SetPropertyString(This,pName,pValue) + +#define ISpRecognizer_GetPropertyString(This,pName,ppCoMemValue) \ + (This)->lpVtbl -> GetPropertyString(This,pName,ppCoMemValue) + + +#define ISpRecognizer_SetRecognizer(This,pRecognizer) \ + (This)->lpVtbl -> SetRecognizer(This,pRecognizer) + +#define ISpRecognizer_GetRecognizer(This,ppRecognizer) \ + (This)->lpVtbl -> GetRecognizer(This,ppRecognizer) + +#define ISpRecognizer_SetInput(This,pUnkInput,fAllowFormatChanges) \ + (This)->lpVtbl -> SetInput(This,pUnkInput,fAllowFormatChanges) + +#define ISpRecognizer_GetInputObjectToken(This,ppToken) \ + (This)->lpVtbl -> GetInputObjectToken(This,ppToken) + +#define ISpRecognizer_GetInputStream(This,ppStream) \ + (This)->lpVtbl -> GetInputStream(This,ppStream) + +#define ISpRecognizer_CreateRecoContext(This,ppNewCtxt) \ + (This)->lpVtbl -> CreateRecoContext(This,ppNewCtxt) + +#define ISpRecognizer_GetRecoProfile(This,ppToken) \ + (This)->lpVtbl -> GetRecoProfile(This,ppToken) + +#define ISpRecognizer_SetRecoProfile(This,pToken) \ + (This)->lpVtbl -> SetRecoProfile(This,pToken) + +#define ISpRecognizer_IsSharedInstance(This) \ + (This)->lpVtbl -> IsSharedInstance(This) + +#define ISpRecognizer_GetRecoState(This,pState) \ + (This)->lpVtbl -> GetRecoState(This,pState) + +#define ISpRecognizer_SetRecoState(This,NewState) \ + (This)->lpVtbl -> SetRecoState(This,NewState) + +#define ISpRecognizer_GetStatus(This,pStatus) \ + (This)->lpVtbl -> GetStatus(This,pStatus) + +#define ISpRecognizer_GetFormat(This,WaveFormatType,pFormatId,ppCoMemWFEX) \ + (This)->lpVtbl -> GetFormat(This,WaveFormatType,pFormatId,ppCoMemWFEX) + +#define ISpRecognizer_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,pfSupported) + +#define ISpRecognizer_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData) + +#define ISpRecognizer_EmulateRecognition(This,pPhrase) \ + (This)->lpVtbl -> EmulateRecognition(This,pPhrase) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_SetRecognizer_Proxy( + ISpRecognizer * This, + /* [in] */ ISpObjectToken *pRecognizer); + + +void __RPC_STUB ISpRecognizer_SetRecognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetRecognizer_Proxy( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppRecognizer); + + +void __RPC_STUB ISpRecognizer_GetRecognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_SetInput_Proxy( + ISpRecognizer * This, + /* [in] */ IUnknown *pUnkInput, + /* [in] */ BOOL fAllowFormatChanges); + + +void __RPC_STUB ISpRecognizer_SetInput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetInputObjectToken_Proxy( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppToken); + + +void __RPC_STUB ISpRecognizer_GetInputObjectToken_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetInputStream_Proxy( + ISpRecognizer * This, + /* [out] */ ISpStreamFormat **ppStream); + + +void __RPC_STUB ISpRecognizer_GetInputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_CreateRecoContext_Proxy( + ISpRecognizer * This, + /* [out] */ ISpRecoContext **ppNewCtxt); + + +void __RPC_STUB ISpRecognizer_CreateRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetRecoProfile_Proxy( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppToken); + + +void __RPC_STUB ISpRecognizer_GetRecoProfile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_SetRecoProfile_Proxy( + ISpRecognizer * This, + /* [in] */ ISpObjectToken *pToken); + + +void __RPC_STUB ISpRecognizer_SetRecoProfile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_IsSharedInstance_Proxy( + ISpRecognizer * This); + + +void __RPC_STUB ISpRecognizer_IsSharedInstance_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetRecoState_Proxy( + ISpRecognizer * This, + /* [out] */ SPRECOSTATE *pState); + + +void __RPC_STUB ISpRecognizer_GetRecoState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_SetRecoState_Proxy( + ISpRecognizer * This, + /* [in] */ SPRECOSTATE NewState); + + +void __RPC_STUB ISpRecognizer_SetRecoState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetStatus_Proxy( + ISpRecognizer * This, + /* [out] */ SPRECOGNIZERSTATUS *pStatus); + + +void __RPC_STUB ISpRecognizer_GetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetFormat_Proxy( + ISpRecognizer * This, + /* [in] */ SPSTREAMFORMATTYPE WaveFormatType, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX); + + +void __RPC_STUB ISpRecognizer_GetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpRecognizer_IsUISupported_Proxy( + ISpRecognizer * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported); + + +void __RPC_STUB ISpRecognizer_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpRecognizer_DisplayUI_Proxy( + ISpRecognizer * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData); + + +void __RPC_STUB ISpRecognizer_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_EmulateRecognition_Proxy( + ISpRecognizer * This, + /* [in] */ ISpPhrase *pPhrase); + + +void __RPC_STUB ISpRecognizer_EmulateRecognition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRecognizer_INTERFACE_DEFINED__ */ + + + +#ifndef __SpeechLib_LIBRARY_DEFINED__ +#define __SpeechLib_LIBRARY_DEFINED__ + +/* library SpeechLib */ +/* [version][uuid][helpstring] */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +typedef long SpeechLanguageId; + +#define __SpeechStringConstants_MODULE_DEFINED__ +typedef /* [hidden] */ +enum DISPID_SpeechDataKey + { DISPID_SDKSetBinaryValue = 1, + DISPID_SDKGetBinaryValue = DISPID_SDKSetBinaryValue + 1, + DISPID_SDKSetStringValue = DISPID_SDKGetBinaryValue + 1, + DISPID_SDKGetStringValue = DISPID_SDKSetStringValue + 1, + DISPID_SDKSetLongValue = DISPID_SDKGetStringValue + 1, + DISPID_SDKGetlongValue = DISPID_SDKSetLongValue + 1, + DISPID_SDKOpenKey = DISPID_SDKGetlongValue + 1, + DISPID_SDKCreateKey = DISPID_SDKOpenKey + 1, + DISPID_SDKDeleteKey = DISPID_SDKCreateKey + 1, + DISPID_SDKDeleteValue = DISPID_SDKDeleteKey + 1, + DISPID_SDKEnumKeys = DISPID_SDKDeleteValue + 1, + DISPID_SDKEnumValues = DISPID_SDKEnumKeys + 1 + } DISPID_SpeechDataKey; + +typedef /* [hidden] */ +enum DISPID_SpeechObjectToken + { DISPID_SOTId = 1, + DISPID_SOTDataKey = DISPID_SOTId + 1, + DISPID_SOTCategory = DISPID_SOTDataKey + 1, + DISPID_SOTGetDescription = DISPID_SOTCategory + 1, + DISPID_SOTSetId = DISPID_SOTGetDescription + 1, + DISPID_SOTGetAttribute = DISPID_SOTSetId + 1, + DISPID_SOTCreateInstance = DISPID_SOTGetAttribute + 1, + DISPID_SOTRemove = DISPID_SOTCreateInstance + 1, + DISPID_SOTGetStorageFileName = DISPID_SOTRemove + 1, + DISPID_SOTRemoveStorageFileName = DISPID_SOTGetStorageFileName + 1, + DISPID_SOTIsUISupported = DISPID_SOTRemoveStorageFileName + 1, + DISPID_SOTDisplayUI = DISPID_SOTIsUISupported + 1, + DISPID_SOTMatchesAttributes = DISPID_SOTDisplayUI + 1 + } DISPID_SpeechObjectToken; + +typedef +enum SpeechDataKeyLocation + { SDKLDefaultLocation = SPDKL_DefaultLocation, + SDKLCurrentUser = SPDKL_CurrentUser, + SDKLLocalMachine = SPDKL_LocalMachine, + SDKLCurrentConfig = SPDKL_CurrentConfig + } SpeechDataKeyLocation; + +typedef +enum SpeechTokenContext + { STCInprocServer = CLSCTX_INPROC_SERVER, + STCInprocHandler = CLSCTX_INPROC_HANDLER, + STCLocalServer = CLSCTX_LOCAL_SERVER, + STCRemoteServer = CLSCTX_REMOTE_SERVER, + STCAll = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER + } SpeechTokenContext; + +typedef +enum SpeechTokenShellFolder + { STSF_AppData = 0x1a, + STSF_LocalAppData = 0x1c, + STSF_CommonAppData = 0x23, + STSF_FlagCreate = 0x8000 + } SpeechTokenShellFolder; + +typedef /* [hidden] */ +enum DISPID_SpeechObjectTokens + { DISPID_SOTsCount = 1, + DISPID_SOTsItem = DISPID_VALUE, + DISPID_SOTs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechObjectTokens; + +typedef /* [hidden] */ +enum DISPID_SpeechObjectTokenCategory + { DISPID_SOTCId = 1, + DISPID_SOTCDefault = DISPID_SOTCId + 1, + DISPID_SOTCSetId = DISPID_SOTCDefault + 1, + DISPID_SOTCGetDataKey = DISPID_SOTCSetId + 1, + DISPID_SOTCEnumerateTokens = DISPID_SOTCGetDataKey + 1 + } DISPID_SpeechObjectTokenCategory; + +typedef +enum SpeechAudioFormatType + { SAFTDefault = -1, + SAFTNoAssignedFormat = 0, + SAFTText = SAFTNoAssignedFormat + 1, + SAFTNonStandardFormat = SAFTText + 1, + SAFTExtendedAudioFormat = SAFTNonStandardFormat + 1, + SAFT8kHz8BitMono = SAFTExtendedAudioFormat + 1, + SAFT8kHz8BitStereo = SAFT8kHz8BitMono + 1, + SAFT8kHz16BitMono = SAFT8kHz8BitStereo + 1, + SAFT8kHz16BitStereo = SAFT8kHz16BitMono + 1, + SAFT11kHz8BitMono = SAFT8kHz16BitStereo + 1, + SAFT11kHz8BitStereo = SAFT11kHz8BitMono + 1, + SAFT11kHz16BitMono = SAFT11kHz8BitStereo + 1, + SAFT11kHz16BitStereo = SAFT11kHz16BitMono + 1, + SAFT12kHz8BitMono = SAFT11kHz16BitStereo + 1, + SAFT12kHz8BitStereo = SAFT12kHz8BitMono + 1, + SAFT12kHz16BitMono = SAFT12kHz8BitStereo + 1, + SAFT12kHz16BitStereo = SAFT12kHz16BitMono + 1, + SAFT16kHz8BitMono = SAFT12kHz16BitStereo + 1, + SAFT16kHz8BitStereo = SAFT16kHz8BitMono + 1, + SAFT16kHz16BitMono = SAFT16kHz8BitStereo + 1, + SAFT16kHz16BitStereo = SAFT16kHz16BitMono + 1, + SAFT22kHz8BitMono = SAFT16kHz16BitStereo + 1, + SAFT22kHz8BitStereo = SAFT22kHz8BitMono + 1, + SAFT22kHz16BitMono = SAFT22kHz8BitStereo + 1, + SAFT22kHz16BitStereo = SAFT22kHz16BitMono + 1, + SAFT24kHz8BitMono = SAFT22kHz16BitStereo + 1, + SAFT24kHz8BitStereo = SAFT24kHz8BitMono + 1, + SAFT24kHz16BitMono = SAFT24kHz8BitStereo + 1, + SAFT24kHz16BitStereo = SAFT24kHz16BitMono + 1, + SAFT32kHz8BitMono = SAFT24kHz16BitStereo + 1, + SAFT32kHz8BitStereo = SAFT32kHz8BitMono + 1, + SAFT32kHz16BitMono = SAFT32kHz8BitStereo + 1, + SAFT32kHz16BitStereo = SAFT32kHz16BitMono + 1, + SAFT44kHz8BitMono = SAFT32kHz16BitStereo + 1, + SAFT44kHz8BitStereo = SAFT44kHz8BitMono + 1, + SAFT44kHz16BitMono = SAFT44kHz8BitStereo + 1, + SAFT44kHz16BitStereo = SAFT44kHz16BitMono + 1, + SAFT48kHz8BitMono = SAFT44kHz16BitStereo + 1, + SAFT48kHz8BitStereo = SAFT48kHz8BitMono + 1, + SAFT48kHz16BitMono = SAFT48kHz8BitStereo + 1, + SAFT48kHz16BitStereo = SAFT48kHz16BitMono + 1, + SAFTTrueSpeech_8kHz1BitMono = SAFT48kHz16BitStereo + 1, + SAFTCCITT_ALaw_8kHzMono = SAFTTrueSpeech_8kHz1BitMono + 1, + SAFTCCITT_ALaw_8kHzStereo = SAFTCCITT_ALaw_8kHzMono + 1, + SAFTCCITT_ALaw_11kHzMono = SAFTCCITT_ALaw_8kHzStereo + 1, + SAFTCCITT_ALaw_11kHzStereo = SAFTCCITT_ALaw_11kHzMono + 1, + SAFTCCITT_ALaw_22kHzMono = SAFTCCITT_ALaw_11kHzStereo + 1, + SAFTCCITT_ALaw_22kHzStereo = SAFTCCITT_ALaw_22kHzMono + 1, + SAFTCCITT_ALaw_44kHzMono = SAFTCCITT_ALaw_22kHzStereo + 1, + SAFTCCITT_ALaw_44kHzStereo = SAFTCCITT_ALaw_44kHzMono + 1, + SAFTCCITT_uLaw_8kHzMono = SAFTCCITT_ALaw_44kHzStereo + 1, + SAFTCCITT_uLaw_8kHzStereo = SAFTCCITT_uLaw_8kHzMono + 1, + SAFTCCITT_uLaw_11kHzMono = SAFTCCITT_uLaw_8kHzStereo + 1, + SAFTCCITT_uLaw_11kHzStereo = SAFTCCITT_uLaw_11kHzMono + 1, + SAFTCCITT_uLaw_22kHzMono = SAFTCCITT_uLaw_11kHzStereo + 1, + SAFTCCITT_uLaw_22kHzStereo = SAFTCCITT_uLaw_22kHzMono + 1, + SAFTCCITT_uLaw_44kHzMono = SAFTCCITT_uLaw_22kHzStereo + 1, + SAFTCCITT_uLaw_44kHzStereo = SAFTCCITT_uLaw_44kHzMono + 1, + SAFTADPCM_8kHzMono = SAFTCCITT_uLaw_44kHzStereo + 1, + SAFTADPCM_8kHzStereo = SAFTADPCM_8kHzMono + 1, + SAFTADPCM_11kHzMono = SAFTADPCM_8kHzStereo + 1, + SAFTADPCM_11kHzStereo = SAFTADPCM_11kHzMono + 1, + SAFTADPCM_22kHzMono = SAFTADPCM_11kHzStereo + 1, + SAFTADPCM_22kHzStereo = SAFTADPCM_22kHzMono + 1, + SAFTADPCM_44kHzMono = SAFTADPCM_22kHzStereo + 1, + SAFTADPCM_44kHzStereo = SAFTADPCM_44kHzMono + 1, + SAFTGSM610_8kHzMono = SAFTADPCM_44kHzStereo + 1, + SAFTGSM610_11kHzMono = SAFTGSM610_8kHzMono + 1, + SAFTGSM610_22kHzMono = SAFTGSM610_11kHzMono + 1, + SAFTGSM610_44kHzMono = SAFTGSM610_22kHzMono + 1 + } SpeechAudioFormatType; + +typedef /* [hidden] */ +enum DISPID_SpeechAudioFormat + { DISPID_SAFType = 1, + DISPID_SAFGuid = DISPID_SAFType + 1, + DISPID_SAFGetWaveFormatEx = DISPID_SAFGuid + 1, + DISPID_SAFSetWaveFormatEx = DISPID_SAFGetWaveFormatEx + 1 + } DISPID_SpeechAudioFormat; + +typedef /* [hidden] */ +enum DISPID_SpeechBaseStream + { DISPID_SBSFormat = 1, + DISPID_SBSRead = DISPID_SBSFormat + 1, + DISPID_SBSWrite = DISPID_SBSRead + 1, + DISPID_SBSSeek = DISPID_SBSWrite + 1 + } DISPID_SpeechBaseStream; + +typedef +enum SpeechStreamSeekPositionType + { SSSPTRelativeToStart = STREAM_SEEK_SET, + SSSPTRelativeToCurrentPosition = STREAM_SEEK_CUR, + SSSPTRelativeToEnd = STREAM_SEEK_END + } SpeechStreamSeekPositionType; + +typedef /* [hidden] */ +enum DISPID_SpeechAudio + { DISPID_SAStatus = 200, + DISPID_SABufferInfo = DISPID_SAStatus + 1, + DISPID_SADefaultFormat = DISPID_SABufferInfo + 1, + DISPID_SAVolume = DISPID_SADefaultFormat + 1, + DISPID_SABufferNotifySize = DISPID_SAVolume + 1, + DISPID_SAEventHandle = DISPID_SABufferNotifySize + 1, + DISPID_SASetState = DISPID_SAEventHandle + 1 + } DISPID_SpeechAudio; + +typedef +enum SpeechAudioState + { SASClosed = SPAS_CLOSED, + SASStop = SPAS_STOP, + SASPause = SPAS_PAUSE, + SASRun = SPAS_RUN + } SpeechAudioState; + +typedef /* [hidden] */ +enum DISPID_SpeechMMSysAudio + { DISPID_SMSADeviceId = 300, + DISPID_SMSALineId = DISPID_SMSADeviceId + 1, + DISPID_SMSAMMHandle = DISPID_SMSALineId + 1 + } DISPID_SpeechMMSysAudio; + +typedef /* [hidden] */ +enum DISPID_SpeechFileStream + { DISPID_SFSOpen = 100, + DISPID_SFSClose = DISPID_SFSOpen + 1 + } DISPID_SpeechFileStream; + +typedef +enum SpeechStreamFileMode + { SSFMOpenForRead = SPFM_OPEN_READONLY, + SSFMOpenReadWrite = SPFM_OPEN_READWRITE, + SSFMCreate = SPFM_CREATE, + SSFMCreateForWrite = SPFM_CREATE_ALWAYS + } SpeechStreamFileMode; + +typedef /* [hidden] */ +enum DISPID_SpeechCustomStream + { DISPID_SCSBaseStream = 100 + } DISPID_SpeechCustomStream; + +typedef /* [hidden] */ +enum DISPID_SpeechMemoryStream + { DISPID_SMSSetData = 100, + DISPID_SMSGetData = DISPID_SMSSetData + 1 + } DISPID_SpeechMemoryStream; + +typedef /* [hidden] */ +enum DISPID_SpeechAudioStatus + { DISPID_SASFreeBufferSpace = 1, + DISPID_SASNonBlockingIO = DISPID_SASFreeBufferSpace + 1, + DISPID_SASState = DISPID_SASNonBlockingIO + 1, + DISPID_SASCurrentSeekPosition = DISPID_SASState + 1, + DISPID_SASCurrentDevicePosition = DISPID_SASCurrentSeekPosition + 1 + } DISPID_SpeechAudioStatus; + +typedef /* [hidden] */ +enum DISPID_SpeechAudioBufferInfo + { DISPID_SABIMinNotification = 1, + DISPID_SABIBufferSize = DISPID_SABIMinNotification + 1, + DISPID_SABIEventBias = DISPID_SABIBufferSize + 1 + } DISPID_SpeechAudioBufferInfo; + +typedef /* [hidden] */ +enum DISPID_SpeechWaveFormatEx + { DISPID_SWFEFormatTag = 1, + DISPID_SWFEChannels = DISPID_SWFEFormatTag + 1, + DISPID_SWFESamplesPerSec = DISPID_SWFEChannels + 1, + DISPID_SWFEAvgBytesPerSec = DISPID_SWFESamplesPerSec + 1, + DISPID_SWFEBlockAlign = DISPID_SWFEAvgBytesPerSec + 1, + DISPID_SWFEBitsPerSample = DISPID_SWFEBlockAlign + 1, + DISPID_SWFEExtraData = DISPID_SWFEBitsPerSample + 1 + } DISPID_SpeechWaveFormatEx; + +typedef /* [hidden] */ +enum DISPID_SpeechVoice + { DISPID_SVStatus = 1, + DISPID_SVVoice = DISPID_SVStatus + 1, + DISPID_SVAudioOutput = DISPID_SVVoice + 1, + DISPID_SVAudioOutputStream = DISPID_SVAudioOutput + 1, + DISPID_SVRate = DISPID_SVAudioOutputStream + 1, + DISPID_SVVolume = DISPID_SVRate + 1, + DISPID_SVAllowAudioOuputFormatChangesOnNextSet = DISPID_SVVolume + 1, + DISPID_SVEventInterests = DISPID_SVAllowAudioOuputFormatChangesOnNextSet + 1, + DISPID_SVPriority = DISPID_SVEventInterests + 1, + DISPID_SVAlertBoundary = DISPID_SVPriority + 1, + DISPID_SVSyncronousSpeakTimeout = DISPID_SVAlertBoundary + 1, + DISPID_SVSpeak = DISPID_SVSyncronousSpeakTimeout + 1, + DISPID_SVSpeakStream = DISPID_SVSpeak + 1, + DISPID_SVPause = DISPID_SVSpeakStream + 1, + DISPID_SVResume = DISPID_SVPause + 1, + DISPID_SVSkip = DISPID_SVResume + 1, + DISPID_SVGetVoices = DISPID_SVSkip + 1, + DISPID_SVGetAudioOutputs = DISPID_SVGetVoices + 1, + DISPID_SVWaitUntilDone = DISPID_SVGetAudioOutputs + 1, + DISPID_SVSpeakCompleteEvent = DISPID_SVWaitUntilDone + 1, + DISPID_SVIsUISupported = DISPID_SVSpeakCompleteEvent + 1, + DISPID_SVDisplayUI = DISPID_SVIsUISupported + 1 + } DISPID_SpeechVoice; + +typedef +enum SpeechVoicePriority + { SVPNormal = SPVPRI_NORMAL, + SVPAlert = SPVPRI_ALERT, + SVPOver = SPVPRI_OVER + } SpeechVoicePriority; + +typedef +enum SpeechVoiceSpeakFlags + { SVSFDefault = SPF_DEFAULT, + SVSFlagsAsync = SPF_ASYNC, + SVSFPurgeBeforeSpeak = SPF_PURGEBEFORESPEAK, + SVSFIsFilename = SPF_IS_FILENAME, + SVSFIsXML = SPF_IS_XML, + SVSFIsNotXML = SPF_IS_NOT_XML, + SVSFPersistXML = SPF_PERSIST_XML, + SVSFNLPSpeakPunc = SPF_NLP_SPEAK_PUNC, + SVSFNLPMask = SPF_NLP_MASK, + SVSFVoiceMask = SPF_VOICE_MASK, + SVSFUnusedFlags = SPF_UNUSED_FLAGS + } SpeechVoiceSpeakFlags; + +typedef +enum SpeechVoiceEvents + { SVEStartInputStream = 1L << 1, + SVEEndInputStream = 1L << 2, + SVEVoiceChange = 1L << 3, + SVEBookmark = 1L << 4, + SVEWordBoundary = 1L << 5, + SVEPhoneme = 1L << 6, + SVESentenceBoundary = 1L << 7, + SVEViseme = 1L << 8, + SVEAudioLevel = 1L << 9, + SVEPrivate = 1L << 15, + SVEAllEvents = 0x83fe + } SpeechVoiceEvents; + +typedef /* [hidden] */ +enum DISPID_SpeechVoiceStatus + { DISPID_SVSCurrentStreamNumber = 1, + DISPID_SVSLastStreamNumberQueued = DISPID_SVSCurrentStreamNumber + 1, + DISPID_SVSLastResult = DISPID_SVSLastStreamNumberQueued + 1, + DISPID_SVSRunningState = DISPID_SVSLastResult + 1, + DISPID_SVSInputWordPosition = DISPID_SVSRunningState + 1, + DISPID_SVSInputWordLength = DISPID_SVSInputWordPosition + 1, + DISPID_SVSInputSentencePosition = DISPID_SVSInputWordLength + 1, + DISPID_SVSInputSentenceLength = DISPID_SVSInputSentencePosition + 1, + DISPID_SVSLastBookmark = DISPID_SVSInputSentenceLength + 1, + DISPID_SVSLastBookmarkId = DISPID_SVSLastBookmark + 1, + DISPID_SVSPhonemeId = DISPID_SVSLastBookmarkId + 1, + DISPID_SVSVisemeId = DISPID_SVSPhonemeId + 1 + } DISPID_SpeechVoiceStatus; + +typedef +enum SpeechRunState + { SRSEDone = SPRS_DONE, + SRSEIsSpeaking = SPRS_IS_SPEAKING + } SpeechRunState; + +typedef +enum SpeechVisemeType + { SVP_0 = 0, + SVP_1 = SVP_0 + 1, + SVP_2 = SVP_1 + 1, + SVP_3 = SVP_2 + 1, + SVP_4 = SVP_3 + 1, + SVP_5 = SVP_4 + 1, + SVP_6 = SVP_5 + 1, + SVP_7 = SVP_6 + 1, + SVP_8 = SVP_7 + 1, + SVP_9 = SVP_8 + 1, + SVP_10 = SVP_9 + 1, + SVP_11 = SVP_10 + 1, + SVP_12 = SVP_11 + 1, + SVP_13 = SVP_12 + 1, + SVP_14 = SVP_13 + 1, + SVP_15 = SVP_14 + 1, + SVP_16 = SVP_15 + 1, + SVP_17 = SVP_16 + 1, + SVP_18 = SVP_17 + 1, + SVP_19 = SVP_18 + 1, + SVP_20 = SVP_19 + 1, + SVP_21 = SVP_20 + 1 + } SpeechVisemeType; + +typedef +enum SpeechVisemeFeature + { SVF_None = 0, + SVF_Stressed = SPVFEATURE_STRESSED, + SVF_Emphasis = SPVFEATURE_EMPHASIS + } SpeechVisemeFeature; + +typedef /* [hidden] */ +enum DISPID_SpeechVoiceEvent + { DISPID_SVEStreamStart = 1, + DISPID_SVEStreamEnd = DISPID_SVEStreamStart + 1, + DISPID_SVEVoiceChange = DISPID_SVEStreamEnd + 1, + DISPID_SVEBookmark = DISPID_SVEVoiceChange + 1, + DISPID_SVEWord = DISPID_SVEBookmark + 1, + DISPID_SVEPhoneme = DISPID_SVEWord + 1, + DISPID_SVESentenceBoundary = DISPID_SVEPhoneme + 1, + DISPID_SVEViseme = DISPID_SVESentenceBoundary + 1, + DISPID_SVEAudioLevel = DISPID_SVEViseme + 1, + DISPID_SVEEnginePrivate = DISPID_SVEAudioLevel + 1 + } DISPID_SpeechVoiceEvent; + +typedef /* [hidden] */ +enum DISPID_SpeechRecognizer + { DISPID_SRRecognizer = 1, + DISPID_SRAllowAudioInputFormatChangesOnNextSet = DISPID_SRRecognizer + 1, + DISPID_SRAudioInput = DISPID_SRAllowAudioInputFormatChangesOnNextSet + 1, + DISPID_SRAudioInputStream = DISPID_SRAudioInput + 1, + DISPID_SRIsShared = DISPID_SRAudioInputStream + 1, + DISPID_SRState = DISPID_SRIsShared + 1, + DISPID_SRStatus = DISPID_SRState + 1, + DISPID_SRProfile = DISPID_SRStatus + 1, + DISPID_SREmulateRecognition = DISPID_SRProfile + 1, + DISPID_SRCreateRecoContext = DISPID_SREmulateRecognition + 1, + DISPID_SRGetFormat = DISPID_SRCreateRecoContext + 1, + DISPID_SRSetPropertyNumber = DISPID_SRGetFormat + 1, + DISPID_SRGetPropertyNumber = DISPID_SRSetPropertyNumber + 1, + DISPID_SRSetPropertyString = DISPID_SRGetPropertyNumber + 1, + DISPID_SRGetPropertyString = DISPID_SRSetPropertyString + 1, + DISPID_SRIsUISupported = DISPID_SRGetPropertyString + 1, + DISPID_SRDisplayUI = DISPID_SRIsUISupported + 1, + DISPID_SRGetRecognizers = DISPID_SRDisplayUI + 1, + DISPID_SVGetAudioInputs = DISPID_SRGetRecognizers + 1, + DISPID_SVGetProfiles = DISPID_SVGetAudioInputs + 1 + } DISPID_SpeechRecognizer; + +typedef +enum SpeechRecognizerState + { SRSInactive = SPRST_INACTIVE, + SRSActive = SPRST_ACTIVE, + SRSActiveAlways = SPRST_ACTIVE_ALWAYS, + SRSInactiveWithPurge = SPRST_INACTIVE_WITH_PURGE + } SpeechRecognizerState; + +typedef +enum SpeechDisplayAttributes + { SDA_No_Trailing_Space = 0, + SDA_One_Trailing_Space = SPAF_ONE_TRAILING_SPACE, + SDA_Two_Trailing_Spaces = SPAF_TWO_TRAILING_SPACES, + SDA_Consume_Leading_Spaces = SPAF_CONSUME_LEADING_SPACES + } SpeechDisplayAttributes; + +typedef +enum SpeechFormatType + { SFTInput = SPWF_INPUT, + SFTSREngine = SPWF_SRENGINE + } SpeechFormatType; + +typedef /* [hidden] */ +enum DISPID_SpeechRecognizerStatus + { DISPID_SRSAudioStatus = 1, + DISPID_SRSCurrentStreamPosition = DISPID_SRSAudioStatus + 1, + DISPID_SRSCurrentStreamNumber = DISPID_SRSCurrentStreamPosition + 1, + DISPID_SRSNumberOfActiveRules = DISPID_SRSCurrentStreamNumber + 1, + DISPID_SRSClsidEngine = DISPID_SRSNumberOfActiveRules + 1, + DISPID_SRSSupportedLanguages = DISPID_SRSClsidEngine + 1 + } DISPID_SpeechRecognizerStatus; + +typedef /* [hidden] */ +enum DISPID_SpeechRecoContext + { DISPID_SRCRecognizer = 1, + DISPID_SRCAudioInInterferenceStatus = DISPID_SRCRecognizer + 1, + DISPID_SRCRequestedUIType = DISPID_SRCAudioInInterferenceStatus + 1, + DISPID_SRCVoice = DISPID_SRCRequestedUIType + 1, + DISPID_SRAllowVoiceFormatMatchingOnNextSet = DISPID_SRCVoice + 1, + DISPID_SRCVoicePurgeEvent = DISPID_SRAllowVoiceFormatMatchingOnNextSet + 1, + DISPID_SRCEventInterests = DISPID_SRCVoicePurgeEvent + 1, + DISPID_SRCCmdMaxAlternates = DISPID_SRCEventInterests + 1, + DISPID_SRCState = DISPID_SRCCmdMaxAlternates + 1, + DISPID_SRCRetainedAudio = DISPID_SRCState + 1, + DISPID_SRCRetainedAudioFormat = DISPID_SRCRetainedAudio + 1, + DISPID_SRCPause = DISPID_SRCRetainedAudioFormat + 1, + DISPID_SRCResume = DISPID_SRCPause + 1, + DISPID_SRCCreateGrammar = DISPID_SRCResume + 1, + DISPID_SRCCreateResultFromMemory = DISPID_SRCCreateGrammar + 1, + DISPID_SRCBookmark = DISPID_SRCCreateResultFromMemory + 1, + DISPID_SRCSetAdaptationData = DISPID_SRCBookmark + 1 + } DISPID_SpeechRecoContext; + +typedef +enum SpeechRetainedAudioOptions + { SRAONone = SPAO_NONE, + SRAORetainAudio = SPAO_RETAIN_AUDIO + } SpeechRetainedAudioOptions; + +typedef +enum SpeechBookmarkOptions + { SBONone = SPBO_NONE, + SBOPause = SPBO_PAUSE + } SpeechBookmarkOptions; + +typedef +enum SpeechInterference + { SINone = SPINTERFERENCE_NONE, + SINoise = SPINTERFERENCE_NOISE, + SINoSignal = SPINTERFERENCE_NOSIGNAL, + SITooLoud = SPINTERFERENCE_TOOLOUD, + SITooQuiet = SPINTERFERENCE_TOOQUIET, + SITooFast = SPINTERFERENCE_TOOFAST, + SITooSlow = SPINTERFERENCE_TOOSLOW + } SpeechInterference; + +typedef +enum SpeechRecoEvents + { SREStreamEnd = 1L << 0, + SRESoundStart = 1L << 1, + SRESoundEnd = 1L << 2, + SREPhraseStart = 1L << 3, + SRERecognition = 1L << 4, + SREHypothesis = 1L << 5, + SREBookmark = 1L << 6, + SREPropertyNumChange = 1L << 7, + SREPropertyStringChange = 1L << 8, + SREFalseRecognition = 1L << 9, + SREInterference = 1L << 10, + SRERequestUI = 1L << 11, + SREStateChange = 1L << 12, + SREAdaptation = 1L << 13, + SREStreamStart = 1L << 14, + SRERecoOtherContext = 1L << 15, + SREAudioLevel = 1L << 16, + SREPrivate = 1L << 18, + SREAllEvents = 0x5ffff + } SpeechRecoEvents; + +typedef +enum SpeechRecoContextState + { SRCS_Disabled = SPCS_DISABLED, + SRCS_Enabled = SPCS_ENABLED + } SpeechRecoContextState; + +typedef /* [hidden] */ +enum DISPIDSPRG + { DISPID_SRGId = 1, + DISPID_SRGRecoContext = DISPID_SRGId + 1, + DISPID_SRGState = DISPID_SRGRecoContext + 1, + DISPID_SRGRules = DISPID_SRGState + 1, + DISPID_SRGReset = DISPID_SRGRules + 1, + DISPID_SRGCommit = DISPID_SRGReset + 1, + DISPID_SRGCmdLoadFromFile = DISPID_SRGCommit + 1, + DISPID_SRGCmdLoadFromObject = DISPID_SRGCmdLoadFromFile + 1, + DISPID_SRGCmdLoadFromResource = DISPID_SRGCmdLoadFromObject + 1, + DISPID_SRGCmdLoadFromMemory = DISPID_SRGCmdLoadFromResource + 1, + DISPID_SRGCmdLoadFromProprietaryGrammar = DISPID_SRGCmdLoadFromMemory + 1, + DISPID_SRGCmdSetRuleState = DISPID_SRGCmdLoadFromProprietaryGrammar + 1, + DISPID_SRGCmdSetRuleIdState = DISPID_SRGCmdSetRuleState + 1, + DISPID_SRGDictationLoad = DISPID_SRGCmdSetRuleIdState + 1, + DISPID_SRGDictationUnload = DISPID_SRGDictationLoad + 1, + DISPID_SRGDictationSetState = DISPID_SRGDictationUnload + 1, + DISPID_SRGSetWordSequenceData = DISPID_SRGDictationSetState + 1, + DISPID_SRGSetTextSelection = DISPID_SRGSetWordSequenceData + 1, + DISPID_SRGIsPronounceable = DISPID_SRGSetTextSelection + 1 + } DISPIDSPRG; + +typedef +enum SpeechLoadOption + { SLOStatic = SPLO_STATIC, + SLODynamic = SPLO_DYNAMIC + } SpeechLoadOption; + +typedef +enum SpeechWordPronounceable + { SWPUnknownWordUnpronounceable = SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, + SWPUnknownWordPronounceable = SPWP_UNKNOWN_WORD_PRONOUNCEABLE, + SWPKnownWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE + } SpeechWordPronounceable; + +typedef +enum SpeechGrammarState + { SGSEnabled = SPGS_ENABLED, + SGSDisabled = SPGS_DISABLED, + SGSExclusive = SPGS_EXCLUSIVE + } SpeechGrammarState; + +typedef +enum SpeechRuleState + { SGDSInactive = SPRS_INACTIVE, + SGDSActive = SPRS_ACTIVE, + SGDSActiveWithAutoPause = SPRS_ACTIVE_WITH_AUTO_PAUSE + } SpeechRuleState; + +typedef +enum SpeechRuleAttributes + { SRATopLevel = SPRAF_TopLevel, + SRADefaultToActive = SPRAF_Active, + SRAExport = SPRAF_Export, + SRAImport = SPRAF_Import, + SRAInterpreter = SPRAF_Interpreter, + SRADynamic = SPRAF_Dynamic + } SpeechRuleAttributes; + +typedef +enum SpeechGrammarWordType + { SGDisplay = SPWT_DISPLAY, + SGLexical = SPWT_LEXICAL, + SGPronounciation = SPWT_PRONUNCIATION + } SpeechGrammarWordType; + +typedef /* [hidden] */ +enum DISPID_SpeechRecoContextEvents + { DISPID_SRCEStartStream = 1, + DISPID_SRCEEndStream = DISPID_SRCEStartStream + 1, + DISPID_SRCEBookmark = DISPID_SRCEEndStream + 1, + DISPID_SRCESoundStart = DISPID_SRCEBookmark + 1, + DISPID_SRCESoundEnd = DISPID_SRCESoundStart + 1, + DISPID_SRCEPhraseStart = DISPID_SRCESoundEnd + 1, + DISPID_SRCERecognition = DISPID_SRCEPhraseStart + 1, + DISPID_SRCEHypothesis = DISPID_SRCERecognition + 1, + DISPID_SRCEPropertyNumberChange = DISPID_SRCEHypothesis + 1, + DISPID_SRCEPropertyStringChange = DISPID_SRCEPropertyNumberChange + 1, + DISPID_SRCEFalseRecognition = DISPID_SRCEPropertyStringChange + 1, + DISPID_SRCEInterference = DISPID_SRCEFalseRecognition + 1, + DISPID_SRCERequestUI = DISPID_SRCEInterference + 1, + DISPID_SRCERecognizerStateChange = DISPID_SRCERequestUI + 1, + DISPID_SRCEAdaptation = DISPID_SRCERecognizerStateChange + 1, + DISPID_SRCERecognitionForOtherContext = DISPID_SRCEAdaptation + 1, + DISPID_SRCEAudioLevel = DISPID_SRCERecognitionForOtherContext + 1, + DISPID_SRCEEnginePrivate = DISPID_SRCEAudioLevel + 1 + } DISPID_SpeechRecoContextEvents; + +typedef +enum SpeechRecognitionType + { SRTStandard = 0, + SRTAutopause = SPREF_AutoPause, + SRTEmulated = SPREF_Emulated + } SpeechRecognitionType; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRule + { DISPID_SGRAttributes = 1, + DISPID_SGRInitialState = DISPID_SGRAttributes + 1, + DISPID_SGRName = DISPID_SGRInitialState + 1, + DISPID_SGRId = DISPID_SGRName + 1, + DISPID_SGRClear = DISPID_SGRId + 1, + DISPID_SGRAddResource = DISPID_SGRClear + 1, + DISPID_SGRAddState = DISPID_SGRAddResource + 1 + } DISPID_SpeechGrammarRule; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRules + { DISPID_SGRsCount = 1, + DISPID_SGRsDynamic = DISPID_SGRsCount + 1, + DISPID_SGRsAdd = DISPID_SGRsDynamic + 1, + DISPID_SGRsCommit = DISPID_SGRsAdd + 1, + DISPID_SGRsCommitAndSave = DISPID_SGRsCommit + 1, + DISPID_SGRsFindRule = DISPID_SGRsCommitAndSave + 1, + DISPID_SGRsItem = DISPID_VALUE, + DISPID_SGRs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechGrammarRules; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRuleState + { DISPID_SGRSRule = 1, + DISPID_SGRSTransitions = DISPID_SGRSRule + 1, + DISPID_SGRSAddWordTransition = DISPID_SGRSTransitions + 1, + DISPID_SGRSAddRuleTransition = DISPID_SGRSAddWordTransition + 1, + DISPID_SGRSAddSpecialTransition = DISPID_SGRSAddRuleTransition + 1 + } DISPID_SpeechGrammarRuleState; + +typedef +enum SpeechSpecialTransitionType + { SSTTWildcard = 1, + SSTTDictation = SSTTWildcard + 1, + SSTTTextBuffer = SSTTDictation + 1 + } SpeechSpecialTransitionType; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRuleStateTransitions + { DISPID_SGRSTsCount = 1, + DISPID_SGRSTsItem = DISPID_VALUE, + DISPID_SGRSTs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechGrammarRuleStateTransitions; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRuleStateTransition + { DISPID_SGRSTType = 1, + DISPID_SGRSTText = DISPID_SGRSTType + 1, + DISPID_SGRSTRule = DISPID_SGRSTText + 1, + DISPID_SGRSTWeight = DISPID_SGRSTRule + 1, + DISPID_SGRSTPropertyName = DISPID_SGRSTWeight + 1, + DISPID_SGRSTPropertyId = DISPID_SGRSTPropertyName + 1, + DISPID_SGRSTPropertyValue = DISPID_SGRSTPropertyId + 1, + DISPID_SGRSTNextState = DISPID_SGRSTPropertyValue + 1 + } DISPID_SpeechGrammarRuleStateTransition; + +typedef +enum SpeechGrammarRuleStateTransitionType + { SGRSTTEpsilon = 0, + SGRSTTWord = SGRSTTEpsilon + 1, + SGRSTTRule = SGRSTTWord + 1, + SGRSTTDictation = SGRSTTRule + 1, + SGRSTTWildcard = SGRSTTDictation + 1, + SGRSTTTextBuffer = SGRSTTWildcard + 1 + } SpeechGrammarRuleStateTransitionType; + +typedef /* [hidden] */ +enum DISPIDSPTSI + { DISPIDSPTSI_ActiveOffset = 1, + DISPIDSPTSI_ActiveLength = DISPIDSPTSI_ActiveOffset + 1, + DISPIDSPTSI_SelectionOffset = DISPIDSPTSI_ActiveLength + 1, + DISPIDSPTSI_SelectionLength = DISPIDSPTSI_SelectionOffset + 1 + } DISPIDSPTSI; + +typedef /* [hidden] */ +enum DISPID_SpeechRecoResult + { DISPID_SRRRecoContext = 1, + DISPID_SRRTimes = DISPID_SRRRecoContext + 1, + DISPID_SRRAudioFormat = DISPID_SRRTimes + 1, + DISPID_SRRPhraseInfo = DISPID_SRRAudioFormat + 1, + DISPID_SRRAlternates = DISPID_SRRPhraseInfo + 1, + DISPID_SRRAudio = DISPID_SRRAlternates + 1, + DISPID_SRRSpeakAudio = DISPID_SRRAudio + 1, + DISPID_SRRSaveToMemory = DISPID_SRRSpeakAudio + 1, + DISPID_SRRDiscardResultInfo = DISPID_SRRSaveToMemory + 1 + } DISPID_SpeechRecoResult; + +typedef +enum SpeechDiscardType + { SDTProperty = SPDF_PROPERTY, + SDTReplacement = SPDF_REPLACEMENT, + SDTRule = SPDF_RULE, + SDTDisplayText = SPDF_DISPLAYTEXT, + SDTLexicalForm = SPDF_LEXICALFORM, + SDTPronunciation = SPDF_PRONUNCIATION, + SDTAudio = SPDF_AUDIO, + SDTAlternates = SPDF_ALTERNATES, + SDTAll = SPDF_ALL + } SpeechDiscardType; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseBuilder + { DISPID_SPPBRestorePhraseFromMemory = 1 + } DISPID_SpeechPhraseBuilder; + +typedef /* [hidden] */ +enum DISPID_SpeechRecoResultTimes + { DISPID_SRRTStreamTime = 1, + DISPID_SRRTLength = DISPID_SRRTStreamTime + 1, + DISPID_SRRTTickCount = DISPID_SRRTLength + 1, + DISPID_SRRTOffsetFromStart = DISPID_SRRTTickCount + 1 + } DISPID_SpeechRecoResultTimes; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseAlternate + { DISPID_SPARecoResult = 1, + DISPID_SPAStartElementInResult = DISPID_SPARecoResult + 1, + DISPID_SPANumberOfElementsInResult = DISPID_SPAStartElementInResult + 1, + DISPID_SPAPhraseInfo = DISPID_SPANumberOfElementsInResult + 1, + DISPID_SPACommit = DISPID_SPAPhraseInfo + 1 + } DISPID_SpeechPhraseAlternate; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseAlternates + { DISPID_SPAsCount = 1, + DISPID_SPAsItem = DISPID_VALUE, + DISPID_SPAs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseAlternates; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseInfo + { DISPID_SPILanguageId = 1, + DISPID_SPIGrammarId = DISPID_SPILanguageId + 1, + DISPID_SPIStartTime = DISPID_SPIGrammarId + 1, + DISPID_SPIAudioStreamPosition = DISPID_SPIStartTime + 1, + DISPID_SPIAudioSizeBytes = DISPID_SPIAudioStreamPosition + 1, + DISPID_SPIRetainedSizeBytes = DISPID_SPIAudioSizeBytes + 1, + DISPID_SPIAudioSizeTime = DISPID_SPIRetainedSizeBytes + 1, + DISPID_SPIRule = DISPID_SPIAudioSizeTime + 1, + DISPID_SPIProperties = DISPID_SPIRule + 1, + DISPID_SPIElements = DISPID_SPIProperties + 1, + DISPID_SPIReplacements = DISPID_SPIElements + 1, + DISPID_SPIEngineId = DISPID_SPIReplacements + 1, + DISPID_SPIEnginePrivateData = DISPID_SPIEngineId + 1, + DISPID_SPISaveToMemory = DISPID_SPIEnginePrivateData + 1, + DISPID_SPIGetText = DISPID_SPISaveToMemory + 1, + DISPID_SPIGetDisplayAttributes = DISPID_SPIGetText + 1 + } DISPID_SpeechPhraseInfo; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseElement + { DISPID_SPEAudioTimeOffset = 1, + DISPID_SPEAudioSizeTime = DISPID_SPEAudioTimeOffset + 1, + DISPID_SPEAudioStreamOffset = DISPID_SPEAudioSizeTime + 1, + DISPID_SPEAudioSizeBytes = DISPID_SPEAudioStreamOffset + 1, + DISPID_SPERetainedStreamOffset = DISPID_SPEAudioSizeBytes + 1, + DISPID_SPERetainedSizeBytes = DISPID_SPERetainedStreamOffset + 1, + DISPID_SPEDisplayText = DISPID_SPERetainedSizeBytes + 1, + DISPID_SPELexicalForm = DISPID_SPEDisplayText + 1, + DISPID_SPEPronunciation = DISPID_SPELexicalForm + 1, + DISPID_SPEDisplayAttributes = DISPID_SPEPronunciation + 1, + DISPID_SPERequiredConfidence = DISPID_SPEDisplayAttributes + 1, + DISPID_SPEActualConfidence = DISPID_SPERequiredConfidence + 1, + DISPID_SPEEngineConfidence = DISPID_SPEActualConfidence + 1 + } DISPID_SpeechPhraseElement; + +typedef +enum SpeechEngineConfidence + { SECLowConfidence = -1, + SECNormalConfidence = 0, + SECHighConfidence = 1 + } SpeechEngineConfidence; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseElements + { DISPID_SPEsCount = 1, + DISPID_SPEsItem = DISPID_VALUE, + DISPID_SPEs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseElements; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseReplacement + { DISPID_SPRDisplayAttributes = 1, + DISPID_SPRText = DISPID_SPRDisplayAttributes + 1, + DISPID_SPRFirstElement = DISPID_SPRText + 1, + DISPID_SPRNumberOfElements = DISPID_SPRFirstElement + 1 + } DISPID_SpeechPhraseReplacement; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseReplacements + { DISPID_SPRsCount = 1, + DISPID_SPRsItem = DISPID_VALUE, + DISPID_SPRs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseReplacements; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseProperty + { DISPID_SPPName = 1, + DISPID_SPPId = DISPID_SPPName + 1, + DISPID_SPPValue = DISPID_SPPId + 1, + DISPID_SPPFirstElement = DISPID_SPPValue + 1, + DISPID_SPPNumberOfElements = DISPID_SPPFirstElement + 1, + DISPID_SPPEngineConfidence = DISPID_SPPNumberOfElements + 1, + DISPID_SPPConfidence = DISPID_SPPEngineConfidence + 1, + DISPID_SPPParent = DISPID_SPPConfidence + 1, + DISPID_SPPChildren = DISPID_SPPParent + 1 + } DISPID_SpeechPhraseProperty; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseProperties + { DISPID_SPPsCount = 1, + DISPID_SPPsItem = DISPID_VALUE, + DISPID_SPPs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseProperties; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseRule + { DISPID_SPRuleName = 1, + DISPID_SPRuleId = DISPID_SPRuleName + 1, + DISPID_SPRuleFirstElement = DISPID_SPRuleId + 1, + DISPID_SPRuleNumberOfElements = DISPID_SPRuleFirstElement + 1, + DISPID_SPRuleParent = DISPID_SPRuleNumberOfElements + 1, + DISPID_SPRuleChildren = DISPID_SPRuleParent + 1, + DISPID_SPRuleConfidence = DISPID_SPRuleChildren + 1, + DISPID_SPRuleEngineConfidence = DISPID_SPRuleConfidence + 1 + } DISPID_SpeechPhraseRule; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseRules + { DISPID_SPRulesCount = 1, + DISPID_SPRulesItem = DISPID_VALUE, + DISPID_SPRules_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseRules; + +typedef /* [hidden] */ +enum DISPID_SpeechLexicon + { DISPID_SLGenerationId = 1, + DISPID_SLGetWords = DISPID_SLGenerationId + 1, + DISPID_SLAddPronunciation = DISPID_SLGetWords + 1, + DISPID_SLAddPronunciationByPhoneIds = DISPID_SLAddPronunciation + 1, + DISPID_SLRemovePronunciation = DISPID_SLAddPronunciationByPhoneIds + 1, + DISPID_SLRemovePronunciationByPhoneIds = DISPID_SLRemovePronunciation + 1, + DISPID_SLGetPronunciations = DISPID_SLRemovePronunciationByPhoneIds + 1, + DISPID_SLGetGenerationChange = DISPID_SLGetPronunciations + 1 + } DISPID_SpeechLexicon; + +typedef +enum SpeechLexiconType + { SLTUser = eLEXTYPE_USER, + SLTApp = eLEXTYPE_APP + } SpeechLexiconType; + +typedef +enum SpeechPartOfSpeech + { SPSNotOverriden = SPPS_NotOverriden, + SPSUnknown = SPPS_Unknown, + SPSNoun = SPPS_Noun, + SPSVerb = SPPS_Verb, + SPSModifier = SPPS_Modifier, + SPSFunction = SPPS_Function, + SPSInterjection = SPPS_Interjection + } SpeechPartOfSpeech; + +typedef /* [hidden] */ +enum DISPID_SpeechLexiconWords + { DISPID_SLWsCount = 1, + DISPID_SLWsItem = DISPID_VALUE, + DISPID_SLWs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechLexiconWords; + +typedef +enum SpeechWordType + { SWTAdded = eWORDTYPE_ADDED, + SWTDeleted = eWORDTYPE_DELETED + } SpeechWordType; + +typedef /* [hidden] */ +enum DISPID_SpeechLexiconWord + { DISPID_SLWLangId = 1, + DISPID_SLWType = DISPID_SLWLangId + 1, + DISPID_SLWWord = DISPID_SLWType + 1, + DISPID_SLWPronunciations = DISPID_SLWWord + 1 + } DISPID_SpeechLexiconWord; + +typedef /* [hidden] */ +enum DISPID_SpeechLexiconProns + { DISPID_SLPsCount = 1, + DISPID_SLPsItem = DISPID_VALUE, + DISPID_SLPs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechLexiconProns; + +typedef /* [hidden] */ +enum DISPID_SpeechLexiconPronunciation + { DISPID_SLPType = 1, + DISPID_SLPLangId = DISPID_SLPType + 1, + DISPID_SLPPartOfSpeech = DISPID_SLPLangId + 1, + DISPID_SLPPhoneIds = DISPID_SLPPartOfSpeech + 1, + DISPID_SLPSymbolic = DISPID_SLPPhoneIds + 1 + } DISPID_SpeechLexiconPronunciation; + +typedef /* [hidden] */ +enum DISPID_SpeechPhoneConverter + { DISPID_SPCLangId = 1, + DISPID_SPCPhoneToId = DISPID_SPCLangId + 1, + DISPID_SPCIdToPhone = DISPID_SPCPhoneToId + 1 + } DISPID_SpeechPhoneConverter; + + +EXTERN_C const IID LIBID_SpeechLib; + +#ifndef __ISpeechDataKey_INTERFACE_DEFINED__ +#define __ISpeechDataKey_INTERFACE_DEFINED__ + +/* interface ISpeechDataKey */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechDataKey; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CE17C09B-4EFA-44d5-A4C9-59D9585AB0CD") + ISpeechDataKey : public IDispatch + { + public: + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetBinaryValue( + /* [in] */ const BSTR ValueName, + /* [in] */ VARIANT Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetBinaryValue( + /* [in] */ const BSTR ValueName, + /* [retval][out] */ VARIANT *Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetStringValue( + /* [in] */ const BSTR ValueName, + /* [in] */ const BSTR Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetStringValue( + /* [in] */ const BSTR ValueName, + /* [retval][out] */ BSTR *Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetLongValue( + /* [in] */ const BSTR ValueName, + /* [in] */ long Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetLongValue( + /* [in] */ const BSTR ValueName, + /* [retval][out] */ long *Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE OpenKey( + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateKey( + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DeleteKey( + /* [in] */ const BSTR SubKeyName) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DeleteValue( + /* [in] */ const BSTR ValueName) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE EnumKeys( + /* [in] */ long Index, + /* [retval][out] */ BSTR *SubKeyName) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE EnumValues( + /* [in] */ long Index, + /* [retval][out] */ BSTR *ValueName) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechDataKeyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechDataKey * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechDataKey * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechDataKey * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechDataKey * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechDataKey * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechDataKey * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechDataKey * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetBinaryValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ VARIANT Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetBinaryValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ VARIANT *Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ const BSTR Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ BSTR *Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetLongValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ long Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetLongValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ long *Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpeechDataKey * This, + /* [in] */ long Index, + /* [retval][out] */ BSTR *SubKeyName); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpeechDataKey * This, + /* [in] */ long Index, + /* [retval][out] */ BSTR *ValueName); + + END_INTERFACE + } ISpeechDataKeyVtbl; + + interface ISpeechDataKey + { + CONST_VTBL struct ISpeechDataKeyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechDataKey_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechDataKey_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechDataKey_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechDataKey_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechDataKey_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechDataKey_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechDataKey_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechDataKey_SetBinaryValue(This,ValueName,Value) \ + (This)->lpVtbl -> SetBinaryValue(This,ValueName,Value) + +#define ISpeechDataKey_GetBinaryValue(This,ValueName,Value) \ + (This)->lpVtbl -> GetBinaryValue(This,ValueName,Value) + +#define ISpeechDataKey_SetStringValue(This,ValueName,Value) \ + (This)->lpVtbl -> SetStringValue(This,ValueName,Value) + +#define ISpeechDataKey_GetStringValue(This,ValueName,Value) \ + (This)->lpVtbl -> GetStringValue(This,ValueName,Value) + +#define ISpeechDataKey_SetLongValue(This,ValueName,Value) \ + (This)->lpVtbl -> SetLongValue(This,ValueName,Value) + +#define ISpeechDataKey_GetLongValue(This,ValueName,Value) \ + (This)->lpVtbl -> GetLongValue(This,ValueName,Value) + +#define ISpeechDataKey_OpenKey(This,SubKeyName,SubKey) \ + (This)->lpVtbl -> OpenKey(This,SubKeyName,SubKey) + +#define ISpeechDataKey_CreateKey(This,SubKeyName,SubKey) \ + (This)->lpVtbl -> CreateKey(This,SubKeyName,SubKey) + +#define ISpeechDataKey_DeleteKey(This,SubKeyName) \ + (This)->lpVtbl -> DeleteKey(This,SubKeyName) + +#define ISpeechDataKey_DeleteValue(This,ValueName) \ + (This)->lpVtbl -> DeleteValue(This,ValueName) + +#define ISpeechDataKey_EnumKeys(This,Index,SubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,SubKeyName) + +#define ISpeechDataKey_EnumValues(This,Index,ValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ValueName) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_SetBinaryValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ VARIANT Value); + + +void __RPC_STUB ISpeechDataKey_SetBinaryValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_GetBinaryValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ VARIANT *Value); + + +void __RPC_STUB ISpeechDataKey_GetBinaryValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_SetStringValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ const BSTR Value); + + +void __RPC_STUB ISpeechDataKey_SetStringValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_GetStringValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ BSTR *Value); + + +void __RPC_STUB ISpeechDataKey_GetStringValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_SetLongValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ long Value); + + +void __RPC_STUB ISpeechDataKey_SetLongValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_GetLongValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ long *Value); + + +void __RPC_STUB ISpeechDataKey_GetLongValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_OpenKey_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey); + + +void __RPC_STUB ISpeechDataKey_OpenKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_CreateKey_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey); + + +void __RPC_STUB ISpeechDataKey_CreateKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_DeleteKey_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName); + + +void __RPC_STUB ISpeechDataKey_DeleteKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_DeleteValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName); + + +void __RPC_STUB ISpeechDataKey_DeleteValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_EnumKeys_Proxy( + ISpeechDataKey * This, + /* [in] */ long Index, + /* [retval][out] */ BSTR *SubKeyName); + + +void __RPC_STUB ISpeechDataKey_EnumKeys_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_EnumValues_Proxy( + ISpeechDataKey * This, + /* [in] */ long Index, + /* [retval][out] */ BSTR *ValueName); + + +void __RPC_STUB ISpeechDataKey_EnumValues_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechDataKey_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechObjectToken_INTERFACE_DEFINED__ +#define __ISpeechObjectToken_INTERFACE_DEFINED__ + +/* interface ISpeechObjectToken */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechObjectToken; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C74A3ADC-B727-4500-A84A-B526721C8B8C") + ISpeechObjectToken : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ BSTR *ObjectId) = 0; + + virtual /* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DataKey( + /* [retval][out] */ ISpeechDataKey **DataKey) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Category( + /* [retval][out] */ ISpeechObjectTokenCategory **Category) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetDescription( + /* [defaultvalue][in] */ long Locale, + /* [retval][out] */ BSTR *Description) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE SetId( + /* [in] */ BSTR Id, + /* [defaultvalue][in] */ BSTR CategoryID = L"", + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetAttribute( + /* [in] */ BSTR AttributeName, + /* [retval][out] */ BSTR *AttributeValue) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateInstance( + /* [defaultvalue][in] */ IUnknown *pUnkOuter, + /* [defaultvalue][in] */ SpeechTokenContext ClsContext, + /* [retval][out] */ IUnknown **Object) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE Remove( + /* [in] */ BSTR ObjectStorageCLSID) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE GetStorageFileName( + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ BSTR FileName, + /* [in] */ SpeechTokenShellFolder Folder, + /* [retval][out] */ BSTR *FilePath) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE RemoveStorageFileName( + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ VARIANT_BOOL DeleteFile) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ long hWnd, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData = 0, + /* [defaultvalue][in] */ IUnknown *Object = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE MatchesAttributes( + /* [in] */ BSTR Attributes, + /* [retval][out] */ VARIANT_BOOL *Matches) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechObjectTokenVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechObjectToken * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechObjectToken * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechObjectToken * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechObjectToken * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechObjectToken * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechObjectToken * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechObjectToken * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechObjectToken * This, + /* [retval][out] */ BSTR *ObjectId); + + /* [hidden][id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataKey )( + ISpeechObjectToken * This, + /* [retval][out] */ ISpeechDataKey **DataKey); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Category )( + ISpeechObjectToken * This, + /* [retval][out] */ ISpeechObjectTokenCategory **Category); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDescription )( + ISpeechObjectToken * This, + /* [defaultvalue][in] */ long Locale, + /* [retval][out] */ BSTR *Description); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpeechObjectToken * This, + /* [in] */ BSTR Id, + /* [defaultvalue][in] */ BSTR CategoryID, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetAttribute )( + ISpeechObjectToken * This, + /* [in] */ BSTR AttributeName, + /* [retval][out] */ BSTR *AttributeValue); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateInstance )( + ISpeechObjectToken * This, + /* [defaultvalue][in] */ IUnknown *pUnkOuter, + /* [defaultvalue][in] */ SpeechTokenContext ClsContext, + /* [retval][out] */ IUnknown **Object); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Remove )( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStorageFileName )( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ BSTR FileName, + /* [in] */ SpeechTokenShellFolder Folder, + /* [retval][out] */ BSTR *FilePath); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemoveStorageFileName )( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ VARIANT_BOOL DeleteFile); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpeechObjectToken * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpeechObjectToken * This, + /* [in] */ long hWnd, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *MatchesAttributes )( + ISpeechObjectToken * This, + /* [in] */ BSTR Attributes, + /* [retval][out] */ VARIANT_BOOL *Matches); + + END_INTERFACE + } ISpeechObjectTokenVtbl; + + interface ISpeechObjectToken + { + CONST_VTBL struct ISpeechObjectTokenVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechObjectToken_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechObjectToken_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechObjectToken_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechObjectToken_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechObjectToken_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechObjectToken_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechObjectToken_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechObjectToken_get_Id(This,ObjectId) \ + (This)->lpVtbl -> get_Id(This,ObjectId) + +#define ISpeechObjectToken_get_DataKey(This,DataKey) \ + (This)->lpVtbl -> get_DataKey(This,DataKey) + +#define ISpeechObjectToken_get_Category(This,Category) \ + (This)->lpVtbl -> get_Category(This,Category) + +#define ISpeechObjectToken_GetDescription(This,Locale,Description) \ + (This)->lpVtbl -> GetDescription(This,Locale,Description) + +#define ISpeechObjectToken_SetId(This,Id,CategoryID,CreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,Id,CategoryID,CreateIfNotExist) + +#define ISpeechObjectToken_GetAttribute(This,AttributeName,AttributeValue) \ + (This)->lpVtbl -> GetAttribute(This,AttributeName,AttributeValue) + +#define ISpeechObjectToken_CreateInstance(This,pUnkOuter,ClsContext,Object) \ + (This)->lpVtbl -> CreateInstance(This,pUnkOuter,ClsContext,Object) + +#define ISpeechObjectToken_Remove(This,ObjectStorageCLSID) \ + (This)->lpVtbl -> Remove(This,ObjectStorageCLSID) + +#define ISpeechObjectToken_GetStorageFileName(This,ObjectStorageCLSID,KeyName,FileName,Folder,FilePath) \ + (This)->lpVtbl -> GetStorageFileName(This,ObjectStorageCLSID,KeyName,FileName,Folder,FilePath) + +#define ISpeechObjectToken_RemoveStorageFileName(This,ObjectStorageCLSID,KeyName,DeleteFile) \ + (This)->lpVtbl -> RemoveStorageFileName(This,ObjectStorageCLSID,KeyName,DeleteFile) + +#define ISpeechObjectToken_IsUISupported(This,TypeOfUI,ExtraData,Object,Supported) \ + (This)->lpVtbl -> IsUISupported(This,TypeOfUI,ExtraData,Object,Supported) + +#define ISpeechObjectToken_DisplayUI(This,hWnd,Title,TypeOfUI,ExtraData,Object) \ + (This)->lpVtbl -> DisplayUI(This,hWnd,Title,TypeOfUI,ExtraData,Object) + +#define ISpeechObjectToken_MatchesAttributes(This,Attributes,Matches) \ + (This)->lpVtbl -> MatchesAttributes(This,Attributes,Matches) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_get_Id_Proxy( + ISpeechObjectToken * This, + /* [retval][out] */ BSTR *ObjectId); + + +void __RPC_STUB ISpeechObjectToken_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_get_DataKey_Proxy( + ISpeechObjectToken * This, + /* [retval][out] */ ISpeechDataKey **DataKey); + + +void __RPC_STUB ISpeechObjectToken_get_DataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_get_Category_Proxy( + ISpeechObjectToken * This, + /* [retval][out] */ ISpeechObjectTokenCategory **Category); + + +void __RPC_STUB ISpeechObjectToken_get_Category_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_GetDescription_Proxy( + ISpeechObjectToken * This, + /* [defaultvalue][in] */ long Locale, + /* [retval][out] */ BSTR *Description); + + +void __RPC_STUB ISpeechObjectToken_GetDescription_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_SetId_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR Id, + /* [defaultvalue][in] */ BSTR CategoryID, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist); + + +void __RPC_STUB ISpeechObjectToken_SetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_GetAttribute_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR AttributeName, + /* [retval][out] */ BSTR *AttributeValue); + + +void __RPC_STUB ISpeechObjectToken_GetAttribute_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_CreateInstance_Proxy( + ISpeechObjectToken * This, + /* [defaultvalue][in] */ IUnknown *pUnkOuter, + /* [defaultvalue][in] */ SpeechTokenContext ClsContext, + /* [retval][out] */ IUnknown **Object); + + +void __RPC_STUB ISpeechObjectToken_CreateInstance_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_Remove_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID); + + +void __RPC_STUB ISpeechObjectToken_Remove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_GetStorageFileName_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ BSTR FileName, + /* [in] */ SpeechTokenShellFolder Folder, + /* [retval][out] */ BSTR *FilePath); + + +void __RPC_STUB ISpeechObjectToken_GetStorageFileName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_RemoveStorageFileName_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ VARIANT_BOOL DeleteFile); + + +void __RPC_STUB ISpeechObjectToken_RemoveStorageFileName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_IsUISupported_Proxy( + ISpeechObjectToken * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechObjectToken_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_DisplayUI_Proxy( + ISpeechObjectToken * This, + /* [in] */ long hWnd, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object); + + +void __RPC_STUB ISpeechObjectToken_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_MatchesAttributes_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR Attributes, + /* [retval][out] */ VARIANT_BOOL *Matches); + + +void __RPC_STUB ISpeechObjectToken_MatchesAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechObjectToken_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechObjectTokens_INTERFACE_DEFINED__ +#define __ISpeechObjectTokens_INTERFACE_DEFINED__ + +/* interface ISpeechObjectTokens */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechObjectTokens; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9285B776-2E7B-4bc0-B53E-580EB6FA967F") + ISpeechObjectTokens : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechObjectToken **Token) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **ppEnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechObjectTokensVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechObjectTokens * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechObjectTokens * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechObjectTokens * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechObjectTokens * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechObjectTokens * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechObjectTokens * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechObjectTokens * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechObjectTokens * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechObjectTokens * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechObjectToken **Token); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechObjectTokens * This, + /* [retval][out] */ IUnknown **ppEnumVARIANT); + + END_INTERFACE + } ISpeechObjectTokensVtbl; + + interface ISpeechObjectTokens + { + CONST_VTBL struct ISpeechObjectTokensVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechObjectTokens_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechObjectTokens_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechObjectTokens_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechObjectTokens_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechObjectTokens_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechObjectTokens_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechObjectTokens_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechObjectTokens_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechObjectTokens_Item(This,Index,Token) \ + (This)->lpVtbl -> Item(This,Index,Token) + +#define ISpeechObjectTokens_get__NewEnum(This,ppEnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,ppEnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokens_get_Count_Proxy( + ISpeechObjectTokens * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechObjectTokens_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokens_Item_Proxy( + ISpeechObjectTokens * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechObjectToken **Token); + + +void __RPC_STUB ISpeechObjectTokens_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokens_get__NewEnum_Proxy( + ISpeechObjectTokens * This, + /* [retval][out] */ IUnknown **ppEnumVARIANT); + + +void __RPC_STUB ISpeechObjectTokens_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechObjectTokens_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechObjectTokenCategory_INTERFACE_DEFINED__ +#define __ISpeechObjectTokenCategory_INTERFACE_DEFINED__ + +/* interface ISpeechObjectTokenCategory */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechObjectTokenCategory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CA7EAC50-2D01-4145-86D4-5AE7D70F4469") + ISpeechObjectTokenCategory : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ BSTR *Id) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Default( + /* [in] */ const BSTR TokenId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Default( + /* [retval][out] */ BSTR *TokenId) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetId( + /* [in] */ const BSTR Id, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist = 0) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE GetDataKey( + /* [defaultvalue][in] */ SpeechDataKeyLocation Location, + /* [retval][out] */ ISpeechDataKey **DataKey) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE EnumerateTokens( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **Tokens) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechObjectTokenCategoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechObjectTokenCategory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechObjectTokenCategory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechObjectTokenCategory * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechObjectTokenCategory * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechObjectTokenCategory * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechObjectTokenCategory * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechObjectTokenCategory * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechObjectTokenCategory * This, + /* [retval][out] */ BSTR *Id); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Default )( + ISpeechObjectTokenCategory * This, + /* [in] */ const BSTR TokenId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Default )( + ISpeechObjectTokenCategory * This, + /* [retval][out] */ BSTR *TokenId); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpeechObjectTokenCategory * This, + /* [in] */ const BSTR Id, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDataKey )( + ISpeechObjectTokenCategory * This, + /* [defaultvalue][in] */ SpeechDataKeyLocation Location, + /* [retval][out] */ ISpeechDataKey **DataKey); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumerateTokens )( + ISpeechObjectTokenCategory * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **Tokens); + + END_INTERFACE + } ISpeechObjectTokenCategoryVtbl; + + interface ISpeechObjectTokenCategory + { + CONST_VTBL struct ISpeechObjectTokenCategoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechObjectTokenCategory_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechObjectTokenCategory_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechObjectTokenCategory_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechObjectTokenCategory_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechObjectTokenCategory_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechObjectTokenCategory_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechObjectTokenCategory_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechObjectTokenCategory_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechObjectTokenCategory_put_Default(This,TokenId) \ + (This)->lpVtbl -> put_Default(This,TokenId) + +#define ISpeechObjectTokenCategory_get_Default(This,TokenId) \ + (This)->lpVtbl -> get_Default(This,TokenId) + +#define ISpeechObjectTokenCategory_SetId(This,Id,CreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,Id,CreateIfNotExist) + +#define ISpeechObjectTokenCategory_GetDataKey(This,Location,DataKey) \ + (This)->lpVtbl -> GetDataKey(This,Location,DataKey) + +#define ISpeechObjectTokenCategory_EnumerateTokens(This,RequiredAttributes,OptionalAttributes,Tokens) \ + (This)->lpVtbl -> EnumerateTokens(This,RequiredAttributes,OptionalAttributes,Tokens) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_get_Id_Proxy( + ISpeechObjectTokenCategory * This, + /* [retval][out] */ BSTR *Id); + + +void __RPC_STUB ISpeechObjectTokenCategory_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_put_Default_Proxy( + ISpeechObjectTokenCategory * This, + /* [in] */ const BSTR TokenId); + + +void __RPC_STUB ISpeechObjectTokenCategory_put_Default_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_get_Default_Proxy( + ISpeechObjectTokenCategory * This, + /* [retval][out] */ BSTR *TokenId); + + +void __RPC_STUB ISpeechObjectTokenCategory_get_Default_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_SetId_Proxy( + ISpeechObjectTokenCategory * This, + /* [in] */ const BSTR Id, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist); + + +void __RPC_STUB ISpeechObjectTokenCategory_SetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_GetDataKey_Proxy( + ISpeechObjectTokenCategory * This, + /* [defaultvalue][in] */ SpeechDataKeyLocation Location, + /* [retval][out] */ ISpeechDataKey **DataKey); + + +void __RPC_STUB ISpeechObjectTokenCategory_GetDataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_EnumerateTokens_Proxy( + ISpeechObjectTokenCategory * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **Tokens); + + +void __RPC_STUB ISpeechObjectTokenCategory_EnumerateTokens_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechObjectTokenCategory_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechAudioBufferInfo_INTERFACE_DEFINED__ +#define __ISpeechAudioBufferInfo_INTERFACE_DEFINED__ + +/* interface ISpeechAudioBufferInfo */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechAudioBufferInfo; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("11B103D8-1142-4edf-A093-82FB3915F8CC") + ISpeechAudioBufferInfo : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_MinNotification( + /* [retval][out] */ long *MinNotification) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_MinNotification( + /* [in] */ long MinNotification) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BufferSize( + /* [retval][out] */ long *BufferSize) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_BufferSize( + /* [in] */ long BufferSize) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EventBias( + /* [retval][out] */ long *EventBias) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_EventBias( + /* [in] */ long EventBias) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechAudioBufferInfoVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechAudioBufferInfo * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechAudioBufferInfo * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechAudioBufferInfo * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechAudioBufferInfo * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechAudioBufferInfo * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechAudioBufferInfo * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechAudioBufferInfo * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinNotification )( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *MinNotification); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MinNotification )( + ISpeechAudioBufferInfo * This, + /* [in] */ long MinNotification); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferSize )( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *BufferSize); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BufferSize )( + ISpeechAudioBufferInfo * This, + /* [in] */ long BufferSize); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventBias )( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *EventBias); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventBias )( + ISpeechAudioBufferInfo * This, + /* [in] */ long EventBias); + + END_INTERFACE + } ISpeechAudioBufferInfoVtbl; + + interface ISpeechAudioBufferInfo + { + CONST_VTBL struct ISpeechAudioBufferInfoVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechAudioBufferInfo_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechAudioBufferInfo_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechAudioBufferInfo_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechAudioBufferInfo_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechAudioBufferInfo_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechAudioBufferInfo_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechAudioBufferInfo_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechAudioBufferInfo_get_MinNotification(This,MinNotification) \ + (This)->lpVtbl -> get_MinNotification(This,MinNotification) + +#define ISpeechAudioBufferInfo_put_MinNotification(This,MinNotification) \ + (This)->lpVtbl -> put_MinNotification(This,MinNotification) + +#define ISpeechAudioBufferInfo_get_BufferSize(This,BufferSize) \ + (This)->lpVtbl -> get_BufferSize(This,BufferSize) + +#define ISpeechAudioBufferInfo_put_BufferSize(This,BufferSize) \ + (This)->lpVtbl -> put_BufferSize(This,BufferSize) + +#define ISpeechAudioBufferInfo_get_EventBias(This,EventBias) \ + (This)->lpVtbl -> get_EventBias(This,EventBias) + +#define ISpeechAudioBufferInfo_put_EventBias(This,EventBias) \ + (This)->lpVtbl -> put_EventBias(This,EventBias) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_get_MinNotification_Proxy( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *MinNotification); + + +void __RPC_STUB ISpeechAudioBufferInfo_get_MinNotification_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_put_MinNotification_Proxy( + ISpeechAudioBufferInfo * This, + /* [in] */ long MinNotification); + + +void __RPC_STUB ISpeechAudioBufferInfo_put_MinNotification_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_get_BufferSize_Proxy( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *BufferSize); + + +void __RPC_STUB ISpeechAudioBufferInfo_get_BufferSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_put_BufferSize_Proxy( + ISpeechAudioBufferInfo * This, + /* [in] */ long BufferSize); + + +void __RPC_STUB ISpeechAudioBufferInfo_put_BufferSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_get_EventBias_Proxy( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *EventBias); + + +void __RPC_STUB ISpeechAudioBufferInfo_get_EventBias_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_put_EventBias_Proxy( + ISpeechAudioBufferInfo * This, + /* [in] */ long EventBias); + + +void __RPC_STUB ISpeechAudioBufferInfo_put_EventBias_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechAudioBufferInfo_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechAudioStatus_INTERFACE_DEFINED__ +#define __ISpeechAudioStatus_INTERFACE_DEFINED__ + +/* interface ISpeechAudioStatus */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechAudioStatus; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C62D9C91-7458-47f6-862D-1EF86FB0B278") + ISpeechAudioStatus : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FreeBufferSpace( + /* [retval][out] */ long *FreeBufferSpace) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NonBlockingIO( + /* [retval][out] */ long *NonBlockingIO) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_State( + /* [retval][out] */ SpeechAudioState *State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentSeekPosition( + /* [retval][out] */ VARIANT *CurrentSeekPosition) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentDevicePosition( + /* [retval][out] */ VARIANT *CurrentDevicePosition) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechAudioStatusVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechAudioStatus * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechAudioStatus * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechAudioStatus * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechAudioStatus * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechAudioStatus * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechAudioStatus * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechAudioStatus * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FreeBufferSpace )( + ISpeechAudioStatus * This, + /* [retval][out] */ long *FreeBufferSpace); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NonBlockingIO )( + ISpeechAudioStatus * This, + /* [retval][out] */ long *NonBlockingIO); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )( + ISpeechAudioStatus * This, + /* [retval][out] */ SpeechAudioState *State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentSeekPosition )( + ISpeechAudioStatus * This, + /* [retval][out] */ VARIANT *CurrentSeekPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentDevicePosition )( + ISpeechAudioStatus * This, + /* [retval][out] */ VARIANT *CurrentDevicePosition); + + END_INTERFACE + } ISpeechAudioStatusVtbl; + + interface ISpeechAudioStatus + { + CONST_VTBL struct ISpeechAudioStatusVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechAudioStatus_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechAudioStatus_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechAudioStatus_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechAudioStatus_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechAudioStatus_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechAudioStatus_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechAudioStatus_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechAudioStatus_get_FreeBufferSpace(This,FreeBufferSpace) \ + (This)->lpVtbl -> get_FreeBufferSpace(This,FreeBufferSpace) + +#define ISpeechAudioStatus_get_NonBlockingIO(This,NonBlockingIO) \ + (This)->lpVtbl -> get_NonBlockingIO(This,NonBlockingIO) + +#define ISpeechAudioStatus_get_State(This,State) \ + (This)->lpVtbl -> get_State(This,State) + +#define ISpeechAudioStatus_get_CurrentSeekPosition(This,CurrentSeekPosition) \ + (This)->lpVtbl -> get_CurrentSeekPosition(This,CurrentSeekPosition) + +#define ISpeechAudioStatus_get_CurrentDevicePosition(This,CurrentDevicePosition) \ + (This)->lpVtbl -> get_CurrentDevicePosition(This,CurrentDevicePosition) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_FreeBufferSpace_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ long *FreeBufferSpace); + + +void __RPC_STUB ISpeechAudioStatus_get_FreeBufferSpace_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_NonBlockingIO_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ long *NonBlockingIO); + + +void __RPC_STUB ISpeechAudioStatus_get_NonBlockingIO_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_State_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ SpeechAudioState *State); + + +void __RPC_STUB ISpeechAudioStatus_get_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_CurrentSeekPosition_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ VARIANT *CurrentSeekPosition); + + +void __RPC_STUB ISpeechAudioStatus_get_CurrentSeekPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_CurrentDevicePosition_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ VARIANT *CurrentDevicePosition); + + +void __RPC_STUB ISpeechAudioStatus_get_CurrentDevicePosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechAudioStatus_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechAudioFormat_INTERFACE_DEFINED__ +#define __ISpeechAudioFormat_INTERFACE_DEFINED__ + +/* interface ISpeechAudioFormat */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechAudioFormat; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E6E9C590-3E18-40e3-8299-061F98BDE7C7") + ISpeechAudioFormat : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ SpeechAudioFormatType *AudioFormat) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Type( + /* [in] */ SpeechAudioFormatType AudioFormat) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_Guid( + /* [retval][out] */ BSTR *Guid) = 0; + + virtual /* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_Guid( + /* [in] */ BSTR Guid) = 0; + + virtual /* [id][helpstring][hidden] */ HRESULT STDMETHODCALLTYPE GetWaveFormatEx( + /* [retval][out] */ ISpeechWaveFormatEx **WaveFormatEx) = 0; + + virtual /* [id][helpstring][hidden] */ HRESULT STDMETHODCALLTYPE SetWaveFormatEx( + /* [in] */ ISpeechWaveFormatEx *WaveFormatEx) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechAudioFormatVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechAudioFormat * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechAudioFormat * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechAudioFormat * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechAudioFormat * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechAudioFormat * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechAudioFormat * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechAudioFormat * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Type )( + ISpeechAudioFormat * This, + /* [retval][out] */ SpeechAudioFormatType *AudioFormat); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Type )( + ISpeechAudioFormat * This, + /* [in] */ SpeechAudioFormatType AudioFormat); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Guid )( + ISpeechAudioFormat * This, + /* [retval][out] */ BSTR *Guid); + + /* [id][helpstring][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Guid )( + ISpeechAudioFormat * This, + /* [in] */ BSTR Guid); + + /* [id][helpstring][hidden] */ HRESULT ( STDMETHODCALLTYPE *GetWaveFormatEx )( + ISpeechAudioFormat * This, + /* [retval][out] */ ISpeechWaveFormatEx **WaveFormatEx); + + /* [id][helpstring][hidden] */ HRESULT ( STDMETHODCALLTYPE *SetWaveFormatEx )( + ISpeechAudioFormat * This, + /* [in] */ ISpeechWaveFormatEx *WaveFormatEx); + + END_INTERFACE + } ISpeechAudioFormatVtbl; + + interface ISpeechAudioFormat + { + CONST_VTBL struct ISpeechAudioFormatVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechAudioFormat_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechAudioFormat_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechAudioFormat_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechAudioFormat_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechAudioFormat_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechAudioFormat_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechAudioFormat_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechAudioFormat_get_Type(This,AudioFormat) \ + (This)->lpVtbl -> get_Type(This,AudioFormat) + +#define ISpeechAudioFormat_put_Type(This,AudioFormat) \ + (This)->lpVtbl -> put_Type(This,AudioFormat) + +#define ISpeechAudioFormat_get_Guid(This,Guid) \ + (This)->lpVtbl -> get_Guid(This,Guid) + +#define ISpeechAudioFormat_put_Guid(This,Guid) \ + (This)->lpVtbl -> put_Guid(This,Guid) + +#define ISpeechAudioFormat_GetWaveFormatEx(This,WaveFormatEx) \ + (This)->lpVtbl -> GetWaveFormatEx(This,WaveFormatEx) + +#define ISpeechAudioFormat_SetWaveFormatEx(This,WaveFormatEx) \ + (This)->lpVtbl -> SetWaveFormatEx(This,WaveFormatEx) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_get_Type_Proxy( + ISpeechAudioFormat * This, + /* [retval][out] */ SpeechAudioFormatType *AudioFormat); + + +void __RPC_STUB ISpeechAudioFormat_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_put_Type_Proxy( + ISpeechAudioFormat * This, + /* [in] */ SpeechAudioFormatType AudioFormat); + + +void __RPC_STUB ISpeechAudioFormat_put_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_get_Guid_Proxy( + ISpeechAudioFormat * This, + /* [retval][out] */ BSTR *Guid); + + +void __RPC_STUB ISpeechAudioFormat_get_Guid_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_put_Guid_Proxy( + ISpeechAudioFormat * This, + /* [in] */ BSTR Guid); + + +void __RPC_STUB ISpeechAudioFormat_put_Guid_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_GetWaveFormatEx_Proxy( + ISpeechAudioFormat * This, + /* [retval][out] */ ISpeechWaveFormatEx **WaveFormatEx); + + +void __RPC_STUB ISpeechAudioFormat_GetWaveFormatEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_SetWaveFormatEx_Proxy( + ISpeechAudioFormat * This, + /* [in] */ ISpeechWaveFormatEx *WaveFormatEx); + + +void __RPC_STUB ISpeechAudioFormat_SetWaveFormatEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechAudioFormat_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechWaveFormatEx_INTERFACE_DEFINED__ +#define __ISpeechWaveFormatEx_INTERFACE_DEFINED__ + +/* interface ISpeechWaveFormatEx */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechWaveFormatEx; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7A1EF0D5-1581-4741-88E4-209A49F11A10") + ISpeechWaveFormatEx : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FormatTag( + /* [retval][out] */ short *FormatTag) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_FormatTag( + /* [in] */ short FormatTag) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Channels( + /* [retval][out] */ short *Channels) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Channels( + /* [in] */ short Channels) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SamplesPerSec( + /* [retval][out] */ long *SamplesPerSec) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_SamplesPerSec( + /* [in] */ long SamplesPerSec) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AvgBytesPerSec( + /* [retval][out] */ long *AvgBytesPerSec) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_AvgBytesPerSec( + /* [in] */ long AvgBytesPerSec) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BlockAlign( + /* [retval][out] */ short *BlockAlign) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_BlockAlign( + /* [in] */ short BlockAlign) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BitsPerSample( + /* [retval][out] */ short *BitsPerSample) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_BitsPerSample( + /* [in] */ short BitsPerSample) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ExtraData( + /* [retval][out] */ VARIANT *ExtraData) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ExtraData( + /* [in] */ VARIANT ExtraData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechWaveFormatExVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechWaveFormatEx * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechWaveFormatEx * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechWaveFormatEx * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechWaveFormatEx * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechWaveFormatEx * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechWaveFormatEx * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechWaveFormatEx * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FormatTag )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *FormatTag); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_FormatTag )( + ISpeechWaveFormatEx * This, + /* [in] */ short FormatTag); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Channels )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *Channels); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Channels )( + ISpeechWaveFormatEx * This, + /* [in] */ short Channels); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SamplesPerSec )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ long *SamplesPerSec); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SamplesPerSec )( + ISpeechWaveFormatEx * This, + /* [in] */ long SamplesPerSec); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AvgBytesPerSec )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ long *AvgBytesPerSec); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AvgBytesPerSec )( + ISpeechWaveFormatEx * This, + /* [in] */ long AvgBytesPerSec); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BlockAlign )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *BlockAlign); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BlockAlign )( + ISpeechWaveFormatEx * This, + /* [in] */ short BlockAlign); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BitsPerSample )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *BitsPerSample); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BitsPerSample )( + ISpeechWaveFormatEx * This, + /* [in] */ short BitsPerSample); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ExtraData )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ VARIANT *ExtraData); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ExtraData )( + ISpeechWaveFormatEx * This, + /* [in] */ VARIANT ExtraData); + + END_INTERFACE + } ISpeechWaveFormatExVtbl; + + interface ISpeechWaveFormatEx + { + CONST_VTBL struct ISpeechWaveFormatExVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechWaveFormatEx_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechWaveFormatEx_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechWaveFormatEx_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechWaveFormatEx_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechWaveFormatEx_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechWaveFormatEx_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechWaveFormatEx_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechWaveFormatEx_get_FormatTag(This,FormatTag) \ + (This)->lpVtbl -> get_FormatTag(This,FormatTag) + +#define ISpeechWaveFormatEx_put_FormatTag(This,FormatTag) \ + (This)->lpVtbl -> put_FormatTag(This,FormatTag) + +#define ISpeechWaveFormatEx_get_Channels(This,Channels) \ + (This)->lpVtbl -> get_Channels(This,Channels) + +#define ISpeechWaveFormatEx_put_Channels(This,Channels) \ + (This)->lpVtbl -> put_Channels(This,Channels) + +#define ISpeechWaveFormatEx_get_SamplesPerSec(This,SamplesPerSec) \ + (This)->lpVtbl -> get_SamplesPerSec(This,SamplesPerSec) + +#define ISpeechWaveFormatEx_put_SamplesPerSec(This,SamplesPerSec) \ + (This)->lpVtbl -> put_SamplesPerSec(This,SamplesPerSec) + +#define ISpeechWaveFormatEx_get_AvgBytesPerSec(This,AvgBytesPerSec) \ + (This)->lpVtbl -> get_AvgBytesPerSec(This,AvgBytesPerSec) + +#define ISpeechWaveFormatEx_put_AvgBytesPerSec(This,AvgBytesPerSec) \ + (This)->lpVtbl -> put_AvgBytesPerSec(This,AvgBytesPerSec) + +#define ISpeechWaveFormatEx_get_BlockAlign(This,BlockAlign) \ + (This)->lpVtbl -> get_BlockAlign(This,BlockAlign) + +#define ISpeechWaveFormatEx_put_BlockAlign(This,BlockAlign) \ + (This)->lpVtbl -> put_BlockAlign(This,BlockAlign) + +#define ISpeechWaveFormatEx_get_BitsPerSample(This,BitsPerSample) \ + (This)->lpVtbl -> get_BitsPerSample(This,BitsPerSample) + +#define ISpeechWaveFormatEx_put_BitsPerSample(This,BitsPerSample) \ + (This)->lpVtbl -> put_BitsPerSample(This,BitsPerSample) + +#define ISpeechWaveFormatEx_get_ExtraData(This,ExtraData) \ + (This)->lpVtbl -> get_ExtraData(This,ExtraData) + +#define ISpeechWaveFormatEx_put_ExtraData(This,ExtraData) \ + (This)->lpVtbl -> put_ExtraData(This,ExtraData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_FormatTag_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *FormatTag); + + +void __RPC_STUB ISpeechWaveFormatEx_get_FormatTag_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_FormatTag_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ short FormatTag); + + +void __RPC_STUB ISpeechWaveFormatEx_put_FormatTag_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_Channels_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *Channels); + + +void __RPC_STUB ISpeechWaveFormatEx_get_Channels_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_Channels_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ short Channels); + + +void __RPC_STUB ISpeechWaveFormatEx_put_Channels_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_SamplesPerSec_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ long *SamplesPerSec); + + +void __RPC_STUB ISpeechWaveFormatEx_get_SamplesPerSec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_SamplesPerSec_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ long SamplesPerSec); + + +void __RPC_STUB ISpeechWaveFormatEx_put_SamplesPerSec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_AvgBytesPerSec_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ long *AvgBytesPerSec); + + +void __RPC_STUB ISpeechWaveFormatEx_get_AvgBytesPerSec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_AvgBytesPerSec_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ long AvgBytesPerSec); + + +void __RPC_STUB ISpeechWaveFormatEx_put_AvgBytesPerSec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_BlockAlign_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *BlockAlign); + + +void __RPC_STUB ISpeechWaveFormatEx_get_BlockAlign_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_BlockAlign_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ short BlockAlign); + + +void __RPC_STUB ISpeechWaveFormatEx_put_BlockAlign_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_BitsPerSample_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *BitsPerSample); + + +void __RPC_STUB ISpeechWaveFormatEx_get_BitsPerSample_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_BitsPerSample_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ short BitsPerSample); + + +void __RPC_STUB ISpeechWaveFormatEx_put_BitsPerSample_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_ExtraData_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ VARIANT *ExtraData); + + +void __RPC_STUB ISpeechWaveFormatEx_get_ExtraData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_ExtraData_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ VARIANT ExtraData); + + +void __RPC_STUB ISpeechWaveFormatEx_put_ExtraData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechWaveFormatEx_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechBaseStream_INTERFACE_DEFINED__ +#define __ISpeechBaseStream_INTERFACE_DEFINED__ + +/* interface ISpeechBaseStream */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechBaseStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6450336F-7D49-4ced-8097-49D6DEE37294") + ISpeechBaseStream : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Format( + /* [retval][out] */ ISpeechAudioFormat **AudioFormat) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Format( + /* [in] */ ISpeechAudioFormat *AudioFormat) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Read( + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Write( + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Seek( + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechBaseStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechBaseStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechBaseStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechBaseStream * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechBaseStream * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechBaseStream * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechBaseStream * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechBaseStream * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechBaseStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechBaseStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechBaseStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechBaseStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechBaseStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + END_INTERFACE + } ISpeechBaseStreamVtbl; + + interface ISpeechBaseStream + { + CONST_VTBL struct ISpeechBaseStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechBaseStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechBaseStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechBaseStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechBaseStream_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechBaseStream_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechBaseStream_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechBaseStream_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechBaseStream_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechBaseStream_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechBaseStream_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechBaseStream_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechBaseStream_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_get_Format_Proxy( + ISpeechBaseStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + +void __RPC_STUB ISpeechBaseStream_get_Format_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_putref_Format_Proxy( + ISpeechBaseStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + +void __RPC_STUB ISpeechBaseStream_putref_Format_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_Read_Proxy( + ISpeechBaseStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + +void __RPC_STUB ISpeechBaseStream_Read_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_Write_Proxy( + ISpeechBaseStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + +void __RPC_STUB ISpeechBaseStream_Write_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_Seek_Proxy( + ISpeechBaseStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + +void __RPC_STUB ISpeechBaseStream_Seek_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechBaseStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechFileStream_INTERFACE_DEFINED__ +#define __ISpeechFileStream_INTERFACE_DEFINED__ + +/* interface ISpeechFileStream */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechFileStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AF67F125-AB39-4e93-B4A2-CC2E66E182A7") + ISpeechFileStream : public ISpeechBaseStream + { + public: + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Open( + /* [in] */ BSTR FileName, + /* [defaultvalue][in] */ SpeechStreamFileMode FileMode = SSFMOpenForRead, + /* [defaultvalue][in] */ VARIANT_BOOL DoEvents = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Close( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechFileStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechFileStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechFileStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechFileStream * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechFileStream * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechFileStream * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechFileStream * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechFileStream * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechFileStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechFileStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechFileStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechFileStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechFileStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Open )( + ISpeechFileStream * This, + /* [in] */ BSTR FileName, + /* [defaultvalue][in] */ SpeechStreamFileMode FileMode, + /* [defaultvalue][in] */ VARIANT_BOOL DoEvents); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Close )( + ISpeechFileStream * This); + + END_INTERFACE + } ISpeechFileStreamVtbl; + + interface ISpeechFileStream + { + CONST_VTBL struct ISpeechFileStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechFileStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechFileStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechFileStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechFileStream_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechFileStream_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechFileStream_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechFileStream_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechFileStream_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechFileStream_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechFileStream_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechFileStream_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechFileStream_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechFileStream_Open(This,FileName,FileMode,DoEvents) \ + (This)->lpVtbl -> Open(This,FileName,FileMode,DoEvents) + +#define ISpeechFileStream_Close(This) \ + (This)->lpVtbl -> Close(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechFileStream_Open_Proxy( + ISpeechFileStream * This, + /* [in] */ BSTR FileName, + /* [defaultvalue][in] */ SpeechStreamFileMode FileMode, + /* [defaultvalue][in] */ VARIANT_BOOL DoEvents); + + +void __RPC_STUB ISpeechFileStream_Open_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechFileStream_Close_Proxy( + ISpeechFileStream * This); + + +void __RPC_STUB ISpeechFileStream_Close_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechFileStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechMemoryStream_INTERFACE_DEFINED__ +#define __ISpeechMemoryStream_INTERFACE_DEFINED__ + +/* interface ISpeechMemoryStream */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechMemoryStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EEB14B68-808B-4abe-A5EA-B51DA7588008") + ISpeechMemoryStream : public ISpeechBaseStream + { + public: + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetData( + /* [in] */ VARIANT Data) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetData( + /* [retval][out] */ VARIANT *pData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechMemoryStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechMemoryStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechMemoryStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechMemoryStream * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechMemoryStream * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechMemoryStream * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechMemoryStream * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechMemoryStream * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechMemoryStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechMemoryStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechMemoryStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechMemoryStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechMemoryStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpeechMemoryStream * This, + /* [in] */ VARIANT Data); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpeechMemoryStream * This, + /* [retval][out] */ VARIANT *pData); + + END_INTERFACE + } ISpeechMemoryStreamVtbl; + + interface ISpeechMemoryStream + { + CONST_VTBL struct ISpeechMemoryStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechMemoryStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechMemoryStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechMemoryStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechMemoryStream_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechMemoryStream_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechMemoryStream_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechMemoryStream_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechMemoryStream_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechMemoryStream_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechMemoryStream_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechMemoryStream_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechMemoryStream_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechMemoryStream_SetData(This,Data) \ + (This)->lpVtbl -> SetData(This,Data) + +#define ISpeechMemoryStream_GetData(This,pData) \ + (This)->lpVtbl -> GetData(This,pData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechMemoryStream_SetData_Proxy( + ISpeechMemoryStream * This, + /* [in] */ VARIANT Data); + + +void __RPC_STUB ISpeechMemoryStream_SetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechMemoryStream_GetData_Proxy( + ISpeechMemoryStream * This, + /* [retval][out] */ VARIANT *pData); + + +void __RPC_STUB ISpeechMemoryStream_GetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechMemoryStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechCustomStream_INTERFACE_DEFINED__ +#define __ISpeechCustomStream_INTERFACE_DEFINED__ + +/* interface ISpeechCustomStream */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechCustomStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1A9E9F4F-104F-4db8-A115-EFD7FD0C97AE") + ISpeechCustomStream : public ISpeechBaseStream + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BaseStream( + /* [retval][out] */ IUnknown **ppUnkStream) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_BaseStream( + /* [in] */ IUnknown *pUnkStream) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechCustomStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechCustomStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechCustomStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechCustomStream * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechCustomStream * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechCustomStream * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechCustomStream * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechCustomStream * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechCustomStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechCustomStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechCustomStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechCustomStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechCustomStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BaseStream )( + ISpeechCustomStream * This, + /* [retval][out] */ IUnknown **ppUnkStream); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_BaseStream )( + ISpeechCustomStream * This, + /* [in] */ IUnknown *pUnkStream); + + END_INTERFACE + } ISpeechCustomStreamVtbl; + + interface ISpeechCustomStream + { + CONST_VTBL struct ISpeechCustomStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechCustomStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechCustomStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechCustomStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechCustomStream_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechCustomStream_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechCustomStream_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechCustomStream_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechCustomStream_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechCustomStream_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechCustomStream_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechCustomStream_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechCustomStream_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechCustomStream_get_BaseStream(This,ppUnkStream) \ + (This)->lpVtbl -> get_BaseStream(This,ppUnkStream) + +#define ISpeechCustomStream_putref_BaseStream(This,pUnkStream) \ + (This)->lpVtbl -> putref_BaseStream(This,pUnkStream) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechCustomStream_get_BaseStream_Proxy( + ISpeechCustomStream * This, + /* [retval][out] */ IUnknown **ppUnkStream); + + +void __RPC_STUB ISpeechCustomStream_get_BaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechCustomStream_putref_BaseStream_Proxy( + ISpeechCustomStream * This, + /* [in] */ IUnknown *pUnkStream); + + +void __RPC_STUB ISpeechCustomStream_putref_BaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechCustomStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechAudio_INTERFACE_DEFINED__ +#define __ISpeechAudio_INTERFACE_DEFINED__ + +/* interface ISpeechAudio */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechAudio; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CFF8E175-019E-11d3-A08E-00C04F8EF9B5") + ISpeechAudio : public ISpeechBaseStream + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Status( + /* [retval][out] */ ISpeechAudioStatus **Status) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BufferInfo( + /* [retval][out] */ ISpeechAudioBufferInfo **BufferInfo) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DefaultFormat( + /* [retval][out] */ ISpeechAudioFormat **StreamFormat) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Volume( + /* [retval][out] */ long *Volume) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Volume( + /* [in] */ long Volume) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BufferNotifySize( + /* [retval][out] */ long *BufferNotifySize) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_BufferNotifySize( + /* [in] */ long BufferNotifySize) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_EventHandle( + /* [retval][out] */ long *EventHandle) = 0; + + virtual /* [hidden][id][helpstring] */ HRESULT STDMETHODCALLTYPE SetState( + /* [in] */ SpeechAudioState State) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechAudioVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechAudio * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechAudio * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechAudio * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechAudio * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechAudio * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechAudio * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechAudio * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechAudio * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechAudio * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechAudio * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechAudio * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioStatus **Status); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferInfo )( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioBufferInfo **BufferInfo); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DefaultFormat )( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioFormat **StreamFormat); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Volume )( + ISpeechAudio * This, + /* [retval][out] */ long *Volume); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Volume )( + ISpeechAudio * This, + /* [in] */ long Volume); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferNotifySize )( + ISpeechAudio * This, + /* [retval][out] */ long *BufferNotifySize); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BufferNotifySize )( + ISpeechAudio * This, + /* [in] */ long BufferNotifySize); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventHandle )( + ISpeechAudio * This, + /* [retval][out] */ long *EventHandle); + + /* [hidden][id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetState )( + ISpeechAudio * This, + /* [in] */ SpeechAudioState State); + + END_INTERFACE + } ISpeechAudioVtbl; + + interface ISpeechAudio + { + CONST_VTBL struct ISpeechAudioVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechAudio_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechAudio_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechAudio_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechAudio_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechAudio_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechAudio_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechAudio_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechAudio_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechAudio_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechAudio_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechAudio_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechAudio_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechAudio_get_Status(This,Status) \ + (This)->lpVtbl -> get_Status(This,Status) + +#define ISpeechAudio_get_BufferInfo(This,BufferInfo) \ + (This)->lpVtbl -> get_BufferInfo(This,BufferInfo) + +#define ISpeechAudio_get_DefaultFormat(This,StreamFormat) \ + (This)->lpVtbl -> get_DefaultFormat(This,StreamFormat) + +#define ISpeechAudio_get_Volume(This,Volume) \ + (This)->lpVtbl -> get_Volume(This,Volume) + +#define ISpeechAudio_put_Volume(This,Volume) \ + (This)->lpVtbl -> put_Volume(This,Volume) + +#define ISpeechAudio_get_BufferNotifySize(This,BufferNotifySize) \ + (This)->lpVtbl -> get_BufferNotifySize(This,BufferNotifySize) + +#define ISpeechAudio_put_BufferNotifySize(This,BufferNotifySize) \ + (This)->lpVtbl -> put_BufferNotifySize(This,BufferNotifySize) + +#define ISpeechAudio_get_EventHandle(This,EventHandle) \ + (This)->lpVtbl -> get_EventHandle(This,EventHandle) + +#define ISpeechAudio_SetState(This,State) \ + (This)->lpVtbl -> SetState(This,State) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_Status_Proxy( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioStatus **Status); + + +void __RPC_STUB ISpeechAudio_get_Status_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_BufferInfo_Proxy( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioBufferInfo **BufferInfo); + + +void __RPC_STUB ISpeechAudio_get_BufferInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_DefaultFormat_Proxy( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioFormat **StreamFormat); + + +void __RPC_STUB ISpeechAudio_get_DefaultFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_Volume_Proxy( + ISpeechAudio * This, + /* [retval][out] */ long *Volume); + + +void __RPC_STUB ISpeechAudio_get_Volume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_put_Volume_Proxy( + ISpeechAudio * This, + /* [in] */ long Volume); + + +void __RPC_STUB ISpeechAudio_put_Volume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_BufferNotifySize_Proxy( + ISpeechAudio * This, + /* [retval][out] */ long *BufferNotifySize); + + +void __RPC_STUB ISpeechAudio_get_BufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_put_BufferNotifySize_Proxy( + ISpeechAudio * This, + /* [in] */ long BufferNotifySize); + + +void __RPC_STUB ISpeechAudio_put_BufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_EventHandle_Proxy( + ISpeechAudio * This, + /* [retval][out] */ long *EventHandle); + + +void __RPC_STUB ISpeechAudio_get_EventHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_SetState_Proxy( + ISpeechAudio * This, + /* [in] */ SpeechAudioState State); + + +void __RPC_STUB ISpeechAudio_SetState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechAudio_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechMMSysAudio_INTERFACE_DEFINED__ +#define __ISpeechMMSysAudio_INTERFACE_DEFINED__ + +/* interface ISpeechMMSysAudio */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechMMSysAudio; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3C76AF6D-1FD7-4831-81D1-3B71D5A13C44") + ISpeechMMSysAudio : public ISpeechAudio + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DeviceId( + /* [retval][out] */ long *DeviceId) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_DeviceId( + /* [in] */ long DeviceId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LineId( + /* [retval][out] */ long *LineId) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_LineId( + /* [in] */ long LineId) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_MMHandle( + /* [retval][out] */ long *Handle) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechMMSysAudioVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechMMSysAudio * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechMMSysAudio * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechMMSysAudio * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechMMSysAudio * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechMMSysAudio * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechMMSysAudio * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechMMSysAudio * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechMMSysAudio * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechMMSysAudio * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechMMSysAudio * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechMMSysAudio * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechMMSysAudio * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ISpeechMMSysAudio * This, + /* [retval][out] */ ISpeechAudioStatus **Status); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferInfo )( + ISpeechMMSysAudio * This, + /* [retval][out] */ ISpeechAudioBufferInfo **BufferInfo); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DefaultFormat )( + ISpeechMMSysAudio * This, + /* [retval][out] */ ISpeechAudioFormat **StreamFormat); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Volume )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *Volume); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Volume )( + ISpeechMMSysAudio * This, + /* [in] */ long Volume); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferNotifySize )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *BufferNotifySize); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BufferNotifySize )( + ISpeechMMSysAudio * This, + /* [in] */ long BufferNotifySize); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventHandle )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *EventHandle); + + /* [hidden][id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetState )( + ISpeechMMSysAudio * This, + /* [in] */ SpeechAudioState State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeviceId )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *DeviceId); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_DeviceId )( + ISpeechMMSysAudio * This, + /* [in] */ long DeviceId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LineId )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *LineId); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_LineId )( + ISpeechMMSysAudio * This, + /* [in] */ long LineId); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MMHandle )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *Handle); + + END_INTERFACE + } ISpeechMMSysAudioVtbl; + + interface ISpeechMMSysAudio + { + CONST_VTBL struct ISpeechMMSysAudioVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechMMSysAudio_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechMMSysAudio_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechMMSysAudio_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechMMSysAudio_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechMMSysAudio_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechMMSysAudio_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechMMSysAudio_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechMMSysAudio_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechMMSysAudio_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechMMSysAudio_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechMMSysAudio_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechMMSysAudio_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechMMSysAudio_get_Status(This,Status) \ + (This)->lpVtbl -> get_Status(This,Status) + +#define ISpeechMMSysAudio_get_BufferInfo(This,BufferInfo) \ + (This)->lpVtbl -> get_BufferInfo(This,BufferInfo) + +#define ISpeechMMSysAudio_get_DefaultFormat(This,StreamFormat) \ + (This)->lpVtbl -> get_DefaultFormat(This,StreamFormat) + +#define ISpeechMMSysAudio_get_Volume(This,Volume) \ + (This)->lpVtbl -> get_Volume(This,Volume) + +#define ISpeechMMSysAudio_put_Volume(This,Volume) \ + (This)->lpVtbl -> put_Volume(This,Volume) + +#define ISpeechMMSysAudio_get_BufferNotifySize(This,BufferNotifySize) \ + (This)->lpVtbl -> get_BufferNotifySize(This,BufferNotifySize) + +#define ISpeechMMSysAudio_put_BufferNotifySize(This,BufferNotifySize) \ + (This)->lpVtbl -> put_BufferNotifySize(This,BufferNotifySize) + +#define ISpeechMMSysAudio_get_EventHandle(This,EventHandle) \ + (This)->lpVtbl -> get_EventHandle(This,EventHandle) + +#define ISpeechMMSysAudio_SetState(This,State) \ + (This)->lpVtbl -> SetState(This,State) + + +#define ISpeechMMSysAudio_get_DeviceId(This,DeviceId) \ + (This)->lpVtbl -> get_DeviceId(This,DeviceId) + +#define ISpeechMMSysAudio_put_DeviceId(This,DeviceId) \ + (This)->lpVtbl -> put_DeviceId(This,DeviceId) + +#define ISpeechMMSysAudio_get_LineId(This,LineId) \ + (This)->lpVtbl -> get_LineId(This,LineId) + +#define ISpeechMMSysAudio_put_LineId(This,LineId) \ + (This)->lpVtbl -> put_LineId(This,LineId) + +#define ISpeechMMSysAudio_get_MMHandle(This,Handle) \ + (This)->lpVtbl -> get_MMHandle(This,Handle) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_get_DeviceId_Proxy( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *DeviceId); + + +void __RPC_STUB ISpeechMMSysAudio_get_DeviceId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_put_DeviceId_Proxy( + ISpeechMMSysAudio * This, + /* [in] */ long DeviceId); + + +void __RPC_STUB ISpeechMMSysAudio_put_DeviceId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_get_LineId_Proxy( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *LineId); + + +void __RPC_STUB ISpeechMMSysAudio_get_LineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_put_LineId_Proxy( + ISpeechMMSysAudio * This, + /* [in] */ long LineId); + + +void __RPC_STUB ISpeechMMSysAudio_put_LineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_get_MMHandle_Proxy( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *Handle); + + +void __RPC_STUB ISpeechMMSysAudio_get_MMHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechMMSysAudio_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechVoice_INTERFACE_DEFINED__ +#define __ISpeechVoice_INTERFACE_DEFINED__ + +/* interface ISpeechVoice */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechVoice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("269316D8-57BD-11D2-9EEE-00C04F797396") + ISpeechVoice : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Status( + /* [retval][out] */ ISpeechVoiceStatus **Status) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Voice( + /* [retval][out] */ ISpeechObjectToken **Voice) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Voice( + /* [in] */ ISpeechObjectToken *Voice) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioOutput( + /* [retval][out] */ ISpeechObjectToken **AudioOutput) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioOutput( + /* [in] */ ISpeechObjectToken *AudioOutput) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioOutputStream( + /* [retval][out] */ ISpeechBaseStream **AudioOutputStream) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioOutputStream( + /* [in] */ ISpeechBaseStream *AudioOutputStream) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rate( + /* [retval][out] */ long *Rate) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Rate( + /* [in] */ long Rate) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Volume( + /* [retval][out] */ long *Volume) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Volume( + /* [in] */ long Volume) = 0; + + virtual /* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_AllowAudioOutputFormatChangesOnNextSet( + /* [in] */ VARIANT_BOOL Allow) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_AllowAudioOutputFormatChangesOnNextSet( + /* [retval][out] */ VARIANT_BOOL *Allow) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EventInterests( + /* [retval][out] */ SpeechVoiceEvents *EventInterestFlags) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_EventInterests( + /* [in] */ SpeechVoiceEvents EventInterestFlags) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Priority( + /* [in] */ SpeechVoicePriority Priority) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Priority( + /* [retval][out] */ SpeechVoicePriority *Priority) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_AlertBoundary( + /* [in] */ SpeechVoiceEvents Boundary) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AlertBoundary( + /* [retval][out] */ SpeechVoiceEvents *Boundary) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_SynchronousSpeakTimeout( + /* [in] */ long msTimeout) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SynchronousSpeakTimeout( + /* [retval][out] */ long *msTimeout) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Speak( + /* [in] */ BSTR Text, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SpeakStream( + /* [in] */ ISpeechBaseStream *Stream, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Resume( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Skip( + /* [in] */ const BSTR Type, + /* [in] */ long NumItems, + /* [retval][out] */ long *NumSkipped) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetVoices( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetAudioOutputs( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE WaitUntilDone( + /* [in] */ long msTimeout, + /* [retval][out] */ VARIANT_BOOL *Done) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE SpeakCompleteEvent( + /* [retval][out] */ long *Handle) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData = 0) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechVoiceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechVoice * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechVoice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechVoice * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechVoice * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechVoice * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechVoice * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechVoice * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ISpeechVoice * This, + /* [retval][out] */ ISpeechVoiceStatus **Status); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Voice )( + ISpeechVoice * This, + /* [retval][out] */ ISpeechObjectToken **Voice); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Voice )( + ISpeechVoice * This, + /* [in] */ ISpeechObjectToken *Voice); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioOutput )( + ISpeechVoice * This, + /* [retval][out] */ ISpeechObjectToken **AudioOutput); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioOutput )( + ISpeechVoice * This, + /* [in] */ ISpeechObjectToken *AudioOutput); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioOutputStream )( + ISpeechVoice * This, + /* [retval][out] */ ISpeechBaseStream **AudioOutputStream); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioOutputStream )( + ISpeechVoice * This, + /* [in] */ ISpeechBaseStream *AudioOutputStream); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rate )( + ISpeechVoice * This, + /* [retval][out] */ long *Rate); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Rate )( + ISpeechVoice * This, + /* [in] */ long Rate); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Volume )( + ISpeechVoice * This, + /* [retval][out] */ long *Volume); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Volume )( + ISpeechVoice * This, + /* [in] */ long Volume); + + /* [id][helpstring][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AllowAudioOutputFormatChangesOnNextSet )( + ISpeechVoice * This, + /* [in] */ VARIANT_BOOL Allow); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllowAudioOutputFormatChangesOnNextSet )( + ISpeechVoice * This, + /* [retval][out] */ VARIANT_BOOL *Allow); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventInterests )( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoiceEvents *EventInterestFlags); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventInterests )( + ISpeechVoice * This, + /* [in] */ SpeechVoiceEvents EventInterestFlags); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Priority )( + ISpeechVoice * This, + /* [in] */ SpeechVoicePriority Priority); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Priority )( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoicePriority *Priority); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AlertBoundary )( + ISpeechVoice * This, + /* [in] */ SpeechVoiceEvents Boundary); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AlertBoundary )( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoiceEvents *Boundary); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SynchronousSpeakTimeout )( + ISpeechVoice * This, + /* [in] */ long msTimeout); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SynchronousSpeakTimeout )( + ISpeechVoice * This, + /* [retval][out] */ long *msTimeout); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Speak )( + ISpeechVoice * This, + /* [in] */ BSTR Text, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SpeakStream )( + ISpeechVoice * This, + /* [in] */ ISpeechBaseStream *Stream, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Pause )( + ISpeechVoice * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Resume )( + ISpeechVoice * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( + ISpeechVoice * This, + /* [in] */ const BSTR Type, + /* [in] */ long NumItems, + /* [retval][out] */ long *NumSkipped); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetVoices )( + ISpeechVoice * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetAudioOutputs )( + ISpeechVoice * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *WaitUntilDone )( + ISpeechVoice * This, + /* [in] */ long msTimeout, + /* [retval][out] */ VARIANT_BOOL *Done); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SpeakCompleteEvent )( + ISpeechVoice * This, + /* [retval][out] */ long *Handle); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpeechVoice * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpeechVoice * This, + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData); + + END_INTERFACE + } ISpeechVoiceVtbl; + + interface ISpeechVoice + { + CONST_VTBL struct ISpeechVoiceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechVoice_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechVoice_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechVoice_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechVoice_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechVoice_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechVoice_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechVoice_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechVoice_get_Status(This,Status) \ + (This)->lpVtbl -> get_Status(This,Status) + +#define ISpeechVoice_get_Voice(This,Voice) \ + (This)->lpVtbl -> get_Voice(This,Voice) + +#define ISpeechVoice_putref_Voice(This,Voice) \ + (This)->lpVtbl -> putref_Voice(This,Voice) + +#define ISpeechVoice_get_AudioOutput(This,AudioOutput) \ + (This)->lpVtbl -> get_AudioOutput(This,AudioOutput) + +#define ISpeechVoice_putref_AudioOutput(This,AudioOutput) \ + (This)->lpVtbl -> putref_AudioOutput(This,AudioOutput) + +#define ISpeechVoice_get_AudioOutputStream(This,AudioOutputStream) \ + (This)->lpVtbl -> get_AudioOutputStream(This,AudioOutputStream) + +#define ISpeechVoice_putref_AudioOutputStream(This,AudioOutputStream) \ + (This)->lpVtbl -> putref_AudioOutputStream(This,AudioOutputStream) + +#define ISpeechVoice_get_Rate(This,Rate) \ + (This)->lpVtbl -> get_Rate(This,Rate) + +#define ISpeechVoice_put_Rate(This,Rate) \ + (This)->lpVtbl -> put_Rate(This,Rate) + +#define ISpeechVoice_get_Volume(This,Volume) \ + (This)->lpVtbl -> get_Volume(This,Volume) + +#define ISpeechVoice_put_Volume(This,Volume) \ + (This)->lpVtbl -> put_Volume(This,Volume) + +#define ISpeechVoice_put_AllowAudioOutputFormatChangesOnNextSet(This,Allow) \ + (This)->lpVtbl -> put_AllowAudioOutputFormatChangesOnNextSet(This,Allow) + +#define ISpeechVoice_get_AllowAudioOutputFormatChangesOnNextSet(This,Allow) \ + (This)->lpVtbl -> get_AllowAudioOutputFormatChangesOnNextSet(This,Allow) + +#define ISpeechVoice_get_EventInterests(This,EventInterestFlags) \ + (This)->lpVtbl -> get_EventInterests(This,EventInterestFlags) + +#define ISpeechVoice_put_EventInterests(This,EventInterestFlags) \ + (This)->lpVtbl -> put_EventInterests(This,EventInterestFlags) + +#define ISpeechVoice_put_Priority(This,Priority) \ + (This)->lpVtbl -> put_Priority(This,Priority) + +#define ISpeechVoice_get_Priority(This,Priority) \ + (This)->lpVtbl -> get_Priority(This,Priority) + +#define ISpeechVoice_put_AlertBoundary(This,Boundary) \ + (This)->lpVtbl -> put_AlertBoundary(This,Boundary) + +#define ISpeechVoice_get_AlertBoundary(This,Boundary) \ + (This)->lpVtbl -> get_AlertBoundary(This,Boundary) + +#define ISpeechVoice_put_SynchronousSpeakTimeout(This,msTimeout) \ + (This)->lpVtbl -> put_SynchronousSpeakTimeout(This,msTimeout) + +#define ISpeechVoice_get_SynchronousSpeakTimeout(This,msTimeout) \ + (This)->lpVtbl -> get_SynchronousSpeakTimeout(This,msTimeout) + +#define ISpeechVoice_Speak(This,Text,Flags,StreamNumber) \ + (This)->lpVtbl -> Speak(This,Text,Flags,StreamNumber) + +#define ISpeechVoice_SpeakStream(This,Stream,Flags,StreamNumber) \ + (This)->lpVtbl -> SpeakStream(This,Stream,Flags,StreamNumber) + +#define ISpeechVoice_Pause(This) \ + (This)->lpVtbl -> Pause(This) + +#define ISpeechVoice_Resume(This) \ + (This)->lpVtbl -> Resume(This) + +#define ISpeechVoice_Skip(This,Type,NumItems,NumSkipped) \ + (This)->lpVtbl -> Skip(This,Type,NumItems,NumSkipped) + +#define ISpeechVoice_GetVoices(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetVoices(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#define ISpeechVoice_GetAudioOutputs(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetAudioOutputs(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#define ISpeechVoice_WaitUntilDone(This,msTimeout,Done) \ + (This)->lpVtbl -> WaitUntilDone(This,msTimeout,Done) + +#define ISpeechVoice_SpeakCompleteEvent(This,Handle) \ + (This)->lpVtbl -> SpeakCompleteEvent(This,Handle) + +#define ISpeechVoice_IsUISupported(This,TypeOfUI,ExtraData,Supported) \ + (This)->lpVtbl -> IsUISupported(This,TypeOfUI,ExtraData,Supported) + +#define ISpeechVoice_DisplayUI(This,hWndParent,Title,TypeOfUI,ExtraData) \ + (This)->lpVtbl -> DisplayUI(This,hWndParent,Title,TypeOfUI,ExtraData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Status_Proxy( + ISpeechVoice * This, + /* [retval][out] */ ISpeechVoiceStatus **Status); + + +void __RPC_STUB ISpeechVoice_get_Status_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Voice_Proxy( + ISpeechVoice * This, + /* [retval][out] */ ISpeechObjectToken **Voice); + + +void __RPC_STUB ISpeechVoice_get_Voice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_putref_Voice_Proxy( + ISpeechVoice * This, + /* [in] */ ISpeechObjectToken *Voice); + + +void __RPC_STUB ISpeechVoice_putref_Voice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_AudioOutput_Proxy( + ISpeechVoice * This, + /* [retval][out] */ ISpeechObjectToken **AudioOutput); + + +void __RPC_STUB ISpeechVoice_get_AudioOutput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_putref_AudioOutput_Proxy( + ISpeechVoice * This, + /* [in] */ ISpeechObjectToken *AudioOutput); + + +void __RPC_STUB ISpeechVoice_putref_AudioOutput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_AudioOutputStream_Proxy( + ISpeechVoice * This, + /* [retval][out] */ ISpeechBaseStream **AudioOutputStream); + + +void __RPC_STUB ISpeechVoice_get_AudioOutputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_putref_AudioOutputStream_Proxy( + ISpeechVoice * This, + /* [in] */ ISpeechBaseStream *AudioOutputStream); + + +void __RPC_STUB ISpeechVoice_putref_AudioOutputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Rate_Proxy( + ISpeechVoice * This, + /* [retval][out] */ long *Rate); + + +void __RPC_STUB ISpeechVoice_get_Rate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_Rate_Proxy( + ISpeechVoice * This, + /* [in] */ long Rate); + + +void __RPC_STUB ISpeechVoice_put_Rate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Volume_Proxy( + ISpeechVoice * This, + /* [retval][out] */ long *Volume); + + +void __RPC_STUB ISpeechVoice_get_Volume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_Volume_Proxy( + ISpeechVoice * This, + /* [in] */ long Volume); + + +void __RPC_STUB ISpeechVoice_put_Volume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_AllowAudioOutputFormatChangesOnNextSet_Proxy( + ISpeechVoice * This, + /* [in] */ VARIANT_BOOL Allow); + + +void __RPC_STUB ISpeechVoice_put_AllowAudioOutputFormatChangesOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_AllowAudioOutputFormatChangesOnNextSet_Proxy( + ISpeechVoice * This, + /* [retval][out] */ VARIANT_BOOL *Allow); + + +void __RPC_STUB ISpeechVoice_get_AllowAudioOutputFormatChangesOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_EventInterests_Proxy( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoiceEvents *EventInterestFlags); + + +void __RPC_STUB ISpeechVoice_get_EventInterests_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_EventInterests_Proxy( + ISpeechVoice * This, + /* [in] */ SpeechVoiceEvents EventInterestFlags); + + +void __RPC_STUB ISpeechVoice_put_EventInterests_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_Priority_Proxy( + ISpeechVoice * This, + /* [in] */ SpeechVoicePriority Priority); + + +void __RPC_STUB ISpeechVoice_put_Priority_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Priority_Proxy( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoicePriority *Priority); + + +void __RPC_STUB ISpeechVoice_get_Priority_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_AlertBoundary_Proxy( + ISpeechVoice * This, + /* [in] */ SpeechVoiceEvents Boundary); + + +void __RPC_STUB ISpeechVoice_put_AlertBoundary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_AlertBoundary_Proxy( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoiceEvents *Boundary); + + +void __RPC_STUB ISpeechVoice_get_AlertBoundary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_SynchronousSpeakTimeout_Proxy( + ISpeechVoice * This, + /* [in] */ long msTimeout); + + +void __RPC_STUB ISpeechVoice_put_SynchronousSpeakTimeout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_SynchronousSpeakTimeout_Proxy( + ISpeechVoice * This, + /* [retval][out] */ long *msTimeout); + + +void __RPC_STUB ISpeechVoice_get_SynchronousSpeakTimeout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_Speak_Proxy( + ISpeechVoice * This, + /* [in] */ BSTR Text, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechVoice_Speak_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_SpeakStream_Proxy( + ISpeechVoice * This, + /* [in] */ ISpeechBaseStream *Stream, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechVoice_SpeakStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_Pause_Proxy( + ISpeechVoice * This); + + +void __RPC_STUB ISpeechVoice_Pause_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_Resume_Proxy( + ISpeechVoice * This); + + +void __RPC_STUB ISpeechVoice_Resume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_Skip_Proxy( + ISpeechVoice * This, + /* [in] */ const BSTR Type, + /* [in] */ long NumItems, + /* [retval][out] */ long *NumSkipped); + + +void __RPC_STUB ISpeechVoice_Skip_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_GetVoices_Proxy( + ISpeechVoice * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechVoice_GetVoices_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_GetAudioOutputs_Proxy( + ISpeechVoice * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechVoice_GetAudioOutputs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_WaitUntilDone_Proxy( + ISpeechVoice * This, + /* [in] */ long msTimeout, + /* [retval][out] */ VARIANT_BOOL *Done); + + +void __RPC_STUB ISpeechVoice_WaitUntilDone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_SpeakCompleteEvent_Proxy( + ISpeechVoice * This, + /* [retval][out] */ long *Handle); + + +void __RPC_STUB ISpeechVoice_SpeakCompleteEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_IsUISupported_Proxy( + ISpeechVoice * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechVoice_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_DisplayUI_Proxy( + ISpeechVoice * This, + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData); + + +void __RPC_STUB ISpeechVoice_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechVoice_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechVoiceStatus_INTERFACE_DEFINED__ +#define __ISpeechVoiceStatus_INTERFACE_DEFINED__ + +/* interface ISpeechVoiceStatus */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechVoiceStatus; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8BE47B07-57F6-11d2-9EEE-00C04F797396") + ISpeechVoiceStatus : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentStreamNumber( + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LastStreamNumberQueued( + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LastHResult( + /* [retval][out] */ long *HResult) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RunningState( + /* [retval][out] */ SpeechRunState *State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InputWordPosition( + /* [retval][out] */ long *Position) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InputWordLength( + /* [retval][out] */ long *Length) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InputSentencePosition( + /* [retval][out] */ long *Position) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InputSentenceLength( + /* [retval][out] */ long *Length) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LastBookmark( + /* [retval][out] */ BSTR *Bookmark) = 0; + + virtual /* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LastBookmarkId( + /* [retval][out] */ long *BookmarkId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PhonemeId( + /* [retval][out] */ short *PhoneId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_VisemeId( + /* [retval][out] */ short *VisemeId) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechVoiceStatusVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechVoiceStatus * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechVoiceStatus * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechVoiceStatus * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechVoiceStatus * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechVoiceStatus * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechVoiceStatus * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechVoiceStatus * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentStreamNumber )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LastStreamNumberQueued )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LastHResult )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *HResult); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RunningState )( + ISpeechVoiceStatus * This, + /* [retval][out] */ SpeechRunState *State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InputWordPosition )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Position); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InputWordLength )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Length); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InputSentencePosition )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Position); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InputSentenceLength )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Length); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LastBookmark )( + ISpeechVoiceStatus * This, + /* [retval][out] */ BSTR *Bookmark); + + /* [hidden][id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LastBookmarkId )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *BookmarkId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PhonemeId )( + ISpeechVoiceStatus * This, + /* [retval][out] */ short *PhoneId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_VisemeId )( + ISpeechVoiceStatus * This, + /* [retval][out] */ short *VisemeId); + + END_INTERFACE + } ISpeechVoiceStatusVtbl; + + interface ISpeechVoiceStatus + { + CONST_VTBL struct ISpeechVoiceStatusVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechVoiceStatus_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechVoiceStatus_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechVoiceStatus_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechVoiceStatus_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechVoiceStatus_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechVoiceStatus_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechVoiceStatus_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechVoiceStatus_get_CurrentStreamNumber(This,StreamNumber) \ + (This)->lpVtbl -> get_CurrentStreamNumber(This,StreamNumber) + +#define ISpeechVoiceStatus_get_LastStreamNumberQueued(This,StreamNumber) \ + (This)->lpVtbl -> get_LastStreamNumberQueued(This,StreamNumber) + +#define ISpeechVoiceStatus_get_LastHResult(This,HResult) \ + (This)->lpVtbl -> get_LastHResult(This,HResult) + +#define ISpeechVoiceStatus_get_RunningState(This,State) \ + (This)->lpVtbl -> get_RunningState(This,State) + +#define ISpeechVoiceStatus_get_InputWordPosition(This,Position) \ + (This)->lpVtbl -> get_InputWordPosition(This,Position) + +#define ISpeechVoiceStatus_get_InputWordLength(This,Length) \ + (This)->lpVtbl -> get_InputWordLength(This,Length) + +#define ISpeechVoiceStatus_get_InputSentencePosition(This,Position) \ + (This)->lpVtbl -> get_InputSentencePosition(This,Position) + +#define ISpeechVoiceStatus_get_InputSentenceLength(This,Length) \ + (This)->lpVtbl -> get_InputSentenceLength(This,Length) + +#define ISpeechVoiceStatus_get_LastBookmark(This,Bookmark) \ + (This)->lpVtbl -> get_LastBookmark(This,Bookmark) + +#define ISpeechVoiceStatus_get_LastBookmarkId(This,BookmarkId) \ + (This)->lpVtbl -> get_LastBookmarkId(This,BookmarkId) + +#define ISpeechVoiceStatus_get_PhonemeId(This,PhoneId) \ + (This)->lpVtbl -> get_PhonemeId(This,PhoneId) + +#define ISpeechVoiceStatus_get_VisemeId(This,VisemeId) \ + (This)->lpVtbl -> get_VisemeId(This,VisemeId) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_CurrentStreamNumber_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechVoiceStatus_get_CurrentStreamNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_LastStreamNumberQueued_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechVoiceStatus_get_LastStreamNumberQueued_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_LastHResult_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *HResult); + + +void __RPC_STUB ISpeechVoiceStatus_get_LastHResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_RunningState_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ SpeechRunState *State); + + +void __RPC_STUB ISpeechVoiceStatus_get_RunningState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_InputWordPosition_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Position); + + +void __RPC_STUB ISpeechVoiceStatus_get_InputWordPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_InputWordLength_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Length); + + +void __RPC_STUB ISpeechVoiceStatus_get_InputWordLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_InputSentencePosition_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Position); + + +void __RPC_STUB ISpeechVoiceStatus_get_InputSentencePosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_InputSentenceLength_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Length); + + +void __RPC_STUB ISpeechVoiceStatus_get_InputSentenceLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_LastBookmark_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ BSTR *Bookmark); + + +void __RPC_STUB ISpeechVoiceStatus_get_LastBookmark_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_LastBookmarkId_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *BookmarkId); + + +void __RPC_STUB ISpeechVoiceStatus_get_LastBookmarkId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_PhonemeId_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ short *PhoneId); + + +void __RPC_STUB ISpeechVoiceStatus_get_PhonemeId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_VisemeId_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ short *VisemeId); + + +void __RPC_STUB ISpeechVoiceStatus_get_VisemeId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechVoiceStatus_INTERFACE_DEFINED__ */ + + +#ifndef ___ISpeechVoiceEvents_DISPINTERFACE_DEFINED__ +#define ___ISpeechVoiceEvents_DISPINTERFACE_DEFINED__ + +/* dispinterface _ISpeechVoiceEvents */ +/* [uuid] */ + + +EXTERN_C const IID DIID__ISpeechVoiceEvents; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A372ACD1-3BEF-4bbd-8FFB-CB3E2B416AF8") + _ISpeechVoiceEvents : public IDispatch + { + }; + +#else /* C style interface */ + + typedef struct _ISpeechVoiceEventsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + _ISpeechVoiceEvents * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + _ISpeechVoiceEvents * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + _ISpeechVoiceEvents * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + _ISpeechVoiceEvents * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + _ISpeechVoiceEvents * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + _ISpeechVoiceEvents * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + _ISpeechVoiceEvents * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + END_INTERFACE + } _ISpeechVoiceEventsVtbl; + + interface _ISpeechVoiceEvents + { + CONST_VTBL struct _ISpeechVoiceEventsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define _ISpeechVoiceEvents_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define _ISpeechVoiceEvents_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define _ISpeechVoiceEvents_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define _ISpeechVoiceEvents_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define _ISpeechVoiceEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define _ISpeechVoiceEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define _ISpeechVoiceEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + +#endif /* ___ISpeechVoiceEvents_DISPINTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecognizer_INTERFACE_DEFINED__ +#define __ISpeechRecognizer_INTERFACE_DEFINED__ + +/* interface ISpeechRecognizer */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecognizer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2D5F1C0C-BD75-4b08-9478-3B11FEA2586C") + ISpeechRecognizer : public IDispatch + { + public: + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Recognizer( + /* [in] */ ISpeechObjectToken *Recognizer) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Recognizer( + /* [retval][out] */ ISpeechObjectToken **Recognizer) = 0; + + virtual /* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_AllowAudioInputFormatChangesOnNextSet( + /* [in] */ VARIANT_BOOL Allow) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_AllowAudioInputFormatChangesOnNextSet( + /* [retval][out] */ VARIANT_BOOL *Allow) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioInput( + /* [defaultvalue][in] */ ISpeechObjectToken *AudioInput = 0) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioInput( + /* [retval][out] */ ISpeechObjectToken **AudioInput) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioInputStream( + /* [defaultvalue][in] */ ISpeechBaseStream *AudioInputStream = 0) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioInputStream( + /* [retval][out] */ ISpeechBaseStream **AudioInputStream) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_IsShared( + /* [retval][out] */ VARIANT_BOOL *Shared) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_State( + /* [in] */ SpeechRecognizerState State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_State( + /* [retval][out] */ SpeechRecognizerState *State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Status( + /* [retval][out] */ ISpeechRecognizerStatus **Status) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Profile( + /* [defaultvalue][in] */ ISpeechObjectToken *Profile = 0) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Profile( + /* [retval][out] */ ISpeechObjectToken **Profile) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE EmulateRecognition( + /* [in] */ VARIANT TextElements, + /* [defaultvalue][in] */ VARIANT *ElementDisplayAttributes = 0, + /* [defaultvalue][in] */ long LanguageId = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateRecoContext( + /* [retval][out] */ ISpeechRecoContext **NewContext) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetFormat( + /* [in] */ SpeechFormatType Type, + /* [retval][out] */ ISpeechAudioFormat **Format) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE SetPropertyNumber( + /* [in] */ const BSTR Name, + /* [in] */ long Value, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertyNumber( + /* [in] */ const BSTR Name, + /* [out][in] */ long *Value, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE SetPropertyString( + /* [in] */ const BSTR Name, + /* [in] */ const BSTR Value, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertyString( + /* [in] */ const BSTR Name, + /* [out][in] */ BSTR *Value, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetRecognizers( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetAudioInputs( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetProfiles( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecognizerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecognizer * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecognizer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecognizer * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecognizer * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecognizer * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecognizer * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Recognizer )( + ISpeechRecognizer * This, + /* [in] */ ISpeechObjectToken *Recognizer); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Recognizer )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **Recognizer); + + /* [id][helpstring][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AllowAudioInputFormatChangesOnNextSet )( + ISpeechRecognizer * This, + /* [in] */ VARIANT_BOOL Allow); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllowAudioInputFormatChangesOnNextSet )( + ISpeechRecognizer * This, + /* [retval][out] */ VARIANT_BOOL *Allow); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioInput )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechObjectToken *AudioInput); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioInput )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **AudioInput); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioInputStream )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechBaseStream *AudioInputStream); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioInputStream )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechBaseStream **AudioInputStream); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsShared )( + ISpeechRecognizer * This, + /* [retval][out] */ VARIANT_BOOL *Shared); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_State )( + ISpeechRecognizer * This, + /* [in] */ SpeechRecognizerState State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )( + ISpeechRecognizer * This, + /* [retval][out] */ SpeechRecognizerState *State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechRecognizerStatus **Status); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Profile )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechObjectToken *Profile); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Profile )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **Profile); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *EmulateRecognition )( + ISpeechRecognizer * This, + /* [in] */ VARIANT TextElements, + /* [defaultvalue][in] */ VARIANT *ElementDisplayAttributes, + /* [defaultvalue][in] */ long LanguageId); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateRecoContext )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechRecoContext **NewContext); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpeechRecognizer * This, + /* [in] */ SpeechFormatType Type, + /* [retval][out] */ ISpeechAudioFormat **Format); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetPropertyNumber )( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [in] */ long Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertyNumber )( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [out][in] */ long *Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetPropertyString )( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [in] */ const BSTR Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertyString )( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [out][in] */ BSTR *Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpeechRecognizer * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpeechRecognizer * This, + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetRecognizers )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetAudioInputs )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetProfiles )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + END_INTERFACE + } ISpeechRecognizerVtbl; + + interface ISpeechRecognizer + { + CONST_VTBL struct ISpeechRecognizerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecognizer_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecognizer_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecognizer_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecognizer_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecognizer_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecognizer_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecognizer_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecognizer_putref_Recognizer(This,Recognizer) \ + (This)->lpVtbl -> putref_Recognizer(This,Recognizer) + +#define ISpeechRecognizer_get_Recognizer(This,Recognizer) \ + (This)->lpVtbl -> get_Recognizer(This,Recognizer) + +#define ISpeechRecognizer_put_AllowAudioInputFormatChangesOnNextSet(This,Allow) \ + (This)->lpVtbl -> put_AllowAudioInputFormatChangesOnNextSet(This,Allow) + +#define ISpeechRecognizer_get_AllowAudioInputFormatChangesOnNextSet(This,Allow) \ + (This)->lpVtbl -> get_AllowAudioInputFormatChangesOnNextSet(This,Allow) + +#define ISpeechRecognizer_putref_AudioInput(This,AudioInput) \ + (This)->lpVtbl -> putref_AudioInput(This,AudioInput) + +#define ISpeechRecognizer_get_AudioInput(This,AudioInput) \ + (This)->lpVtbl -> get_AudioInput(This,AudioInput) + +#define ISpeechRecognizer_putref_AudioInputStream(This,AudioInputStream) \ + (This)->lpVtbl -> putref_AudioInputStream(This,AudioInputStream) + +#define ISpeechRecognizer_get_AudioInputStream(This,AudioInputStream) \ + (This)->lpVtbl -> get_AudioInputStream(This,AudioInputStream) + +#define ISpeechRecognizer_get_IsShared(This,Shared) \ + (This)->lpVtbl -> get_IsShared(This,Shared) + +#define ISpeechRecognizer_put_State(This,State) \ + (This)->lpVtbl -> put_State(This,State) + +#define ISpeechRecognizer_get_State(This,State) \ + (This)->lpVtbl -> get_State(This,State) + +#define ISpeechRecognizer_get_Status(This,Status) \ + (This)->lpVtbl -> get_Status(This,Status) + +#define ISpeechRecognizer_putref_Profile(This,Profile) \ + (This)->lpVtbl -> putref_Profile(This,Profile) + +#define ISpeechRecognizer_get_Profile(This,Profile) \ + (This)->lpVtbl -> get_Profile(This,Profile) + +#define ISpeechRecognizer_EmulateRecognition(This,TextElements,ElementDisplayAttributes,LanguageId) \ + (This)->lpVtbl -> EmulateRecognition(This,TextElements,ElementDisplayAttributes,LanguageId) + +#define ISpeechRecognizer_CreateRecoContext(This,NewContext) \ + (This)->lpVtbl -> CreateRecoContext(This,NewContext) + +#define ISpeechRecognizer_GetFormat(This,Type,Format) \ + (This)->lpVtbl -> GetFormat(This,Type,Format) + +#define ISpeechRecognizer_SetPropertyNumber(This,Name,Value,Supported) \ + (This)->lpVtbl -> SetPropertyNumber(This,Name,Value,Supported) + +#define ISpeechRecognizer_GetPropertyNumber(This,Name,Value,Supported) \ + (This)->lpVtbl -> GetPropertyNumber(This,Name,Value,Supported) + +#define ISpeechRecognizer_SetPropertyString(This,Name,Value,Supported) \ + (This)->lpVtbl -> SetPropertyString(This,Name,Value,Supported) + +#define ISpeechRecognizer_GetPropertyString(This,Name,Value,Supported) \ + (This)->lpVtbl -> GetPropertyString(This,Name,Value,Supported) + +#define ISpeechRecognizer_IsUISupported(This,TypeOfUI,ExtraData,Supported) \ + (This)->lpVtbl -> IsUISupported(This,TypeOfUI,ExtraData,Supported) + +#define ISpeechRecognizer_DisplayUI(This,hWndParent,Title,TypeOfUI,ExtraData) \ + (This)->lpVtbl -> DisplayUI(This,hWndParent,Title,TypeOfUI,ExtraData) + +#define ISpeechRecognizer_GetRecognizers(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetRecognizers(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#define ISpeechRecognizer_GetAudioInputs(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetAudioInputs(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#define ISpeechRecognizer_GetProfiles(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetProfiles(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_putref_Recognizer_Proxy( + ISpeechRecognizer * This, + /* [in] */ ISpeechObjectToken *Recognizer); + + +void __RPC_STUB ISpeechRecognizer_putref_Recognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_Recognizer_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **Recognizer); + + +void __RPC_STUB ISpeechRecognizer_get_Recognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_put_AllowAudioInputFormatChangesOnNextSet_Proxy( + ISpeechRecognizer * This, + /* [in] */ VARIANT_BOOL Allow); + + +void __RPC_STUB ISpeechRecognizer_put_AllowAudioInputFormatChangesOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_AllowAudioInputFormatChangesOnNextSet_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ VARIANT_BOOL *Allow); + + +void __RPC_STUB ISpeechRecognizer_get_AllowAudioInputFormatChangesOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_putref_AudioInput_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechObjectToken *AudioInput); + + +void __RPC_STUB ISpeechRecognizer_putref_AudioInput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_AudioInput_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **AudioInput); + + +void __RPC_STUB ISpeechRecognizer_get_AudioInput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_putref_AudioInputStream_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechBaseStream *AudioInputStream); + + +void __RPC_STUB ISpeechRecognizer_putref_AudioInputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_AudioInputStream_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechBaseStream **AudioInputStream); + + +void __RPC_STUB ISpeechRecognizer_get_AudioInputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_IsShared_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ VARIANT_BOOL *Shared); + + +void __RPC_STUB ISpeechRecognizer_get_IsShared_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_put_State_Proxy( + ISpeechRecognizer * This, + /* [in] */ SpeechRecognizerState State); + + +void __RPC_STUB ISpeechRecognizer_put_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_State_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ SpeechRecognizerState *State); + + +void __RPC_STUB ISpeechRecognizer_get_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_Status_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechRecognizerStatus **Status); + + +void __RPC_STUB ISpeechRecognizer_get_Status_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_putref_Profile_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechObjectToken *Profile); + + +void __RPC_STUB ISpeechRecognizer_putref_Profile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_Profile_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **Profile); + + +void __RPC_STUB ISpeechRecognizer_get_Profile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_EmulateRecognition_Proxy( + ISpeechRecognizer * This, + /* [in] */ VARIANT TextElements, + /* [defaultvalue][in] */ VARIANT *ElementDisplayAttributes, + /* [defaultvalue][in] */ long LanguageId); + + +void __RPC_STUB ISpeechRecognizer_EmulateRecognition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_CreateRecoContext_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechRecoContext **NewContext); + + +void __RPC_STUB ISpeechRecognizer_CreateRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetFormat_Proxy( + ISpeechRecognizer * This, + /* [in] */ SpeechFormatType Type, + /* [retval][out] */ ISpeechAudioFormat **Format); + + +void __RPC_STUB ISpeechRecognizer_GetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_SetPropertyNumber_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [in] */ long Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_SetPropertyNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetPropertyNumber_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [out][in] */ long *Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_GetPropertyNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_SetPropertyString_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [in] */ const BSTR Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_SetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetPropertyString_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [out][in] */ BSTR *Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_GetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_IsUISupported_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_DisplayUI_Proxy( + ISpeechRecognizer * This, + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData); + + +void __RPC_STUB ISpeechRecognizer_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetRecognizers_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechRecognizer_GetRecognizers_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetAudioInputs_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechRecognizer_GetAudioInputs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetProfiles_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechRecognizer_GetProfiles_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecognizer_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecognizerStatus_INTERFACE_DEFINED__ +#define __ISpeechRecognizerStatus_INTERFACE_DEFINED__ + +/* interface ISpeechRecognizerStatus */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecognizerStatus; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BFF9E781-53EC-484e-BB8A-0E1B5551E35C") + ISpeechRecognizerStatus : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStatus( + /* [retval][out] */ ISpeechAudioStatus **AudioStatus) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentStreamPosition( + /* [retval][out] */ VARIANT *pCurrentStreamPos) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentStreamNumber( + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfActiveRules( + /* [retval][out] */ long *NumberOfActiveRules) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ClsidEngine( + /* [retval][out] */ BSTR *ClsidEngine) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SupportedLanguages( + /* [retval][out] */ VARIANT *SupportedLanguages) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecognizerStatusVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecognizerStatus * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecognizerStatus * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecognizerStatus * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecognizerStatus * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecognizerStatus * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecognizerStatus * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecognizerStatus * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioStatus )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ ISpeechAudioStatus **AudioStatus); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentStreamPosition )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ VARIANT *pCurrentStreamPos); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentStreamNumber )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfActiveRules )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ long *NumberOfActiveRules); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClsidEngine )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ BSTR *ClsidEngine); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportedLanguages )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ VARIANT *SupportedLanguages); + + END_INTERFACE + } ISpeechRecognizerStatusVtbl; + + interface ISpeechRecognizerStatus + { + CONST_VTBL struct ISpeechRecognizerStatusVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecognizerStatus_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecognizerStatus_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecognizerStatus_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecognizerStatus_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecognizerStatus_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecognizerStatus_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecognizerStatus_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecognizerStatus_get_AudioStatus(This,AudioStatus) \ + (This)->lpVtbl -> get_AudioStatus(This,AudioStatus) + +#define ISpeechRecognizerStatus_get_CurrentStreamPosition(This,pCurrentStreamPos) \ + (This)->lpVtbl -> get_CurrentStreamPosition(This,pCurrentStreamPos) + +#define ISpeechRecognizerStatus_get_CurrentStreamNumber(This,StreamNumber) \ + (This)->lpVtbl -> get_CurrentStreamNumber(This,StreamNumber) + +#define ISpeechRecognizerStatus_get_NumberOfActiveRules(This,NumberOfActiveRules) \ + (This)->lpVtbl -> get_NumberOfActiveRules(This,NumberOfActiveRules) + +#define ISpeechRecognizerStatus_get_ClsidEngine(This,ClsidEngine) \ + (This)->lpVtbl -> get_ClsidEngine(This,ClsidEngine) + +#define ISpeechRecognizerStatus_get_SupportedLanguages(This,SupportedLanguages) \ + (This)->lpVtbl -> get_SupportedLanguages(This,SupportedLanguages) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_AudioStatus_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ ISpeechAudioStatus **AudioStatus); + + +void __RPC_STUB ISpeechRecognizerStatus_get_AudioStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_CurrentStreamPosition_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ VARIANT *pCurrentStreamPos); + + +void __RPC_STUB ISpeechRecognizerStatus_get_CurrentStreamPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_CurrentStreamNumber_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechRecognizerStatus_get_CurrentStreamNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_NumberOfActiveRules_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ long *NumberOfActiveRules); + + +void __RPC_STUB ISpeechRecognizerStatus_get_NumberOfActiveRules_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_ClsidEngine_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ BSTR *ClsidEngine); + + +void __RPC_STUB ISpeechRecognizerStatus_get_ClsidEngine_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_SupportedLanguages_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ VARIANT *SupportedLanguages); + + +void __RPC_STUB ISpeechRecognizerStatus_get_SupportedLanguages_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecognizerStatus_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecoContext_INTERFACE_DEFINED__ +#define __ISpeechRecoContext_INTERFACE_DEFINED__ + +/* interface ISpeechRecoContext */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecoContext; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("580AA49D-7E1E-4809-B8E2-57DA806104B8") + ISpeechRecoContext : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Recognizer( + /* [retval][out] */ ISpeechRecognizer **Recognizer) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioInputInterferenceStatus( + /* [retval][out] */ SpeechInterference *Interference) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RequestedUIType( + /* [retval][out] */ BSTR *UIType) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Voice( + /* [in] */ ISpeechVoice *Voice) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Voice( + /* [retval][out] */ ISpeechVoice **Voice) = 0; + + virtual /* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_AllowVoiceFormatMatchingOnNextSet( + /* [in] */ VARIANT_BOOL Allow) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_AllowVoiceFormatMatchingOnNextSet( + /* [retval][out] */ VARIANT_BOOL *pAllow) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_VoicePurgeEvent( + /* [in] */ SpeechRecoEvents EventInterest) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_VoicePurgeEvent( + /* [retval][out] */ SpeechRecoEvents *EventInterest) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_EventInterests( + /* [in] */ SpeechRecoEvents EventInterest) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EventInterests( + /* [retval][out] */ SpeechRecoEvents *EventInterest) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_CmdMaxAlternates( + /* [in] */ long MaxAlternates) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CmdMaxAlternates( + /* [retval][out] */ long *MaxAlternates) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_State( + /* [in] */ SpeechRecoContextState State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_State( + /* [retval][out] */ SpeechRecoContextState *State) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_RetainedAudio( + /* [in] */ SpeechRetainedAudioOptions Option) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedAudio( + /* [retval][out] */ SpeechRetainedAudioOptions *Option) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_RetainedAudioFormat( + /* [in] */ ISpeechAudioFormat *Format) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedAudioFormat( + /* [retval][out] */ ISpeechAudioFormat **Format) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Resume( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateGrammar( + /* [defaultvalue][in] */ VARIANT GrammarId, + /* [retval][out] */ ISpeechRecoGrammar **Grammar) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateResultFromMemory( + /* [in] */ VARIANT *ResultBlock, + /* [retval][out] */ ISpeechRecoResult **Result) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Bookmark( + /* [in] */ SpeechBookmarkOptions Options, + /* [in] */ VARIANT StreamPos, + /* [in] */ VARIANT BookmarkId) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetAdaptationData( + /* [in] */ BSTR AdaptationString) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecoContextVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecoContext * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecoContext * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecoContext * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecoContext * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecoContext * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecoContext * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecoContext * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Recognizer )( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechRecognizer **Recognizer); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioInputInterferenceStatus )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechInterference *Interference); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequestedUIType )( + ISpeechRecoContext * This, + /* [retval][out] */ BSTR *UIType); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Voice )( + ISpeechRecoContext * This, + /* [in] */ ISpeechVoice *Voice); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Voice )( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechVoice **Voice); + + /* [id][helpstring][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AllowVoiceFormatMatchingOnNextSet )( + ISpeechRecoContext * This, + /* [in] */ VARIANT_BOOL Allow); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllowVoiceFormatMatchingOnNextSet )( + ISpeechRecoContext * This, + /* [retval][out] */ VARIANT_BOOL *pAllow); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_VoicePurgeEvent )( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoEvents EventInterest); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_VoicePurgeEvent )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoEvents *EventInterest); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventInterests )( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoEvents EventInterest); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventInterests )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoEvents *EventInterest); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_CmdMaxAlternates )( + ISpeechRecoContext * This, + /* [in] */ long MaxAlternates); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CmdMaxAlternates )( + ISpeechRecoContext * This, + /* [retval][out] */ long *MaxAlternates); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_State )( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoContextState State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoContextState *State); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_RetainedAudio )( + ISpeechRecoContext * This, + /* [in] */ SpeechRetainedAudioOptions Option); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedAudio )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRetainedAudioOptions *Option); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_RetainedAudioFormat )( + ISpeechRecoContext * This, + /* [in] */ ISpeechAudioFormat *Format); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedAudioFormat )( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechAudioFormat **Format); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Pause )( + ISpeechRecoContext * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Resume )( + ISpeechRecoContext * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateGrammar )( + ISpeechRecoContext * This, + /* [defaultvalue][in] */ VARIANT GrammarId, + /* [retval][out] */ ISpeechRecoGrammar **Grammar); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateResultFromMemory )( + ISpeechRecoContext * This, + /* [in] */ VARIANT *ResultBlock, + /* [retval][out] */ ISpeechRecoResult **Result); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Bookmark )( + ISpeechRecoContext * This, + /* [in] */ SpeechBookmarkOptions Options, + /* [in] */ VARIANT StreamPos, + /* [in] */ VARIANT BookmarkId); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetAdaptationData )( + ISpeechRecoContext * This, + /* [in] */ BSTR AdaptationString); + + END_INTERFACE + } ISpeechRecoContextVtbl; + + interface ISpeechRecoContext + { + CONST_VTBL struct ISpeechRecoContextVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecoContext_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecoContext_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecoContext_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecoContext_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecoContext_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecoContext_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecoContext_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecoContext_get_Recognizer(This,Recognizer) \ + (This)->lpVtbl -> get_Recognizer(This,Recognizer) + +#define ISpeechRecoContext_get_AudioInputInterferenceStatus(This,Interference) \ + (This)->lpVtbl -> get_AudioInputInterferenceStatus(This,Interference) + +#define ISpeechRecoContext_get_RequestedUIType(This,UIType) \ + (This)->lpVtbl -> get_RequestedUIType(This,UIType) + +#define ISpeechRecoContext_putref_Voice(This,Voice) \ + (This)->lpVtbl -> putref_Voice(This,Voice) + +#define ISpeechRecoContext_get_Voice(This,Voice) \ + (This)->lpVtbl -> get_Voice(This,Voice) + +#define ISpeechRecoContext_put_AllowVoiceFormatMatchingOnNextSet(This,Allow) \ + (This)->lpVtbl -> put_AllowVoiceFormatMatchingOnNextSet(This,Allow) + +#define ISpeechRecoContext_get_AllowVoiceFormatMatchingOnNextSet(This,pAllow) \ + (This)->lpVtbl -> get_AllowVoiceFormatMatchingOnNextSet(This,pAllow) + +#define ISpeechRecoContext_put_VoicePurgeEvent(This,EventInterest) \ + (This)->lpVtbl -> put_VoicePurgeEvent(This,EventInterest) + +#define ISpeechRecoContext_get_VoicePurgeEvent(This,EventInterest) \ + (This)->lpVtbl -> get_VoicePurgeEvent(This,EventInterest) + +#define ISpeechRecoContext_put_EventInterests(This,EventInterest) \ + (This)->lpVtbl -> put_EventInterests(This,EventInterest) + +#define ISpeechRecoContext_get_EventInterests(This,EventInterest) \ + (This)->lpVtbl -> get_EventInterests(This,EventInterest) + +#define ISpeechRecoContext_put_CmdMaxAlternates(This,MaxAlternates) \ + (This)->lpVtbl -> put_CmdMaxAlternates(This,MaxAlternates) + +#define ISpeechRecoContext_get_CmdMaxAlternates(This,MaxAlternates) \ + (This)->lpVtbl -> get_CmdMaxAlternates(This,MaxAlternates) + +#define ISpeechRecoContext_put_State(This,State) \ + (This)->lpVtbl -> put_State(This,State) + +#define ISpeechRecoContext_get_State(This,State) \ + (This)->lpVtbl -> get_State(This,State) + +#define ISpeechRecoContext_put_RetainedAudio(This,Option) \ + (This)->lpVtbl -> put_RetainedAudio(This,Option) + +#define ISpeechRecoContext_get_RetainedAudio(This,Option) \ + (This)->lpVtbl -> get_RetainedAudio(This,Option) + +#define ISpeechRecoContext_putref_RetainedAudioFormat(This,Format) \ + (This)->lpVtbl -> putref_RetainedAudioFormat(This,Format) + +#define ISpeechRecoContext_get_RetainedAudioFormat(This,Format) \ + (This)->lpVtbl -> get_RetainedAudioFormat(This,Format) + +#define ISpeechRecoContext_Pause(This) \ + (This)->lpVtbl -> Pause(This) + +#define ISpeechRecoContext_Resume(This) \ + (This)->lpVtbl -> Resume(This) + +#define ISpeechRecoContext_CreateGrammar(This,GrammarId,Grammar) \ + (This)->lpVtbl -> CreateGrammar(This,GrammarId,Grammar) + +#define ISpeechRecoContext_CreateResultFromMemory(This,ResultBlock,Result) \ + (This)->lpVtbl -> CreateResultFromMemory(This,ResultBlock,Result) + +#define ISpeechRecoContext_Bookmark(This,Options,StreamPos,BookmarkId) \ + (This)->lpVtbl -> Bookmark(This,Options,StreamPos,BookmarkId) + +#define ISpeechRecoContext_SetAdaptationData(This,AdaptationString) \ + (This)->lpVtbl -> SetAdaptationData(This,AdaptationString) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_Recognizer_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechRecognizer **Recognizer); + + +void __RPC_STUB ISpeechRecoContext_get_Recognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_AudioInputInterferenceStatus_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechInterference *Interference); + + +void __RPC_STUB ISpeechRecoContext_get_AudioInputInterferenceStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_RequestedUIType_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ BSTR *UIType); + + +void __RPC_STUB ISpeechRecoContext_get_RequestedUIType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_putref_Voice_Proxy( + ISpeechRecoContext * This, + /* [in] */ ISpeechVoice *Voice); + + +void __RPC_STUB ISpeechRecoContext_putref_Voice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_Voice_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechVoice **Voice); + + +void __RPC_STUB ISpeechRecoContext_get_Voice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_AllowVoiceFormatMatchingOnNextSet_Proxy( + ISpeechRecoContext * This, + /* [in] */ VARIANT_BOOL Allow); + + +void __RPC_STUB ISpeechRecoContext_put_AllowVoiceFormatMatchingOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_AllowVoiceFormatMatchingOnNextSet_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ VARIANT_BOOL *pAllow); + + +void __RPC_STUB ISpeechRecoContext_get_AllowVoiceFormatMatchingOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_VoicePurgeEvent_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoEvents EventInterest); + + +void __RPC_STUB ISpeechRecoContext_put_VoicePurgeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_VoicePurgeEvent_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoEvents *EventInterest); + + +void __RPC_STUB ISpeechRecoContext_get_VoicePurgeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_EventInterests_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoEvents EventInterest); + + +void __RPC_STUB ISpeechRecoContext_put_EventInterests_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_EventInterests_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoEvents *EventInterest); + + +void __RPC_STUB ISpeechRecoContext_get_EventInterests_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_CmdMaxAlternates_Proxy( + ISpeechRecoContext * This, + /* [in] */ long MaxAlternates); + + +void __RPC_STUB ISpeechRecoContext_put_CmdMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_CmdMaxAlternates_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ long *MaxAlternates); + + +void __RPC_STUB ISpeechRecoContext_get_CmdMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_State_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoContextState State); + + +void __RPC_STUB ISpeechRecoContext_put_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_State_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoContextState *State); + + +void __RPC_STUB ISpeechRecoContext_get_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_RetainedAudio_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechRetainedAudioOptions Option); + + +void __RPC_STUB ISpeechRecoContext_put_RetainedAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_RetainedAudio_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRetainedAudioOptions *Option); + + +void __RPC_STUB ISpeechRecoContext_get_RetainedAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_putref_RetainedAudioFormat_Proxy( + ISpeechRecoContext * This, + /* [in] */ ISpeechAudioFormat *Format); + + +void __RPC_STUB ISpeechRecoContext_putref_RetainedAudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_RetainedAudioFormat_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechAudioFormat **Format); + + +void __RPC_STUB ISpeechRecoContext_get_RetainedAudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_Pause_Proxy( + ISpeechRecoContext * This); + + +void __RPC_STUB ISpeechRecoContext_Pause_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_Resume_Proxy( + ISpeechRecoContext * This); + + +void __RPC_STUB ISpeechRecoContext_Resume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_CreateGrammar_Proxy( + ISpeechRecoContext * This, + /* [defaultvalue][in] */ VARIANT GrammarId, + /* [retval][out] */ ISpeechRecoGrammar **Grammar); + + +void __RPC_STUB ISpeechRecoContext_CreateGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_CreateResultFromMemory_Proxy( + ISpeechRecoContext * This, + /* [in] */ VARIANT *ResultBlock, + /* [retval][out] */ ISpeechRecoResult **Result); + + +void __RPC_STUB ISpeechRecoContext_CreateResultFromMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_Bookmark_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechBookmarkOptions Options, + /* [in] */ VARIANT StreamPos, + /* [in] */ VARIANT BookmarkId); + + +void __RPC_STUB ISpeechRecoContext_Bookmark_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_SetAdaptationData_Proxy( + ISpeechRecoContext * This, + /* [in] */ BSTR AdaptationString); + + +void __RPC_STUB ISpeechRecoContext_SetAdaptationData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecoContext_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecoGrammar_INTERFACE_DEFINED__ +#define __ISpeechRecoGrammar_INTERFACE_DEFINED__ + +/* interface ISpeechRecoGrammar */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecoGrammar; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B6D6F79F-2158-4e50-B5BC-9A9CCD852A09") + ISpeechRecoGrammar : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ VARIANT *Id) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RecoContext( + /* [retval][out] */ ISpeechRecoContext **RecoContext) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_State( + /* [in] */ SpeechGrammarState State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_State( + /* [retval][out] */ SpeechGrammarState *State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rules( + /* [retval][out] */ ISpeechGrammarRules **Rules) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Reset( + /* [defaultvalue][in] */ SpeechLanguageId NewLanguage = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromFile( + /* [in] */ const BSTR FileName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromObject( + /* [in] */ const BSTR ClassId, + /* [in] */ const BSTR GrammarName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromResource( + /* [in] */ long hModule, + /* [in] */ VARIANT ResourceName, + /* [in] */ VARIANT ResourceType, + /* [in] */ SpeechLanguageId LanguageId, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromMemory( + /* [in] */ VARIANT GrammarData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromProprietaryGrammar( + /* [in] */ const BSTR ProprietaryGuid, + /* [in] */ const BSTR ProprietaryString, + /* [in] */ VARIANT ProprietaryData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdSetRuleState( + /* [in] */ const BSTR Name, + /* [in] */ SpeechRuleState State) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdSetRuleIdState( + /* [in] */ long RuleId, + /* [in] */ SpeechRuleState State) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DictationLoad( + /* [defaultvalue][in] */ const BSTR TopicName = L"", + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DictationUnload( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DictationSetState( + /* [in] */ SpeechRuleState State) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetWordSequenceData( + /* [in] */ const BSTR Text, + /* [in] */ long TextLength, + /* [in] */ ISpeechTextSelectionInformation *Info) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetTextSelection( + /* [in] */ ISpeechTextSelectionInformation *Info) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE IsPronounceable( + /* [in] */ const BSTR Word, + /* [retval][out] */ SpeechWordPronounceable *WordPronounceable) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecoGrammarVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecoGrammar * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecoGrammar * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecoGrammar * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecoGrammar * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecoGrammar * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecoGrammar * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecoGrammar * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechRecoGrammar * This, + /* [retval][out] */ VARIANT *Id); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RecoContext )( + ISpeechRecoGrammar * This, + /* [retval][out] */ ISpeechRecoContext **RecoContext); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_State )( + ISpeechRecoGrammar * This, + /* [in] */ SpeechGrammarState State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )( + ISpeechRecoGrammar * This, + /* [retval][out] */ SpeechGrammarState *State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rules )( + ISpeechRecoGrammar * This, + /* [retval][out] */ ISpeechGrammarRules **Rules); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( + ISpeechRecoGrammar * This, + /* [defaultvalue][in] */ SpeechLanguageId NewLanguage); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromFile )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR FileName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromObject )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR ClassId, + /* [in] */ const BSTR GrammarName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromResource )( + ISpeechRecoGrammar * This, + /* [in] */ long hModule, + /* [in] */ VARIANT ResourceName, + /* [in] */ VARIANT ResourceType, + /* [in] */ SpeechLanguageId LanguageId, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromMemory )( + ISpeechRecoGrammar * This, + /* [in] */ VARIANT GrammarData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromProprietaryGrammar )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR ProprietaryGuid, + /* [in] */ const BSTR ProprietaryString, + /* [in] */ VARIANT ProprietaryData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdSetRuleState )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Name, + /* [in] */ SpeechRuleState State); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdSetRuleIdState )( + ISpeechRecoGrammar * This, + /* [in] */ long RuleId, + /* [in] */ SpeechRuleState State); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DictationLoad )( + ISpeechRecoGrammar * This, + /* [defaultvalue][in] */ const BSTR TopicName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DictationUnload )( + ISpeechRecoGrammar * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DictationSetState )( + ISpeechRecoGrammar * This, + /* [in] */ SpeechRuleState State); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetWordSequenceData )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Text, + /* [in] */ long TextLength, + /* [in] */ ISpeechTextSelectionInformation *Info); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetTextSelection )( + ISpeechRecoGrammar * This, + /* [in] */ ISpeechTextSelectionInformation *Info); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsPronounceable )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Word, + /* [retval][out] */ SpeechWordPronounceable *WordPronounceable); + + END_INTERFACE + } ISpeechRecoGrammarVtbl; + + interface ISpeechRecoGrammar + { + CONST_VTBL struct ISpeechRecoGrammarVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecoGrammar_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecoGrammar_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecoGrammar_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecoGrammar_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecoGrammar_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecoGrammar_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecoGrammar_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecoGrammar_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechRecoGrammar_get_RecoContext(This,RecoContext) \ + (This)->lpVtbl -> get_RecoContext(This,RecoContext) + +#define ISpeechRecoGrammar_put_State(This,State) \ + (This)->lpVtbl -> put_State(This,State) + +#define ISpeechRecoGrammar_get_State(This,State) \ + (This)->lpVtbl -> get_State(This,State) + +#define ISpeechRecoGrammar_get_Rules(This,Rules) \ + (This)->lpVtbl -> get_Rules(This,Rules) + +#define ISpeechRecoGrammar_Reset(This,NewLanguage) \ + (This)->lpVtbl -> Reset(This,NewLanguage) + +#define ISpeechRecoGrammar_CmdLoadFromFile(This,FileName,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromFile(This,FileName,LoadOption) + +#define ISpeechRecoGrammar_CmdLoadFromObject(This,ClassId,GrammarName,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromObject(This,ClassId,GrammarName,LoadOption) + +#define ISpeechRecoGrammar_CmdLoadFromResource(This,hModule,ResourceName,ResourceType,LanguageId,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromResource(This,hModule,ResourceName,ResourceType,LanguageId,LoadOption) + +#define ISpeechRecoGrammar_CmdLoadFromMemory(This,GrammarData,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromMemory(This,GrammarData,LoadOption) + +#define ISpeechRecoGrammar_CmdLoadFromProprietaryGrammar(This,ProprietaryGuid,ProprietaryString,ProprietaryData,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromProprietaryGrammar(This,ProprietaryGuid,ProprietaryString,ProprietaryData,LoadOption) + +#define ISpeechRecoGrammar_CmdSetRuleState(This,Name,State) \ + (This)->lpVtbl -> CmdSetRuleState(This,Name,State) + +#define ISpeechRecoGrammar_CmdSetRuleIdState(This,RuleId,State) \ + (This)->lpVtbl -> CmdSetRuleIdState(This,RuleId,State) + +#define ISpeechRecoGrammar_DictationLoad(This,TopicName,LoadOption) \ + (This)->lpVtbl -> DictationLoad(This,TopicName,LoadOption) + +#define ISpeechRecoGrammar_DictationUnload(This) \ + (This)->lpVtbl -> DictationUnload(This) + +#define ISpeechRecoGrammar_DictationSetState(This,State) \ + (This)->lpVtbl -> DictationSetState(This,State) + +#define ISpeechRecoGrammar_SetWordSequenceData(This,Text,TextLength,Info) \ + (This)->lpVtbl -> SetWordSequenceData(This,Text,TextLength,Info) + +#define ISpeechRecoGrammar_SetTextSelection(This,Info) \ + (This)->lpVtbl -> SetTextSelection(This,Info) + +#define ISpeechRecoGrammar_IsPronounceable(This,Word,WordPronounceable) \ + (This)->lpVtbl -> IsPronounceable(This,Word,WordPronounceable) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_get_Id_Proxy( + ISpeechRecoGrammar * This, + /* [retval][out] */ VARIANT *Id); + + +void __RPC_STUB ISpeechRecoGrammar_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_get_RecoContext_Proxy( + ISpeechRecoGrammar * This, + /* [retval][out] */ ISpeechRecoContext **RecoContext); + + +void __RPC_STUB ISpeechRecoGrammar_get_RecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_put_State_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ SpeechGrammarState State); + + +void __RPC_STUB ISpeechRecoGrammar_put_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_get_State_Proxy( + ISpeechRecoGrammar * This, + /* [retval][out] */ SpeechGrammarState *State); + + +void __RPC_STUB ISpeechRecoGrammar_get_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_get_Rules_Proxy( + ISpeechRecoGrammar * This, + /* [retval][out] */ ISpeechGrammarRules **Rules); + + +void __RPC_STUB ISpeechRecoGrammar_get_Rules_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_Reset_Proxy( + ISpeechRecoGrammar * This, + /* [defaultvalue][in] */ SpeechLanguageId NewLanguage); + + +void __RPC_STUB ISpeechRecoGrammar_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromFile_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR FileName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromFile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromObject_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR ClassId, + /* [in] */ const BSTR GrammarName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromResource_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ long hModule, + /* [in] */ VARIANT ResourceName, + /* [in] */ VARIANT ResourceType, + /* [in] */ SpeechLanguageId LanguageId, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromMemory_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ VARIANT GrammarData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromProprietaryGrammar_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR ProprietaryGuid, + /* [in] */ const BSTR ProprietaryString, + /* [in] */ VARIANT ProprietaryData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromProprietaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdSetRuleState_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Name, + /* [in] */ SpeechRuleState State); + + +void __RPC_STUB ISpeechRecoGrammar_CmdSetRuleState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdSetRuleIdState_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ long RuleId, + /* [in] */ SpeechRuleState State); + + +void __RPC_STUB ISpeechRecoGrammar_CmdSetRuleIdState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_DictationLoad_Proxy( + ISpeechRecoGrammar * This, + /* [defaultvalue][in] */ const BSTR TopicName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_DictationLoad_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_DictationUnload_Proxy( + ISpeechRecoGrammar * This); + + +void __RPC_STUB ISpeechRecoGrammar_DictationUnload_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_DictationSetState_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ SpeechRuleState State); + + +void __RPC_STUB ISpeechRecoGrammar_DictationSetState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_SetWordSequenceData_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Text, + /* [in] */ long TextLength, + /* [in] */ ISpeechTextSelectionInformation *Info); + + +void __RPC_STUB ISpeechRecoGrammar_SetWordSequenceData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_SetTextSelection_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ ISpeechTextSelectionInformation *Info); + + +void __RPC_STUB ISpeechRecoGrammar_SetTextSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_IsPronounceable_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Word, + /* [retval][out] */ SpeechWordPronounceable *WordPronounceable); + + +void __RPC_STUB ISpeechRecoGrammar_IsPronounceable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecoGrammar_INTERFACE_DEFINED__ */ + + +#ifndef ___ISpeechRecoContextEvents_DISPINTERFACE_DEFINED__ +#define ___ISpeechRecoContextEvents_DISPINTERFACE_DEFINED__ + +/* dispinterface _ISpeechRecoContextEvents */ +/* [uuid] */ + + +EXTERN_C const IID DIID__ISpeechRecoContextEvents; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7B8FCB42-0E9D-4f00-A048-7B04D6179D3D") + _ISpeechRecoContextEvents : public IDispatch + { + }; + +#else /* C style interface */ + + typedef struct _ISpeechRecoContextEventsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + _ISpeechRecoContextEvents * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + _ISpeechRecoContextEvents * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + _ISpeechRecoContextEvents * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + _ISpeechRecoContextEvents * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + _ISpeechRecoContextEvents * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + _ISpeechRecoContextEvents * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + _ISpeechRecoContextEvents * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + END_INTERFACE + } _ISpeechRecoContextEventsVtbl; + + interface _ISpeechRecoContextEvents + { + CONST_VTBL struct _ISpeechRecoContextEventsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define _ISpeechRecoContextEvents_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define _ISpeechRecoContextEvents_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define _ISpeechRecoContextEvents_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define _ISpeechRecoContextEvents_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define _ISpeechRecoContextEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define _ISpeechRecoContextEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define _ISpeechRecoContextEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + +#endif /* ___ISpeechRecoContextEvents_DISPINTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRule_INTERFACE_DEFINED__ +#define __ISpeechGrammarRule_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRule */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRule; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AFE719CF-5DD1-44f2-999C-7A399F1CFCCC") + ISpeechGrammarRule : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Attributes( + /* [retval][out] */ SpeechRuleAttributes *Attributes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InitialState( + /* [retval][out] */ ISpeechGrammarRuleState **State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR *Name) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ long *Id) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Clear( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddResource( + /* [in] */ const BSTR ResourceName, + /* [in] */ const BSTR ResourceValue) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddState( + /* [retval][out] */ ISpeechGrammarRuleState **State) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRuleVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRule * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRule * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRule * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRule * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRule * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRule * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRule * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Attributes )( + ISpeechGrammarRule * This, + /* [retval][out] */ SpeechRuleAttributes *Attributes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InitialState )( + ISpeechGrammarRule * This, + /* [retval][out] */ ISpeechGrammarRuleState **State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( + ISpeechGrammarRule * This, + /* [retval][out] */ BSTR *Name); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechGrammarRule * This, + /* [retval][out] */ long *Id); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clear )( + ISpeechGrammarRule * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddResource )( + ISpeechGrammarRule * This, + /* [in] */ const BSTR ResourceName, + /* [in] */ const BSTR ResourceValue); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddState )( + ISpeechGrammarRule * This, + /* [retval][out] */ ISpeechGrammarRuleState **State); + + END_INTERFACE + } ISpeechGrammarRuleVtbl; + + interface ISpeechGrammarRule + { + CONST_VTBL struct ISpeechGrammarRuleVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRule_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRule_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRule_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRule_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRule_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRule_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRule_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRule_get_Attributes(This,Attributes) \ + (This)->lpVtbl -> get_Attributes(This,Attributes) + +#define ISpeechGrammarRule_get_InitialState(This,State) \ + (This)->lpVtbl -> get_InitialState(This,State) + +#define ISpeechGrammarRule_get_Name(This,Name) \ + (This)->lpVtbl -> get_Name(This,Name) + +#define ISpeechGrammarRule_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechGrammarRule_Clear(This) \ + (This)->lpVtbl -> Clear(This) + +#define ISpeechGrammarRule_AddResource(This,ResourceName,ResourceValue) \ + (This)->lpVtbl -> AddResource(This,ResourceName,ResourceValue) + +#define ISpeechGrammarRule_AddState(This,State) \ + (This)->lpVtbl -> AddState(This,State) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_get_Attributes_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ SpeechRuleAttributes *Attributes); + + +void __RPC_STUB ISpeechGrammarRule_get_Attributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_get_InitialState_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ ISpeechGrammarRuleState **State); + + +void __RPC_STUB ISpeechGrammarRule_get_InitialState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_get_Name_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ BSTR *Name); + + +void __RPC_STUB ISpeechGrammarRule_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_get_Id_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ long *Id); + + +void __RPC_STUB ISpeechGrammarRule_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_Clear_Proxy( + ISpeechGrammarRule * This); + + +void __RPC_STUB ISpeechGrammarRule_Clear_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_AddResource_Proxy( + ISpeechGrammarRule * This, + /* [in] */ const BSTR ResourceName, + /* [in] */ const BSTR ResourceValue); + + +void __RPC_STUB ISpeechGrammarRule_AddResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_AddState_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ ISpeechGrammarRuleState **State); + + +void __RPC_STUB ISpeechGrammarRule_AddState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRule_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRules_INTERFACE_DEFINED__ +#define __ISpeechGrammarRules_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRules */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRules; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6FFA3B44-FC2D-40d1-8AFC-32911C7F1AD1") + ISpeechGrammarRules : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE FindRule( + /* [in] */ VARIANT RuleNameOrId, + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Dynamic( + /* [retval][out] */ VARIANT_BOOL *Dynamic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Add( + /* [in] */ BSTR RuleName, + /* [in] */ SpeechRuleAttributes Attributes, + /* [defaultvalue][in] */ long RuleId, + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Commit( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CommitAndSave( + /* [out] */ BSTR *ErrorText, + /* [retval][out] */ VARIANT *SaveStream) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRulesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRules * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRules * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRules * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRules * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRules * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRules * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRules * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechGrammarRules * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *FindRule )( + ISpeechGrammarRules * This, + /* [in] */ VARIANT RuleNameOrId, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechGrammarRules * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [restricted][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechGrammarRules * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Dynamic )( + ISpeechGrammarRules * This, + /* [retval][out] */ VARIANT_BOOL *Dynamic); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Add )( + ISpeechGrammarRules * This, + /* [in] */ BSTR RuleName, + /* [in] */ SpeechRuleAttributes Attributes, + /* [defaultvalue][in] */ long RuleId, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpeechGrammarRules * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CommitAndSave )( + ISpeechGrammarRules * This, + /* [out] */ BSTR *ErrorText, + /* [retval][out] */ VARIANT *SaveStream); + + END_INTERFACE + } ISpeechGrammarRulesVtbl; + + interface ISpeechGrammarRules + { + CONST_VTBL struct ISpeechGrammarRulesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRules_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRules_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRules_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRules_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRules_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRules_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRules_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRules_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechGrammarRules_FindRule(This,RuleNameOrId,Rule) \ + (This)->lpVtbl -> FindRule(This,RuleNameOrId,Rule) + +#define ISpeechGrammarRules_Item(This,Index,Rule) \ + (This)->lpVtbl -> Item(This,Index,Rule) + +#define ISpeechGrammarRules_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#define ISpeechGrammarRules_get_Dynamic(This,Dynamic) \ + (This)->lpVtbl -> get_Dynamic(This,Dynamic) + +#define ISpeechGrammarRules_Add(This,RuleName,Attributes,RuleId,Rule) \ + (This)->lpVtbl -> Add(This,RuleName,Attributes,RuleId,Rule) + +#define ISpeechGrammarRules_Commit(This) \ + (This)->lpVtbl -> Commit(This) + +#define ISpeechGrammarRules_CommitAndSave(This,ErrorText,SaveStream) \ + (This)->lpVtbl -> CommitAndSave(This,ErrorText,SaveStream) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_get_Count_Proxy( + ISpeechGrammarRules * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechGrammarRules_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_FindRule_Proxy( + ISpeechGrammarRules * This, + /* [in] */ VARIANT RuleNameOrId, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRules_FindRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_Item_Proxy( + ISpeechGrammarRules * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRules_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_get__NewEnum_Proxy( + ISpeechGrammarRules * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechGrammarRules_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_get_Dynamic_Proxy( + ISpeechGrammarRules * This, + /* [retval][out] */ VARIANT_BOOL *Dynamic); + + +void __RPC_STUB ISpeechGrammarRules_get_Dynamic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_Add_Proxy( + ISpeechGrammarRules * This, + /* [in] */ BSTR RuleName, + /* [in] */ SpeechRuleAttributes Attributes, + /* [defaultvalue][in] */ long RuleId, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRules_Add_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_Commit_Proxy( + ISpeechGrammarRules * This); + + +void __RPC_STUB ISpeechGrammarRules_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_CommitAndSave_Proxy( + ISpeechGrammarRules * This, + /* [out] */ BSTR *ErrorText, + /* [retval][out] */ VARIANT *SaveStream); + + +void __RPC_STUB ISpeechGrammarRules_CommitAndSave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRules_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleState_INTERFACE_DEFINED__ +#define __ISpeechGrammarRuleState_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRuleState */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRuleState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D4286F2C-EE67-45ae-B928-28D695362EDA") + ISpeechGrammarRuleState : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rule( + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Transitions( + /* [retval][out] */ ISpeechGrammarRuleStateTransitions **Transitions) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddWordTransition( + /* [in] */ ISpeechGrammarRuleState *DestState, + /* [in] */ const BSTR Words, + /* [defaultvalue][in] */ const BSTR Separators = L" ", + /* [defaultvalue][in] */ SpeechGrammarWordType Type = SGLexical, + /* [defaultvalue][in] */ const BSTR PropertyName = L"", + /* [defaultvalue][in] */ long PropertyId = 0, + /* [defaultvalue][in] */ VARIANT *PropertyValue = 0, + /* [defaultvalue][in] */ float Weight = 1) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddRuleTransition( + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ ISpeechGrammarRule *Rule, + /* [defaultvalue][in] */ const BSTR PropertyName = L"", + /* [defaultvalue][in] */ long PropertyId = 0, + /* [defaultvalue][in] */ VARIANT *PropertyValue = 0, + /* [defaultvalue][in] */ float Weight = 1) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddSpecialTransition( + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ SpeechSpecialTransitionType Type, + /* [defaultvalue][in] */ const BSTR PropertyName = L"", + /* [defaultvalue][in] */ long PropertyId = 0, + /* [defaultvalue][in] */ VARIANT *PropertyValue = 0, + /* [defaultvalue][in] */ float Weight = 1) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRuleStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRuleState * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRuleState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRuleState * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRuleState * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRuleState * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRuleState * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRuleState * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rule )( + ISpeechGrammarRuleState * This, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Transitions )( + ISpeechGrammarRuleState * This, + /* [retval][out] */ ISpeechGrammarRuleStateTransitions **Transitions); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddWordTransition )( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestState, + /* [in] */ const BSTR Words, + /* [defaultvalue][in] */ const BSTR Separators, + /* [defaultvalue][in] */ SpeechGrammarWordType Type, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddRuleTransition )( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ ISpeechGrammarRule *Rule, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddSpecialTransition )( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ SpeechSpecialTransitionType Type, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + END_INTERFACE + } ISpeechGrammarRuleStateVtbl; + + interface ISpeechGrammarRuleState + { + CONST_VTBL struct ISpeechGrammarRuleStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRuleState_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRuleState_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRuleState_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRuleState_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRuleState_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRuleState_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRuleState_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRuleState_get_Rule(This,Rule) \ + (This)->lpVtbl -> get_Rule(This,Rule) + +#define ISpeechGrammarRuleState_get_Transitions(This,Transitions) \ + (This)->lpVtbl -> get_Transitions(This,Transitions) + +#define ISpeechGrammarRuleState_AddWordTransition(This,DestState,Words,Separators,Type,PropertyName,PropertyId,PropertyValue,Weight) \ + (This)->lpVtbl -> AddWordTransition(This,DestState,Words,Separators,Type,PropertyName,PropertyId,PropertyValue,Weight) + +#define ISpeechGrammarRuleState_AddRuleTransition(This,DestinationState,Rule,PropertyName,PropertyId,PropertyValue,Weight) \ + (This)->lpVtbl -> AddRuleTransition(This,DestinationState,Rule,PropertyName,PropertyId,PropertyValue,Weight) + +#define ISpeechGrammarRuleState_AddSpecialTransition(This,DestinationState,Type,PropertyName,PropertyId,PropertyValue,Weight) \ + (This)->lpVtbl -> AddSpecialTransition(This,DestinationState,Type,PropertyName,PropertyId,PropertyValue,Weight) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_get_Rule_Proxy( + ISpeechGrammarRuleState * This, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRuleState_get_Rule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_get_Transitions_Proxy( + ISpeechGrammarRuleState * This, + /* [retval][out] */ ISpeechGrammarRuleStateTransitions **Transitions); + + +void __RPC_STUB ISpeechGrammarRuleState_get_Transitions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_AddWordTransition_Proxy( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestState, + /* [in] */ const BSTR Words, + /* [defaultvalue][in] */ const BSTR Separators, + /* [defaultvalue][in] */ SpeechGrammarWordType Type, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + +void __RPC_STUB ISpeechGrammarRuleState_AddWordTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_AddRuleTransition_Proxy( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ ISpeechGrammarRule *Rule, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + +void __RPC_STUB ISpeechGrammarRuleState_AddRuleTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_AddSpecialTransition_Proxy( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ SpeechSpecialTransitionType Type, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + +void __RPC_STUB ISpeechGrammarRuleState_AddSpecialTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRuleState_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleStateTransition_INTERFACE_DEFINED__ +#define __ISpeechGrammarRuleStateTransition_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRuleStateTransition */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRuleStateTransition; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CAFD1DB1-41D1-4a06-9863-E2E81DA17A9A") + ISpeechGrammarRuleStateTransition : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ SpeechGrammarRuleStateTransitionType *Type) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Text( + /* [retval][out] */ BSTR *Text) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rule( + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Weight( + /* [retval][out] */ VARIANT *Weight) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PropertyName( + /* [retval][out] */ BSTR *PropertyName) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PropertyId( + /* [retval][out] */ long *PropertyId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PropertyValue( + /* [retval][out] */ VARIANT *PropertyValue) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NextState( + /* [retval][out] */ ISpeechGrammarRuleState **NextState) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRuleStateTransitionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRuleStateTransition * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRuleStateTransition * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRuleStateTransition * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRuleStateTransition * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRuleStateTransition * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRuleStateTransition * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRuleStateTransition * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Type )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ SpeechGrammarRuleStateTransitionType *Type); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Text )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ BSTR *Text); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rule )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Weight )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ VARIANT *Weight); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PropertyName )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ BSTR *PropertyName); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PropertyId )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ long *PropertyId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PropertyValue )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ VARIANT *PropertyValue); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NextState )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ ISpeechGrammarRuleState **NextState); + + END_INTERFACE + } ISpeechGrammarRuleStateTransitionVtbl; + + interface ISpeechGrammarRuleStateTransition + { + CONST_VTBL struct ISpeechGrammarRuleStateTransitionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRuleStateTransition_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRuleStateTransition_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRuleStateTransition_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRuleStateTransition_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRuleStateTransition_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRuleStateTransition_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRuleStateTransition_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRuleStateTransition_get_Type(This,Type) \ + (This)->lpVtbl -> get_Type(This,Type) + +#define ISpeechGrammarRuleStateTransition_get_Text(This,Text) \ + (This)->lpVtbl -> get_Text(This,Text) + +#define ISpeechGrammarRuleStateTransition_get_Rule(This,Rule) \ + (This)->lpVtbl -> get_Rule(This,Rule) + +#define ISpeechGrammarRuleStateTransition_get_Weight(This,Weight) \ + (This)->lpVtbl -> get_Weight(This,Weight) + +#define ISpeechGrammarRuleStateTransition_get_PropertyName(This,PropertyName) \ + (This)->lpVtbl -> get_PropertyName(This,PropertyName) + +#define ISpeechGrammarRuleStateTransition_get_PropertyId(This,PropertyId) \ + (This)->lpVtbl -> get_PropertyId(This,PropertyId) + +#define ISpeechGrammarRuleStateTransition_get_PropertyValue(This,PropertyValue) \ + (This)->lpVtbl -> get_PropertyValue(This,PropertyValue) + +#define ISpeechGrammarRuleStateTransition_get_NextState(This,NextState) \ + (This)->lpVtbl -> get_NextState(This,NextState) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_Type_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ SpeechGrammarRuleStateTransitionType *Type); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_Text_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ BSTR *Text); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_Text_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_Rule_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_Rule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_Weight_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ VARIANT *Weight); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_Weight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_PropertyName_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ BSTR *PropertyName); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_PropertyName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_PropertyId_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ long *PropertyId); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_PropertyId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_PropertyValue_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ VARIANT *PropertyValue); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_PropertyValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_NextState_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ ISpeechGrammarRuleState **NextState); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_NextState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRuleStateTransition_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleStateTransitions_INTERFACE_DEFINED__ +#define __ISpeechGrammarRuleStateTransitions_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRuleStateTransitions */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRuleStateTransitions; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EABCE657-75BC-44a2-AA7F-C56476742963") + ISpeechGrammarRuleStateTransitions : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRuleStateTransition **Transition) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRuleStateTransitionsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRuleStateTransitions * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRuleStateTransitions * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRuleStateTransitions * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechGrammarRuleStateTransitions * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRuleStateTransition **Transition); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechGrammarRuleStateTransitions * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechGrammarRuleStateTransitionsVtbl; + + interface ISpeechGrammarRuleStateTransitions + { + CONST_VTBL struct ISpeechGrammarRuleStateTransitionsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRuleStateTransitions_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRuleStateTransitions_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRuleStateTransitions_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRuleStateTransitions_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRuleStateTransitions_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRuleStateTransitions_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRuleStateTransitions_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRuleStateTransitions_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechGrammarRuleStateTransitions_Item(This,Index,Transition) \ + (This)->lpVtbl -> Item(This,Index,Transition) + +#define ISpeechGrammarRuleStateTransitions_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransitions_get_Count_Proxy( + ISpeechGrammarRuleStateTransitions * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechGrammarRuleStateTransitions_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransitions_Item_Proxy( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRuleStateTransition **Transition); + + +void __RPC_STUB ISpeechGrammarRuleStateTransitions_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransitions_get__NewEnum_Proxy( + ISpeechGrammarRuleStateTransitions * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechGrammarRuleStateTransitions_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRuleStateTransitions_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechTextSelectionInformation_INTERFACE_DEFINED__ +#define __ISpeechTextSelectionInformation_INTERFACE_DEFINED__ + +/* interface ISpeechTextSelectionInformation */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechTextSelectionInformation; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3B9C7E7A-6EEE-4DED-9092-11657279ADBE") + ISpeechTextSelectionInformation : public IDispatch + { + public: + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ActiveOffset( + /* [in] */ long ActiveOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ActiveOffset( + /* [retval][out] */ long *ActiveOffset) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ActiveLength( + /* [in] */ long ActiveLength) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ActiveLength( + /* [retval][out] */ long *ActiveLength) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionOffset( + /* [in] */ long SelectionOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionOffset( + /* [retval][out] */ long *SelectionOffset) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionLength( + /* [in] */ long SelectionLength) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionLength( + /* [retval][out] */ long *SelectionLength) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechTextSelectionInformationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechTextSelectionInformation * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechTextSelectionInformation * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechTextSelectionInformation * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechTextSelectionInformation * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechTextSelectionInformation * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechTextSelectionInformation * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechTextSelectionInformation * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ActiveOffset )( + ISpeechTextSelectionInformation * This, + /* [in] */ long ActiveOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ActiveOffset )( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *ActiveOffset); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ActiveLength )( + ISpeechTextSelectionInformation * This, + /* [in] */ long ActiveLength); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ActiveLength )( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *ActiveLength); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SelectionOffset )( + ISpeechTextSelectionInformation * This, + /* [in] */ long SelectionOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SelectionOffset )( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *SelectionOffset); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SelectionLength )( + ISpeechTextSelectionInformation * This, + /* [in] */ long SelectionLength); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SelectionLength )( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *SelectionLength); + + END_INTERFACE + } ISpeechTextSelectionInformationVtbl; + + interface ISpeechTextSelectionInformation + { + CONST_VTBL struct ISpeechTextSelectionInformationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechTextSelectionInformation_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechTextSelectionInformation_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechTextSelectionInformation_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechTextSelectionInformation_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechTextSelectionInformation_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechTextSelectionInformation_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechTextSelectionInformation_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechTextSelectionInformation_put_ActiveOffset(This,ActiveOffset) \ + (This)->lpVtbl -> put_ActiveOffset(This,ActiveOffset) + +#define ISpeechTextSelectionInformation_get_ActiveOffset(This,ActiveOffset) \ + (This)->lpVtbl -> get_ActiveOffset(This,ActiveOffset) + +#define ISpeechTextSelectionInformation_put_ActiveLength(This,ActiveLength) \ + (This)->lpVtbl -> put_ActiveLength(This,ActiveLength) + +#define ISpeechTextSelectionInformation_get_ActiveLength(This,ActiveLength) \ + (This)->lpVtbl -> get_ActiveLength(This,ActiveLength) + +#define ISpeechTextSelectionInformation_put_SelectionOffset(This,SelectionOffset) \ + (This)->lpVtbl -> put_SelectionOffset(This,SelectionOffset) + +#define ISpeechTextSelectionInformation_get_SelectionOffset(This,SelectionOffset) \ + (This)->lpVtbl -> get_SelectionOffset(This,SelectionOffset) + +#define ISpeechTextSelectionInformation_put_SelectionLength(This,SelectionLength) \ + (This)->lpVtbl -> put_SelectionLength(This,SelectionLength) + +#define ISpeechTextSelectionInformation_get_SelectionLength(This,SelectionLength) \ + (This)->lpVtbl -> get_SelectionLength(This,SelectionLength) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_put_ActiveOffset_Proxy( + ISpeechTextSelectionInformation * This, + /* [in] */ long ActiveOffset); + + +void __RPC_STUB ISpeechTextSelectionInformation_put_ActiveOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_get_ActiveOffset_Proxy( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *ActiveOffset); + + +void __RPC_STUB ISpeechTextSelectionInformation_get_ActiveOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_put_ActiveLength_Proxy( + ISpeechTextSelectionInformation * This, + /* [in] */ long ActiveLength); + + +void __RPC_STUB ISpeechTextSelectionInformation_put_ActiveLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_get_ActiveLength_Proxy( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *ActiveLength); + + +void __RPC_STUB ISpeechTextSelectionInformation_get_ActiveLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_put_SelectionOffset_Proxy( + ISpeechTextSelectionInformation * This, + /* [in] */ long SelectionOffset); + + +void __RPC_STUB ISpeechTextSelectionInformation_put_SelectionOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_get_SelectionOffset_Proxy( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *SelectionOffset); + + +void __RPC_STUB ISpeechTextSelectionInformation_get_SelectionOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_put_SelectionLength_Proxy( + ISpeechTextSelectionInformation * This, + /* [in] */ long SelectionLength); + + +void __RPC_STUB ISpeechTextSelectionInformation_put_SelectionLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_get_SelectionLength_Proxy( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *SelectionLength); + + +void __RPC_STUB ISpeechTextSelectionInformation_get_SelectionLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechTextSelectionInformation_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecoResult_INTERFACE_DEFINED__ +#define __ISpeechRecoResult_INTERFACE_DEFINED__ + +/* interface ISpeechRecoResult */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecoResult; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ED2879CF-CED9-4ee6-A534-DE0191D5468D") + ISpeechRecoResult : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RecoContext( + /* [retval][out] */ ISpeechRecoContext **RecoContext) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Times( + /* [retval][out] */ ISpeechRecoResultTimes **Times) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioFormat( + /* [in] */ ISpeechAudioFormat *Format) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioFormat( + /* [retval][out] */ ISpeechAudioFormat **Format) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PhraseInfo( + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Alternates( + /* [in] */ long RequestCount, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechPhraseAlternates **Alternates) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Audio( + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechMemoryStream **Stream) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SpeakAudio( + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SaveToMemory( + /* [retval][out] */ VARIANT *ResultBlock) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DiscardResultInfo( + /* [in] */ SpeechDiscardType ValueTypes) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecoResultVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecoResult * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecoResult * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecoResult * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecoResult * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecoResult * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecoResult * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecoResult * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RecoContext )( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechRecoContext **RecoContext); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Times )( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechRecoResultTimes **Times); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioFormat )( + ISpeechRecoResult * This, + /* [in] */ ISpeechAudioFormat *Format); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioFormat )( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechAudioFormat **Format); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PhraseInfo )( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Alternates )( + ISpeechRecoResult * This, + /* [in] */ long RequestCount, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechPhraseAlternates **Alternates); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Audio )( + ISpeechRecoResult * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechMemoryStream **Stream); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SpeakAudio )( + ISpeechRecoResult * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SaveToMemory )( + ISpeechRecoResult * This, + /* [retval][out] */ VARIANT *ResultBlock); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DiscardResultInfo )( + ISpeechRecoResult * This, + /* [in] */ SpeechDiscardType ValueTypes); + + END_INTERFACE + } ISpeechRecoResultVtbl; + + interface ISpeechRecoResult + { + CONST_VTBL struct ISpeechRecoResultVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecoResult_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecoResult_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecoResult_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecoResult_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecoResult_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecoResult_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecoResult_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecoResult_get_RecoContext(This,RecoContext) \ + (This)->lpVtbl -> get_RecoContext(This,RecoContext) + +#define ISpeechRecoResult_get_Times(This,Times) \ + (This)->lpVtbl -> get_Times(This,Times) + +#define ISpeechRecoResult_putref_AudioFormat(This,Format) \ + (This)->lpVtbl -> putref_AudioFormat(This,Format) + +#define ISpeechRecoResult_get_AudioFormat(This,Format) \ + (This)->lpVtbl -> get_AudioFormat(This,Format) + +#define ISpeechRecoResult_get_PhraseInfo(This,PhraseInfo) \ + (This)->lpVtbl -> get_PhraseInfo(This,PhraseInfo) + +#define ISpeechRecoResult_Alternates(This,RequestCount,StartElement,Elements,Alternates) \ + (This)->lpVtbl -> Alternates(This,RequestCount,StartElement,Elements,Alternates) + +#define ISpeechRecoResult_Audio(This,StartElement,Elements,Stream) \ + (This)->lpVtbl -> Audio(This,StartElement,Elements,Stream) + +#define ISpeechRecoResult_SpeakAudio(This,StartElement,Elements,Flags,StreamNumber) \ + (This)->lpVtbl -> SpeakAudio(This,StartElement,Elements,Flags,StreamNumber) + +#define ISpeechRecoResult_SaveToMemory(This,ResultBlock) \ + (This)->lpVtbl -> SaveToMemory(This,ResultBlock) + +#define ISpeechRecoResult_DiscardResultInfo(This,ValueTypes) \ + (This)->lpVtbl -> DiscardResultInfo(This,ValueTypes) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_get_RecoContext_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechRecoContext **RecoContext); + + +void __RPC_STUB ISpeechRecoResult_get_RecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_get_Times_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechRecoResultTimes **Times); + + +void __RPC_STUB ISpeechRecoResult_get_Times_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_putref_AudioFormat_Proxy( + ISpeechRecoResult * This, + /* [in] */ ISpeechAudioFormat *Format); + + +void __RPC_STUB ISpeechRecoResult_putref_AudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_get_AudioFormat_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechAudioFormat **Format); + + +void __RPC_STUB ISpeechRecoResult_get_AudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_get_PhraseInfo_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + +void __RPC_STUB ISpeechRecoResult_get_PhraseInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_Alternates_Proxy( + ISpeechRecoResult * This, + /* [in] */ long RequestCount, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechPhraseAlternates **Alternates); + + +void __RPC_STUB ISpeechRecoResult_Alternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_Audio_Proxy( + ISpeechRecoResult * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechMemoryStream **Stream); + + +void __RPC_STUB ISpeechRecoResult_Audio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_SpeakAudio_Proxy( + ISpeechRecoResult * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechRecoResult_SpeakAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_SaveToMemory_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ VARIANT *ResultBlock); + + +void __RPC_STUB ISpeechRecoResult_SaveToMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_DiscardResultInfo_Proxy( + ISpeechRecoResult * This, + /* [in] */ SpeechDiscardType ValueTypes); + + +void __RPC_STUB ISpeechRecoResult_DiscardResultInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecoResult_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecoResultTimes_INTERFACE_DEFINED__ +#define __ISpeechRecoResultTimes_INTERFACE_DEFINED__ + +/* interface ISpeechRecoResultTimes */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecoResultTimes; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("62B3B8FB-F6E7-41be-BDCB-056B1C29EFC0") + ISpeechRecoResultTimes : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_StreamTime( + /* [retval][out] */ VARIANT *Time) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Length( + /* [retval][out] */ VARIANT *Length) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_TickCount( + /* [retval][out] */ long *TickCount) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_OffsetFromStart( + /* [retval][out] */ VARIANT *OffsetFromStart) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecoResultTimesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecoResultTimes * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecoResultTimes * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecoResultTimes * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecoResultTimes * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecoResultTimes * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecoResultTimes * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecoResultTimes * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StreamTime )( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *Time); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Length )( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *Length); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TickCount )( + ISpeechRecoResultTimes * This, + /* [retval][out] */ long *TickCount); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_OffsetFromStart )( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *OffsetFromStart); + + END_INTERFACE + } ISpeechRecoResultTimesVtbl; + + interface ISpeechRecoResultTimes + { + CONST_VTBL struct ISpeechRecoResultTimesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecoResultTimes_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecoResultTimes_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecoResultTimes_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecoResultTimes_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecoResultTimes_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecoResultTimes_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecoResultTimes_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecoResultTimes_get_StreamTime(This,Time) \ + (This)->lpVtbl -> get_StreamTime(This,Time) + +#define ISpeechRecoResultTimes_get_Length(This,Length) \ + (This)->lpVtbl -> get_Length(This,Length) + +#define ISpeechRecoResultTimes_get_TickCount(This,TickCount) \ + (This)->lpVtbl -> get_TickCount(This,TickCount) + +#define ISpeechRecoResultTimes_get_OffsetFromStart(This,OffsetFromStart) \ + (This)->lpVtbl -> get_OffsetFromStart(This,OffsetFromStart) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResultTimes_get_StreamTime_Proxy( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *Time); + + +void __RPC_STUB ISpeechRecoResultTimes_get_StreamTime_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResultTimes_get_Length_Proxy( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *Length); + + +void __RPC_STUB ISpeechRecoResultTimes_get_Length_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResultTimes_get_TickCount_Proxy( + ISpeechRecoResultTimes * This, + /* [retval][out] */ long *TickCount); + + +void __RPC_STUB ISpeechRecoResultTimes_get_TickCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResultTimes_get_OffsetFromStart_Proxy( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *OffsetFromStart); + + +void __RPC_STUB ISpeechRecoResultTimes_get_OffsetFromStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecoResultTimes_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseAlternate_INTERFACE_DEFINED__ +#define __ISpeechPhraseAlternate_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseAlternate */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseAlternate; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("27864A2A-2B9F-4cb8-92D3-0D2722FD1E73") + ISpeechPhraseAlternate : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RecoResult( + /* [retval][out] */ ISpeechRecoResult **RecoResult) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_StartElementInResult( + /* [retval][out] */ long *StartElement) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfElementsInResult( + /* [retval][out] */ long *NumberOfElements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PhraseInfo( + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Commit( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseAlternateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseAlternate * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseAlternate * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseAlternate * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseAlternate * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseAlternate * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseAlternate * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseAlternate * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RecoResult )( + ISpeechPhraseAlternate * This, + /* [retval][out] */ ISpeechRecoResult **RecoResult); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StartElementInResult )( + ISpeechPhraseAlternate * This, + /* [retval][out] */ long *StartElement); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfElementsInResult )( + ISpeechPhraseAlternate * This, + /* [retval][out] */ long *NumberOfElements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PhraseInfo )( + ISpeechPhraseAlternate * This, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpeechPhraseAlternate * This); + + END_INTERFACE + } ISpeechPhraseAlternateVtbl; + + interface ISpeechPhraseAlternate + { + CONST_VTBL struct ISpeechPhraseAlternateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseAlternate_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseAlternate_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseAlternate_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseAlternate_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseAlternate_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseAlternate_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseAlternate_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseAlternate_get_RecoResult(This,RecoResult) \ + (This)->lpVtbl -> get_RecoResult(This,RecoResult) + +#define ISpeechPhraseAlternate_get_StartElementInResult(This,StartElement) \ + (This)->lpVtbl -> get_StartElementInResult(This,StartElement) + +#define ISpeechPhraseAlternate_get_NumberOfElementsInResult(This,NumberOfElements) \ + (This)->lpVtbl -> get_NumberOfElementsInResult(This,NumberOfElements) + +#define ISpeechPhraseAlternate_get_PhraseInfo(This,PhraseInfo) \ + (This)->lpVtbl -> get_PhraseInfo(This,PhraseInfo) + +#define ISpeechPhraseAlternate_Commit(This) \ + (This)->lpVtbl -> Commit(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_get_RecoResult_Proxy( + ISpeechPhraseAlternate * This, + /* [retval][out] */ ISpeechRecoResult **RecoResult); + + +void __RPC_STUB ISpeechPhraseAlternate_get_RecoResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_get_StartElementInResult_Proxy( + ISpeechPhraseAlternate * This, + /* [retval][out] */ long *StartElement); + + +void __RPC_STUB ISpeechPhraseAlternate_get_StartElementInResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_get_NumberOfElementsInResult_Proxy( + ISpeechPhraseAlternate * This, + /* [retval][out] */ long *NumberOfElements); + + +void __RPC_STUB ISpeechPhraseAlternate_get_NumberOfElementsInResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_get_PhraseInfo_Proxy( + ISpeechPhraseAlternate * This, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + +void __RPC_STUB ISpeechPhraseAlternate_get_PhraseInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_Commit_Proxy( + ISpeechPhraseAlternate * This); + + +void __RPC_STUB ISpeechPhraseAlternate_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseAlternate_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseAlternates_INTERFACE_DEFINED__ +#define __ISpeechPhraseAlternates_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseAlternates */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseAlternates; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B238B6D5-F276-4c3d-A6C1-2974801C3CC2") + ISpeechPhraseAlternates : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseAlternate **PhraseAlternate) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseAlternatesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseAlternates * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseAlternates * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseAlternates * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseAlternates * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseAlternates * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseAlternates * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseAlternates * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseAlternates * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseAlternates * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseAlternate **PhraseAlternate); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseAlternates * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhraseAlternatesVtbl; + + interface ISpeechPhraseAlternates + { + CONST_VTBL struct ISpeechPhraseAlternatesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseAlternates_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseAlternates_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseAlternates_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseAlternates_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseAlternates_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseAlternates_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseAlternates_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseAlternates_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseAlternates_Item(This,Index,PhraseAlternate) \ + (This)->lpVtbl -> Item(This,Index,PhraseAlternate) + +#define ISpeechPhraseAlternates_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternates_get_Count_Proxy( + ISpeechPhraseAlternates * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseAlternates_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternates_Item_Proxy( + ISpeechPhraseAlternates * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseAlternate **PhraseAlternate); + + +void __RPC_STUB ISpeechPhraseAlternates_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternates_get__NewEnum_Proxy( + ISpeechPhraseAlternates * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseAlternates_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseAlternates_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseInfo_INTERFACE_DEFINED__ +#define __ISpeechPhraseInfo_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseInfo */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseInfo; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("961559CF-4E67-4662-8BF0-D93F1FCD61B3") + ISpeechPhraseInfo : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LanguageId( + /* [retval][out] */ long *LanguageId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_GrammarId( + /* [retval][out] */ VARIANT *GrammarId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_StartTime( + /* [retval][out] */ VARIANT *StartTime) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStreamPosition( + /* [retval][out] */ VARIANT *AudioStreamPosition) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioSizeBytes( + /* [retval][out] */ long *pAudioSizeBytes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedSizeBytes( + /* [retval][out] */ long *RetainedSizeBytes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioSizeTime( + /* [retval][out] */ long *AudioSizeTime) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rule( + /* [retval][out] */ ISpeechPhraseRule **Rule) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Properties( + /* [retval][out] */ ISpeechPhraseProperties **Properties) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Elements( + /* [retval][out] */ ISpeechPhraseElements **Elements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Replacements( + /* [retval][out] */ ISpeechPhraseReplacements **Replacements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EngineId( + /* [retval][out] */ BSTR *EngineIdGuid) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EnginePrivateData( + /* [retval][out] */ VARIANT *PrivateData) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SaveToMemory( + /* [retval][out] */ VARIANT *PhraseBlock) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetText( + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ BSTR *Text) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetDisplayAttributes( + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseInfoVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseInfo * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseInfo * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseInfo * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseInfo * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseInfo * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseInfo * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseInfo * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LanguageId )( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *LanguageId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_GrammarId )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *GrammarId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StartTime )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *StartTime); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioStreamPosition )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *AudioStreamPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSizeBytes )( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *pAudioSizeBytes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedSizeBytes )( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *RetainedSizeBytes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSizeTime )( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *AudioSizeTime); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rule )( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseRule **Rule); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Properties )( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseProperties **Properties); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Elements )( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseElements **Elements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Replacements )( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseReplacements **Replacements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EngineId )( + ISpeechPhraseInfo * This, + /* [retval][out] */ BSTR *EngineIdGuid); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EnginePrivateData )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *PrivateData); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SaveToMemory )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *PhraseBlock); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpeechPhraseInfo * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ BSTR *Text); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDisplayAttributes )( + ISpeechPhraseInfo * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + END_INTERFACE + } ISpeechPhraseInfoVtbl; + + interface ISpeechPhraseInfo + { + CONST_VTBL struct ISpeechPhraseInfoVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseInfo_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseInfo_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseInfo_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseInfo_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseInfo_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseInfo_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseInfo_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseInfo_get_LanguageId(This,LanguageId) \ + (This)->lpVtbl -> get_LanguageId(This,LanguageId) + +#define ISpeechPhraseInfo_get_GrammarId(This,GrammarId) \ + (This)->lpVtbl -> get_GrammarId(This,GrammarId) + +#define ISpeechPhraseInfo_get_StartTime(This,StartTime) \ + (This)->lpVtbl -> get_StartTime(This,StartTime) + +#define ISpeechPhraseInfo_get_AudioStreamPosition(This,AudioStreamPosition) \ + (This)->lpVtbl -> get_AudioStreamPosition(This,AudioStreamPosition) + +#define ISpeechPhraseInfo_get_AudioSizeBytes(This,pAudioSizeBytes) \ + (This)->lpVtbl -> get_AudioSizeBytes(This,pAudioSizeBytes) + +#define ISpeechPhraseInfo_get_RetainedSizeBytes(This,RetainedSizeBytes) \ + (This)->lpVtbl -> get_RetainedSizeBytes(This,RetainedSizeBytes) + +#define ISpeechPhraseInfo_get_AudioSizeTime(This,AudioSizeTime) \ + (This)->lpVtbl -> get_AudioSizeTime(This,AudioSizeTime) + +#define ISpeechPhraseInfo_get_Rule(This,Rule) \ + (This)->lpVtbl -> get_Rule(This,Rule) + +#define ISpeechPhraseInfo_get_Properties(This,Properties) \ + (This)->lpVtbl -> get_Properties(This,Properties) + +#define ISpeechPhraseInfo_get_Elements(This,Elements) \ + (This)->lpVtbl -> get_Elements(This,Elements) + +#define ISpeechPhraseInfo_get_Replacements(This,Replacements) \ + (This)->lpVtbl -> get_Replacements(This,Replacements) + +#define ISpeechPhraseInfo_get_EngineId(This,EngineIdGuid) \ + (This)->lpVtbl -> get_EngineId(This,EngineIdGuid) + +#define ISpeechPhraseInfo_get_EnginePrivateData(This,PrivateData) \ + (This)->lpVtbl -> get_EnginePrivateData(This,PrivateData) + +#define ISpeechPhraseInfo_SaveToMemory(This,PhraseBlock) \ + (This)->lpVtbl -> SaveToMemory(This,PhraseBlock) + +#define ISpeechPhraseInfo_GetText(This,StartElement,Elements,UseReplacements,Text) \ + (This)->lpVtbl -> GetText(This,StartElement,Elements,UseReplacements,Text) + +#define ISpeechPhraseInfo_GetDisplayAttributes(This,StartElement,Elements,UseReplacements,DisplayAttributes) \ + (This)->lpVtbl -> GetDisplayAttributes(This,StartElement,Elements,UseReplacements,DisplayAttributes) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_LanguageId_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *LanguageId); + + +void __RPC_STUB ISpeechPhraseInfo_get_LanguageId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_GrammarId_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *GrammarId); + + +void __RPC_STUB ISpeechPhraseInfo_get_GrammarId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_StartTime_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *StartTime); + + +void __RPC_STUB ISpeechPhraseInfo_get_StartTime_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_AudioStreamPosition_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *AudioStreamPosition); + + +void __RPC_STUB ISpeechPhraseInfo_get_AudioStreamPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_AudioSizeBytes_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *pAudioSizeBytes); + + +void __RPC_STUB ISpeechPhraseInfo_get_AudioSizeBytes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_RetainedSizeBytes_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *RetainedSizeBytes); + + +void __RPC_STUB ISpeechPhraseInfo_get_RetainedSizeBytes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_AudioSizeTime_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *AudioSizeTime); + + +void __RPC_STUB ISpeechPhraseInfo_get_AudioSizeTime_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_Rule_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseRule **Rule); + + +void __RPC_STUB ISpeechPhraseInfo_get_Rule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_Properties_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseProperties **Properties); + + +void __RPC_STUB ISpeechPhraseInfo_get_Properties_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_Elements_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseElements **Elements); + + +void __RPC_STUB ISpeechPhraseInfo_get_Elements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_Replacements_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseReplacements **Replacements); + + +void __RPC_STUB ISpeechPhraseInfo_get_Replacements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_EngineId_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ BSTR *EngineIdGuid); + + +void __RPC_STUB ISpeechPhraseInfo_get_EngineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_EnginePrivateData_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *PrivateData); + + +void __RPC_STUB ISpeechPhraseInfo_get_EnginePrivateData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_SaveToMemory_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *PhraseBlock); + + +void __RPC_STUB ISpeechPhraseInfo_SaveToMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_GetText_Proxy( + ISpeechPhraseInfo * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ BSTR *Text); + + +void __RPC_STUB ISpeechPhraseInfo_GetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_GetDisplayAttributes_Proxy( + ISpeechPhraseInfo * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + +void __RPC_STUB ISpeechPhraseInfo_GetDisplayAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseInfo_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseElement_INTERFACE_DEFINED__ +#define __ISpeechPhraseElement_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseElement */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseElement; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E6176F96-E373-4801-B223-3B62C068C0B4") + ISpeechPhraseElement : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioTimeOffset( + /* [retval][out] */ long *AudioTimeOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioSizeTime( + /* [retval][out] */ long *AudioSizeTime) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStreamOffset( + /* [retval][out] */ long *AudioStreamOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioSizeBytes( + /* [retval][out] */ long *AudioSizeBytes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedStreamOffset( + /* [retval][out] */ long *RetainedStreamOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedSizeBytes( + /* [retval][out] */ long *RetainedSizeBytes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayText( + /* [retval][out] */ BSTR *DisplayText) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LexicalForm( + /* [retval][out] */ BSTR *LexicalForm) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Pronunciation( + /* [retval][out] */ VARIANT *Pronunciation) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayAttributes( + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RequiredConfidence( + /* [retval][out] */ SpeechEngineConfidence *RequiredConfidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ActualConfidence( + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EngineConfidence( + /* [retval][out] */ float *EngineConfidence) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseElementVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseElement * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseElement * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseElement * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseElement * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseElement * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseElement * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseElement * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioTimeOffset )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioTimeOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSizeTime )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioSizeTime); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioStreamOffset )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioStreamOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSizeBytes )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioSizeBytes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedStreamOffset )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *RetainedStreamOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedSizeBytes )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *RetainedSizeBytes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayText )( + ISpeechPhraseElement * This, + /* [retval][out] */ BSTR *DisplayText); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LexicalForm )( + ISpeechPhraseElement * This, + /* [retval][out] */ BSTR *LexicalForm); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Pronunciation )( + ISpeechPhraseElement * This, + /* [retval][out] */ VARIANT *Pronunciation); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayAttributes )( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequiredConfidence )( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechEngineConfidence *RequiredConfidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ActualConfidence )( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EngineConfidence )( + ISpeechPhraseElement * This, + /* [retval][out] */ float *EngineConfidence); + + END_INTERFACE + } ISpeechPhraseElementVtbl; + + interface ISpeechPhraseElement + { + CONST_VTBL struct ISpeechPhraseElementVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseElement_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseElement_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseElement_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseElement_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseElement_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseElement_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseElement_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseElement_get_AudioTimeOffset(This,AudioTimeOffset) \ + (This)->lpVtbl -> get_AudioTimeOffset(This,AudioTimeOffset) + +#define ISpeechPhraseElement_get_AudioSizeTime(This,AudioSizeTime) \ + (This)->lpVtbl -> get_AudioSizeTime(This,AudioSizeTime) + +#define ISpeechPhraseElement_get_AudioStreamOffset(This,AudioStreamOffset) \ + (This)->lpVtbl -> get_AudioStreamOffset(This,AudioStreamOffset) + +#define ISpeechPhraseElement_get_AudioSizeBytes(This,AudioSizeBytes) \ + (This)->lpVtbl -> get_AudioSizeBytes(This,AudioSizeBytes) + +#define ISpeechPhraseElement_get_RetainedStreamOffset(This,RetainedStreamOffset) \ + (This)->lpVtbl -> get_RetainedStreamOffset(This,RetainedStreamOffset) + +#define ISpeechPhraseElement_get_RetainedSizeBytes(This,RetainedSizeBytes) \ + (This)->lpVtbl -> get_RetainedSizeBytes(This,RetainedSizeBytes) + +#define ISpeechPhraseElement_get_DisplayText(This,DisplayText) \ + (This)->lpVtbl -> get_DisplayText(This,DisplayText) + +#define ISpeechPhraseElement_get_LexicalForm(This,LexicalForm) \ + (This)->lpVtbl -> get_LexicalForm(This,LexicalForm) + +#define ISpeechPhraseElement_get_Pronunciation(This,Pronunciation) \ + (This)->lpVtbl -> get_Pronunciation(This,Pronunciation) + +#define ISpeechPhraseElement_get_DisplayAttributes(This,DisplayAttributes) \ + (This)->lpVtbl -> get_DisplayAttributes(This,DisplayAttributes) + +#define ISpeechPhraseElement_get_RequiredConfidence(This,RequiredConfidence) \ + (This)->lpVtbl -> get_RequiredConfidence(This,RequiredConfidence) + +#define ISpeechPhraseElement_get_ActualConfidence(This,ActualConfidence) \ + (This)->lpVtbl -> get_ActualConfidence(This,ActualConfidence) + +#define ISpeechPhraseElement_get_EngineConfidence(This,EngineConfidence) \ + (This)->lpVtbl -> get_EngineConfidence(This,EngineConfidence) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_AudioTimeOffset_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioTimeOffset); + + +void __RPC_STUB ISpeechPhraseElement_get_AudioTimeOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_AudioSizeTime_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioSizeTime); + + +void __RPC_STUB ISpeechPhraseElement_get_AudioSizeTime_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_AudioStreamOffset_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioStreamOffset); + + +void __RPC_STUB ISpeechPhraseElement_get_AudioStreamOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_AudioSizeBytes_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioSizeBytes); + + +void __RPC_STUB ISpeechPhraseElement_get_AudioSizeBytes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_RetainedStreamOffset_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *RetainedStreamOffset); + + +void __RPC_STUB ISpeechPhraseElement_get_RetainedStreamOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_RetainedSizeBytes_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *RetainedSizeBytes); + + +void __RPC_STUB ISpeechPhraseElement_get_RetainedSizeBytes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_DisplayText_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ BSTR *DisplayText); + + +void __RPC_STUB ISpeechPhraseElement_get_DisplayText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_LexicalForm_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ BSTR *LexicalForm); + + +void __RPC_STUB ISpeechPhraseElement_get_LexicalForm_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_Pronunciation_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ VARIANT *Pronunciation); + + +void __RPC_STUB ISpeechPhraseElement_get_Pronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_DisplayAttributes_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + +void __RPC_STUB ISpeechPhraseElement_get_DisplayAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_RequiredConfidence_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechEngineConfidence *RequiredConfidence); + + +void __RPC_STUB ISpeechPhraseElement_get_RequiredConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_ActualConfidence_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence); + + +void __RPC_STUB ISpeechPhraseElement_get_ActualConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_EngineConfidence_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ float *EngineConfidence); + + +void __RPC_STUB ISpeechPhraseElement_get_EngineConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseElement_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseElements_INTERFACE_DEFINED__ +#define __ISpeechPhraseElements_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseElements */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseElements; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0626B328-3478-467d-A0B3-D0853B93DDA3") + ISpeechPhraseElements : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseElement **Element) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseElementsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseElements * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseElements * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseElements * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseElements * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseElements * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseElements * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseElements * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseElements * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseElements * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseElement **Element); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseElements * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhraseElementsVtbl; + + interface ISpeechPhraseElements + { + CONST_VTBL struct ISpeechPhraseElementsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseElements_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseElements_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseElements_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseElements_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseElements_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseElements_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseElements_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseElements_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseElements_Item(This,Index,Element) \ + (This)->lpVtbl -> Item(This,Index,Element) + +#define ISpeechPhraseElements_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElements_get_Count_Proxy( + ISpeechPhraseElements * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseElements_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElements_Item_Proxy( + ISpeechPhraseElements * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseElement **Element); + + +void __RPC_STUB ISpeechPhraseElements_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElements_get__NewEnum_Proxy( + ISpeechPhraseElements * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseElements_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseElements_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseReplacement_INTERFACE_DEFINED__ +#define __ISpeechPhraseReplacement_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseReplacement */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseReplacement; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2890A410-53A7-4fb5-94EC-06D4998E3D02") + ISpeechPhraseReplacement : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayAttributes( + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Text( + /* [retval][out] */ BSTR *Text) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FirstElement( + /* [retval][out] */ long *FirstElement) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfElements( + /* [retval][out] */ long *NumberOfElements) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseReplacementVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseReplacement * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseReplacement * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseReplacement * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseReplacement * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseReplacement * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseReplacement * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseReplacement * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayAttributes )( + ISpeechPhraseReplacement * This, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Text )( + ISpeechPhraseReplacement * This, + /* [retval][out] */ BSTR *Text); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FirstElement )( + ISpeechPhraseReplacement * This, + /* [retval][out] */ long *FirstElement); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfElements )( + ISpeechPhraseReplacement * This, + /* [retval][out] */ long *NumberOfElements); + + END_INTERFACE + } ISpeechPhraseReplacementVtbl; + + interface ISpeechPhraseReplacement + { + CONST_VTBL struct ISpeechPhraseReplacementVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseReplacement_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseReplacement_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseReplacement_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseReplacement_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseReplacement_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseReplacement_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseReplacement_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseReplacement_get_DisplayAttributes(This,DisplayAttributes) \ + (This)->lpVtbl -> get_DisplayAttributes(This,DisplayAttributes) + +#define ISpeechPhraseReplacement_get_Text(This,Text) \ + (This)->lpVtbl -> get_Text(This,Text) + +#define ISpeechPhraseReplacement_get_FirstElement(This,FirstElement) \ + (This)->lpVtbl -> get_FirstElement(This,FirstElement) + +#define ISpeechPhraseReplacement_get_NumberOfElements(This,NumberOfElements) \ + (This)->lpVtbl -> get_NumberOfElements(This,NumberOfElements) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacement_get_DisplayAttributes_Proxy( + ISpeechPhraseReplacement * This, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + +void __RPC_STUB ISpeechPhraseReplacement_get_DisplayAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacement_get_Text_Proxy( + ISpeechPhraseReplacement * This, + /* [retval][out] */ BSTR *Text); + + +void __RPC_STUB ISpeechPhraseReplacement_get_Text_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacement_get_FirstElement_Proxy( + ISpeechPhraseReplacement * This, + /* [retval][out] */ long *FirstElement); + + +void __RPC_STUB ISpeechPhraseReplacement_get_FirstElement_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacement_get_NumberOfElements_Proxy( + ISpeechPhraseReplacement * This, + /* [retval][out] */ long *NumberOfElements); + + +void __RPC_STUB ISpeechPhraseReplacement_get_NumberOfElements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseReplacement_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseReplacements_INTERFACE_DEFINED__ +#define __ISpeechPhraseReplacements_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseReplacements */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseReplacements; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("38BC662F-2257-4525-959E-2069D2596C05") + ISpeechPhraseReplacements : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseReplacement **Reps) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseReplacementsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseReplacements * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseReplacements * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseReplacements * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseReplacements * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseReplacements * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseReplacements * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseReplacements * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseReplacements * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseReplacements * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseReplacement **Reps); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseReplacements * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhraseReplacementsVtbl; + + interface ISpeechPhraseReplacements + { + CONST_VTBL struct ISpeechPhraseReplacementsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseReplacements_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseReplacements_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseReplacements_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseReplacements_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseReplacements_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseReplacements_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseReplacements_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseReplacements_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseReplacements_Item(This,Index,Reps) \ + (This)->lpVtbl -> Item(This,Index,Reps) + +#define ISpeechPhraseReplacements_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacements_get_Count_Proxy( + ISpeechPhraseReplacements * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseReplacements_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacements_Item_Proxy( + ISpeechPhraseReplacements * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseReplacement **Reps); + + +void __RPC_STUB ISpeechPhraseReplacements_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacements_get__NewEnum_Proxy( + ISpeechPhraseReplacements * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseReplacements_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseReplacements_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseProperty_INTERFACE_DEFINED__ +#define __ISpeechPhraseProperty_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseProperty */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseProperty; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CE563D48-961E-4732-A2E1-378A42B430BE") + ISpeechPhraseProperty : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR *Name) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ long *Id) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Value( + /* [retval][out] */ VARIANT *Value) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FirstElement( + /* [retval][out] */ long *FirstElement) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfElements( + /* [retval][out] */ long *NumberOfElements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EngineConfidence( + /* [retval][out] */ float *Confidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Confidence( + /* [retval][out] */ SpeechEngineConfidence *Confidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Parent( + /* [retval][out] */ ISpeechPhraseProperty **ParentProperty) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Children( + /* [retval][out] */ ISpeechPhraseProperties **Children) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhrasePropertyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseProperty * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseProperty * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseProperty * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseProperty * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseProperty * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseProperty * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseProperty * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( + ISpeechPhraseProperty * This, + /* [retval][out] */ BSTR *Name); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *Id); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Value )( + ISpeechPhraseProperty * This, + /* [retval][out] */ VARIANT *Value); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FirstElement )( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *FirstElement); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfElements )( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *NumberOfElements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EngineConfidence )( + ISpeechPhraseProperty * This, + /* [retval][out] */ float *Confidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Confidence )( + ISpeechPhraseProperty * This, + /* [retval][out] */ SpeechEngineConfidence *Confidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Parent )( + ISpeechPhraseProperty * This, + /* [retval][out] */ ISpeechPhraseProperty **ParentProperty); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Children )( + ISpeechPhraseProperty * This, + /* [retval][out] */ ISpeechPhraseProperties **Children); + + END_INTERFACE + } ISpeechPhrasePropertyVtbl; + + interface ISpeechPhraseProperty + { + CONST_VTBL struct ISpeechPhrasePropertyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseProperty_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseProperty_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseProperty_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseProperty_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseProperty_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseProperty_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseProperty_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseProperty_get_Name(This,Name) \ + (This)->lpVtbl -> get_Name(This,Name) + +#define ISpeechPhraseProperty_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechPhraseProperty_get_Value(This,Value) \ + (This)->lpVtbl -> get_Value(This,Value) + +#define ISpeechPhraseProperty_get_FirstElement(This,FirstElement) \ + (This)->lpVtbl -> get_FirstElement(This,FirstElement) + +#define ISpeechPhraseProperty_get_NumberOfElements(This,NumberOfElements) \ + (This)->lpVtbl -> get_NumberOfElements(This,NumberOfElements) + +#define ISpeechPhraseProperty_get_EngineConfidence(This,Confidence) \ + (This)->lpVtbl -> get_EngineConfidence(This,Confidence) + +#define ISpeechPhraseProperty_get_Confidence(This,Confidence) \ + (This)->lpVtbl -> get_Confidence(This,Confidence) + +#define ISpeechPhraseProperty_get_Parent(This,ParentProperty) \ + (This)->lpVtbl -> get_Parent(This,ParentProperty) + +#define ISpeechPhraseProperty_get_Children(This,Children) \ + (This)->lpVtbl -> get_Children(This,Children) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Name_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ BSTR *Name); + + +void __RPC_STUB ISpeechPhraseProperty_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Id_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *Id); + + +void __RPC_STUB ISpeechPhraseProperty_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Value_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ VARIANT *Value); + + +void __RPC_STUB ISpeechPhraseProperty_get_Value_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_FirstElement_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *FirstElement); + + +void __RPC_STUB ISpeechPhraseProperty_get_FirstElement_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_NumberOfElements_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *NumberOfElements); + + +void __RPC_STUB ISpeechPhraseProperty_get_NumberOfElements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_EngineConfidence_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ float *Confidence); + + +void __RPC_STUB ISpeechPhraseProperty_get_EngineConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Confidence_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ SpeechEngineConfidence *Confidence); + + +void __RPC_STUB ISpeechPhraseProperty_get_Confidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Parent_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ ISpeechPhraseProperty **ParentProperty); + + +void __RPC_STUB ISpeechPhraseProperty_get_Parent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Children_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ ISpeechPhraseProperties **Children); + + +void __RPC_STUB ISpeechPhraseProperty_get_Children_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseProperty_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseProperties_INTERFACE_DEFINED__ +#define __ISpeechPhraseProperties_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseProperties */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("08166B47-102E-4b23-A599-BDB98DBFD1F4") + ISpeechPhraseProperties : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseProperty **Property) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhrasePropertiesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseProperties * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseProperties * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseProperties * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseProperties * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseProperties * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseProperties * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseProperties * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseProperties * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseProperties * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseProperty **Property); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseProperties * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhrasePropertiesVtbl; + + interface ISpeechPhraseProperties + { + CONST_VTBL struct ISpeechPhrasePropertiesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseProperties_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseProperties_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseProperties_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseProperties_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseProperties_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseProperties_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseProperties_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseProperties_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseProperties_Item(This,Index,Property) \ + (This)->lpVtbl -> Item(This,Index,Property) + +#define ISpeechPhraseProperties_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperties_get_Count_Proxy( + ISpeechPhraseProperties * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseProperties_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperties_Item_Proxy( + ISpeechPhraseProperties * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseProperty **Property); + + +void __RPC_STUB ISpeechPhraseProperties_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperties_get__NewEnum_Proxy( + ISpeechPhraseProperties * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseProperties_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseProperties_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseRule_INTERFACE_DEFINED__ +#define __ISpeechPhraseRule_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseRule */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseRule; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A7BFE112-A4A0-48d9-B602-C313843F6964") + ISpeechPhraseRule : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR *Name) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ long *Id) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FirstElement( + /* [retval][out] */ long *FirstElement) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfElements( + /* [retval][out] */ long *NumberOfElements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Parent( + /* [retval][out] */ ISpeechPhraseRule **Parent) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Children( + /* [retval][out] */ ISpeechPhraseRules **Children) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Confidence( + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EngineConfidence( + /* [retval][out] */ float *EngineConfidence) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseRuleVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseRule * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseRule * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseRule * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseRule * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseRule * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseRule * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseRule * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( + ISpeechPhraseRule * This, + /* [retval][out] */ BSTR *Name); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechPhraseRule * This, + /* [retval][out] */ long *Id); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FirstElement )( + ISpeechPhraseRule * This, + /* [retval][out] */ long *FirstElement); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfElements )( + ISpeechPhraseRule * This, + /* [retval][out] */ long *NumberOfElements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Parent )( + ISpeechPhraseRule * This, + /* [retval][out] */ ISpeechPhraseRule **Parent); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Children )( + ISpeechPhraseRule * This, + /* [retval][out] */ ISpeechPhraseRules **Children); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Confidence )( + ISpeechPhraseRule * This, + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EngineConfidence )( + ISpeechPhraseRule * This, + /* [retval][out] */ float *EngineConfidence); + + END_INTERFACE + } ISpeechPhraseRuleVtbl; + + interface ISpeechPhraseRule + { + CONST_VTBL struct ISpeechPhraseRuleVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseRule_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseRule_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseRule_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseRule_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseRule_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseRule_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseRule_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseRule_get_Name(This,Name) \ + (This)->lpVtbl -> get_Name(This,Name) + +#define ISpeechPhraseRule_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechPhraseRule_get_FirstElement(This,FirstElement) \ + (This)->lpVtbl -> get_FirstElement(This,FirstElement) + +#define ISpeechPhraseRule_get_NumberOfElements(This,NumberOfElements) \ + (This)->lpVtbl -> get_NumberOfElements(This,NumberOfElements) + +#define ISpeechPhraseRule_get_Parent(This,Parent) \ + (This)->lpVtbl -> get_Parent(This,Parent) + +#define ISpeechPhraseRule_get_Children(This,Children) \ + (This)->lpVtbl -> get_Children(This,Children) + +#define ISpeechPhraseRule_get_Confidence(This,ActualConfidence) \ + (This)->lpVtbl -> get_Confidence(This,ActualConfidence) + +#define ISpeechPhraseRule_get_EngineConfidence(This,EngineConfidence) \ + (This)->lpVtbl -> get_EngineConfidence(This,EngineConfidence) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Name_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ BSTR *Name); + + +void __RPC_STUB ISpeechPhraseRule_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Id_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ long *Id); + + +void __RPC_STUB ISpeechPhraseRule_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_FirstElement_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ long *FirstElement); + + +void __RPC_STUB ISpeechPhraseRule_get_FirstElement_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_NumberOfElements_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ long *NumberOfElements); + + +void __RPC_STUB ISpeechPhraseRule_get_NumberOfElements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Parent_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ ISpeechPhraseRule **Parent); + + +void __RPC_STUB ISpeechPhraseRule_get_Parent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Children_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ ISpeechPhraseRules **Children); + + +void __RPC_STUB ISpeechPhraseRule_get_Children_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Confidence_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence); + + +void __RPC_STUB ISpeechPhraseRule_get_Confidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_EngineConfidence_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ float *EngineConfidence); + + +void __RPC_STUB ISpeechPhraseRule_get_EngineConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseRule_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseRules_INTERFACE_DEFINED__ +#define __ISpeechPhraseRules_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseRules */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseRules; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9047D593-01DD-4b72-81A3-E4A0CA69F407") + ISpeechPhraseRules : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseRule **Rule) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseRulesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseRules * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseRules * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseRules * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseRules * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseRules * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseRules * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseRules * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseRules * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseRules * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseRule **Rule); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseRules * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhraseRulesVtbl; + + interface ISpeechPhraseRules + { + CONST_VTBL struct ISpeechPhraseRulesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseRules_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseRules_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseRules_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseRules_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseRules_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseRules_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseRules_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseRules_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseRules_Item(This,Index,Rule) \ + (This)->lpVtbl -> Item(This,Index,Rule) + +#define ISpeechPhraseRules_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRules_get_Count_Proxy( + ISpeechPhraseRules * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseRules_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRules_Item_Proxy( + ISpeechPhraseRules * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseRule **Rule); + + +void __RPC_STUB ISpeechPhraseRules_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRules_get__NewEnum_Proxy( + ISpeechPhraseRules * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseRules_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseRules_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexicon_INTERFACE_DEFINED__ +#define __ISpeechLexicon_INTERFACE_DEFINED__ + +/* interface ISpeechLexicon */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexicon; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3DA7627A-C7AE-4b23-8708-638C50362C25") + ISpeechLexicon : public IDispatch + { + public: + virtual /* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_GenerationId( + /* [retval][out] */ long *GenerationId) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetWords( + /* [defaultvalue][in] */ SpeechLexiconType Flags, + /* [defaultvalue][out] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **Words) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddPronunciation( + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech = SPSUnknown, + /* [defaultvalue][in] */ BSTR bstrPronunciation = L"") = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE AddPronunciationByPhoneIds( + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech = SPSUnknown, + /* [defaultvalue][in] */ VARIANT *PhoneIds = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE RemovePronunciation( + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech = SPSUnknown, + /* [defaultvalue][in] */ BSTR bstrPronunciation = L"") = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE RemovePronunciationByPhoneIds( + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech = SPSUnknown, + /* [defaultvalue][in] */ VARIANT *PhoneIds = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetPronunciations( + /* [in] */ BSTR bstrWord, + /* [defaultvalue][in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechLexiconType TypeFlags, + /* [retval][out] */ ISpeechLexiconPronunciations **ppPronunciations) = 0; + + virtual /* [hidden][id][helpstring] */ HRESULT STDMETHODCALLTYPE GetGenerationChange( + /* [out][in] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **ppWords) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexicon * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexicon * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexicon * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexicon * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexicon * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexicon * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexicon * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [hidden][id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_GenerationId )( + ISpeechLexicon * This, + /* [retval][out] */ long *GenerationId); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetWords )( + ISpeechLexicon * This, + /* [defaultvalue][in] */ SpeechLexiconType Flags, + /* [defaultvalue][out] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **Words); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddPronunciation )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ BSTR bstrPronunciation); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddPronunciationByPhoneIds )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ VARIANT *PhoneIds); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemovePronunciation )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ BSTR bstrPronunciation); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemovePronunciationByPhoneIds )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ VARIANT *PhoneIds); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPronunciations )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [defaultvalue][in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechLexiconType TypeFlags, + /* [retval][out] */ ISpeechLexiconPronunciations **ppPronunciations); + + /* [hidden][id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetGenerationChange )( + ISpeechLexicon * This, + /* [out][in] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **ppWords); + + END_INTERFACE + } ISpeechLexiconVtbl; + + interface ISpeechLexicon + { + CONST_VTBL struct ISpeechLexiconVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexicon_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexicon_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexicon_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexicon_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexicon_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexicon_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexicon_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexicon_get_GenerationId(This,GenerationId) \ + (This)->lpVtbl -> get_GenerationId(This,GenerationId) + +#define ISpeechLexicon_GetWords(This,Flags,GenerationID,Words) \ + (This)->lpVtbl -> GetWords(This,Flags,GenerationID,Words) + +#define ISpeechLexicon_AddPronunciation(This,bstrWord,LangId,PartOfSpeech,bstrPronunciation) \ + (This)->lpVtbl -> AddPronunciation(This,bstrWord,LangId,PartOfSpeech,bstrPronunciation) + +#define ISpeechLexicon_AddPronunciationByPhoneIds(This,bstrWord,LangId,PartOfSpeech,PhoneIds) \ + (This)->lpVtbl -> AddPronunciationByPhoneIds(This,bstrWord,LangId,PartOfSpeech,PhoneIds) + +#define ISpeechLexicon_RemovePronunciation(This,bstrWord,LangId,PartOfSpeech,bstrPronunciation) \ + (This)->lpVtbl -> RemovePronunciation(This,bstrWord,LangId,PartOfSpeech,bstrPronunciation) + +#define ISpeechLexicon_RemovePronunciationByPhoneIds(This,bstrWord,LangId,PartOfSpeech,PhoneIds) \ + (This)->lpVtbl -> RemovePronunciationByPhoneIds(This,bstrWord,LangId,PartOfSpeech,PhoneIds) + +#define ISpeechLexicon_GetPronunciations(This,bstrWord,LangId,TypeFlags,ppPronunciations) \ + (This)->lpVtbl -> GetPronunciations(This,bstrWord,LangId,TypeFlags,ppPronunciations) + +#define ISpeechLexicon_GetGenerationChange(This,GenerationID,ppWords) \ + (This)->lpVtbl -> GetGenerationChange(This,GenerationID,ppWords) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_get_GenerationId_Proxy( + ISpeechLexicon * This, + /* [retval][out] */ long *GenerationId); + + +void __RPC_STUB ISpeechLexicon_get_GenerationId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_GetWords_Proxy( + ISpeechLexicon * This, + /* [defaultvalue][in] */ SpeechLexiconType Flags, + /* [defaultvalue][out] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **Words); + + +void __RPC_STUB ISpeechLexicon_GetWords_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_AddPronunciation_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ BSTR bstrPronunciation); + + +void __RPC_STUB ISpeechLexicon_AddPronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_AddPronunciationByPhoneIds_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ VARIANT *PhoneIds); + + +void __RPC_STUB ISpeechLexicon_AddPronunciationByPhoneIds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_RemovePronunciation_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ BSTR bstrPronunciation); + + +void __RPC_STUB ISpeechLexicon_RemovePronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_RemovePronunciationByPhoneIds_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ VARIANT *PhoneIds); + + +void __RPC_STUB ISpeechLexicon_RemovePronunciationByPhoneIds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_GetPronunciations_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [defaultvalue][in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechLexiconType TypeFlags, + /* [retval][out] */ ISpeechLexiconPronunciations **ppPronunciations); + + +void __RPC_STUB ISpeechLexicon_GetPronunciations_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_GetGenerationChange_Proxy( + ISpeechLexicon * This, + /* [out][in] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **ppWords); + + +void __RPC_STUB ISpeechLexicon_GetGenerationChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexicon_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexiconWords_INTERFACE_DEFINED__ +#define __ISpeechLexiconWords_INTERFACE_DEFINED__ + +/* interface ISpeechLexiconWords */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexiconWords; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8D199862-415E-47d5-AC4F-FAA608B424E6") + ISpeechLexiconWords : public IDispatch + { + public: + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconWord **Word) = 0; + + virtual /* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconWordsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexiconWords * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexiconWords * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexiconWords * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexiconWords * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexiconWords * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexiconWords * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexiconWords * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechLexiconWords * This, + /* [retval][out] */ long *Count); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechLexiconWords * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconWord **Word); + + /* [restricted][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechLexiconWords * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechLexiconWordsVtbl; + + interface ISpeechLexiconWords + { + CONST_VTBL struct ISpeechLexiconWordsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexiconWords_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexiconWords_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexiconWords_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexiconWords_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexiconWords_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexiconWords_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexiconWords_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexiconWords_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechLexiconWords_Item(This,Index,Word) \ + (This)->lpVtbl -> Item(This,Index,Word) + +#define ISpeechLexiconWords_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWords_get_Count_Proxy( + ISpeechLexiconWords * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechLexiconWords_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWords_Item_Proxy( + ISpeechLexiconWords * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconWord **Word); + + +void __RPC_STUB ISpeechLexiconWords_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWords_get__NewEnum_Proxy( + ISpeechLexiconWords * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechLexiconWords_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexiconWords_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexiconWord_INTERFACE_DEFINED__ +#define __ISpeechLexiconWord_INTERFACE_DEFINED__ + +/* interface ISpeechLexiconWord */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexiconWord; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4E5B933C-C9BE-48ed-8842-1EE51BB1D4FF") + ISpeechLexiconWord : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_LangId( + /* [retval][out] */ SpeechLanguageId *LangId) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ SpeechWordType *WordType) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Word( + /* [retval][out] */ BSTR *Word) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Pronunciations( + /* [retval][out] */ ISpeechLexiconPronunciations **Pronunciations) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconWordVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexiconWord * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexiconWord * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexiconWord * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexiconWord * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexiconWord * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexiconWord * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexiconWord * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_LangId )( + ISpeechLexiconWord * This, + /* [retval][out] */ SpeechLanguageId *LangId); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Type )( + ISpeechLexiconWord * This, + /* [retval][out] */ SpeechWordType *WordType); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Word )( + ISpeechLexiconWord * This, + /* [retval][out] */ BSTR *Word); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Pronunciations )( + ISpeechLexiconWord * This, + /* [retval][out] */ ISpeechLexiconPronunciations **Pronunciations); + + END_INTERFACE + } ISpeechLexiconWordVtbl; + + interface ISpeechLexiconWord + { + CONST_VTBL struct ISpeechLexiconWordVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexiconWord_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexiconWord_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexiconWord_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexiconWord_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexiconWord_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexiconWord_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexiconWord_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexiconWord_get_LangId(This,LangId) \ + (This)->lpVtbl -> get_LangId(This,LangId) + +#define ISpeechLexiconWord_get_Type(This,WordType) \ + (This)->lpVtbl -> get_Type(This,WordType) + +#define ISpeechLexiconWord_get_Word(This,Word) \ + (This)->lpVtbl -> get_Word(This,Word) + +#define ISpeechLexiconWord_get_Pronunciations(This,Pronunciations) \ + (This)->lpVtbl -> get_Pronunciations(This,Pronunciations) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWord_get_LangId_Proxy( + ISpeechLexiconWord * This, + /* [retval][out] */ SpeechLanguageId *LangId); + + +void __RPC_STUB ISpeechLexiconWord_get_LangId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWord_get_Type_Proxy( + ISpeechLexiconWord * This, + /* [retval][out] */ SpeechWordType *WordType); + + +void __RPC_STUB ISpeechLexiconWord_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWord_get_Word_Proxy( + ISpeechLexiconWord * This, + /* [retval][out] */ BSTR *Word); + + +void __RPC_STUB ISpeechLexiconWord_get_Word_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWord_get_Pronunciations_Proxy( + ISpeechLexiconWord * This, + /* [retval][out] */ ISpeechLexiconPronunciations **Pronunciations); + + +void __RPC_STUB ISpeechLexiconWord_get_Pronunciations_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexiconWord_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexiconPronunciations_INTERFACE_DEFINED__ +#define __ISpeechLexiconPronunciations_INTERFACE_DEFINED__ + +/* interface ISpeechLexiconPronunciations */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexiconPronunciations; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("72829128-5682-4704-A0D4-3E2BB6F2EAD3") + ISpeechLexiconPronunciations : public IDispatch + { + public: + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconPronunciation **Pronunciation) = 0; + + virtual /* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconPronunciationsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexiconPronunciations * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexiconPronunciations * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexiconPronunciations * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexiconPronunciations * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexiconPronunciations * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexiconPronunciations * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexiconPronunciations * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechLexiconPronunciations * This, + /* [retval][out] */ long *Count); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechLexiconPronunciations * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconPronunciation **Pronunciation); + + /* [restricted][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechLexiconPronunciations * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechLexiconPronunciationsVtbl; + + interface ISpeechLexiconPronunciations + { + CONST_VTBL struct ISpeechLexiconPronunciationsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexiconPronunciations_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexiconPronunciations_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexiconPronunciations_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexiconPronunciations_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexiconPronunciations_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexiconPronunciations_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexiconPronunciations_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexiconPronunciations_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechLexiconPronunciations_Item(This,Index,Pronunciation) \ + (This)->lpVtbl -> Item(This,Index,Pronunciation) + +#define ISpeechLexiconPronunciations_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciations_get_Count_Proxy( + ISpeechLexiconPronunciations * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechLexiconPronunciations_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciations_Item_Proxy( + ISpeechLexiconPronunciations * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconPronunciation **Pronunciation); + + +void __RPC_STUB ISpeechLexiconPronunciations_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciations_get__NewEnum_Proxy( + ISpeechLexiconPronunciations * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechLexiconPronunciations_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexiconPronunciations_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexiconPronunciation_INTERFACE_DEFINED__ +#define __ISpeechLexiconPronunciation_INTERFACE_DEFINED__ + +/* interface ISpeechLexiconPronunciation */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexiconPronunciation; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("95252C5D-9E43-4f4a-9899-48EE73352F9F") + ISpeechLexiconPronunciation : public IDispatch + { + public: + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ SpeechLexiconType *LexiconType) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_LangId( + /* [retval][out] */ SpeechLanguageId *LangId) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_PartOfSpeech( + /* [retval][out] */ SpeechPartOfSpeech *PartOfSpeech) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_PhoneIds( + /* [retval][out] */ VARIANT *PhoneIds) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Symbolic( + /* [retval][out] */ BSTR *Symbolic) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconPronunciationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexiconPronunciation * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexiconPronunciation * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexiconPronunciation * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexiconPronunciation * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexiconPronunciation * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexiconPronunciation * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexiconPronunciation * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Type )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechLexiconType *LexiconType); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_LangId )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechLanguageId *LangId); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_PartOfSpeech )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechPartOfSpeech *PartOfSpeech); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_PhoneIds )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ VARIANT *PhoneIds); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Symbolic )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ BSTR *Symbolic); + + END_INTERFACE + } ISpeechLexiconPronunciationVtbl; + + interface ISpeechLexiconPronunciation + { + CONST_VTBL struct ISpeechLexiconPronunciationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexiconPronunciation_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexiconPronunciation_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexiconPronunciation_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexiconPronunciation_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexiconPronunciation_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexiconPronunciation_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexiconPronunciation_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexiconPronunciation_get_Type(This,LexiconType) \ + (This)->lpVtbl -> get_Type(This,LexiconType) + +#define ISpeechLexiconPronunciation_get_LangId(This,LangId) \ + (This)->lpVtbl -> get_LangId(This,LangId) + +#define ISpeechLexiconPronunciation_get_PartOfSpeech(This,PartOfSpeech) \ + (This)->lpVtbl -> get_PartOfSpeech(This,PartOfSpeech) + +#define ISpeechLexiconPronunciation_get_PhoneIds(This,PhoneIds) \ + (This)->lpVtbl -> get_PhoneIds(This,PhoneIds) + +#define ISpeechLexiconPronunciation_get_Symbolic(This,Symbolic) \ + (This)->lpVtbl -> get_Symbolic(This,Symbolic) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_Type_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechLexiconType *LexiconType); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_LangId_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechLanguageId *LangId); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_LangId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_PartOfSpeech_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechPartOfSpeech *PartOfSpeech); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_PartOfSpeech_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_PhoneIds_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ VARIANT *PhoneIds); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_PhoneIds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_Symbolic_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ BSTR *Symbolic); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_Symbolic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexiconPronunciation_INTERFACE_DEFINED__ */ + + + +#ifndef __SpeechStringConstants_MODULE_DEFINED__ +#define __SpeechStringConstants_MODULE_DEFINED__ + + +/* module SpeechStringConstants */ +/* [uuid] */ + +const BSTR SpeechRegistryUserRoot = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech"; + +const BSTR SpeechRegistryLocalMachineRoot = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech"; + +const BSTR SpeechCategoryAudioOut = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioOutput"; + +const BSTR SpeechCategoryAudioIn = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput"; + +const BSTR SpeechCategoryVoices = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices"; + +const BSTR SpeechCategoryRecognizers = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Recognizers"; + +const BSTR SpeechCategoryAppLexicons = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AppLexicons"; + +const BSTR SpeechCategoryPhoneConverters = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\PhoneConverters"; + +const BSTR SpeechCategoryRecoProfiles = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\RecoProfiles"; + +const BSTR SpeechTokenIdUserLexicon = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\CurrentUserLexicon"; + +const BSTR SpeechTokenValueCLSID = L"CLSID"; + +const BSTR SpeechTokenKeyFiles = L"Files"; + +const BSTR SpeechTokenKeyUI = L"UI"; + +const BSTR SpeechTokenKeyAttributes = L"Attributes"; + +const BSTR SpeechVoiceCategoryTTSRate = L"DefaultTTSRate"; + +const BSTR SpeechPropertyResourceUsage = L"ResourceUsage"; + +const BSTR SpeechPropertyHighConfidenceThreshold = L"HighConfidenceThreshold"; + +const BSTR SpeechPropertyNormalConfidenceThreshold = L"NormalConfidenceThreshold"; + +const BSTR SpeechPropertyLowConfidenceThreshold = L"LowConfidenceThreshold"; + +const BSTR SpeechPropertyResponseSpeed = L"ResponseSpeed"; + +const BSTR SpeechPropertyComplexResponseSpeed = L"ComplexResponseSpeed"; + +const BSTR SpeechPropertyAdaptationOn = L"AdaptationOn"; + +const BSTR SpeechDictationTopicSpelling = L"Spelling"; + +const BSTR SpeechGrammarTagWildcard = L"..."; + +const BSTR SpeechGrammarTagDictation = L"*"; + +const BSTR SpeechGrammarTagUnlimitedDictation = L"*+"; + +const BSTR SpeechEngineProperties = L"EngineProperties"; + +const BSTR SpeechAddRemoveWord = L"AddRemoveWord"; + +const BSTR SpeechUserTraining = L"UserTraining"; + +const BSTR SpeechMicTraining = L"MicTraining"; + +const BSTR SpeechRecoProfileProperties = L"RecoProfileProperties"; + +const BSTR SpeechAudioProperties = L"AudioProperties"; + +const BSTR SpeechAudioVolume = L"AudioVolume"; + +const BSTR SpeechVoiceSkipTypeSentence = L"Sentence"; + +const BSTR SpeechAudioFormatGUIDWave = L"{C31ADBAE-527F-4ff5-A230-F62BB61FF70C}"; + +const BSTR SpeechAudioFormatGUIDText = L"{7CEEF9F9-3D13-11d2-9EE7-00C04F797396}"; + +#endif /* __SpeechStringConstants_MODULE_DEFINED__ */ + + +#ifndef __SpeechConstants_MODULE_DEFINED__ +#define __SpeechConstants_MODULE_DEFINED__ + + +/* module SpeechConstants */ +/* [uuid] */ + +const float Speech_Default_Weight = DEFAULT_WEIGHT; + +const LONG Speech_Max_Word_Length = SP_MAX_WORD_LENGTH; + +const LONG Speech_Max_Pron_Length = SP_MAX_PRON_LENGTH; + +const LONG Speech_StreamPos_Asap = SP_STREAMPOS_ASAP; + +const LONG Speech_StreamPos_RealTime = SP_STREAMPOS_REALTIME; + +const LONG SpeechAllElements = SPPR_ALL_ELEMENTS; + +#endif /* __SpeechConstants_MODULE_DEFINED__ */ + +#ifndef __ISpeechPhraseInfoBuilder_INTERFACE_DEFINED__ +#define __ISpeechPhraseInfoBuilder_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseInfoBuilder */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseInfoBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3B151836-DF3A-4E0A-846C-D2ADC9334333") + ISpeechPhraseInfoBuilder : public IDispatch + { + public: + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE RestorePhraseFromMemory( + /* [in] */ VARIANT *PhraseInMemory, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseInfoBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseInfoBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseInfoBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseInfoBuilder * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *RestorePhraseFromMemory )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ VARIANT *PhraseInMemory, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + END_INTERFACE + } ISpeechPhraseInfoBuilderVtbl; + + interface ISpeechPhraseInfoBuilder + { + CONST_VTBL struct ISpeechPhraseInfoBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseInfoBuilder_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseInfoBuilder_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseInfoBuilder_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseInfoBuilder_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseInfoBuilder_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseInfoBuilder_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseInfoBuilder_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseInfoBuilder_RestorePhraseFromMemory(This,PhraseInMemory,PhraseInfo) \ + (This)->lpVtbl -> RestorePhraseFromMemory(This,PhraseInMemory,PhraseInfo) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfoBuilder_RestorePhraseFromMemory_Proxy( + ISpeechPhraseInfoBuilder * This, + /* [in] */ VARIANT *PhraseInMemory, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + +void __RPC_STUB ISpeechPhraseInfoBuilder_RestorePhraseFromMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseInfoBuilder_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhoneConverter_INTERFACE_DEFINED__ +#define __ISpeechPhoneConverter_INTERFACE_DEFINED__ + +/* interface ISpeechPhoneConverter */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhoneConverter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C3E4F353-433F-43d6-89A1-6A62A7054C3D") + ISpeechPhoneConverter : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LanguageId( + /* [retval][out] */ SpeechLanguageId *LanguageId) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_LanguageId( + /* [in] */ SpeechLanguageId LanguageId) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE PhoneToId( + /* [in] */ const BSTR Phonemes, + /* [retval][out] */ VARIANT *IdArray) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IdToPhone( + /* [in] */ const VARIANT IdArray, + /* [retval][out] */ BSTR *Phonemes) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhoneConverterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhoneConverter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhoneConverter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhoneConverter * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhoneConverter * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhoneConverter * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhoneConverter * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhoneConverter * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LanguageId )( + ISpeechPhoneConverter * This, + /* [retval][out] */ SpeechLanguageId *LanguageId); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_LanguageId )( + ISpeechPhoneConverter * This, + /* [in] */ SpeechLanguageId LanguageId); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *PhoneToId )( + ISpeechPhoneConverter * This, + /* [in] */ const BSTR Phonemes, + /* [retval][out] */ VARIANT *IdArray); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *IdToPhone )( + ISpeechPhoneConverter * This, + /* [in] */ const VARIANT IdArray, + /* [retval][out] */ BSTR *Phonemes); + + END_INTERFACE + } ISpeechPhoneConverterVtbl; + + interface ISpeechPhoneConverter + { + CONST_VTBL struct ISpeechPhoneConverterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhoneConverter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhoneConverter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhoneConverter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhoneConverter_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhoneConverter_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhoneConverter_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhoneConverter_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhoneConverter_get_LanguageId(This,LanguageId) \ + (This)->lpVtbl -> get_LanguageId(This,LanguageId) + +#define ISpeechPhoneConverter_put_LanguageId(This,LanguageId) \ + (This)->lpVtbl -> put_LanguageId(This,LanguageId) + +#define ISpeechPhoneConverter_PhoneToId(This,Phonemes,IdArray) \ + (This)->lpVtbl -> PhoneToId(This,Phonemes,IdArray) + +#define ISpeechPhoneConverter_IdToPhone(This,IdArray,Phonemes) \ + (This)->lpVtbl -> IdToPhone(This,IdArray,Phonemes) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhoneConverter_get_LanguageId_Proxy( + ISpeechPhoneConverter * This, + /* [retval][out] */ SpeechLanguageId *LanguageId); + + +void __RPC_STUB ISpeechPhoneConverter_get_LanguageId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechPhoneConverter_put_LanguageId_Proxy( + ISpeechPhoneConverter * This, + /* [in] */ SpeechLanguageId LanguageId); + + +void __RPC_STUB ISpeechPhoneConverter_put_LanguageId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechPhoneConverter_PhoneToId_Proxy( + ISpeechPhoneConverter * This, + /* [in] */ const BSTR Phonemes, + /* [retval][out] */ VARIANT *IdArray); + + +void __RPC_STUB ISpeechPhoneConverter_PhoneToId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechPhoneConverter_IdToPhone_Proxy( + ISpeechPhoneConverter * This, + /* [in] */ const VARIANT IdArray, + /* [retval][out] */ BSTR *Phonemes); + + +void __RPC_STUB ISpeechPhoneConverter_IdToPhone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhoneConverter_INTERFACE_DEFINED__ */ + + +EXTERN_C const CLSID CLSID_SpNotifyTranslator; + +#ifdef __cplusplus + +class DECLSPEC_UUID("E2AE5372-5D40-11D2-960E-00C04F8EE628") +SpNotifyTranslator; +#endif + +EXTERN_C const CLSID CLSID_SpObjectTokenCategory; + +#ifdef __cplusplus + +class DECLSPEC_UUID("A910187F-0C7A-45AC-92CC-59EDAFB77B53") +SpObjectTokenCategory; +#endif + +EXTERN_C const CLSID CLSID_SpObjectToken; + +#ifdef __cplusplus + +class DECLSPEC_UUID("EF411752-3736-4CB4-9C8C-8EF4CCB58EFE") +SpObjectToken; +#endif + +EXTERN_C const CLSID CLSID_SpResourceManager; + +#ifdef __cplusplus + +class DECLSPEC_UUID("96749373-3391-11D2-9EE3-00C04F797396") +SpResourceManager; +#endif + +EXTERN_C const CLSID CLSID_SpStreamFormatConverter; + +#ifdef __cplusplus + +class DECLSPEC_UUID("7013943A-E2EC-11D2-A086-00C04F8EF9B5") +SpStreamFormatConverter; +#endif + +EXTERN_C const CLSID CLSID_SpMMAudioEnum; + +#ifdef __cplusplus + +class DECLSPEC_UUID("AB1890A0-E91F-11D2-BB91-00C04F8EE6C0") +SpMMAudioEnum; +#endif + +EXTERN_C const CLSID CLSID_SpMMAudioIn; + +#ifdef __cplusplus + +class DECLSPEC_UUID("CF3D2E50-53F2-11D2-960C-00C04F8EE628") +SpMMAudioIn; +#endif + +EXTERN_C const CLSID CLSID_SpMMAudioOut; + +#ifdef __cplusplus + +class DECLSPEC_UUID("A8C680EB-3D32-11D2-9EE7-00C04F797396") +SpMMAudioOut; +#endif + +EXTERN_C const CLSID CLSID_SpRecPlayAudio; + +#ifdef __cplusplus + +class DECLSPEC_UUID("FEE225FC-7AFD-45E9-95D0-5A318079D911") +SpRecPlayAudio; +#endif + +EXTERN_C const CLSID CLSID_SpStream; + +#ifdef __cplusplus + +class DECLSPEC_UUID("715D9C59-4442-11D2-9605-00C04F8EE628") +SpStream; +#endif + +EXTERN_C const CLSID CLSID_SpVoice; + +#ifdef __cplusplus + +class DECLSPEC_UUID("96749377-3391-11D2-9EE3-00C04F797396") +SpVoice; +#endif + +EXTERN_C const CLSID CLSID_SpSharedRecoContext; + +#ifdef __cplusplus + +class DECLSPEC_UUID("47206204-5ECA-11D2-960F-00C04F8EE628") +SpSharedRecoContext; +#endif + +EXTERN_C const CLSID CLSID_SpInprocRecognizer; + +#ifdef __cplusplus + +class DECLSPEC_UUID("41B89B6B-9399-11D2-9623-00C04F8EE628") +SpInprocRecognizer; +#endif + +EXTERN_C const CLSID CLSID_SpSharedRecognizer; + +#ifdef __cplusplus + +class DECLSPEC_UUID("3BEE4890-4FE9-4A37-8C1E-5E7E12791C1F") +SpSharedRecognizer; +#endif + +EXTERN_C const CLSID CLSID_SpLexicon; + +#ifdef __cplusplus + +class DECLSPEC_UUID("0655E396-25D0-11D3-9C26-00C04F8EF87C") +SpLexicon; +#endif + +EXTERN_C const CLSID CLSID_SpUnCompressedLexicon; + +#ifdef __cplusplus + +class DECLSPEC_UUID("C9E37C15-DF92-4727-85D6-72E5EEB6995A") +SpUnCompressedLexicon; +#endif + +EXTERN_C const CLSID CLSID_SpCompressedLexicon; + +#ifdef __cplusplus + +class DECLSPEC_UUID("90903716-2F42-11D3-9C26-00C04F8EF87C") +SpCompressedLexicon; +#endif + +EXTERN_C const CLSID CLSID_SpPhoneConverter; + +#ifdef __cplusplus + +class DECLSPEC_UUID("9185F743-1143-4C28-86B5-BFF14F20E5C8") +SpPhoneConverter; +#endif + +EXTERN_C const CLSID CLSID_SpNullPhoneConverter; + +#ifdef __cplusplus + +class DECLSPEC_UUID("455F24E9-7396-4A16-9715-7C0FDBE3EFE3") +SpNullPhoneConverter; +#endif + +EXTERN_C const CLSID CLSID_SpTextSelectionInformation; + +#ifdef __cplusplus + +class DECLSPEC_UUID("0F92030A-CBFD-4AB8-A164-FF5985547FF6") +SpTextSelectionInformation; +#endif + +EXTERN_C const CLSID CLSID_SpPhraseInfoBuilder; + +#ifdef __cplusplus + +class DECLSPEC_UUID("C23FC28D-C55F-4720-8B32-91F73C2BD5D1") +SpPhraseInfoBuilder; +#endif + +EXTERN_C const CLSID CLSID_SpAudioFormat; + +#ifdef __cplusplus + +class DECLSPEC_UUID("9EF96870-E160-4792-820D-48CF0649E4EC") +SpAudioFormat; +#endif + +EXTERN_C const CLSID CLSID_SpWaveFormatEx; + +#ifdef __cplusplus + +class DECLSPEC_UUID("C79A574C-63BE-44b9-801F-283F87F898BE") +SpWaveFormatEx; +#endif + +EXTERN_C const CLSID CLSID_SpInProcRecoContext; + +#ifdef __cplusplus + +class DECLSPEC_UUID("73AD6842-ACE0-45E8-A4DD-8795881A2C2A") +SpInProcRecoContext; +#endif + +EXTERN_C const CLSID CLSID_SpCustomStream; + +#ifdef __cplusplus + +class DECLSPEC_UUID("8DBEF13F-1948-4aa8-8CF0-048EEBED95D8") +SpCustomStream; +#endif + +EXTERN_C const CLSID CLSID_SpFileStream; + +#ifdef __cplusplus + +class DECLSPEC_UUID("947812B3-2AE1-4644-BA86-9E90DED7EC91") +SpFileStream; +#endif + +EXTERN_C const CLSID CLSID_SpMemoryStream; + +#ifdef __cplusplus + +class DECLSPEC_UUID("5FB7EF7D-DFF4-468a-B6B7-2FCBD188F994") +SpMemoryStream; +#endif +#endif /* __SpeechLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/mp/src/utils/sapi51/Include/sapiddk.h b/mp/src/utils/sapi51/Include/sapiddk.h new file mode 100644 index 00000000..c311aad3 --- /dev/null +++ b/mp/src/utils/sapi51/Include/sapiddk.h @@ -0,0 +1,4557 @@ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 6.00.0347 */ +/* Compiler settings for sapiddk.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __sapiddk_h__ +#define __sapiddk_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ISpTokenUI_FWD_DEFINED__ +#define __ISpTokenUI_FWD_DEFINED__ +typedef interface ISpTokenUI ISpTokenUI; +#endif /* __ISpTokenUI_FWD_DEFINED__ */ + + +#ifndef __ISpObjectTokenEnumBuilder_FWD_DEFINED__ +#define __ISpObjectTokenEnumBuilder_FWD_DEFINED__ +typedef interface ISpObjectTokenEnumBuilder ISpObjectTokenEnumBuilder; +#endif /* __ISpObjectTokenEnumBuilder_FWD_DEFINED__ */ + + +#ifndef __ISpErrorLog_FWD_DEFINED__ +#define __ISpErrorLog_FWD_DEFINED__ +typedef interface ISpErrorLog ISpErrorLog; +#endif /* __ISpErrorLog_FWD_DEFINED__ */ + + +#ifndef __ISpGrammarCompiler_FWD_DEFINED__ +#define __ISpGrammarCompiler_FWD_DEFINED__ +typedef interface ISpGrammarCompiler ISpGrammarCompiler; +#endif /* __ISpGrammarCompiler_FWD_DEFINED__ */ + + +#ifndef __ISpGramCompBackend_FWD_DEFINED__ +#define __ISpGramCompBackend_FWD_DEFINED__ +typedef interface ISpGramCompBackend ISpGramCompBackend; +#endif /* __ISpGramCompBackend_FWD_DEFINED__ */ + + +#ifndef __ISpITNProcessor_FWD_DEFINED__ +#define __ISpITNProcessor_FWD_DEFINED__ +typedef interface ISpITNProcessor ISpITNProcessor; +#endif /* __ISpITNProcessor_FWD_DEFINED__ */ + + +#ifndef __ISpPhraseBuilder_FWD_DEFINED__ +#define __ISpPhraseBuilder_FWD_DEFINED__ +typedef interface ISpPhraseBuilder ISpPhraseBuilder; +#endif /* __ISpPhraseBuilder_FWD_DEFINED__ */ + + +#ifndef __ISpThreadControl_FWD_DEFINED__ +#define __ISpThreadControl_FWD_DEFINED__ +typedef interface ISpThreadControl ISpThreadControl; +#endif /* __ISpThreadControl_FWD_DEFINED__ */ + + +#ifndef __ISpTaskManager_FWD_DEFINED__ +#define __ISpTaskManager_FWD_DEFINED__ +typedef interface ISpTaskManager ISpTaskManager; +#endif /* __ISpTaskManager_FWD_DEFINED__ */ + + +#ifndef __ISpTTSEngineSite_FWD_DEFINED__ +#define __ISpTTSEngineSite_FWD_DEFINED__ +typedef interface ISpTTSEngineSite ISpTTSEngineSite; +#endif /* __ISpTTSEngineSite_FWD_DEFINED__ */ + + +#ifndef __ISpTTSEngine_FWD_DEFINED__ +#define __ISpTTSEngine_FWD_DEFINED__ +typedef interface ISpTTSEngine ISpTTSEngine; +#endif /* __ISpTTSEngine_FWD_DEFINED__ */ + + +#ifndef __ISpCFGInterpreterSite_FWD_DEFINED__ +#define __ISpCFGInterpreterSite_FWD_DEFINED__ +typedef interface ISpCFGInterpreterSite ISpCFGInterpreterSite; +#endif /* __ISpCFGInterpreterSite_FWD_DEFINED__ */ + + +#ifndef __ISpCFGInterpreter_FWD_DEFINED__ +#define __ISpCFGInterpreter_FWD_DEFINED__ +typedef interface ISpCFGInterpreter ISpCFGInterpreter; +#endif /* __ISpCFGInterpreter_FWD_DEFINED__ */ + + +#ifndef __ISpSREngineSite_FWD_DEFINED__ +#define __ISpSREngineSite_FWD_DEFINED__ +typedef interface ISpSREngineSite ISpSREngineSite; +#endif /* __ISpSREngineSite_FWD_DEFINED__ */ + + +#ifndef __ISpSREngine_FWD_DEFINED__ +#define __ISpSREngine_FWD_DEFINED__ +typedef interface ISpSREngine ISpSREngine; +#endif /* __ISpSREngine_FWD_DEFINED__ */ + + +#ifndef __ISpSRAlternates_FWD_DEFINED__ +#define __ISpSRAlternates_FWD_DEFINED__ +typedef interface ISpSRAlternates ISpSRAlternates; +#endif /* __ISpSRAlternates_FWD_DEFINED__ */ + + +#ifndef ___ISpPrivateEngineCall_FWD_DEFINED__ +#define ___ISpPrivateEngineCall_FWD_DEFINED__ +typedef interface _ISpPrivateEngineCall _ISpPrivateEngineCall; +#endif /* ___ISpPrivateEngineCall_FWD_DEFINED__ */ + + +#ifndef __SpDataKey_FWD_DEFINED__ +#define __SpDataKey_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpDataKey SpDataKey; +#else +typedef struct SpDataKey SpDataKey; +#endif /* __cplusplus */ + +#endif /* __SpDataKey_FWD_DEFINED__ */ + + +#ifndef __SpObjectTokenEnum_FWD_DEFINED__ +#define __SpObjectTokenEnum_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpObjectTokenEnum SpObjectTokenEnum; +#else +typedef struct SpObjectTokenEnum SpObjectTokenEnum; +#endif /* __cplusplus */ + +#endif /* __SpObjectTokenEnum_FWD_DEFINED__ */ + + +#ifndef __SpPhraseBuilder_FWD_DEFINED__ +#define __SpPhraseBuilder_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpPhraseBuilder SpPhraseBuilder; +#else +typedef struct SpPhraseBuilder SpPhraseBuilder; +#endif /* __cplusplus */ + +#endif /* __SpPhraseBuilder_FWD_DEFINED__ */ + + +#ifndef __SpITNProcessor_FWD_DEFINED__ +#define __SpITNProcessor_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpITNProcessor SpITNProcessor; +#else +typedef struct SpITNProcessor SpITNProcessor; +#endif /* __cplusplus */ + +#endif /* __SpITNProcessor_FWD_DEFINED__ */ + + +#ifndef __SpGrammarCompiler_FWD_DEFINED__ +#define __SpGrammarCompiler_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpGrammarCompiler SpGrammarCompiler; +#else +typedef struct SpGrammarCompiler SpGrammarCompiler; +#endif /* __cplusplus */ + +#endif /* __SpGrammarCompiler_FWD_DEFINED__ */ + + +#ifndef __SpGramCompBackend_FWD_DEFINED__ +#define __SpGramCompBackend_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpGramCompBackend SpGramCompBackend; +#else +typedef struct SpGramCompBackend SpGramCompBackend; +#endif /* __cplusplus */ + +#endif /* __SpGramCompBackend_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "sapi.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +void * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void * ); + +/* interface __MIDL_itf_sapiddk_0000 */ +/* [local] */ + + + + + + +#define SPRECOEXTENSION L"RecoExtension" +#define SPALTERNATESCLSID L"AlternatesCLSID" + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0000_v0_0_s_ifspec; + +#ifndef __ISpTokenUI_INTERFACE_DEFINED__ +#define __ISpTokenUI_INTERFACE_DEFINED__ + +/* interface ISpTokenUI */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpTokenUI; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F8E690F0-39CB-4843-B8D7-C84696E1119D") + ISpTokenUI : public IUnknown + { + public: + virtual /* [local] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ ISpObjectToken *pToken, + /* [in] */ IUnknown *punkObject) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTokenUIVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTokenUI * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTokenUI * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTokenUI * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpTokenUI * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpTokenUI * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ ISpObjectToken *pToken, + /* [in] */ IUnknown *punkObject); + + END_INTERFACE + } ISpTokenUIVtbl; + + interface ISpTokenUI + { + CONST_VTBL struct ISpTokenUIVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTokenUI_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTokenUI_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTokenUI_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTokenUI_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) + +#define ISpTokenUI_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,pToken,punkObject) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,pToken,punkObject) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpTokenUI_IsUISupported_Proxy( + ISpTokenUI * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + +void __RPC_STUB ISpTokenUI_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpTokenUI_DisplayUI_Proxy( + ISpTokenUI * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ ISpObjectToken *pToken, + /* [in] */ IUnknown *punkObject); + + +void __RPC_STUB ISpTokenUI_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTokenUI_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectTokenEnumBuilder_INTERFACE_DEFINED__ +#define __ISpObjectTokenEnumBuilder_INTERFACE_DEFINED__ + +/* interface ISpObjectTokenEnumBuilder */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectTokenEnumBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("06B64F9F-7FDA-11d2-B4F2-00C04F797396") + ISpObjectTokenEnumBuilder : public IEnumSpObjectTokens + { + public: + virtual HRESULT STDMETHODCALLTYPE SetAttribs( + const WCHAR *pszReqAttribs, + const WCHAR *pszOptAttribs) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddTokens( + ULONG cTokens, + ISpObjectToken **pToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddTokensFromDataKey( + ISpDataKey *pDataKey, + const WCHAR *pszSubKey, + const WCHAR *pszCategoryId) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddTokensFromTokenEnum( + IEnumSpObjectTokens *pTokenEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE Sort( + const WCHAR *pszTokenIdToListFirst) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectTokenEnumBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectTokenEnumBuilder * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectTokenEnumBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectTokenEnumBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + ISpObjectTokenEnumBuilder * This, + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ ISpObjectToken **pelt, + /* [out] */ ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + ISpObjectTokenEnumBuilder * This, + /* [in] */ ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ISpObjectTokenEnumBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpObjectTokenEnumBuilder * This, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + HRESULT ( STDMETHODCALLTYPE *Item )( + ISpObjectTokenEnumBuilder * This, + /* [in] */ ULONG Index, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *GetCount )( + ISpObjectTokenEnumBuilder * This, + /* [out] */ ULONG *pCount); + + HRESULT ( STDMETHODCALLTYPE *SetAttribs )( + ISpObjectTokenEnumBuilder * This, + const WCHAR *pszReqAttribs, + const WCHAR *pszOptAttribs); + + HRESULT ( STDMETHODCALLTYPE *AddTokens )( + ISpObjectTokenEnumBuilder * This, + ULONG cTokens, + ISpObjectToken **pToken); + + HRESULT ( STDMETHODCALLTYPE *AddTokensFromDataKey )( + ISpObjectTokenEnumBuilder * This, + ISpDataKey *pDataKey, + const WCHAR *pszSubKey, + const WCHAR *pszCategoryId); + + HRESULT ( STDMETHODCALLTYPE *AddTokensFromTokenEnum )( + ISpObjectTokenEnumBuilder * This, + IEnumSpObjectTokens *pTokenEnum); + + HRESULT ( STDMETHODCALLTYPE *Sort )( + ISpObjectTokenEnumBuilder * This, + const WCHAR *pszTokenIdToListFirst); + + END_INTERFACE + } ISpObjectTokenEnumBuilderVtbl; + + interface ISpObjectTokenEnumBuilder + { + CONST_VTBL struct ISpObjectTokenEnumBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectTokenEnumBuilder_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectTokenEnumBuilder_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectTokenEnumBuilder_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectTokenEnumBuilder_Next(This,celt,pelt,pceltFetched) \ + (This)->lpVtbl -> Next(This,celt,pelt,pceltFetched) + +#define ISpObjectTokenEnumBuilder_Skip(This,celt) \ + (This)->lpVtbl -> Skip(This,celt) + +#define ISpObjectTokenEnumBuilder_Reset(This) \ + (This)->lpVtbl -> Reset(This) + +#define ISpObjectTokenEnumBuilder_Clone(This,ppEnum) \ + (This)->lpVtbl -> Clone(This,ppEnum) + +#define ISpObjectTokenEnumBuilder_Item(This,Index,ppToken) \ + (This)->lpVtbl -> Item(This,Index,ppToken) + +#define ISpObjectTokenEnumBuilder_GetCount(This,pCount) \ + (This)->lpVtbl -> GetCount(This,pCount) + + +#define ISpObjectTokenEnumBuilder_SetAttribs(This,pszReqAttribs,pszOptAttribs) \ + (This)->lpVtbl -> SetAttribs(This,pszReqAttribs,pszOptAttribs) + +#define ISpObjectTokenEnumBuilder_AddTokens(This,cTokens,pToken) \ + (This)->lpVtbl -> AddTokens(This,cTokens,pToken) + +#define ISpObjectTokenEnumBuilder_AddTokensFromDataKey(This,pDataKey,pszSubKey,pszCategoryId) \ + (This)->lpVtbl -> AddTokensFromDataKey(This,pDataKey,pszSubKey,pszCategoryId) + +#define ISpObjectTokenEnumBuilder_AddTokensFromTokenEnum(This,pTokenEnum) \ + (This)->lpVtbl -> AddTokensFromTokenEnum(This,pTokenEnum) + +#define ISpObjectTokenEnumBuilder_Sort(This,pszTokenIdToListFirst) \ + (This)->lpVtbl -> Sort(This,pszTokenIdToListFirst) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_SetAttribs_Proxy( + ISpObjectTokenEnumBuilder * This, + const WCHAR *pszReqAttribs, + const WCHAR *pszOptAttribs); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_SetAttribs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_AddTokens_Proxy( + ISpObjectTokenEnumBuilder * This, + ULONG cTokens, + ISpObjectToken **pToken); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_AddTokens_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_AddTokensFromDataKey_Proxy( + ISpObjectTokenEnumBuilder * This, + ISpDataKey *pDataKey, + const WCHAR *pszSubKey, + const WCHAR *pszCategoryId); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_AddTokensFromDataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_AddTokensFromTokenEnum_Proxy( + ISpObjectTokenEnumBuilder * This, + IEnumSpObjectTokens *pTokenEnum); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_AddTokensFromTokenEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_Sort_Proxy( + ISpObjectTokenEnumBuilder * This, + const WCHAR *pszTokenIdToListFirst); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_Sort_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectTokenEnumBuilder_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0339 */ +/* [local] */ + +#if 0 +typedef void *SPWORDHANDLE; + +typedef void *SPRULEHANDLE; + +typedef void *SPGRAMMARHANDLE; + +typedef void *SPRECOCONTEXTHANDLE; + +typedef void *SPPHRASERULEHANDLE; + +typedef void *SPPHRASEPROPERTYHANDLE; + +typedef void *SPTRANSITIONID; + +#else +DECLARE_HANDLE(SPWORDHANDLE); +DECLARE_HANDLE(SPRULEHANDLE); +DECLARE_HANDLE(SPGRAMMARHANDLE); +DECLARE_HANDLE(SPRECOCONTEXTHANDLE); +DECLARE_HANDLE(SPPHRASERULEHANDLE); +DECLARE_HANDLE(SPPHRASEPROPERTYHANDLE); +DECLARE_HANDLE(SPTRANSITIONID); +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0339_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0339_v0_0_s_ifspec; + +#ifndef __ISpErrorLog_INTERFACE_DEFINED__ +#define __ISpErrorLog_INTERFACE_DEFINED__ + +/* interface ISpErrorLog */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpErrorLog; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F4711347-E608-11d2-A086-00C04F8EF9B5") + ISpErrorLog : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AddError( + const long lLineNumber, + HRESULT hr, + const WCHAR *pszDescription, + const WCHAR *pszHelpFile, + DWORD dwHelpContext) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpErrorLogVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpErrorLog * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpErrorLog * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpErrorLog * This); + + HRESULT ( STDMETHODCALLTYPE *AddError )( + ISpErrorLog * This, + const long lLineNumber, + HRESULT hr, + const WCHAR *pszDescription, + const WCHAR *pszHelpFile, + DWORD dwHelpContext); + + END_INTERFACE + } ISpErrorLogVtbl; + + interface ISpErrorLog + { + CONST_VTBL struct ISpErrorLogVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpErrorLog_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpErrorLog_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpErrorLog_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpErrorLog_AddError(This,lLineNumber,hr,pszDescription,pszHelpFile,dwHelpContext) \ + (This)->lpVtbl -> AddError(This,lLineNumber,hr,pszDescription,pszHelpFile,dwHelpContext) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpErrorLog_AddError_Proxy( + ISpErrorLog * This, + const long lLineNumber, + HRESULT hr, + const WCHAR *pszDescription, + const WCHAR *pszHelpFile, + DWORD dwHelpContext); + + +void __RPC_STUB ISpErrorLog_AddError_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpErrorLog_INTERFACE_DEFINED__ */ + + +#ifndef __ISpGrammarCompiler_INTERFACE_DEFINED__ +#define __ISpGrammarCompiler_INTERFACE_DEFINED__ + +/* interface ISpGrammarCompiler */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpGrammarCompiler; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B1E29D58-A675-11D2-8302-00C04F8EE6C0") + ISpGrammarCompiler : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CompileStream( + IStream *pSource, + IStream *pDest, + IStream *pHeader, + IUnknown *pReserved, + ISpErrorLog *pErrorLog, + /* [in] */ DWORD dwFlags) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpGrammarCompilerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpGrammarCompiler * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpGrammarCompiler * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpGrammarCompiler * This); + + HRESULT ( STDMETHODCALLTYPE *CompileStream )( + ISpGrammarCompiler * This, + IStream *pSource, + IStream *pDest, + IStream *pHeader, + IUnknown *pReserved, + ISpErrorLog *pErrorLog, + /* [in] */ DWORD dwFlags); + + END_INTERFACE + } ISpGrammarCompilerVtbl; + + interface ISpGrammarCompiler + { + CONST_VTBL struct ISpGrammarCompilerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpGrammarCompiler_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpGrammarCompiler_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpGrammarCompiler_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpGrammarCompiler_CompileStream(This,pSource,pDest,pHeader,pReserved,pErrorLog,dwFlags) \ + (This)->lpVtbl -> CompileStream(This,pSource,pDest,pHeader,pReserved,pErrorLog,dwFlags) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpGrammarCompiler_CompileStream_Proxy( + ISpGrammarCompiler * This, + IStream *pSource, + IStream *pDest, + IStream *pHeader, + IUnknown *pReserved, + ISpErrorLog *pErrorLog, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB ISpGrammarCompiler_CompileStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpGrammarCompiler_INTERFACE_DEFINED__ */ + + +#ifndef __ISpGramCompBackend_INTERFACE_DEFINED__ +#define __ISpGramCompBackend_INTERFACE_DEFINED__ + +/* interface ISpGramCompBackend */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpGramCompBackend; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3DDCA27C-665C-4786-9F97-8C90C3488B61") + ISpGramCompBackend : public ISpGrammarBuilder + { + public: + virtual HRESULT STDMETHODCALLTYPE SetSaveObjects( + IStream *pStream, + ISpErrorLog *pErrorLog) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitFromBinaryGrammar( + const SPBINARYGRAMMAR *pBinaryData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpGramCompBackendVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpGramCompBackend * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpGramCompBackend * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpGramCompBackend * This); + + HRESULT ( STDMETHODCALLTYPE *ResetGrammar )( + ISpGramCompBackend * This, + /* [in] */ WORD NewLanguage); + + HRESULT ( STDMETHODCALLTYPE *GetRule )( + ISpGramCompBackend * This, + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState); + + HRESULT ( STDMETHODCALLTYPE *ClearRule )( + ISpGramCompBackend * This, + SPSTATEHANDLE hState); + + HRESULT ( STDMETHODCALLTYPE *CreateNewState )( + ISpGramCompBackend * This, + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState); + + HRESULT ( STDMETHODCALLTYPE *AddWordTransition )( + ISpGramCompBackend * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddRuleTransition )( + ISpGramCompBackend * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddResource )( + ISpGramCompBackend * This, + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpGramCompBackend * This, + DWORD dwReserved); + + HRESULT ( STDMETHODCALLTYPE *SetSaveObjects )( + ISpGramCompBackend * This, + IStream *pStream, + ISpErrorLog *pErrorLog); + + HRESULT ( STDMETHODCALLTYPE *InitFromBinaryGrammar )( + ISpGramCompBackend * This, + const SPBINARYGRAMMAR *pBinaryData); + + END_INTERFACE + } ISpGramCompBackendVtbl; + + interface ISpGramCompBackend + { + CONST_VTBL struct ISpGramCompBackendVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpGramCompBackend_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpGramCompBackend_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpGramCompBackend_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpGramCompBackend_ResetGrammar(This,NewLanguage) \ + (This)->lpVtbl -> ResetGrammar(This,NewLanguage) + +#define ISpGramCompBackend_GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) \ + (This)->lpVtbl -> GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) + +#define ISpGramCompBackend_ClearRule(This,hState) \ + (This)->lpVtbl -> ClearRule(This,hState) + +#define ISpGramCompBackend_CreateNewState(This,hState,phState) \ + (This)->lpVtbl -> CreateNewState(This,hState,phState) + +#define ISpGramCompBackend_AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) \ + (This)->lpVtbl -> AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) + +#define ISpGramCompBackend_AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) \ + (This)->lpVtbl -> AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) + +#define ISpGramCompBackend_AddResource(This,hRuleState,pszResourceName,pszResourceValue) \ + (This)->lpVtbl -> AddResource(This,hRuleState,pszResourceName,pszResourceValue) + +#define ISpGramCompBackend_Commit(This,dwReserved) \ + (This)->lpVtbl -> Commit(This,dwReserved) + + +#define ISpGramCompBackend_SetSaveObjects(This,pStream,pErrorLog) \ + (This)->lpVtbl -> SetSaveObjects(This,pStream,pErrorLog) + +#define ISpGramCompBackend_InitFromBinaryGrammar(This,pBinaryData) \ + (This)->lpVtbl -> InitFromBinaryGrammar(This,pBinaryData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpGramCompBackend_SetSaveObjects_Proxy( + ISpGramCompBackend * This, + IStream *pStream, + ISpErrorLog *pErrorLog); + + +void __RPC_STUB ISpGramCompBackend_SetSaveObjects_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGramCompBackend_InitFromBinaryGrammar_Proxy( + ISpGramCompBackend * This, + const SPBINARYGRAMMAR *pBinaryData); + + +void __RPC_STUB ISpGramCompBackend_InitFromBinaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpGramCompBackend_INTERFACE_DEFINED__ */ + + +#ifndef __ISpITNProcessor_INTERFACE_DEFINED__ +#define __ISpITNProcessor_INTERFACE_DEFINED__ + +/* interface ISpITNProcessor */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpITNProcessor; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("12D7360F-A1C9-11d3-BC90-00C04F72DF9F") + ISpITNProcessor : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE LoadITNGrammar( + WCHAR *pszCLSID) = 0; + + virtual HRESULT STDMETHODCALLTYPE ITNPhrase( + ISpPhraseBuilder *pPhrase) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpITNProcessorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpITNProcessor * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpITNProcessor * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpITNProcessor * This); + + HRESULT ( STDMETHODCALLTYPE *LoadITNGrammar )( + ISpITNProcessor * This, + WCHAR *pszCLSID); + + HRESULT ( STDMETHODCALLTYPE *ITNPhrase )( + ISpITNProcessor * This, + ISpPhraseBuilder *pPhrase); + + END_INTERFACE + } ISpITNProcessorVtbl; + + interface ISpITNProcessor + { + CONST_VTBL struct ISpITNProcessorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpITNProcessor_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpITNProcessor_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpITNProcessor_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpITNProcessor_LoadITNGrammar(This,pszCLSID) \ + (This)->lpVtbl -> LoadITNGrammar(This,pszCLSID) + +#define ISpITNProcessor_ITNPhrase(This,pPhrase) \ + (This)->lpVtbl -> ITNPhrase(This,pPhrase) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpITNProcessor_LoadITNGrammar_Proxy( + ISpITNProcessor * This, + WCHAR *pszCLSID); + + +void __RPC_STUB ISpITNProcessor_LoadITNGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpITNProcessor_ITNPhrase_Proxy( + ISpITNProcessor * This, + ISpPhraseBuilder *pPhrase); + + +void __RPC_STUB ISpITNProcessor_ITNPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpITNProcessor_INTERFACE_DEFINED__ */ + + +#ifndef __ISpPhraseBuilder_INTERFACE_DEFINED__ +#define __ISpPhraseBuilder_INTERFACE_DEFINED__ + +/* interface ISpPhraseBuilder */ +/* [restricted][unique][helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_ISpPhraseBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("88A3342A-0BED-4834-922B-88D43173162F") + ISpPhraseBuilder : public ISpPhrase + { + public: + virtual HRESULT STDMETHODCALLTYPE InitFromPhrase( + const SPPHRASE *pPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitFromSerializedPhrase( + const SPSERIALIZEDPHRASE *pPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddElements( + ULONG cElements, + const SPPHRASEELEMENT *pElement) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddRules( + const SPPHRASERULEHANDLE hParent, + const SPPHRASERULE *pRule, + SPPHRASERULEHANDLE *phNewRule) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddProperties( + const SPPHRASEPROPERTYHANDLE hParent, + const SPPHRASEPROPERTY *pProperty, + SPPHRASEPROPERTYHANDLE *phNewProperty) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddReplacements( + ULONG cReplacements, + const SPPHRASEREPLACEMENT *pReplacements) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPhraseBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpPhraseBuilder * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpPhraseBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpPhraseBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *GetPhrase )( + ISpPhraseBuilder * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetSerializedPhrase )( + ISpPhraseBuilder * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpPhraseBuilder * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + HRESULT ( STDMETHODCALLTYPE *Discard )( + ISpPhraseBuilder * This, + /* [in] */ DWORD dwValueTypes); + + HRESULT ( STDMETHODCALLTYPE *InitFromPhrase )( + ISpPhraseBuilder * This, + const SPPHRASE *pPhrase); + + HRESULT ( STDMETHODCALLTYPE *InitFromSerializedPhrase )( + ISpPhraseBuilder * This, + const SPSERIALIZEDPHRASE *pPhrase); + + HRESULT ( STDMETHODCALLTYPE *AddElements )( + ISpPhraseBuilder * This, + ULONG cElements, + const SPPHRASEELEMENT *pElement); + + HRESULT ( STDMETHODCALLTYPE *AddRules )( + ISpPhraseBuilder * This, + const SPPHRASERULEHANDLE hParent, + const SPPHRASERULE *pRule, + SPPHRASERULEHANDLE *phNewRule); + + HRESULT ( STDMETHODCALLTYPE *AddProperties )( + ISpPhraseBuilder * This, + const SPPHRASEPROPERTYHANDLE hParent, + const SPPHRASEPROPERTY *pProperty, + SPPHRASEPROPERTYHANDLE *phNewProperty); + + HRESULT ( STDMETHODCALLTYPE *AddReplacements )( + ISpPhraseBuilder * This, + ULONG cReplacements, + const SPPHRASEREPLACEMENT *pReplacements); + + END_INTERFACE + } ISpPhraseBuilderVtbl; + + interface ISpPhraseBuilder + { + CONST_VTBL struct ISpPhraseBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpPhraseBuilder_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpPhraseBuilder_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpPhraseBuilder_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpPhraseBuilder_GetPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetPhrase(This,ppCoMemPhrase) + +#define ISpPhraseBuilder_GetSerializedPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetSerializedPhrase(This,ppCoMemPhrase) + +#define ISpPhraseBuilder_GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) \ + (This)->lpVtbl -> GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) + +#define ISpPhraseBuilder_Discard(This,dwValueTypes) \ + (This)->lpVtbl -> Discard(This,dwValueTypes) + + +#define ISpPhraseBuilder_InitFromPhrase(This,pPhrase) \ + (This)->lpVtbl -> InitFromPhrase(This,pPhrase) + +#define ISpPhraseBuilder_InitFromSerializedPhrase(This,pPhrase) \ + (This)->lpVtbl -> InitFromSerializedPhrase(This,pPhrase) + +#define ISpPhraseBuilder_AddElements(This,cElements,pElement) \ + (This)->lpVtbl -> AddElements(This,cElements,pElement) + +#define ISpPhraseBuilder_AddRules(This,hParent,pRule,phNewRule) \ + (This)->lpVtbl -> AddRules(This,hParent,pRule,phNewRule) + +#define ISpPhraseBuilder_AddProperties(This,hParent,pProperty,phNewProperty) \ + (This)->lpVtbl -> AddProperties(This,hParent,pProperty,phNewProperty) + +#define ISpPhraseBuilder_AddReplacements(This,cReplacements,pReplacements) \ + (This)->lpVtbl -> AddReplacements(This,cReplacements,pReplacements) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_InitFromPhrase_Proxy( + ISpPhraseBuilder * This, + const SPPHRASE *pPhrase); + + +void __RPC_STUB ISpPhraseBuilder_InitFromPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_InitFromSerializedPhrase_Proxy( + ISpPhraseBuilder * This, + const SPSERIALIZEDPHRASE *pPhrase); + + +void __RPC_STUB ISpPhraseBuilder_InitFromSerializedPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_AddElements_Proxy( + ISpPhraseBuilder * This, + ULONG cElements, + const SPPHRASEELEMENT *pElement); + + +void __RPC_STUB ISpPhraseBuilder_AddElements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_AddRules_Proxy( + ISpPhraseBuilder * This, + const SPPHRASERULEHANDLE hParent, + const SPPHRASERULE *pRule, + SPPHRASERULEHANDLE *phNewRule); + + +void __RPC_STUB ISpPhraseBuilder_AddRules_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_AddProperties_Proxy( + ISpPhraseBuilder * This, + const SPPHRASEPROPERTYHANDLE hParent, + const SPPHRASEPROPERTY *pProperty, + SPPHRASEPROPERTYHANDLE *phNewProperty); + + +void __RPC_STUB ISpPhraseBuilder_AddProperties_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_AddReplacements_Proxy( + ISpPhraseBuilder * This, + ULONG cReplacements, + const SPPHRASEREPLACEMENT *pReplacements); + + +void __RPC_STUB ISpPhraseBuilder_AddReplacements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpPhraseBuilder_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0344 */ +/* [local] */ + +#if defined(__cplusplus) +interface ISpTask +{ +virtual HRESULT STDMETHODCALLTYPE Execute( + void *pvTaskData, + volatile const BOOL* pfContinueProcessing) = 0; +}; +#else +typedef void *ISpTask; + +#endif +#if defined(__cplusplus) +interface ISpThreadTask +{ +virtual HRESULT STDMETHODCALLTYPE InitThread( + void * pvTaskData, + HWND hwnd) = 0; +virtual HRESULT STDMETHODCALLTYPE ThreadProc( + void *pvTaskData, + HANDLE hExitThreadEvent, + HANDLE hNotifyEvent, + HWND hwndWorker, + volatile const BOOL * pfContinueProcessing) = 0; +virtual LRESULT STDMETHODCALLTYPE WindowMessage( + void *pvTaskData, + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam) = 0; +}; +#else +typedef void *ISpThreadTask; + +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0344_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0344_v0_0_s_ifspec; + +#ifndef __ISpThreadControl_INTERFACE_DEFINED__ +#define __ISpThreadControl_INTERFACE_DEFINED__ + +/* interface ISpThreadControl */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpThreadControl; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A6BE4D73-4403-4358-B22D-0346E23B1764") + ISpThreadControl : public ISpNotifySink + { + public: + virtual HRESULT STDMETHODCALLTYPE StartThread( + DWORD dwFlags, + HWND *phwnd) = 0; + + virtual HRESULT STDMETHODCALLTYPE WaitForThreadDone( + BOOL fForceStop, + HRESULT *phrThreadResult, + ULONG msTimeOut) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateThread( void) = 0; + + virtual HANDLE STDMETHODCALLTYPE ThreadHandle( void) = 0; + + virtual DWORD STDMETHODCALLTYPE ThreadId( void) = 0; + + virtual HANDLE STDMETHODCALLTYPE NotifyEvent( void) = 0; + + virtual HWND STDMETHODCALLTYPE WindowHandle( void) = 0; + + virtual HANDLE STDMETHODCALLTYPE ThreadCompleteEvent( void) = 0; + + virtual HANDLE STDMETHODCALLTYPE ExitThreadEvent( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpThreadControlVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpThreadControl * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpThreadControl * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpThreadControl * This); + + HRESULT ( STDMETHODCALLTYPE *Notify )( + ISpThreadControl * This); + + HRESULT ( STDMETHODCALLTYPE *StartThread )( + ISpThreadControl * This, + DWORD dwFlags, + HWND *phwnd); + + HRESULT ( STDMETHODCALLTYPE *WaitForThreadDone )( + ISpThreadControl * This, + BOOL fForceStop, + HRESULT *phrThreadResult, + ULONG msTimeOut); + + HRESULT ( STDMETHODCALLTYPE *TerminateThread )( + ISpThreadControl * This); + + HANDLE ( STDMETHODCALLTYPE *ThreadHandle )( + ISpThreadControl * This); + + DWORD ( STDMETHODCALLTYPE *ThreadId )( + ISpThreadControl * This); + + HANDLE ( STDMETHODCALLTYPE *NotifyEvent )( + ISpThreadControl * This); + + HWND ( STDMETHODCALLTYPE *WindowHandle )( + ISpThreadControl * This); + + HANDLE ( STDMETHODCALLTYPE *ThreadCompleteEvent )( + ISpThreadControl * This); + + HANDLE ( STDMETHODCALLTYPE *ExitThreadEvent )( + ISpThreadControl * This); + + END_INTERFACE + } ISpThreadControlVtbl; + + interface ISpThreadControl + { + CONST_VTBL struct ISpThreadControlVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpThreadControl_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpThreadControl_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpThreadControl_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpThreadControl_Notify(This) \ + (This)->lpVtbl -> Notify(This) + + +#define ISpThreadControl_StartThread(This,dwFlags,phwnd) \ + (This)->lpVtbl -> StartThread(This,dwFlags,phwnd) + +#define ISpThreadControl_WaitForThreadDone(This,fForceStop,phrThreadResult,msTimeOut) \ + (This)->lpVtbl -> WaitForThreadDone(This,fForceStop,phrThreadResult,msTimeOut) + +#define ISpThreadControl_TerminateThread(This) \ + (This)->lpVtbl -> TerminateThread(This) + +#define ISpThreadControl_ThreadHandle(This) \ + (This)->lpVtbl -> ThreadHandle(This) + +#define ISpThreadControl_ThreadId(This) \ + (This)->lpVtbl -> ThreadId(This) + +#define ISpThreadControl_NotifyEvent(This) \ + (This)->lpVtbl -> NotifyEvent(This) + +#define ISpThreadControl_WindowHandle(This) \ + (This)->lpVtbl -> WindowHandle(This) + +#define ISpThreadControl_ThreadCompleteEvent(This) \ + (This)->lpVtbl -> ThreadCompleteEvent(This) + +#define ISpThreadControl_ExitThreadEvent(This) \ + (This)->lpVtbl -> ExitThreadEvent(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpThreadControl_StartThread_Proxy( + ISpThreadControl * This, + DWORD dwFlags, + HWND *phwnd); + + +void __RPC_STUB ISpThreadControl_StartThread_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpThreadControl_WaitForThreadDone_Proxy( + ISpThreadControl * This, + BOOL fForceStop, + HRESULT *phrThreadResult, + ULONG msTimeOut); + + +void __RPC_STUB ISpThreadControl_WaitForThreadDone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpThreadControl_TerminateThread_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_TerminateThread_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpThreadControl_ThreadHandle_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_ThreadHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +DWORD STDMETHODCALLTYPE ISpThreadControl_ThreadId_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_ThreadId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpThreadControl_NotifyEvent_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_NotifyEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HWND STDMETHODCALLTYPE ISpThreadControl_WindowHandle_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_WindowHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpThreadControl_ThreadCompleteEvent_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_ThreadCompleteEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpThreadControl_ExitThreadEvent_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_ExitThreadEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpThreadControl_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0345 */ +/* [local] */ + +typedef /* [restricted] */ struct SPTMTHREADINFO + { + long lPoolSize; + long lPriority; + ULONG ulConcurrencyLimit; + ULONG ulMaxQuickAllocThreads; + } SPTMTHREADINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0345_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0345_v0_0_s_ifspec; + +#ifndef __ISpTaskManager_INTERFACE_DEFINED__ +#define __ISpTaskManager_INTERFACE_DEFINED__ + +/* interface ISpTaskManager */ +/* [object][restricted][unique][helpstring][uuid][local] */ + + +EXTERN_C const IID IID_ISpTaskManager; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2BAEEF81-2CA3-4331-98F3-26EC5ABEFB03") + ISpTaskManager : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetThreadPoolInfo( + /* [in] */ const SPTMTHREADINFO *pPoolInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetThreadPoolInfo( + /* [out] */ SPTMTHREADINFO *pPoolInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE QueueTask( + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out][in] */ DWORD *pdwGroupId, + /* [out] */ DWORD *pTaskID) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateReoccurringTask( + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out] */ ISpNotifySink **ppTaskCtrl) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateThreadControl( + /* [in] */ ISpThreadTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ long nPriority, + /* [out] */ ISpThreadControl **ppTaskCtrl) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateTask( + /* [in] */ DWORD dwTaskId, + /* [in] */ ULONG ulWaitPeriod) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateTaskGroup( + /* [in] */ DWORD dwGroupId, + /* [in] */ ULONG ulWaitPeriod) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTaskManagerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTaskManager * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTaskManager * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTaskManager * This); + + HRESULT ( STDMETHODCALLTYPE *SetThreadPoolInfo )( + ISpTaskManager * This, + /* [in] */ const SPTMTHREADINFO *pPoolInfo); + + HRESULT ( STDMETHODCALLTYPE *GetThreadPoolInfo )( + ISpTaskManager * This, + /* [out] */ SPTMTHREADINFO *pPoolInfo); + + HRESULT ( STDMETHODCALLTYPE *QueueTask )( + ISpTaskManager * This, + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out][in] */ DWORD *pdwGroupId, + /* [out] */ DWORD *pTaskID); + + HRESULT ( STDMETHODCALLTYPE *CreateReoccurringTask )( + ISpTaskManager * This, + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out] */ ISpNotifySink **ppTaskCtrl); + + HRESULT ( STDMETHODCALLTYPE *CreateThreadControl )( + ISpTaskManager * This, + /* [in] */ ISpThreadTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ long nPriority, + /* [out] */ ISpThreadControl **ppTaskCtrl); + + HRESULT ( STDMETHODCALLTYPE *TerminateTask )( + ISpTaskManager * This, + /* [in] */ DWORD dwTaskId, + /* [in] */ ULONG ulWaitPeriod); + + HRESULT ( STDMETHODCALLTYPE *TerminateTaskGroup )( + ISpTaskManager * This, + /* [in] */ DWORD dwGroupId, + /* [in] */ ULONG ulWaitPeriod); + + END_INTERFACE + } ISpTaskManagerVtbl; + + interface ISpTaskManager + { + CONST_VTBL struct ISpTaskManagerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTaskManager_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTaskManager_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTaskManager_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTaskManager_SetThreadPoolInfo(This,pPoolInfo) \ + (This)->lpVtbl -> SetThreadPoolInfo(This,pPoolInfo) + +#define ISpTaskManager_GetThreadPoolInfo(This,pPoolInfo) \ + (This)->lpVtbl -> GetThreadPoolInfo(This,pPoolInfo) + +#define ISpTaskManager_QueueTask(This,pTask,pvTaskData,hCompEvent,pdwGroupId,pTaskID) \ + (This)->lpVtbl -> QueueTask(This,pTask,pvTaskData,hCompEvent,pdwGroupId,pTaskID) + +#define ISpTaskManager_CreateReoccurringTask(This,pTask,pvTaskData,hCompEvent,ppTaskCtrl) \ + (This)->lpVtbl -> CreateReoccurringTask(This,pTask,pvTaskData,hCompEvent,ppTaskCtrl) + +#define ISpTaskManager_CreateThreadControl(This,pTask,pvTaskData,nPriority,ppTaskCtrl) \ + (This)->lpVtbl -> CreateThreadControl(This,pTask,pvTaskData,nPriority,ppTaskCtrl) + +#define ISpTaskManager_TerminateTask(This,dwTaskId,ulWaitPeriod) \ + (This)->lpVtbl -> TerminateTask(This,dwTaskId,ulWaitPeriod) + +#define ISpTaskManager_TerminateTaskGroup(This,dwGroupId,ulWaitPeriod) \ + (This)->lpVtbl -> TerminateTaskGroup(This,dwGroupId,ulWaitPeriod) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_SetThreadPoolInfo_Proxy( + ISpTaskManager * This, + /* [in] */ const SPTMTHREADINFO *pPoolInfo); + + +void __RPC_STUB ISpTaskManager_SetThreadPoolInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_GetThreadPoolInfo_Proxy( + ISpTaskManager * This, + /* [out] */ SPTMTHREADINFO *pPoolInfo); + + +void __RPC_STUB ISpTaskManager_GetThreadPoolInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_QueueTask_Proxy( + ISpTaskManager * This, + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out][in] */ DWORD *pdwGroupId, + /* [out] */ DWORD *pTaskID); + + +void __RPC_STUB ISpTaskManager_QueueTask_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_CreateReoccurringTask_Proxy( + ISpTaskManager * This, + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out] */ ISpNotifySink **ppTaskCtrl); + + +void __RPC_STUB ISpTaskManager_CreateReoccurringTask_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_CreateThreadControl_Proxy( + ISpTaskManager * This, + /* [in] */ ISpThreadTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ long nPriority, + /* [out] */ ISpThreadControl **ppTaskCtrl); + + +void __RPC_STUB ISpTaskManager_CreateThreadControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_TerminateTask_Proxy( + ISpTaskManager * This, + /* [in] */ DWORD dwTaskId, + /* [in] */ ULONG ulWaitPeriod); + + +void __RPC_STUB ISpTaskManager_TerminateTask_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_TerminateTaskGroup_Proxy( + ISpTaskManager * This, + /* [in] */ DWORD dwGroupId, + /* [in] */ ULONG ulWaitPeriod); + + +void __RPC_STUB ISpTaskManager_TerminateTaskGroup_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTaskManager_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0346 */ +/* [local] */ + +typedef +enum SPVSKIPTYPE + { SPVST_SENTENCE = 1L << 0 + } SPVSKIPTYPE; + +typedef +enum SPVESACTIONS + { SPVES_CONTINUE = 0, + SPVES_ABORT = 1L << 0, + SPVES_SKIP = 1L << 1, + SPVES_RATE = 1L << 2, + SPVES_VOLUME = 1L << 3 + } SPVESACTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0346_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0346_v0_0_s_ifspec; + +#ifndef __ISpTTSEngineSite_INTERFACE_DEFINED__ +#define __ISpTTSEngineSite_INTERFACE_DEFINED__ + +/* interface ISpTTSEngineSite */ +/* [unique][helpstring][uuid][local][object] */ + + +EXTERN_C const IID IID_ISpTTSEngineSite; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9880499B-CCE9-11d2-B503-00C04F797396") + ISpTTSEngineSite : public ISpEventSink + { + public: + virtual DWORD STDMETHODCALLTYPE GetActions( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Write( + /* [in] */ const void *pBuff, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRate( + /* [out] */ long *pRateAdjust) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVolume( + /* [out] */ USHORT *pusVolume) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSkipInfo( + /* [out] */ SPVSKIPTYPE *peType, + /* [out] */ long *plNumItems) = 0; + + virtual HRESULT STDMETHODCALLTYPE CompleteSkip( + /* [in] */ long ulNumSkipped) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTTSEngineSiteVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTTSEngineSite * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTTSEngineSite * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTTSEngineSite * This); + + HRESULT ( STDMETHODCALLTYPE *AddEvents )( + ISpTTSEngineSite * This, + /* [in] */ const SPEVENT *pEventArray, + /* [in] */ ULONG ulCount); + + HRESULT ( STDMETHODCALLTYPE *GetEventInterest )( + ISpTTSEngineSite * This, + /* [out] */ ULONGLONG *pullEventInterest); + + DWORD ( STDMETHODCALLTYPE *GetActions )( + ISpTTSEngineSite * This); + + HRESULT ( STDMETHODCALLTYPE *Write )( + ISpTTSEngineSite * This, + /* [in] */ const void *pBuff, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *GetRate )( + ISpTTSEngineSite * This, + /* [out] */ long *pRateAdjust); + + HRESULT ( STDMETHODCALLTYPE *GetVolume )( + ISpTTSEngineSite * This, + /* [out] */ USHORT *pusVolume); + + HRESULT ( STDMETHODCALLTYPE *GetSkipInfo )( + ISpTTSEngineSite * This, + /* [out] */ SPVSKIPTYPE *peType, + /* [out] */ long *plNumItems); + + HRESULT ( STDMETHODCALLTYPE *CompleteSkip )( + ISpTTSEngineSite * This, + /* [in] */ long ulNumSkipped); + + END_INTERFACE + } ISpTTSEngineSiteVtbl; + + interface ISpTTSEngineSite + { + CONST_VTBL struct ISpTTSEngineSiteVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTTSEngineSite_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTTSEngineSite_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTTSEngineSite_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTTSEngineSite_AddEvents(This,pEventArray,ulCount) \ + (This)->lpVtbl -> AddEvents(This,pEventArray,ulCount) + +#define ISpTTSEngineSite_GetEventInterest(This,pullEventInterest) \ + (This)->lpVtbl -> GetEventInterest(This,pullEventInterest) + + +#define ISpTTSEngineSite_GetActions(This) \ + (This)->lpVtbl -> GetActions(This) + +#define ISpTTSEngineSite_Write(This,pBuff,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pBuff,cb,pcbWritten) + +#define ISpTTSEngineSite_GetRate(This,pRateAdjust) \ + (This)->lpVtbl -> GetRate(This,pRateAdjust) + +#define ISpTTSEngineSite_GetVolume(This,pusVolume) \ + (This)->lpVtbl -> GetVolume(This,pusVolume) + +#define ISpTTSEngineSite_GetSkipInfo(This,peType,plNumItems) \ + (This)->lpVtbl -> GetSkipInfo(This,peType,plNumItems) + +#define ISpTTSEngineSite_CompleteSkip(This,ulNumSkipped) \ + (This)->lpVtbl -> CompleteSkip(This,ulNumSkipped) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +DWORD STDMETHODCALLTYPE ISpTTSEngineSite_GetActions_Proxy( + ISpTTSEngineSite * This); + + +void __RPC_STUB ISpTTSEngineSite_GetActions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_Write_Proxy( + ISpTTSEngineSite * This, + /* [in] */ const void *pBuff, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + +void __RPC_STUB ISpTTSEngineSite_Write_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_GetRate_Proxy( + ISpTTSEngineSite * This, + /* [out] */ long *pRateAdjust); + + +void __RPC_STUB ISpTTSEngineSite_GetRate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_GetVolume_Proxy( + ISpTTSEngineSite * This, + /* [out] */ USHORT *pusVolume); + + +void __RPC_STUB ISpTTSEngineSite_GetVolume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_GetSkipInfo_Proxy( + ISpTTSEngineSite * This, + /* [out] */ SPVSKIPTYPE *peType, + /* [out] */ long *plNumItems); + + +void __RPC_STUB ISpTTSEngineSite_GetSkipInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_CompleteSkip_Proxy( + ISpTTSEngineSite * This, + /* [in] */ long ulNumSkipped); + + +void __RPC_STUB ISpTTSEngineSite_CompleteSkip_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTTSEngineSite_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0347 */ +/* [local] */ + +typedef struct SPVTEXTFRAG + { + struct SPVTEXTFRAG *pNext; + SPVSTATE State; + LPCWSTR pTextStart; + ULONG ulTextLen; + ULONG ulTextSrcOffset; + } SPVTEXTFRAG; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0347_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0347_v0_0_s_ifspec; + +#ifndef __ISpTTSEngine_INTERFACE_DEFINED__ +#define __ISpTTSEngine_INTERFACE_DEFINED__ + +/* interface ISpTTSEngine */ +/* [unique][helpstring][uuid][local][object] */ + + +EXTERN_C const IID IID_ISpTTSEngine; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A74D7C8E-4CC5-4f2f-A6EB-804DEE18500E") + ISpTTSEngine : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Speak( + /* [in] */ DWORD dwSpeakFlags, + /* [in] */ REFGUID rguidFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ const SPVTEXTFRAG *pTextFragList, + /* [in] */ ISpTTSEngineSite *pOutputSite) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOutputFormat( + /* [in] */ const GUID *pTargetFmtId, + /* [in] */ const WAVEFORMATEX *pTargetWaveFormatEx, + /* [out] */ GUID *pOutputFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemOutputWaveFormatEx) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTTSEngineVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTTSEngine * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTTSEngine * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTTSEngine * This); + + HRESULT ( STDMETHODCALLTYPE *Speak )( + ISpTTSEngine * This, + /* [in] */ DWORD dwSpeakFlags, + /* [in] */ REFGUID rguidFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ const SPVTEXTFRAG *pTextFragList, + /* [in] */ ISpTTSEngineSite *pOutputSite); + + HRESULT ( STDMETHODCALLTYPE *GetOutputFormat )( + ISpTTSEngine * This, + /* [in] */ const GUID *pTargetFmtId, + /* [in] */ const WAVEFORMATEX *pTargetWaveFormatEx, + /* [out] */ GUID *pOutputFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemOutputWaveFormatEx); + + END_INTERFACE + } ISpTTSEngineVtbl; + + interface ISpTTSEngine + { + CONST_VTBL struct ISpTTSEngineVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTTSEngine_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTTSEngine_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTTSEngine_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTTSEngine_Speak(This,dwSpeakFlags,rguidFormatId,pWaveFormatEx,pTextFragList,pOutputSite) \ + (This)->lpVtbl -> Speak(This,dwSpeakFlags,rguidFormatId,pWaveFormatEx,pTextFragList,pOutputSite) + +#define ISpTTSEngine_GetOutputFormat(This,pTargetFmtId,pTargetWaveFormatEx,pOutputFormatId,ppCoMemOutputWaveFormatEx) \ + (This)->lpVtbl -> GetOutputFormat(This,pTargetFmtId,pTargetWaveFormatEx,pOutputFormatId,ppCoMemOutputWaveFormatEx) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpTTSEngine_Speak_Proxy( + ISpTTSEngine * This, + /* [in] */ DWORD dwSpeakFlags, + /* [in] */ REFGUID rguidFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ const SPVTEXTFRAG *pTextFragList, + /* [in] */ ISpTTSEngineSite *pOutputSite); + + +void __RPC_STUB ISpTTSEngine_Speak_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngine_GetOutputFormat_Proxy( + ISpTTSEngine * This, + /* [in] */ const GUID *pTargetFmtId, + /* [in] */ const WAVEFORMATEX *pTargetWaveFormatEx, + /* [out] */ GUID *pOutputFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemOutputWaveFormatEx); + + +void __RPC_STUB ISpTTSEngine_GetOutputFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTTSEngine_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0348 */ +/* [local] */ + +typedef /* [restricted] */ struct SPWORDENTRY + { + SPWORDHANDLE hWord; + WORD LangID; + WCHAR *pszDisplayText; + WCHAR *pszLexicalForm; + SPPHONEID *aPhoneId; + void *pvClientContext; + } SPWORDENTRY; + +typedef /* [restricted] */ struct SPRULEENTRY + { + SPRULEHANDLE hRule; + SPSTATEHANDLE hInitialState; + DWORD Attributes; + void *pvClientRuleContext; + void *pvClientGrammarContext; + } SPRULEENTRY; + +typedef +enum SPTRANSITIONTYPE + { SPTRANSEPSILON = 0, + SPTRANSWORD = SPTRANSEPSILON + 1, + SPTRANSRULE = SPTRANSWORD + 1, + SPTRANSTEXTBUF = SPTRANSRULE + 1, + SPTRANSWILDCARD = SPTRANSTEXTBUF + 1, + SPTRANSDICTATION = SPTRANSWILDCARD + 1 + } SPTRANSITIONTYPE; + +typedef /* [restricted] */ struct SPTRANSITIONENTRY + { + SPTRANSITIONID ID; + SPSTATEHANDLE hNextState; + BYTE Type; + char RequiredConfidence; + struct + { + DWORD fHasProperty; + } ; + float Weight; + union + { + struct + { + SPSTATEHANDLE hRuleInitialState; + SPRULEHANDLE hRule; + void *pvClientRuleContext; + } ; + struct + { + SPWORDHANDLE hWord; + void *pvClientWordContext; + } ; + struct + { + void *pvGrammarCookie; + } ; + } ; + } SPTRANSITIONENTRY; + +typedef /* [restricted] */ struct SPTRANSITIONPROPERTY + { + const WCHAR *pszName; + ULONG ulId; + const WCHAR *pszValue; + VARIANT vValue; + } SPTRANSITIONPROPERTY; + +typedef /* [restricted] */ struct SPSTATEINFO + { + ULONG cAllocatedEntries; + SPTRANSITIONENTRY *pTransitions; + ULONG cEpsilons; + ULONG cRules; + ULONG cWords; + ULONG cSpecialTransitions; + } SPSTATEINFO; + +typedef /* [restricted] */ struct SPPATHENTRY + { + SPTRANSITIONID hTransition; + SPPHRASEELEMENT elem; + } SPPATHENTRY; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0348_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0348_v0_0_s_ifspec; + +#ifndef __ISpCFGInterpreterSite_INTERFACE_DEFINED__ +#define __ISpCFGInterpreterSite_INTERFACE_DEFINED__ + +/* interface ISpCFGInterpreterSite */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpCFGInterpreterSite; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6A6FFAD8-78B6-473d-B844-98152E4FB16B") + ISpCFGInterpreterSite : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AddTextReplacement( + /* [in] */ SPPHRASEREPLACEMENT *pReplace) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddProperty( + /* [in] */ const SPPHRASEPROPERTY *pProperty) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetResourceValue( + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpCFGInterpreterSiteVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpCFGInterpreterSite * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpCFGInterpreterSite * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpCFGInterpreterSite * This); + + HRESULT ( STDMETHODCALLTYPE *AddTextReplacement )( + ISpCFGInterpreterSite * This, + /* [in] */ SPPHRASEREPLACEMENT *pReplace); + + HRESULT ( STDMETHODCALLTYPE *AddProperty )( + ISpCFGInterpreterSite * This, + /* [in] */ const SPPHRASEPROPERTY *pProperty); + + HRESULT ( STDMETHODCALLTYPE *GetResourceValue )( + ISpCFGInterpreterSite * This, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource); + + END_INTERFACE + } ISpCFGInterpreterSiteVtbl; + + interface ISpCFGInterpreterSite + { + CONST_VTBL struct ISpCFGInterpreterSiteVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpCFGInterpreterSite_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpCFGInterpreterSite_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpCFGInterpreterSite_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpCFGInterpreterSite_AddTextReplacement(This,pReplace) \ + (This)->lpVtbl -> AddTextReplacement(This,pReplace) + +#define ISpCFGInterpreterSite_AddProperty(This,pProperty) \ + (This)->lpVtbl -> AddProperty(This,pProperty) + +#define ISpCFGInterpreterSite_GetResourceValue(This,pszResourceName,ppCoMemResource) \ + (This)->lpVtbl -> GetResourceValue(This,pszResourceName,ppCoMemResource) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreterSite_AddTextReplacement_Proxy( + ISpCFGInterpreterSite * This, + /* [in] */ SPPHRASEREPLACEMENT *pReplace); + + +void __RPC_STUB ISpCFGInterpreterSite_AddTextReplacement_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreterSite_AddProperty_Proxy( + ISpCFGInterpreterSite * This, + /* [in] */ const SPPHRASEPROPERTY *pProperty); + + +void __RPC_STUB ISpCFGInterpreterSite_AddProperty_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreterSite_GetResourceValue_Proxy( + ISpCFGInterpreterSite * This, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource); + + +void __RPC_STUB ISpCFGInterpreterSite_GetResourceValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpCFGInterpreterSite_INTERFACE_DEFINED__ */ + + +#ifndef __ISpCFGInterpreter_INTERFACE_DEFINED__ +#define __ISpCFGInterpreter_INTERFACE_DEFINED__ + +/* interface ISpCFGInterpreter */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpCFGInterpreter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F3D3F926-11FC-11d3-BB97-00C04F8EE6C0") + ISpCFGInterpreter : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InitGrammar( + /* [in] */ const WCHAR *pszGrammarName, + /* [in] */ const void **pvGrammarData) = 0; + + virtual HRESULT STDMETHODCALLTYPE Interpret( + /* [in] */ ISpPhraseBuilder *pPhrase, + /* [in] */ const ULONG ulFirstElement, + /* [in] */ const ULONG ulCountOfElements, + /* [in] */ ISpCFGInterpreterSite *pSite) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpCFGInterpreterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpCFGInterpreter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpCFGInterpreter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpCFGInterpreter * This); + + HRESULT ( STDMETHODCALLTYPE *InitGrammar )( + ISpCFGInterpreter * This, + /* [in] */ const WCHAR *pszGrammarName, + /* [in] */ const void **pvGrammarData); + + HRESULT ( STDMETHODCALLTYPE *Interpret )( + ISpCFGInterpreter * This, + /* [in] */ ISpPhraseBuilder *pPhrase, + /* [in] */ const ULONG ulFirstElement, + /* [in] */ const ULONG ulCountOfElements, + /* [in] */ ISpCFGInterpreterSite *pSite); + + END_INTERFACE + } ISpCFGInterpreterVtbl; + + interface ISpCFGInterpreter + { + CONST_VTBL struct ISpCFGInterpreterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpCFGInterpreter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpCFGInterpreter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpCFGInterpreter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpCFGInterpreter_InitGrammar(This,pszGrammarName,pvGrammarData) \ + (This)->lpVtbl -> InitGrammar(This,pszGrammarName,pvGrammarData) + +#define ISpCFGInterpreter_Interpret(This,pPhrase,ulFirstElement,ulCountOfElements,pSite) \ + (This)->lpVtbl -> Interpret(This,pPhrase,ulFirstElement,ulCountOfElements,pSite) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreter_InitGrammar_Proxy( + ISpCFGInterpreter * This, + /* [in] */ const WCHAR *pszGrammarName, + /* [in] */ const void **pvGrammarData); + + +void __RPC_STUB ISpCFGInterpreter_InitGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreter_Interpret_Proxy( + ISpCFGInterpreter * This, + /* [in] */ ISpPhraseBuilder *pPhrase, + /* [in] */ const ULONG ulFirstElement, + /* [in] */ const ULONG ulCountOfElements, + /* [in] */ ISpCFGInterpreterSite *pSite); + + +void __RPC_STUB ISpCFGInterpreter_Interpret_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpCFGInterpreter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0350 */ +/* [local] */ + +typedef +enum SPCFGNOTIFY + { SPCFGN_ADD = 0, + SPCFGN_REMOVE = SPCFGN_ADD + 1, + SPCFGN_INVALIDATE = SPCFGN_REMOVE + 1, + SPCFGN_ACTIVATE = SPCFGN_INVALIDATE + 1, + SPCFGN_DEACTIVATE = SPCFGN_ACTIVATE + 1 + } SPCFGNOTIFY; + +typedef +enum SPRESULTTYPE + { SPRT_CFG = 0, + SPRT_SLM = 1, + SPRT_PROPRIETARY = 2, + SPRT_FALSE_RECOGNITION = 1L << 2 + } SPRESULTTYPE; + +typedef struct tagSPPHRASEALT + { + ISpPhraseBuilder *pPhrase; + ULONG ulStartElementInParent; + ULONG cElementsInParent; + ULONG cElementsInAlternate; + void *pvAltExtra; + ULONG cbAltExtra; + } SPPHRASEALT; + +typedef struct SPRECORESULTINFO + { + ULONG cbSize; + SPRESULTTYPE eResultType; + BOOL fHypothesis; + BOOL fProprietaryAutoPause; + ULONGLONG ullStreamPosStart; + ULONGLONG ullStreamPosEnd; + SPGRAMMARHANDLE hGrammar; + ULONG ulSizeEngineData; + void *pvEngineData; + ISpPhraseBuilder *pPhrase; + SPPHRASEALT *aPhraseAlts; + ULONG ulNumAlts; + } SPRECORESULTINFO; + +typedef +enum SPWORDINFOOPT + { SPWIO_NONE = 0, + SPWIO_WANT_TEXT = 1 + } SPWORDINFOOPT; + +typedef +enum SPRULEINFOOPT + { SPRIO_NONE = 0 + } SPRULEINFOOPT; + +typedef struct SPPARSEINFO + { + ULONG cbSize; + SPRULEHANDLE hRule; + ULONGLONG ullAudioStreamPosition; + ULONG ulAudioSize; + ULONG cTransitions; + SPPATHENTRY *pPath; + GUID SREngineID; + ULONG ulSREnginePrivateDataSize; + const BYTE *pSREnginePrivateData; + BOOL fHypothesis; + } SPPARSEINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0350_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0350_v0_0_s_ifspec; + +#ifndef __ISpSREngineSite_INTERFACE_DEFINED__ +#define __ISpSREngineSite_INTERFACE_DEFINED__ + +/* interface ISpSREngineSite */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpSREngineSite; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3B414AEC-720C-4883-B9EF-178CD394FB3A") + ISpSREngineSite : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Read( + /* [in] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead) = 0; + + virtual HRESULT STDMETHODCALLTYPE DataAvailable( + ULONG *pcb) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBufferNotifySize( + /* [in] */ ULONG cbSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE ParseFromTransitions( + /* [in] */ const SPPARSEINFO *pParseInfo, + /* [out] */ ISpPhraseBuilder **ppNewPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE Recognition( + /* [in] */ const SPRECORESULTINFO *pResultInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddEvent( + /* [in] */ const SPEVENT *pEvent, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE Synchronize( + /* [in] */ ULONGLONG ullProcessedThruPos) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetWordInfo( + /* [out][in] */ SPWORDENTRY *pWordEntry, + /* [in] */ SPWORDINFOOPT Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetWordClientContext( + SPWORDHANDLE hWord, + void *pvClientContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRuleInfo( + /* [out][in] */ SPRULEENTRY *pRuleEntry, + /* [in] */ SPRULEINFOOPT Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRuleClientContext( + SPRULEHANDLE hRule, + void *pvClientContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStateInfo( + SPSTATEHANDLE hState, + SPSTATEINFO *pStateInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetResource( + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTransitionProperty( + /* [in] */ SPTRANSITIONID ID, + /* [out] */ SPTRANSITIONPROPERTY **ppCoMemProperty) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsAlternate( + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ SPRULEHANDLE hAltRule) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMaxAlternates( + /* [in] */ SPRULEHANDLE hRule, + /* [out] */ ULONG *pulNumAlts) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetContextMaxAlternates( + /* [in] */ SPRECOCONTEXTHANDLE hContext, + /* [out] */ ULONG *pulNumAlts) = 0; + + virtual HRESULT STDMETHODCALLTYPE UpdateRecoPos( + /* [in] */ ULONGLONG ullCurrentRecoPos) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpSREngineSiteVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpSREngineSite * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpSREngineSite * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpSREngineSite * This); + + HRESULT ( STDMETHODCALLTYPE *Read )( + ISpSREngineSite * This, + /* [in] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + HRESULT ( STDMETHODCALLTYPE *DataAvailable )( + ISpSREngineSite * This, + ULONG *pcb); + + HRESULT ( STDMETHODCALLTYPE *SetBufferNotifySize )( + ISpSREngineSite * This, + /* [in] */ ULONG cbSize); + + HRESULT ( STDMETHODCALLTYPE *ParseFromTransitions )( + ISpSREngineSite * This, + /* [in] */ const SPPARSEINFO *pParseInfo, + /* [out] */ ISpPhraseBuilder **ppNewPhrase); + + HRESULT ( STDMETHODCALLTYPE *Recognition )( + ISpSREngineSite * This, + /* [in] */ const SPRECORESULTINFO *pResultInfo); + + HRESULT ( STDMETHODCALLTYPE *AddEvent )( + ISpSREngineSite * This, + /* [in] */ const SPEVENT *pEvent, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext); + + HRESULT ( STDMETHODCALLTYPE *Synchronize )( + ISpSREngineSite * This, + /* [in] */ ULONGLONG ullProcessedThruPos); + + HRESULT ( STDMETHODCALLTYPE *GetWordInfo )( + ISpSREngineSite * This, + /* [out][in] */ SPWORDENTRY *pWordEntry, + /* [in] */ SPWORDINFOOPT Options); + + HRESULT ( STDMETHODCALLTYPE *SetWordClientContext )( + ISpSREngineSite * This, + SPWORDHANDLE hWord, + void *pvClientContext); + + HRESULT ( STDMETHODCALLTYPE *GetRuleInfo )( + ISpSREngineSite * This, + /* [out][in] */ SPRULEENTRY *pRuleEntry, + /* [in] */ SPRULEINFOOPT Options); + + HRESULT ( STDMETHODCALLTYPE *SetRuleClientContext )( + ISpSREngineSite * This, + SPRULEHANDLE hRule, + void *pvClientContext); + + HRESULT ( STDMETHODCALLTYPE *GetStateInfo )( + ISpSREngineSite * This, + SPSTATEHANDLE hState, + SPSTATEINFO *pStateInfo); + + HRESULT ( STDMETHODCALLTYPE *GetResource )( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource); + + HRESULT ( STDMETHODCALLTYPE *GetTransitionProperty )( + ISpSREngineSite * This, + /* [in] */ SPTRANSITIONID ID, + /* [out] */ SPTRANSITIONPROPERTY **ppCoMemProperty); + + HRESULT ( STDMETHODCALLTYPE *IsAlternate )( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ SPRULEHANDLE hAltRule); + + HRESULT ( STDMETHODCALLTYPE *GetMaxAlternates )( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [out] */ ULONG *pulNumAlts); + + HRESULT ( STDMETHODCALLTYPE *GetContextMaxAlternates )( + ISpSREngineSite * This, + /* [in] */ SPRECOCONTEXTHANDLE hContext, + /* [out] */ ULONG *pulNumAlts); + + HRESULT ( STDMETHODCALLTYPE *UpdateRecoPos )( + ISpSREngineSite * This, + /* [in] */ ULONGLONG ullCurrentRecoPos); + + END_INTERFACE + } ISpSREngineSiteVtbl; + + interface ISpSREngineSite + { + CONST_VTBL struct ISpSREngineSiteVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpSREngineSite_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpSREngineSite_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpSREngineSite_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpSREngineSite_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpSREngineSite_DataAvailable(This,pcb) \ + (This)->lpVtbl -> DataAvailable(This,pcb) + +#define ISpSREngineSite_SetBufferNotifySize(This,cbSize) \ + (This)->lpVtbl -> SetBufferNotifySize(This,cbSize) + +#define ISpSREngineSite_ParseFromTransitions(This,pParseInfo,ppNewPhrase) \ + (This)->lpVtbl -> ParseFromTransitions(This,pParseInfo,ppNewPhrase) + +#define ISpSREngineSite_Recognition(This,pResultInfo) \ + (This)->lpVtbl -> Recognition(This,pResultInfo) + +#define ISpSREngineSite_AddEvent(This,pEvent,hSAPIRecoContext) \ + (This)->lpVtbl -> AddEvent(This,pEvent,hSAPIRecoContext) + +#define ISpSREngineSite_Synchronize(This,ullProcessedThruPos) \ + (This)->lpVtbl -> Synchronize(This,ullProcessedThruPos) + +#define ISpSREngineSite_GetWordInfo(This,pWordEntry,Options) \ + (This)->lpVtbl -> GetWordInfo(This,pWordEntry,Options) + +#define ISpSREngineSite_SetWordClientContext(This,hWord,pvClientContext) \ + (This)->lpVtbl -> SetWordClientContext(This,hWord,pvClientContext) + +#define ISpSREngineSite_GetRuleInfo(This,pRuleEntry,Options) \ + (This)->lpVtbl -> GetRuleInfo(This,pRuleEntry,Options) + +#define ISpSREngineSite_SetRuleClientContext(This,hRule,pvClientContext) \ + (This)->lpVtbl -> SetRuleClientContext(This,hRule,pvClientContext) + +#define ISpSREngineSite_GetStateInfo(This,hState,pStateInfo) \ + (This)->lpVtbl -> GetStateInfo(This,hState,pStateInfo) + +#define ISpSREngineSite_GetResource(This,hRule,pszResourceName,ppCoMemResource) \ + (This)->lpVtbl -> GetResource(This,hRule,pszResourceName,ppCoMemResource) + +#define ISpSREngineSite_GetTransitionProperty(This,ID,ppCoMemProperty) \ + (This)->lpVtbl -> GetTransitionProperty(This,ID,ppCoMemProperty) + +#define ISpSREngineSite_IsAlternate(This,hRule,hAltRule) \ + (This)->lpVtbl -> IsAlternate(This,hRule,hAltRule) + +#define ISpSREngineSite_GetMaxAlternates(This,hRule,pulNumAlts) \ + (This)->lpVtbl -> GetMaxAlternates(This,hRule,pulNumAlts) + +#define ISpSREngineSite_GetContextMaxAlternates(This,hContext,pulNumAlts) \ + (This)->lpVtbl -> GetContextMaxAlternates(This,hContext,pulNumAlts) + +#define ISpSREngineSite_UpdateRecoPos(This,ullCurrentRecoPos) \ + (This)->lpVtbl -> UpdateRecoPos(This,ullCurrentRecoPos) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_Read_Proxy( + ISpSREngineSite * This, + /* [in] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + +void __RPC_STUB ISpSREngineSite_Read_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_DataAvailable_Proxy( + ISpSREngineSite * This, + ULONG *pcb); + + +void __RPC_STUB ISpSREngineSite_DataAvailable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_SetBufferNotifySize_Proxy( + ISpSREngineSite * This, + /* [in] */ ULONG cbSize); + + +void __RPC_STUB ISpSREngineSite_SetBufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_ParseFromTransitions_Proxy( + ISpSREngineSite * This, + /* [in] */ const SPPARSEINFO *pParseInfo, + /* [out] */ ISpPhraseBuilder **ppNewPhrase); + + +void __RPC_STUB ISpSREngineSite_ParseFromTransitions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_Recognition_Proxy( + ISpSREngineSite * This, + /* [in] */ const SPRECORESULTINFO *pResultInfo); + + +void __RPC_STUB ISpSREngineSite_Recognition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_AddEvent_Proxy( + ISpSREngineSite * This, + /* [in] */ const SPEVENT *pEvent, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext); + + +void __RPC_STUB ISpSREngineSite_AddEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_Synchronize_Proxy( + ISpSREngineSite * This, + /* [in] */ ULONGLONG ullProcessedThruPos); + + +void __RPC_STUB ISpSREngineSite_Synchronize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetWordInfo_Proxy( + ISpSREngineSite * This, + /* [out][in] */ SPWORDENTRY *pWordEntry, + /* [in] */ SPWORDINFOOPT Options); + + +void __RPC_STUB ISpSREngineSite_GetWordInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_SetWordClientContext_Proxy( + ISpSREngineSite * This, + SPWORDHANDLE hWord, + void *pvClientContext); + + +void __RPC_STUB ISpSREngineSite_SetWordClientContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetRuleInfo_Proxy( + ISpSREngineSite * This, + /* [out][in] */ SPRULEENTRY *pRuleEntry, + /* [in] */ SPRULEINFOOPT Options); + + +void __RPC_STUB ISpSREngineSite_GetRuleInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_SetRuleClientContext_Proxy( + ISpSREngineSite * This, + SPRULEHANDLE hRule, + void *pvClientContext); + + +void __RPC_STUB ISpSREngineSite_SetRuleClientContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetStateInfo_Proxy( + ISpSREngineSite * This, + SPSTATEHANDLE hState, + SPSTATEINFO *pStateInfo); + + +void __RPC_STUB ISpSREngineSite_GetStateInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetResource_Proxy( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource); + + +void __RPC_STUB ISpSREngineSite_GetResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetTransitionProperty_Proxy( + ISpSREngineSite * This, + /* [in] */ SPTRANSITIONID ID, + /* [out] */ SPTRANSITIONPROPERTY **ppCoMemProperty); + + +void __RPC_STUB ISpSREngineSite_GetTransitionProperty_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_IsAlternate_Proxy( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ SPRULEHANDLE hAltRule); + + +void __RPC_STUB ISpSREngineSite_IsAlternate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetMaxAlternates_Proxy( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [out] */ ULONG *pulNumAlts); + + +void __RPC_STUB ISpSREngineSite_GetMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetContextMaxAlternates_Proxy( + ISpSREngineSite * This, + /* [in] */ SPRECOCONTEXTHANDLE hContext, + /* [out] */ ULONG *pulNumAlts); + + +void __RPC_STUB ISpSREngineSite_GetContextMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_UpdateRecoPos_Proxy( + ISpSREngineSite * This, + /* [in] */ ULONGLONG ullCurrentRecoPos); + + +void __RPC_STUB ISpSREngineSite_UpdateRecoPos_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpSREngineSite_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0351 */ +/* [local] */ + +typedef +enum SPPROPSRC + { SPPROPSRC_RECO_INST = 0, + SPPROPSRC_RECO_CTX = SPPROPSRC_RECO_INST + 1, + SPPROPSRC_RECO_GRAMMAR = SPPROPSRC_RECO_CTX + 1 + } SPPROPSRC; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0351_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0351_v0_0_s_ifspec; + +#ifndef __ISpSREngine_INTERFACE_DEFINED__ +#define __ISpSREngine_INTERFACE_DEFINED__ + +/* interface ISpSREngine */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpSREngine; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2F472991-854B-4465-B613-FBAFB3AD8ED8") + ISpSREngine : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetSite( + /* [in] */ ISpSREngineSite *pSite) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInputAudioFormat( + /* [in] */ const GUID *pguidSourceFormatId, + /* [in] */ const WAVEFORMATEX *pSourceWaveFormatEx, + /* [out] */ GUID *pguidDesiredFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemDesiredWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE RecognizeStream( + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ HANDLE hRequestSync, + /* [in] */ HANDLE hDataAvailable, + /* [in] */ HANDLE hExit, + /* [in] */ BOOL fNewAudioStream, + /* [in] */ BOOL fRealTimeAudio, + /* [in] */ ISpObjectToken *pAudioObjectToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRecoProfile( + ISpObjectToken *pProfile) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnCreateGrammar( + /* [in] */ void *pvEngineRecoContext, + /* [in] */ SPGRAMMARHANDLE hSAPIGrammar, + /* [out] */ void **ppvEngineGrammarContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnDeleteGrammar( + /* [in] */ void *pvEngineGrammar) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadProprietaryGrammar( + /* [in] */ void *pvEngineGrammar, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataParam, + /* [in] */ ULONG ulDataSize, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnloadProprietaryGrammar( + /* [in] */ void *pvEngineGrammar) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetProprietaryRuleState( + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszName, + /* [in] */ void *pReserved, + /* [in] */ SPRULESTATE NewState, + /* [out] */ ULONG *pcRulesChanged) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetProprietaryRuleIdState( + /* [in] */ void *pvEngineGrammar, + /* [in] */ DWORD dwRuleId, + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadSLM( + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszTopicName) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnloadSLM( + /* [in] */ void *pvEngineGrammar) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetSLMState( + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetWordSequenceData( + /* [in] */ void *pvEngineGrammar, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTextSelection( + /* [in] */ void *pvEngineGrammar, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsPronounceable( + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnCreateRecoContext( + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext, + /* [out] */ void **ppvEngineContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnDeleteRecoContext( + /* [in] */ void *pvEngineContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE PrivateCall( + /* [in] */ void *pvEngineContext, + /* [out][in] */ PVOID pCallFrame, + /* [in] */ ULONG ulCallFrameSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAdaptationData( + /* [in] */ void *pvEngineContext, + const WCHAR *pAdaptationData, + const ULONG cch) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPropertyNum( + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyNum( + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *lValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPropertyString( + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyString( + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetGrammarState( + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPGRAMMARSTATE eGrammarState) = 0; + + virtual HRESULT STDMETHODCALLTYPE WordNotify( + SPCFGNOTIFY Action, + ULONG cWords, + const SPWORDENTRY *pWords) = 0; + + virtual HRESULT STDMETHODCALLTYPE RuleNotify( + SPCFGNOTIFY Action, + ULONG cRules, + const SPRULEENTRY *pRules) = 0; + + virtual HRESULT STDMETHODCALLTYPE PrivateCallEx( + /* [in] */ void *pvEngineContext, + /* [in] */ const void *pInCallFrame, + /* [in] */ ULONG ulInCallFrameSize, + /* [out] */ void **ppvCoMemResponse, + /* [out] */ ULONG *pulResponseSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetContextState( + /* [in] */ void *pvEngineContext, + /* [in] */ SPCONTEXTSTATE eContextState) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpSREngineVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpSREngine * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpSREngine * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpSREngine * This); + + HRESULT ( STDMETHODCALLTYPE *SetSite )( + ISpSREngine * This, + /* [in] */ ISpSREngineSite *pSite); + + HRESULT ( STDMETHODCALLTYPE *GetInputAudioFormat )( + ISpSREngine * This, + /* [in] */ const GUID *pguidSourceFormatId, + /* [in] */ const WAVEFORMATEX *pSourceWaveFormatEx, + /* [out] */ GUID *pguidDesiredFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemDesiredWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *RecognizeStream )( + ISpSREngine * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ HANDLE hRequestSync, + /* [in] */ HANDLE hDataAvailable, + /* [in] */ HANDLE hExit, + /* [in] */ BOOL fNewAudioStream, + /* [in] */ BOOL fRealTimeAudio, + /* [in] */ ISpObjectToken *pAudioObjectToken); + + HRESULT ( STDMETHODCALLTYPE *SetRecoProfile )( + ISpSREngine * This, + ISpObjectToken *pProfile); + + HRESULT ( STDMETHODCALLTYPE *OnCreateGrammar )( + ISpSREngine * This, + /* [in] */ void *pvEngineRecoContext, + /* [in] */ SPGRAMMARHANDLE hSAPIGrammar, + /* [out] */ void **ppvEngineGrammarContext); + + HRESULT ( STDMETHODCALLTYPE *OnDeleteGrammar )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + HRESULT ( STDMETHODCALLTYPE *LoadProprietaryGrammar )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataParam, + /* [in] */ ULONG ulDataSize, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *UnloadProprietaryGrammar )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + HRESULT ( STDMETHODCALLTYPE *SetProprietaryRuleState )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszName, + /* [in] */ void *pReserved, + /* [in] */ SPRULESTATE NewState, + /* [out] */ ULONG *pcRulesChanged); + + HRESULT ( STDMETHODCALLTYPE *SetProprietaryRuleIdState )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ DWORD dwRuleId, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *LoadSLM )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszTopicName); + + HRESULT ( STDMETHODCALLTYPE *UnloadSLM )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + HRESULT ( STDMETHODCALLTYPE *SetSLMState )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *SetWordSequenceData )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *SetTextSelection )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *IsPronounceable )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable); + + HRESULT ( STDMETHODCALLTYPE *OnCreateRecoContext )( + ISpSREngine * This, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext, + /* [out] */ void **ppvEngineContext); + + HRESULT ( STDMETHODCALLTYPE *OnDeleteRecoContext )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext); + + HRESULT ( STDMETHODCALLTYPE *PrivateCall )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [out][in] */ PVOID pCallFrame, + /* [in] */ ULONG ulCallFrameSize); + + HRESULT ( STDMETHODCALLTYPE *SetAdaptationData )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + const WCHAR *pAdaptationData, + const ULONG cch); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyNum )( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyNum )( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *lValue); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyString )( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyString )( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + HRESULT ( STDMETHODCALLTYPE *SetGrammarState )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPGRAMMARSTATE eGrammarState); + + HRESULT ( STDMETHODCALLTYPE *WordNotify )( + ISpSREngine * This, + SPCFGNOTIFY Action, + ULONG cWords, + const SPWORDENTRY *pWords); + + HRESULT ( STDMETHODCALLTYPE *RuleNotify )( + ISpSREngine * This, + SPCFGNOTIFY Action, + ULONG cRules, + const SPRULEENTRY *pRules); + + HRESULT ( STDMETHODCALLTYPE *PrivateCallEx )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [in] */ const void *pInCallFrame, + /* [in] */ ULONG ulInCallFrameSize, + /* [out] */ void **ppvCoMemResponse, + /* [out] */ ULONG *pulResponseSize); + + HRESULT ( STDMETHODCALLTYPE *SetContextState )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [in] */ SPCONTEXTSTATE eContextState); + + END_INTERFACE + } ISpSREngineVtbl; + + interface ISpSREngine + { + CONST_VTBL struct ISpSREngineVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpSREngine_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpSREngine_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpSREngine_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpSREngine_SetSite(This,pSite) \ + (This)->lpVtbl -> SetSite(This,pSite) + +#define ISpSREngine_GetInputAudioFormat(This,pguidSourceFormatId,pSourceWaveFormatEx,pguidDesiredFormatId,ppCoMemDesiredWaveFormatEx) \ + (This)->lpVtbl -> GetInputAudioFormat(This,pguidSourceFormatId,pSourceWaveFormatEx,pguidDesiredFormatId,ppCoMemDesiredWaveFormatEx) + +#define ISpSREngine_RecognizeStream(This,rguidFmtId,pWaveFormatEx,hRequestSync,hDataAvailable,hExit,fNewAudioStream,fRealTimeAudio,pAudioObjectToken) \ + (This)->lpVtbl -> RecognizeStream(This,rguidFmtId,pWaveFormatEx,hRequestSync,hDataAvailable,hExit,fNewAudioStream,fRealTimeAudio,pAudioObjectToken) + +#define ISpSREngine_SetRecoProfile(This,pProfile) \ + (This)->lpVtbl -> SetRecoProfile(This,pProfile) + +#define ISpSREngine_OnCreateGrammar(This,pvEngineRecoContext,hSAPIGrammar,ppvEngineGrammarContext) \ + (This)->lpVtbl -> OnCreateGrammar(This,pvEngineRecoContext,hSAPIGrammar,ppvEngineGrammarContext) + +#define ISpSREngine_OnDeleteGrammar(This,pvEngineGrammar) \ + (This)->lpVtbl -> OnDeleteGrammar(This,pvEngineGrammar) + +#define ISpSREngine_LoadProprietaryGrammar(This,pvEngineGrammar,rguidParam,pszStringParam,pvDataParam,ulDataSize,Options) \ + (This)->lpVtbl -> LoadProprietaryGrammar(This,pvEngineGrammar,rguidParam,pszStringParam,pvDataParam,ulDataSize,Options) + +#define ISpSREngine_UnloadProprietaryGrammar(This,pvEngineGrammar) \ + (This)->lpVtbl -> UnloadProprietaryGrammar(This,pvEngineGrammar) + +#define ISpSREngine_SetProprietaryRuleState(This,pvEngineGrammar,pszName,pReserved,NewState,pcRulesChanged) \ + (This)->lpVtbl -> SetProprietaryRuleState(This,pvEngineGrammar,pszName,pReserved,NewState,pcRulesChanged) + +#define ISpSREngine_SetProprietaryRuleIdState(This,pvEngineGrammar,dwRuleId,NewState) \ + (This)->lpVtbl -> SetProprietaryRuleIdState(This,pvEngineGrammar,dwRuleId,NewState) + +#define ISpSREngine_LoadSLM(This,pvEngineGrammar,pszTopicName) \ + (This)->lpVtbl -> LoadSLM(This,pvEngineGrammar,pszTopicName) + +#define ISpSREngine_UnloadSLM(This,pvEngineGrammar) \ + (This)->lpVtbl -> UnloadSLM(This,pvEngineGrammar) + +#define ISpSREngine_SetSLMState(This,pvEngineGrammar,NewState) \ + (This)->lpVtbl -> SetSLMState(This,pvEngineGrammar,NewState) + +#define ISpSREngine_SetWordSequenceData(This,pvEngineGrammar,pText,cchText,pInfo) \ + (This)->lpVtbl -> SetWordSequenceData(This,pvEngineGrammar,pText,cchText,pInfo) + +#define ISpSREngine_SetTextSelection(This,pvEngineGrammar,pInfo) \ + (This)->lpVtbl -> SetTextSelection(This,pvEngineGrammar,pInfo) + +#define ISpSREngine_IsPronounceable(This,pvEngineGrammar,pszWord,pWordPronounceable) \ + (This)->lpVtbl -> IsPronounceable(This,pvEngineGrammar,pszWord,pWordPronounceable) + +#define ISpSREngine_OnCreateRecoContext(This,hSAPIRecoContext,ppvEngineContext) \ + (This)->lpVtbl -> OnCreateRecoContext(This,hSAPIRecoContext,ppvEngineContext) + +#define ISpSREngine_OnDeleteRecoContext(This,pvEngineContext) \ + (This)->lpVtbl -> OnDeleteRecoContext(This,pvEngineContext) + +#define ISpSREngine_PrivateCall(This,pvEngineContext,pCallFrame,ulCallFrameSize) \ + (This)->lpVtbl -> PrivateCall(This,pvEngineContext,pCallFrame,ulCallFrameSize) + +#define ISpSREngine_SetAdaptationData(This,pvEngineContext,pAdaptationData,cch) \ + (This)->lpVtbl -> SetAdaptationData(This,pvEngineContext,pAdaptationData,cch) + +#define ISpSREngine_SetPropertyNum(This,eSrc,pvSrcObj,pName,lValue) \ + (This)->lpVtbl -> SetPropertyNum(This,eSrc,pvSrcObj,pName,lValue) + +#define ISpSREngine_GetPropertyNum(This,eSrc,pvSrcObj,pName,lValue) \ + (This)->lpVtbl -> GetPropertyNum(This,eSrc,pvSrcObj,pName,lValue) + +#define ISpSREngine_SetPropertyString(This,eSrc,pvSrcObj,pName,pValue) \ + (This)->lpVtbl -> SetPropertyString(This,eSrc,pvSrcObj,pName,pValue) + +#define ISpSREngine_GetPropertyString(This,eSrc,pvSrcObj,pName,ppCoMemValue) \ + (This)->lpVtbl -> GetPropertyString(This,eSrc,pvSrcObj,pName,ppCoMemValue) + +#define ISpSREngine_SetGrammarState(This,pvEngineGrammar,eGrammarState) \ + (This)->lpVtbl -> SetGrammarState(This,pvEngineGrammar,eGrammarState) + +#define ISpSREngine_WordNotify(This,Action,cWords,pWords) \ + (This)->lpVtbl -> WordNotify(This,Action,cWords,pWords) + +#define ISpSREngine_RuleNotify(This,Action,cRules,pRules) \ + (This)->lpVtbl -> RuleNotify(This,Action,cRules,pRules) + +#define ISpSREngine_PrivateCallEx(This,pvEngineContext,pInCallFrame,ulInCallFrameSize,ppvCoMemResponse,pulResponseSize) \ + (This)->lpVtbl -> PrivateCallEx(This,pvEngineContext,pInCallFrame,ulInCallFrameSize,ppvCoMemResponse,pulResponseSize) + +#define ISpSREngine_SetContextState(This,pvEngineContext,eContextState) \ + (This)->lpVtbl -> SetContextState(This,pvEngineContext,eContextState) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetSite_Proxy( + ISpSREngine * This, + /* [in] */ ISpSREngineSite *pSite); + + +void __RPC_STUB ISpSREngine_SetSite_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_GetInputAudioFormat_Proxy( + ISpSREngine * This, + /* [in] */ const GUID *pguidSourceFormatId, + /* [in] */ const WAVEFORMATEX *pSourceWaveFormatEx, + /* [out] */ GUID *pguidDesiredFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemDesiredWaveFormatEx); + + +void __RPC_STUB ISpSREngine_GetInputAudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_RecognizeStream_Proxy( + ISpSREngine * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ HANDLE hRequestSync, + /* [in] */ HANDLE hDataAvailable, + /* [in] */ HANDLE hExit, + /* [in] */ BOOL fNewAudioStream, + /* [in] */ BOOL fRealTimeAudio, + /* [in] */ ISpObjectToken *pAudioObjectToken); + + +void __RPC_STUB ISpSREngine_RecognizeStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetRecoProfile_Proxy( + ISpSREngine * This, + ISpObjectToken *pProfile); + + +void __RPC_STUB ISpSREngine_SetRecoProfile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_OnCreateGrammar_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineRecoContext, + /* [in] */ SPGRAMMARHANDLE hSAPIGrammar, + /* [out] */ void **ppvEngineGrammarContext); + + +void __RPC_STUB ISpSREngine_OnCreateGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_OnDeleteGrammar_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + +void __RPC_STUB ISpSREngine_OnDeleteGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_LoadProprietaryGrammar_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataParam, + /* [in] */ ULONG ulDataSize, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpSREngine_LoadProprietaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_UnloadProprietaryGrammar_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + +void __RPC_STUB ISpSREngine_UnloadProprietaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetProprietaryRuleState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszName, + /* [in] */ void *pReserved, + /* [in] */ SPRULESTATE NewState, + /* [out] */ ULONG *pcRulesChanged); + + +void __RPC_STUB ISpSREngine_SetProprietaryRuleState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetProprietaryRuleIdState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ DWORD dwRuleId, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpSREngine_SetProprietaryRuleIdState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_LoadSLM_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszTopicName); + + +void __RPC_STUB ISpSREngine_LoadSLM_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_UnloadSLM_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + +void __RPC_STUB ISpSREngine_UnloadSLM_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetSLMState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpSREngine_SetSLMState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetWordSequenceData_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + +void __RPC_STUB ISpSREngine_SetWordSequenceData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetTextSelection_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + +void __RPC_STUB ISpSREngine_SetTextSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_IsPronounceable_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable); + + +void __RPC_STUB ISpSREngine_IsPronounceable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_OnCreateRecoContext_Proxy( + ISpSREngine * This, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext, + /* [out] */ void **ppvEngineContext); + + +void __RPC_STUB ISpSREngine_OnCreateRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_OnDeleteRecoContext_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext); + + +void __RPC_STUB ISpSREngine_OnDeleteRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_PrivateCall_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [out][in] */ PVOID pCallFrame, + /* [in] */ ULONG ulCallFrameSize); + + +void __RPC_STUB ISpSREngine_PrivateCall_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetAdaptationData_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + const WCHAR *pAdaptationData, + const ULONG cch); + + +void __RPC_STUB ISpSREngine_SetAdaptationData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetPropertyNum_Proxy( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + +void __RPC_STUB ISpSREngine_SetPropertyNum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_GetPropertyNum_Proxy( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *lValue); + + +void __RPC_STUB ISpSREngine_GetPropertyNum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetPropertyString_Proxy( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + +void __RPC_STUB ISpSREngine_SetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_GetPropertyString_Proxy( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + +void __RPC_STUB ISpSREngine_GetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetGrammarState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPGRAMMARSTATE eGrammarState); + + +void __RPC_STUB ISpSREngine_SetGrammarState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_WordNotify_Proxy( + ISpSREngine * This, + SPCFGNOTIFY Action, + ULONG cWords, + const SPWORDENTRY *pWords); + + +void __RPC_STUB ISpSREngine_WordNotify_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_RuleNotify_Proxy( + ISpSREngine * This, + SPCFGNOTIFY Action, + ULONG cRules, + const SPRULEENTRY *pRules); + + +void __RPC_STUB ISpSREngine_RuleNotify_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_PrivateCallEx_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [in] */ const void *pInCallFrame, + /* [in] */ ULONG ulInCallFrameSize, + /* [out] */ void **ppvCoMemResponse, + /* [out] */ ULONG *pulResponseSize); + + +void __RPC_STUB ISpSREngine_PrivateCallEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetContextState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [in] */ SPCONTEXTSTATE eContextState); + + +void __RPC_STUB ISpSREngine_SetContextState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpSREngine_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0352 */ +/* [local] */ + +typedef struct tagSPPHRASEALTREQUEST + { + ULONG ulStartElement; + ULONG cElements; + ULONG ulRequestAltCount; + void *pvResultExtra; + ULONG cbResultExtra; + ISpPhrase *pPhrase; + ISpRecoContext *pRecoContext; + } SPPHRASEALTREQUEST; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0352_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0352_v0_0_s_ifspec; + +#ifndef __ISpSRAlternates_INTERFACE_DEFINED__ +#define __ISpSRAlternates_INTERFACE_DEFINED__ + +/* interface ISpSRAlternates */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpSRAlternates; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("FECE8294-2BE1-408f-8E68-2DE377092F0E") + ISpSRAlternates : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAlternates( + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [out] */ SPPHRASEALT **ppAlts, + /* [out] */ ULONG *pcAlts) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [in] */ SPPHRASEALT *pAlt, + /* [out] */ void **ppvResultExtra, + /* [out] */ ULONG *pcbResultExtra) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpSRAlternatesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpSRAlternates * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpSRAlternates * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpSRAlternates * This); + + HRESULT ( STDMETHODCALLTYPE *GetAlternates )( + ISpSRAlternates * This, + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [out] */ SPPHRASEALT **ppAlts, + /* [out] */ ULONG *pcAlts); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpSRAlternates * This, + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [in] */ SPPHRASEALT *pAlt, + /* [out] */ void **ppvResultExtra, + /* [out] */ ULONG *pcbResultExtra); + + END_INTERFACE + } ISpSRAlternatesVtbl; + + interface ISpSRAlternates + { + CONST_VTBL struct ISpSRAlternatesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpSRAlternates_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpSRAlternates_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpSRAlternates_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpSRAlternates_GetAlternates(This,pAltRequest,ppAlts,pcAlts) \ + (This)->lpVtbl -> GetAlternates(This,pAltRequest,ppAlts,pcAlts) + +#define ISpSRAlternates_Commit(This,pAltRequest,pAlt,ppvResultExtra,pcbResultExtra) \ + (This)->lpVtbl -> Commit(This,pAltRequest,pAlt,ppvResultExtra,pcbResultExtra) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpSRAlternates_GetAlternates_Proxy( + ISpSRAlternates * This, + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [out] */ SPPHRASEALT **ppAlts, + /* [out] */ ULONG *pcAlts); + + +void __RPC_STUB ISpSRAlternates_GetAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSRAlternates_Commit_Proxy( + ISpSRAlternates * This, + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [in] */ SPPHRASEALT *pAlt, + /* [out] */ void **ppvResultExtra, + /* [out] */ ULONG *pcbResultExtra); + + +void __RPC_STUB ISpSRAlternates_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpSRAlternates_INTERFACE_DEFINED__ */ + + +#ifndef ___ISpPrivateEngineCall_INTERFACE_DEFINED__ +#define ___ISpPrivateEngineCall_INTERFACE_DEFINED__ + +/* interface _ISpPrivateEngineCall */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID__ISpPrivateEngineCall; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8E7C791E-4467-11d3-9723-00C04F72DB08") + _ISpPrivateEngineCall : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CallEngine( + /* [out][in] */ void *pCallFrame, + /* [in] */ ULONG ulCallFrameSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE CallEngineEx( + /* [in] */ const void *pInFrame, + /* [in] */ ULONG ulInFrameSize, + /* [out] */ void **ppCoMemOutFrame, + /* [out] */ ULONG *pulOutFrameSize) = 0; + + }; + +#else /* C style interface */ + + typedef struct _ISpPrivateEngineCallVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + _ISpPrivateEngineCall * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + _ISpPrivateEngineCall * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + _ISpPrivateEngineCall * This); + + HRESULT ( STDMETHODCALLTYPE *CallEngine )( + _ISpPrivateEngineCall * This, + /* [out][in] */ void *pCallFrame, + /* [in] */ ULONG ulCallFrameSize); + + HRESULT ( STDMETHODCALLTYPE *CallEngineEx )( + _ISpPrivateEngineCall * This, + /* [in] */ const void *pInFrame, + /* [in] */ ULONG ulInFrameSize, + /* [out] */ void **ppCoMemOutFrame, + /* [out] */ ULONG *pulOutFrameSize); + + END_INTERFACE + } _ISpPrivateEngineCallVtbl; + + interface _ISpPrivateEngineCall + { + CONST_VTBL struct _ISpPrivateEngineCallVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define _ISpPrivateEngineCall_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define _ISpPrivateEngineCall_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define _ISpPrivateEngineCall_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define _ISpPrivateEngineCall_CallEngine(This,pCallFrame,ulCallFrameSize) \ + (This)->lpVtbl -> CallEngine(This,pCallFrame,ulCallFrameSize) + +#define _ISpPrivateEngineCall_CallEngineEx(This,pInFrame,ulInFrameSize,ppCoMemOutFrame,pulOutFrameSize) \ + (This)->lpVtbl -> CallEngineEx(This,pInFrame,ulInFrameSize,ppCoMemOutFrame,pulOutFrameSize) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE _ISpPrivateEngineCall_CallEngine_Proxy( + _ISpPrivateEngineCall * This, + /* [out][in] */ void *pCallFrame, + /* [in] */ ULONG ulCallFrameSize); + + +void __RPC_STUB _ISpPrivateEngineCall_CallEngine_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE _ISpPrivateEngineCall_CallEngineEx_Proxy( + _ISpPrivateEngineCall * This, + /* [in] */ const void *pInFrame, + /* [in] */ ULONG ulInFrameSize, + /* [out] */ void **ppCoMemOutFrame, + /* [out] */ ULONG *pulOutFrameSize); + + +void __RPC_STUB _ISpPrivateEngineCall_CallEngineEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* ___ISpPrivateEngineCall_INTERFACE_DEFINED__ */ + + + +#ifndef __SpeechDDKLib_LIBRARY_DEFINED__ +#define __SpeechDDKLib_LIBRARY_DEFINED__ + +/* library SpeechDDKLib */ +/* [version][uuid][helpstring] */ + + +EXTERN_C const IID LIBID_SpeechDDKLib; + +EXTERN_C const CLSID CLSID_SpDataKey; + +#ifdef __cplusplus + +class DECLSPEC_UUID("D9F6EE60-58C9-458b-88E1-2F908FD7F87C") +SpDataKey; +#endif + +EXTERN_C const CLSID CLSID_SpObjectTokenEnum; + +#ifdef __cplusplus + +class DECLSPEC_UUID("3918D75F-0ACB-41f2-B733-92AA15BCECF6") +SpObjectTokenEnum; +#endif + +EXTERN_C const CLSID CLSID_SpPhraseBuilder; + +#ifdef __cplusplus + +class DECLSPEC_UUID("777B6BBD-2FF2-11d3-88FE-00C04F8EF9B5") +SpPhraseBuilder; +#endif + +EXTERN_C const CLSID CLSID_SpITNProcessor; + +#ifdef __cplusplus + +class DECLSPEC_UUID("12D73610-A1C9-11d3-BC90-00C04F72DF9F") +SpITNProcessor; +#endif + +EXTERN_C const CLSID CLSID_SpGrammarCompiler; + +#ifdef __cplusplus + +class DECLSPEC_UUID("B1E29D59-A675-11D2-8302-00C04F8EE6C0") +SpGrammarCompiler; +#endif + +EXTERN_C const CLSID CLSID_SpGramCompBackend; + +#ifdef __cplusplus + +class DECLSPEC_UUID("DA93E903-C843-11D2-A084-00C04F8EF9B5") +SpGramCompBackend; +#endif +#endif /* __SpeechDDKLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/mp/src/utils/sapi51/Include/spcollec.h b/mp/src/utils/sapi51/Include/spcollec.h new file mode 100644 index 00000000..faee6437 --- /dev/null +++ b/mp/src/utils/sapi51/Include/spcollec.h @@ -0,0 +1,1432 @@ +/***************************************************************************** +* SPCollec.h * +*------------* +* This header file contains the SAPI5 collection class templates. These +* are a modified version of the MFC template classes without the dependencies. +*----------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#ifndef SPCollec_h +#define SPCollec_h + +#ifndef _INC_LIMITS +#include +#endif + +#ifndef _INC_STRING +#include +#endif + +#ifndef _INC_STDLIB +#include +#endif + +#ifndef _WIN32_WCE +#ifndef _INC_SEARCH +#include +#endif +#endif + +///////////////////////////////////////////////////////////////////////////// +#define SPASSERT_VALID( a ) // This doesn't do anything right now + +typedef void* SPLISTPOS; +typedef DWORD SPLISTHANDLE; + +#define SP_BEFORE_START_POSITION ((void*)-1L) + +inline BOOL SPIsValidAddress(const void* lp, UINT nBytes, BOOL bReadWrite) +{ + // simple version using Win-32 APIs for pointer validation. + return (lp != NULL && !IsBadReadPtr(lp, nBytes) && + (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes))); +} + +///////////////////////////////////////////////////////////////////////////// +// global helpers (can be overridden) +template +inline HRESULT SPConstructElements(TYPE* pElements, int nCount) +{ + HRESULT hr = S_OK; + SPDBG_ASSERT( nCount == 0 || + SPIsValidAddress( pElements, nCount * sizeof(TYPE), TRUE ) ); + + // default is bit-wise zero initialization + memset((void*)pElements, 0, nCount * sizeof(TYPE)); + return hr; +} + +template +inline void SPDestructElements(TYPE* pElements, int nCount) +{ + SPDBG_ASSERT( ( nCount == 0 || + SPIsValidAddress( pElements, nCount * sizeof(TYPE), TRUE ) ) ); + pElements; // not used + nCount; // not used + + // default does nothing +} + +template +inline HRESULT SPCopyElements(TYPE* pDest, const TYPE* pSrc, int nCount) +{ + HRESULT hr = S_OK; + SPDBG_ASSERT( ( nCount == 0 || + SPIsValidAddress( pDest, nCount * sizeof(TYPE), TRUE )) ); + SPDBG_ASSERT( ( nCount == 0 || + SPIsValidAddress( pSrc, nCount * sizeof(TYPE), FALSE )) ); + + // default is bit-wise copy + memcpy(pDest, pSrc, nCount * sizeof(TYPE)); + return hr; +} + +template +BOOL SPCompareElements(const TYPE* pElement1, const ARG_TYPE* pElement2) +{ + SPDBG_ASSERT( SPIsValidAddress( pElement1, sizeof(TYPE), FALSE ) ); + SPDBG_ASSERT( SPIsValidAddress( pElement2, sizeof(ARG_TYPE), FALSE ) ); + return *pElement1 == *pElement2; +} + +template +inline UINT SPHashKey(ARG_KEY key) +{ + // default identity hash - works for most primitive values + return ((UINT)(void*)(DWORD)key) >> 4; +} + +///////////////////////////////////////////////////////////////////////////// +// CSPPlex + +struct CSPPlex // warning variable length structure +{ + CSPPlex* pNext; + UINT nMax; + UINT nCur; + /* BYTE data[maxNum*elementSize]; */ + void* data() { return this+1; } + + static CSPPlex* PASCAL Create( CSPPlex*& pHead, UINT nMax, UINT cbElement ) + { + CSPPlex* p = (CSPPlex*) new BYTE[sizeof(CSPPlex) + nMax * cbElement]; + SPDBG_ASSERT(p); + p->nMax = nMax; + p->nCur = 0; + p->pNext = pHead; + pHead = p; // change head (adds in reverse order for simplicity) + return p; + } + + void FreeDataChain() + { + CSPPlex* p = this; + while (p != NULL) + { + BYTE* bytes = (BYTE*) p; + CSPPlex* pNext = p->pNext; + delete[] bytes; + p = pNext; + } + } +}; + + +///////////////////////////////////////////////////////////////////////////// +// CSPArray + +template +class CSPArray +{ +public: +// Construction + CSPArray(); + +// Attributes + int GetSize() const; + int GetUpperBound() const; + HRESULT SetSize(int nNewSize, int nGrowBy = -1); + +// Operations + // Clean up + void FreeExtra(); + void RemoveAll(); + + // Accessing elements + TYPE GetAt(int nIndex) const; + void SetAt(int nIndex, ARG_TYPE newElement); + TYPE& ElementAt(int nIndex); + + // Direct Access to the element data (may return NULL) + const TYPE* GetData() const; + TYPE* GetData(); + + // Potentially growing the array + HRESULT SetAtGrow(int nIndex, ARG_TYPE newElement); + int Add(ARG_TYPE newElement); + int Append(const CSPArray& src); + HRESULT Copy(const CSPArray& src); + + // overloaded operator helpers + TYPE operator[](int nIndex) const; + TYPE& operator[](int nIndex); + + // Operations that move elements around + HRESULT InsertAt(int nIndex, ARG_TYPE newElement, int nCount = 1); + void RemoveAt(int nIndex, int nCount = 1); + HRESULT InsertAt(int nStartIndex, CSPArray* pNewArray); + void Sort(int (__cdecl *compare )(const void *elem1, const void *elem2 )); + +// Implementation +protected: + TYPE* m_pData; // the actual array of data + int m_nSize; // # of elements (upperBound - 1) + int m_nMaxSize; // max allocated + int m_nGrowBy; // grow amount + +public: + ~CSPArray(); +#ifdef _DEBUG +// void Dump(CDumpContext&) const; + void AssertValid() const; +#endif +}; + +///////////////////////////////////////////////////////////////////////////// +// CSPArray inline functions + +template +inline int CSPArray::GetSize() const + { return m_nSize; } +template +inline int CSPArray::GetUpperBound() const + { return m_nSize-1; } +template +inline void CSPArray::RemoveAll() + { SetSize(0, -1); } +template +inline TYPE CSPArray::GetAt(int nIndex) const + { SPDBG_ASSERT( (nIndex >= 0 && nIndex < m_nSize) ); + return m_pData[nIndex]; } +template +inline void CSPArray::SetAt(int nIndex, ARG_TYPE newElement) + { SPDBG_ASSERT( (nIndex >= 0 && nIndex < m_nSize) ); + m_pData[nIndex] = newElement; } +template +inline TYPE& CSPArray::ElementAt(int nIndex) + { SPDBG_ASSERT( (nIndex >= 0 && nIndex < m_nSize) ); + return m_pData[nIndex]; } +template +inline const TYPE* CSPArray::GetData() const + { return (const TYPE*)m_pData; } +template +inline TYPE* CSPArray::GetData() + { return (TYPE*)m_pData; } +template +inline int CSPArray::Add(ARG_TYPE newElement) + { int nIndex = m_nSize; + SetAtGrow(nIndex, newElement); + return nIndex; } +template +inline TYPE CSPArray::operator[](int nIndex) const + { return GetAt(nIndex); } +template +inline TYPE& CSPArray::operator[](int nIndex) + { return ElementAt(nIndex); } + +///////////////////////////////////////////////////////////////////////////// +// CSPArray out-of-line functions + +template +CSPArray::CSPArray() +{ + m_pData = NULL; + m_nSize = m_nMaxSize = m_nGrowBy = 0; +} + +template +CSPArray::~CSPArray() +{ + SPASSERT_VALID( this ); + + if (m_pData != NULL) + { + SPDestructElements(m_pData, m_nSize); + delete[] (BYTE*)m_pData; + } +} + +template +HRESULT CSPArray::SetSize(int nNewSize, int nGrowBy) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nNewSize >= 0 ); + HRESULT hr = S_OK; + + if (nGrowBy != -1) + m_nGrowBy = nGrowBy; // set new size + + if (nNewSize == 0) + { + // shrink to nothing + if (m_pData != NULL) + { + SPDestructElements(m_pData, m_nSize); + delete[] (BYTE*)m_pData; + m_pData = NULL; + } + m_nSize = m_nMaxSize = 0; + } + else if (m_pData == NULL) + { + // create one with exact size +#ifdef SIZE_T_MAX + SPDBG_ASSERT( nNewSize <= SIZE_T_MAX/sizeof(TYPE) ); // no overflow +#endif + m_pData = (TYPE*) new BYTE[nNewSize * sizeof(TYPE)]; + if( m_pData ) + { + hr = SPConstructElements(m_pData, nNewSize); + if( SUCCEEDED( hr ) ) + { + m_nSize = m_nMaxSize = nNewSize; + } + else + { + delete[] (BYTE*)m_pData; + m_pData = NULL; + } + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if (nNewSize <= m_nMaxSize) + { + // it fits + if (nNewSize > m_nSize) + { + // initialize the new elements + hr = SPConstructElements(&m_pData[m_nSize], nNewSize-m_nSize); + } + else if (m_nSize > nNewSize) + { + // destroy the old elements + SPDestructElements(&m_pData[nNewSize], m_nSize-nNewSize); + } + + if( SUCCEEDED( hr ) ) + { + m_nSize = nNewSize; + } + } + else + { + // otherwise, grow array + int nGrowBy = m_nGrowBy; + if (nGrowBy == 0) + { + // heuristically determe growth when nGrowBy == 0 + // (this avoids heap fragmentation in many situations) + nGrowBy = min(1024, max(4, m_nSize / 8)); + } + int nNewMax; + if (nNewSize < m_nMaxSize + nGrowBy) + nNewMax = m_nMaxSize + nGrowBy; // granularity + else + nNewMax = nNewSize; // no slush + + SPDBG_ASSERT( nNewMax >= m_nMaxSize ); // no wrap around +#ifdef SIZE_T_MAX + SPDBG_ASSERT( nNewMax <= SIZE_T_MAX/sizeof(TYPE) ); // no overflow +#endif + TYPE* pNewData = (TYPE*) new BYTE[nNewMax * sizeof(TYPE)]; + + if( pNewData ) + { + // copy new data from old + memcpy(pNewData, m_pData, m_nSize * sizeof(TYPE)); + + // construct remaining elements + SPDBG_ASSERT( nNewSize > m_nSize ); + hr = SPConstructElements(&pNewData[m_nSize], nNewSize-m_nSize); + + // get rid of old stuff (note: no destructors called) + delete[] (BYTE*)m_pData; + m_pData = pNewData; + m_nSize = nNewSize; + m_nMaxSize = nNewMax; + } + else + { + hr = E_OUTOFMEMORY; + } + } + return hr; +} + +template +int CSPArray::Append(const CSPArray& src) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( this != &src ); // cannot append to itself + + int nOldSize = m_nSize; + HRESULT hr = SetSize(m_nSize + src.m_nSize); + if( SUCCEEDED( hr ) ) + { + hr = SPCopyElements(m_pData + nOldSize, src.m_pData, src.m_nSize); + } + return ( SUCCEEDED( hr ) )?(nOldSize):(-1); +} + +template +HRESULT CSPArray::Copy(const CSPArray& src) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( this != &src ); // cannot copy to itself + + HRESULT hr = SetSize(src.m_nSize); + if( SUCCEEDED( hr ) ) + { + hr = SPCopyElements(m_pData, src.m_pData, src.m_nSize); + } + return hr; +} + +template +void CSPArray::FreeExtra() +{ + SPASSERT_VALID( this ); + + if (m_nSize != m_nMaxSize) + { + // shrink to desired size +#ifdef SIZE_T_MAX + SPDBG_ASSERT( m_nSize <= SIZE_T_MAX/sizeof(TYPE)); // no overflow +#endif + TYPE* pNewData = NULL; + if (m_nSize != 0) + { + pNewData = (TYPE*) new BYTE[m_nSize * sizeof(TYPE)]; + SPDBG_ASSERT(pNewData); + // copy new data from old + memcpy(pNewData, m_pData, m_nSize * sizeof(TYPE)); + } + + // get rid of old stuff (note: no destructors called) + delete[] (BYTE*)m_pData; + m_pData = pNewData; + m_nMaxSize = m_nSize; + } +} + +template +HRESULT CSPArray::SetAtGrow(int nIndex, ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nIndex >= 0 ); + HRESULT hr = S_OK; + + if (nIndex >= m_nSize) + { + hr = SetSize(nIndex+1, -1); + } + + if( SUCCEEDED( hr ) ) + { + m_pData[nIndex] = newElement; + } + return hr; +} + +template +HRESULT CSPArray::InsertAt(int nIndex, ARG_TYPE newElement, int nCount /*=1*/) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nIndex >= 0 ); // will expand to meet need + SPDBG_ASSERT( nCount > 0 ); // zero or negative size not allowed + HRESULT hr = S_OK; + + if (nIndex >= m_nSize) + { + // adding after the end of the array + hr = SetSize(nIndex + nCount, -1); // grow so nIndex is valid + } + else + { + // inserting in the middle of the array + int nOldSize = m_nSize; + hr = SetSize(m_nSize + nCount, -1); // grow it to new size + if( SUCCEEDED( hr ) ) + { + // shift old data up to fill gap + memmove(&m_pData[nIndex+nCount], &m_pData[nIndex], + (nOldSize-nIndex) * sizeof(TYPE)); + + // re-init slots we copied from + hr = SPConstructElements(&m_pData[nIndex], nCount); + } + } + + // insert new value in the gap + if( SUCCEEDED( hr ) ) + { + SPDBG_ASSERT( nIndex + nCount <= m_nSize ); + while (nCount--) + m_pData[nIndex++] = newElement; + } + return hr; +} + +template +void CSPArray::RemoveAt(int nIndex, int nCount) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nIndex >= 0 ); + SPDBG_ASSERT( nCount >= 0 ); + SPDBG_ASSERT( nIndex + nCount <= m_nSize ); + + // just remove a range + int nMoveCount = m_nSize - (nIndex + nCount); + SPDestructElements(&m_pData[nIndex], nCount); + if (nMoveCount) + memcpy(&m_pData[nIndex], &m_pData[nIndex + nCount], + nMoveCount * sizeof(TYPE)); + m_nSize -= nCount; +} + +template +HRESULT CSPArray::InsertAt(int nStartIndex, CSPArray* pNewArray) +{ + SPASSERT_VALID( this ); + SPASSERT_VALID( pNewArray ); + SPDBG_ASSERT( nStartIndex >= 0 ); + HRESULT hr = S_OK; + + if (pNewArray->GetSize() > 0) + { + hr = InsertAt(nStartIndex, pNewArray->GetAt(0), pNewArray->GetSize()); + for (int i = 0; SUCCEEDED( hr )&& (i < pNewArray->GetSize()); i++) + { + SetAt(nStartIndex + i, pNewArray->GetAt(i)); + } + } + return hr; +} + +template +void CSPArray::Sort(int (__cdecl *compare )(const void *elem1, const void *elem2 )) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_pData != NULL ); + + qsort( m_pData, m_nSize, sizeof(TYPE), compare ); +} + +#ifdef _DEBUG +template +void CSPArray::AssertValid() const +{ + if (m_pData == NULL) + { + SPDBG_ASSERT( m_nSize == 0 ); + SPDBG_ASSERT( m_nMaxSize == 0 ); + } + else + { + SPDBG_ASSERT( m_nSize >= 0 ); + SPDBG_ASSERT( m_nMaxSize >= 0 ); + SPDBG_ASSERT( m_nSize <= m_nMaxSize ); + SPDBG_ASSERT( SPIsValidAddress(m_pData, m_nMaxSize * sizeof(TYPE), TRUE ) ); + } +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CSPList + +template +class CSPList +{ +protected: + struct CNode + { + CNode* pNext; + CNode* pPrev; + TYPE data; + }; +public: + +// Construction + CSPList(int nBlockSize = 10); + +// Attributes (head and tail) + // count of elements + int GetCount() const; + BOOL IsEmpty() const; + + // peek at head or tail + TYPE& GetHead(); + TYPE GetHead() const; + TYPE& GetTail(); + TYPE GetTail() const; + +// Operations + // get head or tail (and remove it) - don't call on empty list ! + TYPE RemoveHead(); + TYPE RemoveTail(); + + // add before head or after tail + SPLISTPOS AddHead(ARG_TYPE newElement); + SPLISTPOS AddTail(ARG_TYPE newElement); + + // add another list of elements before head or after tail + void AddHead(CSPList* pNewList); + void AddTail(CSPList* pNewList); + + // remove all elements + void RemoveAll(); + + // iteration + SPLISTPOS GetHeadPosition() const; + SPLISTPOS GetTailPosition() const; + TYPE& GetNext(SPLISTPOS& rPosition); // return *Position++ + TYPE GetNext(SPLISTPOS& rPosition) const; // return *Position++ + TYPE& GetPrev(SPLISTPOS& rPosition); // return *Position-- + TYPE GetPrev(SPLISTPOS& rPosition) const; // return *Position-- + + // getting/modifying an element at a given position + TYPE& GetAt(SPLISTPOS position); + TYPE GetAt(SPLISTPOS position) const; + void SetAt(SPLISTPOS pos, ARG_TYPE newElement); + void RemoveAt(SPLISTPOS position); + + // inserting before or after a given position + SPLISTPOS InsertBefore(SPLISTPOS position, ARG_TYPE newElement); + SPLISTPOS InsertAfter(SPLISTPOS position, ARG_TYPE newElement); + + // helper functions (note: O(n) speed) + SPLISTPOS Find(ARG_TYPE searchValue, SPLISTPOS startAfter = NULL) const; + // defaults to starting at the HEAD, return NULL if not found + SPLISTPOS FindIndex(int nIndex) const; + // get the 'nIndex'th element (may return NULL) + +// Implementation +protected: + CNode* m_pNodeHead; + CNode* m_pNodeTail; + int m_nCount; + CNode* m_pNodeFree; + struct CSPPlex* m_pBlocks; + int m_nBlockSize; + + CNode* NewNode(CNode*, CNode*); + void FreeNode(CNode*); + +public: + ~CSPList(); +#ifdef _DEBUG + void AssertValid() const; +#endif +}; + +///////////////////////////////////////////////////////////////////////////// +// CSPList inline functions + +template +inline int CSPList::GetCount() const + { return m_nCount; } +template +inline BOOL CSPList::IsEmpty() const + { return m_nCount == 0; } +template +inline TYPE& CSPList::GetHead() + { SPDBG_ASSERT( m_pNodeHead != NULL ); + return m_pNodeHead->data; } +template +inline TYPE CSPList::GetHead() const + { SPDBG_ASSERT( m_pNodeHead != NULL ); + return m_pNodeHead->data; } +template +inline TYPE& CSPList::GetTail() + { SPDBG_ASSERT( m_pNodeTail != NULL ); + return m_pNodeTail->data; } +template +inline TYPE CSPList::GetTail() const + { SPDBG_ASSERT( m_pNodeTail != NULL ); + return m_pNodeTail->data; } +template +inline SPLISTPOS CSPList::GetHeadPosition() const + { return (SPLISTPOS) m_pNodeHead; } +template +inline SPLISTPOS CSPList::GetTailPosition() const + { return (SPLISTPOS) m_pNodeTail; } +template +inline TYPE& CSPList::GetNext(SPLISTPOS& rPosition) // return *Position++ + { CNode* pNode = (CNode*) rPosition; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + rPosition = (SPLISTPOS) pNode->pNext; + return pNode->data; } +template +inline TYPE CSPList::GetNext(SPLISTPOS& rPosition) const // return *Position++ + { CNode* pNode = (CNode*) rPosition; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + rPosition = (SPLISTPOS) pNode->pNext; + return pNode->data; } +template +inline TYPE& CSPList::GetPrev(SPLISTPOS& rPosition) // return *Position-- + { CNode* pNode = (CNode*) rPosition; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + rPosition = (SPLISTPOS) pNode->pPrev; + return pNode->data; } +template +inline TYPE CSPList::GetPrev(SPLISTPOS& rPosition) const // return *Position-- + { CNode* pNode = (CNode*) rPosition; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + rPosition = (SPLISTPOS) pNode->pPrev; + return pNode->data; } +template +inline TYPE& CSPList::GetAt(SPLISTPOS position) + { CNode* pNode = (CNode*) position; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + return pNode->data; } +template +inline TYPE CSPList::GetAt(SPLISTPOS position) const + { CNode* pNode = (CNode*) position; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + return pNode->data; } +template +inline void CSPList::SetAt(SPLISTPOS pos, ARG_TYPE newElement) + { CNode* pNode = (CNode*) pos; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + pNode->data = newElement; } + +///////////////////////////////////////////////////////////////////////////// +// CSPList out-of-line functions + +template +CSPList::CSPList( int nBlockSize ) +{ + SPDBG_ASSERT( nBlockSize > 0 ); + + m_nCount = 0; + m_pNodeHead = m_pNodeTail = m_pNodeFree = NULL; + m_pBlocks = NULL; + m_nBlockSize = nBlockSize; +} + +template +void CSPList::RemoveAll() +{ + SPASSERT_VALID( this ); + + // destroy elements + CNode* pNode; + for (pNode = m_pNodeHead; pNode != NULL; pNode = pNode->pNext) + SPDestructElements(&pNode->data, 1); + + m_nCount = 0; + m_pNodeHead = m_pNodeTail = m_pNodeFree = NULL; + m_pBlocks->FreeDataChain(); + m_pBlocks = NULL; +} + +template +CSPList::~CSPList() +{ + RemoveAll(); + SPDBG_ASSERT( m_nCount == 0 ); +} + +///////////////////////////////////////////////////////////////////////////// +// Node helpers +// +// Implementation note: CNode's are stored in CSPPlex blocks and +// chained together. Free blocks are maintained in a singly linked list +// using the 'pNext' member of CNode with 'm_pNodeFree' as the head. +// Used blocks are maintained in a doubly linked list using both 'pNext' +// and 'pPrev' as links and 'm_pNodeHead' and 'm_pNodeTail' +// as the head/tail. +// +// We never free a CSPPlex block unless the List is destroyed or RemoveAll() +// is used - so the total number of CSPPlex blocks may grow large depending +// on the maximum past size of the list. +// + +template +CSPList::CNode* +CSPList::NewNode(CSPList::CNode* pPrev, CSPList::CNode* pNext) +{ + if (m_pNodeFree == NULL) + { + // add another block + CSPPlex* pNewBlock = CSPPlex::Create(m_pBlocks, m_nBlockSize,sizeof(CNode)); + + // chain them into free list + CNode* pNode = (CNode*) pNewBlock->data(); + // free in reverse order to make it easier to debug + pNode += m_nBlockSize - 1; + for (int i = m_nBlockSize-1; i >= 0; i--, pNode--) + { + pNode->pNext = m_pNodeFree; + m_pNodeFree = pNode; + } + } + + CSPList::CNode* pNode = m_pNodeFree; + if( pNode ) + { + if( SUCCEEDED( SPConstructElements(&pNode->data, 1) ) ) + { + m_pNodeFree = m_pNodeFree->pNext; + pNode->pPrev = pPrev; + pNode->pNext = pNext; + m_nCount++; + SPDBG_ASSERT( m_nCount > 0 ); // make sure we don't overflow + } + } + return pNode; +} + +template +void CSPList::FreeNode(CSPList::CNode* pNode) +{ + SPDestructElements(&pNode->data, 1); + pNode->pNext = m_pNodeFree; + m_pNodeFree = pNode; + m_nCount--; + SPDBG_ASSERT( m_nCount >= 0 ); // make sure we don't underflow +} + +template +SPLISTPOS CSPList::AddHead(ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + + CNode* pNewNode = NewNode(NULL, m_pNodeHead); + if( pNewNode ) + { + pNewNode->data = newElement; + if (m_pNodeHead != NULL) + m_pNodeHead->pPrev = pNewNode; + else + m_pNodeTail = pNewNode; + m_pNodeHead = pNewNode; + } + return (SPLISTPOS) pNewNode; +} + +template +SPLISTPOS CSPList::AddTail(ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + + CNode* pNewNode = NewNode(m_pNodeTail, NULL); + if( pNewNode ) + { + pNewNode->data = newElement; + if (m_pNodeTail != NULL) + m_pNodeTail->pNext = pNewNode; + else + m_pNodeHead = pNewNode; + m_pNodeTail = pNewNode; + } + return (SPLISTPOS) pNewNode; +} + +template +void CSPList::AddHead(CSPList* pNewList) +{ + SPASSERT_VALID( this ); + SPASSERT_VALID( pNewList ); + + // add a list of same elements to head (maintain order) + SPLISTPOS pos = pNewList->GetTailPosition(); + while (pos != NULL) + AddHead(pNewList->GetPrev(pos)); +} + +template +void CSPList::AddTail(CSPList* pNewList) +{ + SPASSERT_VALID( this ); + SPASSERT_VALID( pNewList ); + + // add a list of same elements + SPLISTPOS pos = pNewList->GetHeadPosition(); + while (pos != NULL) + AddTail(pNewList->GetNext(pos)); +} + +template +TYPE CSPList::RemoveHead() +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_pNodeHead != NULL ); // don't call on empty list !!! + SPDBG_ASSERT( SPIsValidAddress(m_pNodeHead, sizeof(CNode), TRUE ) ); + + CNode* pOldNode = m_pNodeHead; + TYPE returnValue = pOldNode->data; + + m_pNodeHead = pOldNode->pNext; + if (m_pNodeHead != NULL) + m_pNodeHead->pPrev = NULL; + else + m_pNodeTail = NULL; + FreeNode(pOldNode); + return returnValue; +} + +template +TYPE CSPList::RemoveTail() +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_pNodeTail != NULL ); // don't call on empty list !!! + SPDBG_ASSERT( SPIsValidAddress(m_pNodeTail, sizeof(CNode), TRUE ) ); + + CNode* pOldNode = m_pNodeTail; + TYPE returnValue = pOldNode->data; + + m_pNodeTail = pOldNode->pPrev; + if (m_pNodeTail != NULL) + m_pNodeTail->pNext = NULL; + else + m_pNodeHead = NULL; + FreeNode(pOldNode); + return returnValue; +} + +template +SPLISTPOS CSPList::InsertBefore(SPLISTPOS position, ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + + if (position == NULL) + return AddHead(newElement); // insert before nothing -> head of the list + + // Insert it before position + CNode* pOldNode = (CNode*) position; + CNode* pNewNode = NewNode(pOldNode->pPrev, pOldNode); + if( pNewNode ) + { + pNewNode->data = newElement; + + if (pOldNode->pPrev != NULL) + { + SPDBG_ASSERT( SPIsValidAddress(pOldNode->pPrev, sizeof(CNode), TRUE ) ); + pOldNode->pPrev->pNext = pNewNode; + } + else + { + SPDBG_ASSERT( pOldNode == m_pNodeHead ); + m_pNodeHead = pNewNode; + } + pOldNode->pPrev = pNewNode; + } + return (SPLISTPOS) pNewNode; +} + +template +SPLISTPOS CSPList::InsertAfter(SPLISTPOS position, ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + + if (position == NULL) + return AddTail(newElement); // insert after nothing -> tail of the list + + // Insert it before position + CNode* pOldNode = (CNode*) position; + SPDBG_ASSERT( SPIsValidAddress(pOldNode, sizeof(CNode), TRUE )); + CNode* pNewNode = NewNode(pOldNode, pOldNode->pNext); + if( pNewNode ) + { + pNewNode->data = newElement; + + if (pOldNode->pNext != NULL) + { + SPDBG_ASSERT( SPIsValidAddress(pOldNode->pNext, sizeof(CNode), TRUE )); + pOldNode->pNext->pPrev = pNewNode; + } + else + { + SPDBG_ASSERT( pOldNode == m_pNodeTail ); + m_pNodeTail = pNewNode; + } + pOldNode->pNext = pNewNode; + } + return (SPLISTPOS) pNewNode; +} + +template +void CSPList::RemoveAt(SPLISTPOS position) +{ + SPASSERT_VALID( this ); + + CNode* pOldNode = (CNode*) position; + SPDBG_ASSERT( SPIsValidAddress(pOldNode, sizeof(CNode), TRUE ) ); + + // remove pOldNode from list + if (pOldNode == m_pNodeHead) + { + m_pNodeHead = pOldNode->pNext; + } + else + { + SPDBG_ASSERT( SPIsValidAddress(pOldNode->pPrev, sizeof(CNode), TRUE ) ); + pOldNode->pPrev->pNext = pOldNode->pNext; + } + if (pOldNode == m_pNodeTail) + { + m_pNodeTail = pOldNode->pPrev; + } + else + { + SPDBG_ASSERT( SPIsValidAddress(pOldNode->pNext, sizeof(CNode), TRUE ) ); + pOldNode->pNext->pPrev = pOldNode->pPrev; + } + FreeNode(pOldNode); +} + +template +SPLISTPOS CSPList::FindIndex(int nIndex) const +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nIndex >= 0 ); + + if (nIndex >= m_nCount) + return NULL; // went too far + + CNode* pNode = m_pNodeHead; + while (nIndex--) + { + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE )); + pNode = pNode->pNext; + } + return (SPLISTPOS) pNode; +} + +template +SPLISTPOS CSPList::Find(ARG_TYPE searchValue, SPLISTPOS startAfter) const +{ + SPASSERT_VALID( this ); + + CNode* pNode = (CNode*) startAfter; + if (pNode == NULL) + { + pNode = m_pNodeHead; // start at head + } + else + { + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + pNode = pNode->pNext; // start after the one specified + } + + for (; pNode != NULL; pNode = pNode->pNext) + if (SPCompareElements(&pNode->data, &searchValue)) + return (SPLISTPOS)pNode; + return NULL; +} + +#ifdef _DEBUG +template +void CSPList::AssertValid() const +{ + if (m_nCount == 0) + { + // empty list + SPDBG_ASSERT( m_pNodeHead == NULL ); + SPDBG_ASSERT( m_pNodeTail == NULL ); + } + else + { + // non-empty list + SPDBG_ASSERT( SPIsValidAddress(m_pNodeHead, sizeof(CNode), TRUE )); + SPDBG_ASSERT( SPIsValidAddress(m_pNodeTail, sizeof(CNode), TRUE )); + } +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CSPMap + +template +class CSPMap +{ +protected: + // Association + struct CAssoc + { + CAssoc* pNext; + UINT nHashValue; // needed for efficient iteration + KEY key; + VALUE value; + }; +public: +// Construction + CSPMap( int nBlockSize = 10 ); + +// Attributes + // number of elements + int GetCount() const; + BOOL IsEmpty() const; + + // Lookup + BOOL Lookup(ARG_KEY key, VALUE& rValue) const; + +// Operations + // Lookup and add if not there + VALUE& operator[](ARG_KEY key); + + // add a new (key, value) pair + void SetAt(ARG_KEY key, ARG_VALUE newValue); + + // removing existing (key, ?) pair + BOOL RemoveKey(ARG_KEY key); + void RemoveAll(); + + // iterating all (key, value) pairs + SPLISTPOS GetStartPosition() const; + void GetNextAssoc(SPLISTPOS& rNextPosition, KEY& rKey, VALUE& rValue) const; + + // advanced features for derived classes + UINT GetHashTableSize() const; + HRESULT InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE); + +// Implementation +protected: + CAssoc** m_pHashTable; + UINT m_nHashTableSize; + int m_nCount; + CAssoc* m_pFreeList; + struct CSPPlex* m_pBlocks; + int m_nBlockSize; + + CAssoc* NewAssoc(); + void FreeAssoc(CAssoc*); + CAssoc* GetAssocAt(ARG_KEY, UINT&) const; + +public: + ~CSPMap(); +#ifdef _DEBUG +// void Dump(CDumpContext&) const; + void AssertValid() const; +#endif +}; + +///////////////////////////////////////////////////////////////////////////// +// CSPMap inline functions + +template +inline int CSPMap::GetCount() const + { return m_nCount; } +template +inline BOOL CSPMap::IsEmpty() const + { return m_nCount == 0; } +template +inline void CSPMap::SetAt(ARG_KEY key, ARG_VALUE newValue) + { (*this)[key] = newValue; } +template +inline SPLISTPOS CSPMap::GetStartPosition() const + { return (m_nCount == 0) ? NULL : SP_BEFORE_START_POSITION; } +template +inline UINT CSPMap::GetHashTableSize() const + { return m_nHashTableSize; } + +///////////////////////////////////////////////////////////////////////////// +// CSPMap out-of-line functions + +template +CSPMap::CSPMap( int nBlockSize ) +{ + SPDBG_ASSERT( nBlockSize > 0 ); + + m_pHashTable = NULL; + m_nHashTableSize = 17; // default size + m_nCount = 0; + m_pFreeList = NULL; + m_pBlocks = NULL; + m_nBlockSize = nBlockSize; +} + +template +HRESULT CSPMap::InitHashTable( + UINT nHashSize, BOOL bAllocNow) +// +// Used to force allocation of a hash table or to override the default +// hash table size of (which is fairly small) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_nCount == 0 ); + SPDBG_ASSERT( nHashSize > 0 ); + HRESULT hr = S_OK; + + if (m_pHashTable != NULL) + { + // free hash table + delete[] m_pHashTable; + m_pHashTable = NULL; + } + + if (bAllocNow) + { + m_pHashTable = new CAssoc* [nHashSize]; + if( m_pHashTable ) + { + memset(m_pHashTable, 0, sizeof(CAssoc*) * nHashSize); + } + else + { + hr = E_OUTOFMEMORY; + } + } + + m_nHashTableSize = ( SUCCEEDED( hr ) )?(nHashSize):(0); + return hr; +} + +template +void CSPMap::RemoveAll() +{ + SPASSERT_VALID( this ); + + if (m_pHashTable != NULL) + { + // destroy elements (values and keys) + for (UINT nHash = 0; nHash < m_nHashTableSize; nHash++) + { + CAssoc* pAssoc; + for( pAssoc = m_pHashTable[nHash]; pAssoc != NULL; + pAssoc = pAssoc->pNext) + { + SPDestructElements(&pAssoc->value, 1); + SPDestructElements(&pAssoc->key, 1); + } + } + } + + // free hash table + delete[] m_pHashTable; + m_pHashTable = NULL; + + m_nCount = 0; + m_pFreeList = NULL; + m_pBlocks->FreeDataChain(); + m_pBlocks = NULL; +} + +template +CSPMap::~CSPMap() +{ + RemoveAll(); + SPDBG_ASSERT( m_nCount == 0 ); +} + +template +CSPMap::CAssoc* +CSPMap::NewAssoc() +{ + if (m_pFreeList == NULL) + { + // add another block + CSPPlex* newBlock = CSPPlex::Create(m_pBlocks, m_nBlockSize, sizeof(CSPMap::CAssoc)); + + if( newBlock ) + { + // chain them into free list + CSPMap::CAssoc* pAssoc = (CSPMap::CAssoc*) newBlock->data(); + // free in reverse order to make it easier to debug + pAssoc += m_nBlockSize - 1; + for (int i = m_nBlockSize-1; i >= 0; i--, pAssoc--) + { + pAssoc->pNext = m_pFreeList; + m_pFreeList = pAssoc; + } + } + } + + CSPMap::CAssoc* pAssoc = m_pFreeList; + if( pAssoc ) + { + if( SUCCEEDED( SPConstructElements(&pAssoc->key, 1 ) ) ) + { + if( SUCCEEDED( SPConstructElements(&pAssoc->value, 1 ) ) ) + { + m_pFreeList = m_pFreeList->pNext; + m_nCount++; + SPDBG_ASSERT( m_nCount > 0 ); // make sure we don't overflow + } + else + { + SPDestructElements( &pAssoc->key, 1 ); + } + } + else + { + pAssoc = NULL; + } + } + return pAssoc; +} + +template +void CSPMap::FreeAssoc(CSPMap::CAssoc* pAssoc) +{ + SPDestructElements(&pAssoc->value, 1); + SPDestructElements(&pAssoc->key, 1); + pAssoc->pNext = m_pFreeList; + m_pFreeList = pAssoc; + m_nCount--; + SPDBG_ASSERT( m_nCount >= 0 ); // make sure we don't underflow +} + +template +CSPMap::CAssoc* +CSPMap::GetAssocAt(ARG_KEY key, UINT& nHash) const +// find association (or return NULL) +{ + nHash = SPHashKey(key) % m_nHashTableSize; + + if (m_pHashTable == NULL) + return NULL; + + // see if it exists + CAssoc* pAssoc; + for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext) + { + if (SPCompareElements(&pAssoc->key, &key)) + return pAssoc; + } + return NULL; +} + +template +BOOL CSPMap::Lookup(ARG_KEY key, VALUE& rValue) const +{ + SPASSERT_VALID( this ); + + UINT nHash; + CAssoc* pAssoc = GetAssocAt(key, nHash); + if (pAssoc == NULL) + return FALSE; // not in map + + rValue = pAssoc->value; + return TRUE; +} + +template +VALUE& CSPMap::operator[](ARG_KEY key) +{ + SPASSERT_VALID( this ); + HRESULT hr = S_OK; + static const CAssoc ErrAssoc = 0; + + UINT nHash; + CAssoc* pAssoc; + if ((pAssoc = GetAssocAt(key, nHash)) == NULL) + { + if( m_pHashTable == NULL ) + { + hr = InitHashTable(m_nHashTableSize); + } + + if( SUCCEEDED( hr ) ) + { + // it doesn't exist, add a new Association + pAssoc = NewAssoc(); + if( pAssoc ) + { + pAssoc->nHashValue = nHash; + pAssoc->key = key; + // 'pAssoc->value' is a constructed object, nothing more + + // put into hash table + pAssoc->pNext = m_pHashTable[nHash]; + m_pHashTable[nHash] = pAssoc; + } + else + { + pAssoc = &ErrAssoc; + } + } + } + return pAssoc->value; // return new reference +} + +template +BOOL CSPMap::RemoveKey(ARG_KEY key) +// remove key - return TRUE if removed +{ + SPASSERT_VALID( this ); + + if (m_pHashTable == NULL) + return FALSE; // nothing in the table + + CAssoc** ppAssocPrev; + ppAssocPrev = &m_pHashTable[SPHashKey(key) % m_nHashTableSize]; + + CAssoc* pAssoc; + for (pAssoc = *ppAssocPrev; pAssoc != NULL; pAssoc = pAssoc->pNext) + { + if (SPCompareElements(&pAssoc->key, &key)) + { + // remove it + *ppAssocPrev = pAssoc->pNext; // remove from list + FreeAssoc(pAssoc); + return TRUE; + } + ppAssocPrev = &pAssoc->pNext; + } + return FALSE; // not found +} + +template +void CSPMap::GetNextAssoc(SPLISTPOS& rNextPosition, + KEY& rKey, VALUE& rValue) const +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_pHashTable != NULL ); // never call on empty map + + CAssoc* pAssocRet = (CAssoc*)rNextPosition; + SPDBG_ASSERT( pAssocRet != NULL ); + + if (pAssocRet == (CAssoc*) SP_BEFORE_START_POSITION) + { + // find the first association + for (UINT nBucket = 0; nBucket < m_nHashTableSize; nBucket++) + if ((pAssocRet = m_pHashTable[nBucket]) != NULL) + break; + SPDBG_ASSERT( pAssocRet != NULL ); // must find something + } + + // find next association + SPDBG_ASSERT( SPIsValidAddress(pAssocRet, sizeof(CAssoc), TRUE )); + CAssoc* pAssocNext; + if ((pAssocNext = pAssocRet->pNext) == NULL) + { + // go to next bucket + for (UINT nBucket = pAssocRet->nHashValue + 1; + nBucket < m_nHashTableSize; nBucket++) + if ((pAssocNext = m_pHashTable[nBucket]) != NULL) + break; + } + + rNextPosition = (SPLISTPOS) pAssocNext; + + // fill in return data + rKey = pAssocRet->key; + rValue = pAssocRet->value; +} + +#ifdef _DEBUG +template +void CSPMap::AssertValid() const +{ + SPDBG_ASSERT( m_nHashTableSize > 0 ); + SPDBG_ASSERT( (m_nCount == 0 || m_pHashTable != NULL) ); + // non-empty map should have hash table +} +#endif //_DEBUG + +#endif //--- This must be the last line in the file diff --git a/mp/src/utils/sapi51/Include/spdebug.h b/mp/src/utils/sapi51/Include/spdebug.h new file mode 100644 index 00000000..da9a7ee9 --- /dev/null +++ b/mp/src/utils/sapi51/Include/spdebug.h @@ -0,0 +1,636 @@ +/******************************************************************************* +* SPDebug.h * +*-----------* +* Description: +* This header file contains debug output services for SAPI5 +*------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*******************************************************************************/ + +#pragma once + +#include +#include + +#ifdef ASSERT_WITH_STACK +#include "AssertWithStack.h" +#endif + +const TCHAR g_szSpDebugKey[] = _T("SPDebug"); +const TCHAR g_szSpDebugFuncTraceReportMode[] = _T("FuncTraceMode"); +const TCHAR g_szSpDebugFuncTraceReportFile[] = _T("FuncTraceFile"); +const TCHAR g_szSpDebugParamInfoReportMode[] = _T("ParamInfoMode"); +const TCHAR g_szSpDebugParamInfoReportFile[] = _T("ParamInfoFile"); +const TCHAR g_szSpDebugDumpInfoReportMode[] = _T("DumpInfoMode"); +const TCHAR g_szSpDebugDumpInfoReportFile[] = _T("DumpInfoFile"); +const TCHAR g_szSpDebugAssertReportMode[] = _T("AssertMode"); +const TCHAR g_szSpDebugAssertReportFile[] = _T("AssertFile"); +const TCHAR g_szSpDebugHRFailReportMode[] = _T("HRFailMode"); +const TCHAR g_szSpDebugHRFailReportFile[] = _T("HRFailFile"); + +const TCHAR g_szSpDebugAssertSettingsReReadEachTime[] = _T("AssertSettingsReReadEachTime"); +const TCHAR g_szSpDebugServerOnStart[] = _T("DebugServerOnStart"); +const TCHAR g_szSpDebugClientOnStart[] = _T("DebugClientOnStart"); + +const TCHAR g_szSpDebugLog[] = _T("c:\\spdebug.log"); + +#ifdef _DEBUG + +class CSpDebug +{ +public: + + CSpDebug() + { + m_mutex = NULL; + m_reportModePrev = -1; + m_hfilePrev = NULL; + Read(); + } + + ~CSpDebug() + { + if (m_mutex != NULL) + { + CloseHandle(m_mutex); + } + } + + BOOL FuncTrace(BOOL fEnter = TRUE) + { + return fEnter + ? Enter(_CRT_WARN, m_FuncTraceMode, m_szFuncTraceFile) + : Leave(); + } + + BOOL ParamInfo(BOOL fEnter = TRUE) + { + return fEnter + ? Enter(_CRT_WARN, m_ParamInfoMode, m_szParamInfoFile) + : Leave(); + } + + BOOL DumpInfo(BOOL fEnter = TRUE) + { + return fEnter + ? Enter(_CRT_WARN, m_DumpInfoMode, m_szDumpInfoFile) + : Leave(); + } + + BOOL Assert(BOOL fEnter = TRUE) + { + if (m_fAssertSettingsReReadEachTime) + Read(); + + return fEnter + ? Enter(_CRT_ASSERT, m_AssertMode, m_szAssertFile) + : Leave(); + } + + BOOL HRFail(BOOL fEnter = TRUE) + { + return fEnter + ? Enter(_CRT_WARN, m_HRFailMode, m_szHRFailFile) + : Leave(); + } + + BOOL DebugServerOnStart() + { + return m_fDebugServerOnStart; + } + + BOOL DebugClientOnStart() + { + return m_fDebugClientOnStart; + } + +private: + + void Read() + { + HKEY hkeyDebug; + RegCreateKeyEx( + HKEY_CLASSES_ROOT, + g_szSpDebugKey, + 0, + NULL, + 0, + KEY_READ | KEY_WRITE, + NULL, + &hkeyDebug, + NULL); + if (hkeyDebug == NULL) + { + RegCreateKeyEx( + HKEY_CLASSES_ROOT, + g_szSpDebugKey, + 0, + NULL, + 0, + KEY_READ, + NULL, + &hkeyDebug, + NULL); + } + + DWORD dw = sizeof(m_fAssertSettingsReReadEachTime); + if (RegQueryValueEx( + hkeyDebug, + g_szSpDebugAssertSettingsReReadEachTime, + NULL, + NULL, + LPBYTE(&m_fAssertSettingsReReadEachTime), + &dw) != ERROR_SUCCESS) + { + m_fAssertSettingsReReadEachTime = FALSE; + RegSetValueEx( + hkeyDebug, + g_szSpDebugAssertSettingsReReadEachTime, + NULL, + REG_DWORD, + LPBYTE(&m_fAssertSettingsReReadEachTime), + sizeof(m_fAssertSettingsReReadEachTime)); + } + + ReadFor( + hkeyDebug, + g_szSpDebugFuncTraceReportMode, + g_szSpDebugFuncTraceReportFile, + &m_FuncTraceMode, + m_szFuncTraceFile, + 0, + g_szSpDebugLog); + ReadFor( + hkeyDebug, + g_szSpDebugParamInfoReportMode, + g_szSpDebugParamInfoReportFile, + &m_ParamInfoMode, + m_szParamInfoFile, + 0, + g_szSpDebugLog); + ReadFor( + hkeyDebug, + g_szSpDebugDumpInfoReportMode, + g_szSpDebugDumpInfoReportFile, + &m_DumpInfoMode, + m_szDumpInfoFile, + _CRTDBG_MODE_DEBUG, + g_szSpDebugLog); + ReadFor( + hkeyDebug, + g_szSpDebugAssertReportMode, + g_szSpDebugAssertReportFile, + &m_AssertMode, + m_szAssertFile, + _CRTDBG_MODE_WNDW, + g_szSpDebugLog); + ReadFor( + hkeyDebug, + g_szSpDebugHRFailReportMode, + g_szSpDebugHRFailReportFile, + &m_HRFailMode, + m_szHRFailFile, + _CRTDBG_MODE_DEBUG, + g_szSpDebugLog); + + dw = sizeof(m_fDebugServerOnStart); + if (RegQueryValueEx( + hkeyDebug, + g_szSpDebugServerOnStart, + NULL, + NULL, + LPBYTE(&m_fDebugServerOnStart), + &dw) != ERROR_SUCCESS) + { + m_fDebugServerOnStart = FALSE; + RegSetValueEx( + hkeyDebug, + g_szSpDebugServerOnStart, + NULL, + REG_DWORD, + LPBYTE(&m_fDebugServerOnStart), + sizeof(m_fDebugServerOnStart)); + } + + dw = sizeof(m_fDebugClientOnStart); + if (RegQueryValueEx( + hkeyDebug, + g_szSpDebugClientOnStart, + NULL, + NULL, + LPBYTE(&m_fDebugClientOnStart), + &dw) != ERROR_SUCCESS) + { + m_fDebugClientOnStart = FALSE; + RegSetValueEx( + hkeyDebug, + g_szSpDebugClientOnStart, + NULL, + REG_DWORD, + LPBYTE(&m_fDebugClientOnStart), + sizeof(m_fDebugClientOnStart)); + } + + RegCloseKey(hkeyDebug); + } + + void ReadFor( + HKEY hkey, + const TCHAR * pszModeValueName, + const TCHAR * pszFileValueName, + DWORD * pdwModeValue, + TCHAR * pszFileValue, + DWORD dwDefaultModeValue, + const TCHAR * pszDefaultFileValue) + { + DWORD dw = sizeof(*pdwModeValue); + if (RegQueryValueEx( + hkey, + pszModeValueName, + NULL, + NULL, + LPBYTE(pdwModeValue), + &dw) != ERROR_SUCCESS) + { + *pdwModeValue = dwDefaultModeValue; + RegSetValueEx( + hkey, + pszModeValueName, + NULL, + REG_DWORD, + LPBYTE(pdwModeValue), + sizeof(*pdwModeValue)); + } + + dw = MAX_PATH; + if (RegQueryValueEx( + hkey, + pszFileValueName, + NULL, + NULL, + LPBYTE(pszFileValue), + &dw) != ERROR_SUCCESS) + { + _tcscpy(pszFileValue, pszDefaultFileValue); + RegSetValueEx( + hkey, + pszFileValueName, + NULL, + REG_SZ, + LPBYTE(pszFileValue), + MAX_PATH); + } + } + + BOOL Enter(int reportType, DWORD &reportMode, TCHAR * pszFile) + { + if (reportMode != 0) + { + // We'll hold the mutex, until the caller also calls Leave + if (m_mutex == NULL) + { + m_mutex = CreateMutex(NULL, FALSE, _T("SpDebug")); + } + WaitForSingleObject(m_mutex, INFINITE); + + m_reportType = reportType; + m_reportModePrev = _CrtSetReportMode(reportType, reportMode); + if (reportMode & _CRTDBG_MODE_FILE) + { + HANDLE hfile = CreateFile( + pszFile, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, + NULL, + OPEN_ALWAYS, + 0, + NULL); + SetFilePointer(hfile, 0, NULL, FILE_END); + m_hfilePrev = (_HFILE)_CrtSetReportFile(reportType, (_HFILE)hfile); + } + + return TRUE; + } + + return FALSE; + } + + BOOL Leave() + { + int reportMode = _CrtSetReportMode(m_reportType, m_reportModePrev); + if (reportMode & _CRTDBG_MODE_FILE) + { + CloseHandle((_HFILE)_CrtSetReportFile(m_reportType, (_HFILE)m_hfilePrev)); + } + + ReleaseMutex(m_mutex); + + return TRUE; + } + +private: + + HANDLE m_mutex; + + int m_reportType; + int m_reportModePrev; + _HFILE m_hfilePrev; + + BOOL m_fAssertSettingsReReadEachTime; + + DWORD m_FuncTraceMode; + TCHAR m_szFuncTraceFile[MAX_PATH + 1]; + DWORD m_ParamInfoMode; + TCHAR m_szParamInfoFile[MAX_PATH + 1]; + DWORD m_DumpInfoMode; + TCHAR m_szDumpInfoFile[MAX_PATH + 1]; + DWORD m_AssertMode; + TCHAR m_szAssertFile[MAX_PATH + 1]; + DWORD m_HRFailMode; + TCHAR m_szHRFailFile[MAX_PATH + 1]; + + BOOL m_fDebugServerOnStart; + BOOL m_fDebugClientOnStart; +}; + +inline CSpDebug *PSpDebug() +{ + static CSpDebug debug; + return &debug; +} + +class CSpFuncTrace +{ +public: + + CSpFuncTrace(PCHAR pFuncName) + { + m_pFuncName = pFuncName; + if (PSpDebug()->FuncTrace()) + { + _RPT1( _CRT_WARN, "\nEntering Function: %s\n", m_pFuncName ); + PSpDebug()->FuncTrace(FALSE); + } + } + + ~CSpFuncTrace() + { + if (PSpDebug()->FuncTrace()) + { + _RPT1( _CRT_WARN, "Leaving Function: %s\n", m_pFuncName ); + PSpDebug()->FuncTrace(FALSE); + } + } + +private: + + PCHAR m_pFuncName; +}; + +#endif // _DEBUG + +//=== User macros ============================================================== + +#ifdef _DEBUG + +#define SPDBG_FUNC(name) \ + CSpFuncTrace functrace(name) + +#if defined(ASSERT_WITH_STACK) && !defined(_WIN64) +#define SPDBG_REPORT_ON_FAIL(hr) \ + do \ + { \ + HRESULT _hr = (hr); \ + if (FAILED(_hr) && PSpDebug()->HRFail()) \ + { \ + SYSTEMTIME sysTime; \ + GetLocalTime(&sysTime); \ + CHAR pszHrWithTime[100]; \ + sprintf(pszHrWithTime, "%lX\n\n%d.%d.%d %02d:%02d:%02d", \ + _hr, \ + sysTime.wMonth,sysTime.wDay,sysTime.wYear, \ + sysTime.wHour,sysTime.wMinute,sysTime.wSecond); \ + PCHAR pszStack = \ + (PCHAR)_alloca( \ + cchMaxAssertStackLevelStringLen * \ + cfrMaxAssertStackLevels + 1); \ + GetStringFromStackLevels(0, 10, pszStack); \ + _RPT4(_CRT_WARN, \ + "%s(%d): Failed HR = %s\n\n%s\n", \ + __FILE__, \ + __LINE__, \ + pszHrWithTime, \ + pszStack); \ + PSpDebug()->HRFail(FALSE); \ + } \ + } while (0) +#else // ASSERT_WITH_STACK & !_WIN64 +#define SPDBG_REPORT_ON_FAIL(hr) \ + do \ + { \ + HRESULT _hr = (hr); \ + if (FAILED(_hr) && PSpDebug()->HRFail()) \ + { \ + _RPT3(_CRT_WARN, "%s(%d): Failed HR = %lX\n", __FILE__, __LINE__, (_hr) );\ + PSpDebug()->HRFail(FALSE); \ + } \ + } while (0) +#endif // ASSERT_WITH_STACK + +#define SPDBG_ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + if (PSpDebug()->Assert()) \ + { \ + _ASSERTE( expr ); \ + PSpDebug()->Assert(FALSE); \ + } \ + } \ + } \ + while (0) + +#define SPDBG_VERIFY(expr) \ + SPDBG_ASSERT(expr) + +#define SPDBG_PMSG0(format) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT0(_CRT_WARN, format); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_PMSG1(format, arg1) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT1(_CRT_WARN, format, arg1); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_PMSG2(format, arg1, arg2) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT2(_CRT_WARN, format, arg1, arg2); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_PMSG3(format, arg1, arg2, arg3) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT3(_CRT_WARN, format, arg1, arg2, arg3); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_PMSG4(format, arg1, arg2, arg3, arg4) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT4(_CRT_WARN, format, arg1, arg2, arg3, arg4); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) + +#define SPDBG_DMSG0(format) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT0(_CRT_WARN, format); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_DMSG1(format, arg1) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT1(_CRT_WARN, format, arg1); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_DMSG2(format, arg1, arg2) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT2(_CRT_WARN, format, arg1, arg2); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_DMSG3(format, arg1, arg2, arg3) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT3(_CRT_WARN, format, arg1, arg2, arg3); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_DMSG4(format, arg1, arg2, arg3, arg4) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT4(_CRT_WARN, format, arg1, arg2, arg3, arg4); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) + +#define SPDBG_RETURN(hr) \ + { \ + HRESULT __hr = (hr); \ + if (FAILED(__hr)) \ + { \ + SPDBG_REPORT_ON_FAIL(__hr); \ + } \ + return __hr; \ + } + +#define SPDBG_DEBUG_SERVER_ON_START() \ + { \ + if (PSpDebug()->DebugServerOnStart()) \ + { \ + if (MessageBox( \ + GetDesktopWindow(), \ + _T("Attach Debugger to the SAPI Server process?"), \ + _T("SAPI"), \ + MB_YESNO) == IDYES) \ + { \ + USES_CONVERSION; \ + TCHAR szCommand[MAX_PATH + 1]; \ + wsprintf( \ + szCommand, \ + _T("msdev -p %d"), \ + GetCurrentProcessId()); \ + system(T2A(szCommand)); \ + } \ + } \ + } + +#define SPDBG_DEBUG_CLIENT_ON_START() \ + { \ + if (PSpDebug()->DebugClientOnStart()) \ + { \ + TCHAR szModule[MAX_PATH + 1]; \ + szModule[0] = '\0'; \ + TCHAR * pszSapiServer = \ + _T("sapisvr.exe"); \ + GetModuleFileName( \ + NULL, \ + szModule, \ + MAX_PATH); \ + if ((_tcslen(szModule) <= \ + _tcslen(pszSapiServer) || \ + _tcsicmp( \ + szModule + \ + _tcslen(szModule) - \ + _tcslen(pszSapiServer), \ + pszSapiServer) != 0) && \ + MessageBox( \ + GetDesktopWindow(), \ + _T("Attach Debugger to the SAPI Client process?"), \ + _T("SAPI"), \ + MB_YESNO) == IDYES) \ + { \ + USES_CONVERSION; \ + TCHAR szCommand[MAX_PATH + 1]; \ + wsprintf( \ + szCommand, \ + _T("msdev -p %d"), \ + GetCurrentProcessId()); \ + system(T2A(szCommand)); \ + } \ + } \ + } + +#else // _DEBUG + +#define SPDBG_FUNC(name) +#define SPDBG_REPORT_ON_FAIL(hr) +#define SPDBG_ASSERT(expr) +#define SPDBG_VERIFY(expr) (expr) +#define SPDBG_PMSG0(format) +#define SPDBG_PMSG1(format, arg1) +#define SPDBG_PMSG2(format, arg1, arg2) +#define SPDBG_PMSG3(format, arg1, arg2, arg3) +#define SPDBG_PMSG4(format, arg1, arg2, arg3, arg4) +#define SPDBG_DMSG0(format) +#define SPDBG_DMSG1(format, arg1) +#define SPDBG_DMSG2(format, arg1, arg2) +#define SPDBG_DMSG3(format, arg1, arg2, arg3) +#define SPDBG_DMSG4(format, arg1, arg2, arg3, arg4) +#define SPDBG_RETURN(hr) return (hr) +#define SPDBG_DEBUG_SERVER_ON_START() +#define SPDBG_DEBUG_CLIENT_ON_START() + +#endif // _DEBUG diff --git a/mp/src/utils/sapi51/Include/sperror.h b/mp/src/utils/sapi51/Include/sperror.h new file mode 100644 index 00000000..95a43952 --- /dev/null +++ b/mp/src/utils/sapi51/Include/sperror.h @@ -0,0 +1,559 @@ +/******************************************************************************* +* SPError.h * +*-----------* +* Description: +* This header file contains the custom error codes specific to SAPI5 +*------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*******************************************************************************/ +#ifndef SPError_h +#define SPError_h + +#ifndef _WINERROR_ +#include +#endif + +#define FACILITY_SAPI FACILITY_ITF +#define SAPI_ERROR_BASE 0x5000 + +#define MAKE_SAPI_HRESULT(sev, err) MAKE_HRESULT(sev, FACILITY_SAPI, err) +#define MAKE_SAPI_ERROR(err) MAKE_SAPI_HRESULT(SEVERITY_ERROR, err + SAPI_ERROR_BASE) +#define MAKE_SAPI_SCODE(scode) MAKE_SAPI_HRESULT(SEVERITY_SUCCESS, scode + SAPI_ERROR_BASE) + +/*** SPERR_UNINITIALIZED 0x80045001 -2147201023 +* The object has not been properly initialized. +*/ +#define SPERR_UNINITIALIZED MAKE_SAPI_ERROR(0x001) + +/*** SPERR_ALREADY_INITIALIZED 0x80045002 -2147201022 +* The object has already been initialized. +*/ +#define SPERR_ALREADY_INITIALIZED MAKE_SAPI_ERROR(0x002) + +/*** SPERR_UNSUPPORTED_FORMAT 0x80045003 -2147201021 +* The caller has specified an unsupported format. +*/ +#define SPERR_UNSUPPORTED_FORMAT MAKE_SAPI_ERROR(0x003) + +/*** SPERR_INVALID_FLAGS 0x80045004 -2147201020 +* The caller has specified invalid flags for this operation. +*/ +#define SPERR_INVALID_FLAGS MAKE_SAPI_ERROR(0x004) + +/*** SP_END_OF_STREAM 0x00045005 282629 +* The operation has reached the end of stream. +*/ +#define SP_END_OF_STREAM MAKE_SAPI_SCODE(0x005) + +/*** SPERR_DEVICE_BUSY 0x80045006 -2147201018 +* The wave device is busy. +*/ +#define SPERR_DEVICE_BUSY MAKE_SAPI_ERROR(0x006) + +/*** SPERR_DEVICE_NOT_SUPPORTED 0x80045007 -2147201017 +* The wave device is not supported. +*/ +#define SPERR_DEVICE_NOT_SUPPORTED MAKE_SAPI_ERROR(0x007) + +/*** SPERR_DEVICE_NOT_ENABLED 0x80045008 -2147201016 +* The wave device is not enabled. +*/ +#define SPERR_DEVICE_NOT_ENABLED MAKE_SAPI_ERROR(0x008) + +/*** SPERR_NO_DRIVER 0x80045009 -2147201015 +* There is no wave driver installed. +*/ +#define SPERR_NO_DRIVER MAKE_SAPI_ERROR(0x009) + +/*** SPERR_FILEMUSTBEUNICODE 0x8004500a -2147201014 +* The file must be Unicode. +*/ +#define SPERR_FILE_MUST_BE_UNICODE MAKE_SAPI_ERROR(0x00a) + +/*** SP_INSUFFICIENTDATA 0x0004500b 282635 +* +*/ +#define SP_INSUFFICIENT_DATA MAKE_SAPI_SCODE(0x00b) + +/*** SPERR_INVALID_PHRASE_ID 0x8004500c -2147201012 +* The phrase ID specified does not exist or is out of range. +*/ +#define SPERR_INVALID_PHRASE_ID MAKE_SAPI_ERROR(0x00c) + +/*** SPERR_BUFFER_TOO_SMALL 0x8004500d -2147201011 +* The caller provided a buffer too small to return a result. +*/ +#define SPERR_BUFFER_TOO_SMALL MAKE_SAPI_ERROR(0x00d) + +/*** SPERR_FORMAT_NOT_SPECIFIED 0x8004500e -2147201010 +* Caller did not specify a format prior to opening a stream. +*/ +#define SPERR_FORMAT_NOT_SPECIFIED MAKE_SAPI_ERROR(0x00e) + +/*** SPERR_AUDIO_STOPPED 0x8004500f -2147201009 +* This method is deprecated. Use SP_AUDIO_STOPPED instead. +*/ +#define SPERR_AUDIO_STOPPED MAKE_SAPI_ERROR(0x00f) + +/*** SP_AUDIO_PAUSED 0x00045010 282640 +* This will be returned only on input (read) streams when the stream is paused. Reads on +* paused streams will not block, and this return code indicates that all of the data has been +* removed from the stream. +*/ +#define SP_AUDIO_PAUSED MAKE_SAPI_SCODE(0x010) + +/*** SPERR_RULE_NOT_FOUND 0x80045011 -2147201007 +* Invalid rule name passed to ActivateGrammar. +*/ +#define SPERR_RULE_NOT_FOUND MAKE_SAPI_ERROR(0x011) + +/*** SPERR_TTS_ENGINE_EXCEPTION 0x80045012 -2147201006 +* An exception was raised during a call to the current TTS driver. +*/ +#define SPERR_TTS_ENGINE_EXCEPTION MAKE_SAPI_ERROR(0x012) + +/*** SPERR_TTS_NLP_EXCEPTION 0x80045013 -2147201005 +* An exception was raised during a call to an application sentence filter. +*/ +#define SPERR_TTS_NLP_EXCEPTION MAKE_SAPI_ERROR(0x013) + +/*** SPERR_ENGINE_BUSY 0x80045014 -2147201004 +* In speech recognition, the current method can not be performed while +* a grammar rule is active. +*/ +#define SPERR_ENGINE_BUSY MAKE_SAPI_ERROR(0x014) + +/*** SP_AUDIO_CONVERSION_ENABLED 0x00045015 282645 +* The operation was successful, but only with automatic stream format conversion. +*/ +#define SP_AUDIO_CONVERSION_ENABLED MAKE_SAPI_SCODE(0x015) + +/*** SP_NO_HYPOTHESIS_AVAILABLE 0x00045016 282646 +* There is currently no hypothesis recognition available. +*/ +#define SP_NO_HYPOTHESIS_AVAILABLE MAKE_SAPI_SCODE(0x016) + +/*** SPERR_CANT_CREATE 0x80045017 -2147201001 +* Can not create a new object instance for the specified object category. +*/ +#define SPERR_CANT_CREATE MAKE_SAPI_ERROR(0x017) + +/*** SP_ALREADY_IN_LEX 0x00045018 282648 +* The word, pronunciation, or POS pair being added is already in lexicon. +*/ +#define SP_ALREADY_IN_LEX MAKE_SAPI_SCODE(0x018) + +/*** SPERR_NOT_IN_LEX 0x80045019 -2147200999 +* The word does not exist in the lexicon. +*/ +#define SPERR_NOT_IN_LEX MAKE_SAPI_ERROR(0x019) + +/*** SP_LEX_NOTHING_TO_SYNC 0x0004501a 282650 +* The client is currently synced with the lexicon. +*/ +#define SP_LEX_NOTHING_TO_SYNC MAKE_SAPI_SCODE(0x01a) + +/*** SPERR_LEX_VERY_OUT_OF_SYNC 0x8004501b -2147200997 +* The client is excessively out of sync with the lexicon. Mismatches may not be incrementally sync'd. +*/ +#define SPERR_LEX_VERY_OUT_OF_SYNC MAKE_SAPI_ERROR(0x01b) + +/*** SPERR_UNDEFINED_FORWARD_RULE_REF 0x8004501c -2147200996 +* A rule reference in a grammar was made to a named rule that was never defined. +*/ +#define SPERR_UNDEFINED_FORWARD_RULE_REF MAKE_SAPI_ERROR(0x01c) + +/*** SPERR_EMPTY_RULE 0x8004501d -2147200995 +* A non-dynamic grammar rule that has no body. +*/ +#define SPERR_EMPTY_RULE MAKE_SAPI_ERROR(0x01d) + +/*** SPERR_GRAMMAR_COMPILER_INTERNAL_ERROR 0x8004501e -2147200994 +* The grammar compiler failed due to an internal state error. +*/ +#define SPERR_GRAMMAR_COMPILER_INTERNAL_ERROR MAKE_SAPI_ERROR(0x01e) + + +/*** SPERR_RULE_NOT_DYNAMIC 0x8004501f -2147200993 +* An attempt was made to modify a non-dynamic rule. +*/ +#define SPERR_RULE_NOT_DYNAMIC MAKE_SAPI_ERROR(0x01f) + +/*** SPERR_DUPLICATE_RULE_NAME 0x80045020 -2147200992 +* A rule name was duplicated. +*/ +#define SPERR_DUPLICATE_RULE_NAME MAKE_SAPI_ERROR(0x020) + +/*** SPERR_DUPLICATE_RESOURCE_NAME 0x80045021 -2147200991 +* A resource name was duplicated for a given rule. +*/ +#define SPERR_DUPLICATE_RESOURCE_NAME MAKE_SAPI_ERROR(0x021) + + +/*** SPERR_TOO_MANY_GRAMMARS 0x80045022 -2147200990 +* Too many grammars have been loaded. +*/ +#define SPERR_TOO_MANY_GRAMMARS MAKE_SAPI_ERROR(0x022) + +/*** SPERR_CIRCULAR_REFERENCE 0x80045023 -2147200989 +* Circular reference in import rules of grammars. +*/ +#define SPERR_CIRCULAR_REFERENCE MAKE_SAPI_ERROR(0x023) + +/*** SPERR_INVALID_IMPORT 0x80045024 -2147200988 +* A rule reference to an imported grammar that could not be resolved. +*/ +#define SPERR_INVALID_IMPORT MAKE_SAPI_ERROR(0x024) + +/*** SPERR_INVALID_WAV_FILE 0x80045025 -2147200987 +* The format of the WAV file is not supported. +*/ +#define SPERR_INVALID_WAV_FILE MAKE_SAPI_ERROR(0x025) + +/*** SP_REQUEST_PENDING 0x00045026 282662 +* This success code indicates that an SR method called with the SPRIF_ASYNC flag is +* being processed. When it has finished processing, an SPFEI_ASYNC_COMPLETED event will be generated. +*/ +#define SP_REQUEST_PENDING MAKE_SAPI_SCODE(0x026) + +/*** SPERR_ALL_WORDS_OPTIONAL 0x80045027 -2147200985 +* A grammar rule was defined with a null path through the rule. That is, it is possible +* to satisfy the rule conditions with no words. +*/ +#define SPERR_ALL_WORDS_OPTIONAL MAKE_SAPI_ERROR(0x027) + +/*** SPERR_INSTANCE_CHANGE_INVALID 0x80045028 -2147200984 +* It is not possible to change the current engine or input. This occurs in the +* following cases: +* +* 1) SelectEngine called while a recognition context exists, or +* 2) SetInput called in the shared instance case. +*/ +#define SPERR_INSTANCE_CHANGE_INVALID MAKE_SAPI_ERROR(0x028) + +/*** SPERR_RULE_NAME_ID_CONFLICT 0x80045029 -2147200983 +* A rule exists with matching IDs (names) but different names (IDs). +*/ +#define SPERR_RULE_NAME_ID_CONFLICT MAKE_SAPI_ERROR(0x029) + +/*** SPERR_NO_RULES 0x8004502a -2147200982 +* A grammar contains no top-level, dynamic, or exported rules. There is no possible +* way to activate or otherwise use any rule in this grammar. +*/ +#define SPERR_NO_RULES MAKE_SAPI_ERROR(0x02a) + +/*** SPERR_CIRCULAR_RULE_REF 0x8004502b -2147200981 +* Rule 'A' refers to a second rule 'B' which, in turn, refers to rule 'A'. +*/ +#define SPERR_CIRCULAR_RULE_REF MAKE_SAPI_ERROR(0x02b) + +/*** SP_NO_PARSE_FOUND 0x0004502c 282668 +* Parse path cannot be parsed given the currently active rules. +*/ +#define SP_NO_PARSE_FOUND MAKE_SAPI_SCODE(0x02c) + +/*** SPERR_NO_PARSE_FOUND 0x8004502d -2147200979 +* Parse path cannot be parsed given the currently active rules. +*/ +#define SPERR_INVALID_HANDLE MAKE_SAPI_ERROR(0x02d) + +/*** SPERR_REMOTE_CALL_TIMED_OUT 0x8004502e -2147200978 +* A marshaled remote call failed to respond. +*/ +#define SPERR_REMOTE_CALL_TIMED_OUT MAKE_SAPI_ERROR(0x02e) + +/*** SPERR_AUDIO_BUFFER_OVERFLOW 0x8004502f -2147200977 +* This will only be returned on input (read) streams when the stream is paused because +* the SR driver has not retrieved data recently. +*/ +#define SPERR_AUDIO_BUFFER_OVERFLOW MAKE_SAPI_ERROR(0x02f) + + +/*** SPERR_NO_AUDIO_DATA 0x80045030 -2147200976 +* The result does not contain any audio, nor does the portion of the element chain of the result +* contain any audio. +*/ +#define SPERR_NO_AUDIO_DATA MAKE_SAPI_ERROR(0x030) + +/*** SPERR_DEAD_ALTERNATE 0x80045031 -2147200975 +* This alternate is no longer a valid alternate to the result it was obtained from. +* Returned from ISpPhraseAlt methods. +*/ +#define SPERR_DEAD_ALTERNATE MAKE_SAPI_ERROR(0x031) + +/*** SPERR_HIGH_LOW_CONFIDENCE 0x80045032 -2147200974 +* The result does not contain any audio, nor does the portion of the element chain of the result +* contain any audio. Returned from ISpResult::GetAudio and ISpResult::SpeakAudio. +*/ +#define SPERR_HIGH_LOW_CONFIDENCE MAKE_SAPI_ERROR(0x032) + +/*** SPERR_INVALID_FORMAT_STRING 0x80045033 -2147200973 +* The XML format string for this RULEREF is invalid, e.g. not a GUID or REFCLSID. +*/ +#define SPERR_INVALID_FORMAT_STRING MAKE_SAPI_ERROR(0x033) + +/*** SP_UNSUPPORTED_ON_STREAM_INPUT 0x00045034 282676 +* The operation is not supported for stream input. +*/ +#define SP_UNSUPPORTED_ON_STREAM_INPUT MAKE_SAPI_SCODE(0x034) + +/*** SPERR_APPLEX_READ_ONLY 0x80045035 -2147200971 +* The operation is invalid for all but newly created application lexicons. +*/ +#define SPERR_APPLEX_READ_ONLY MAKE_SAPI_ERROR(0x035) + +/*** SPERR_NO_TERMINATING_RULE_PATH 0x80045036 -2147200970 +* +*/ + +#define SPERR_NO_TERMINATING_RULE_PATH MAKE_SAPI_ERROR(0x036) + +/*** SP_WORD_EXISTS_WITHOUT_PRONUNCIATION 0x00045037 282679 +* The word exists but without pronunciation. +*/ +#define SP_WORD_EXISTS_WITHOUT_PRONUNCIATION MAKE_SAPI_SCODE(0x037) + +/*** SPERR_STREAM_CLOSED 0x80045038 -2147200968 +* An operation was attempted on a stream object that has been closed. +*/ +#define SPERR_STREAM_CLOSED MAKE_SAPI_ERROR(0x038) + +// --- The following error codes are taken directly from WIN32 --- + +/*** SPERR_NO_MORE_ITEMS 0x80045039 -2147200967 +* When enumerating items, the requested index is greater than the count of items. +*/ +#define SPERR_NO_MORE_ITEMS MAKE_SAPI_ERROR(0x039) + +/*** SPERR_NOT_FOUND 0x8004503a -2147200966 +* The requested data item (data key, value, etc.) was not found. +*/ +#define SPERR_NOT_FOUND MAKE_SAPI_ERROR(0x03a) + +/*** SPERR_INVALID_AUDIO_STATE 0x8004503b -2147200965 +* Audio state passed to SetState() is invalid. +*/ +#define SPERR_INVALID_AUDIO_STATE MAKE_SAPI_ERROR(0x03b) + +/*** SPERR_GENERIC_MMSYS_ERROR 0x8004503c -2147200964 +* A generic MMSYS error not caught by _MMRESULT_TO_HRESULT. +*/ +#define SPERR_GENERIC_MMSYS_ERROR MAKE_SAPI_ERROR(0x03c) + +/*** SPERR_MARSHALER_EXCEPTION 0x8004503d -2147200963 +* An exception was raised during a call to the marshaling code. +*/ +#define SPERR_MARSHALER_EXCEPTION MAKE_SAPI_ERROR(0x03d) + +/*** SPERR_NOT_DYNAMIC_GRAMMAR 0x8004503e -2147200962 +* Attempt was made to manipulate a non-dynamic grammar. +*/ +#define SPERR_NOT_DYNAMIC_GRAMMAR MAKE_SAPI_ERROR(0x03e) + +/*** SPERR_AMBIGUOUS_PROPERTY 0x8004503f -2147200961 +* Cannot add ambiguous property. +*/ +#define SPERR_AMBIGUOUS_PROPERTY MAKE_SAPI_ERROR(0x03f) + +/*** SPERR_INVALID_REGISTRY_KEY 0x80045040 -2147200960 +* The key specified is invalid. +*/ +#define SPERR_INVALID_REGISTRY_KEY MAKE_SAPI_ERROR(0x040) + +/*** SPERR_INVALID_TOKEN_ID 0x80045041 -2147200959 +* The token specified is invalid. +*/ +#define SPERR_INVALID_TOKEN_ID MAKE_SAPI_ERROR(0x041) + +/*** SPERR_XML_BAD_SYNTAX 0x80045042 -2147200958 +* The xml parser failed due to bad syntax. +*/ +#define SPERR_XML_BAD_SYNTAX MAKE_SAPI_ERROR(0x042) + +/*** SPERR_XML_RESOURCE_NOT_FOUND 0x80045043 -2147200957 +* The xml parser failed to load a required resource (e.g., voice, phoneconverter, etc.). +*/ +#define SPERR_XML_RESOURCE_NOT_FOUND MAKE_SAPI_ERROR(0x043) + +/*** SPERR_TOKEN_IN_USE 0x80045044 -2147200956 +* Attempted to remove registry data from a token that is already in use elsewhere. +*/ +#define SPERR_TOKEN_IN_USE MAKE_SAPI_ERROR(0x044) + +/*** SPERR_TOKEN_DELETED 0x80045045 -2147200955 +* Attempted to perform an action on an object token that has had associated registry key deleted. +*/ +#define SPERR_TOKEN_DELETED MAKE_SAPI_ERROR(0x045) + +/*** SPERR_MULTI_LINGUAL_NOT_SUPPORTED 0x80045046 -2147200954 +* The selected voice was registered as multi-lingual. SAPI does not support multi-lingual registration. +*/ +#define SPERR_MULTI_LINGUAL_NOT_SUPPORTED MAKE_SAPI_ERROR(0x046) + +/*** SPERR_EXPORT_DYNAMIC_RULE 0x80045047 -2147200953 +* Exported rules cannot refer directly or indirectly to a dynamic rule. +*/ +#define SPERR_EXPORT_DYNAMIC_RULE MAKE_SAPI_ERROR(0x047) + +/*** SPERR_STGF_ERROR 0x80045048 -2147200952 +* Error parsing the SAPI Text Grammar Format (XML grammar). +*/ +#define SPERR_STGF_ERROR MAKE_SAPI_ERROR(0x048) + +/*** SPERR_WORDFORMAT_ERROR 0x80045049 -2147200951 +* Incorrect word format, probably due to incorrect pronunciation string. +*/ +#define SPERR_WORDFORMAT_ERROR MAKE_SAPI_ERROR(0x049) + +/*** SPERR_STREAM_NOT_ACTIVE 0x8004504a -2147200950 +* Methods associated with active audio stream cannot be called unless stream is active. +*/ +#define SPERR_STREAM_NOT_ACTIVE MAKE_SAPI_ERROR(0x04a) + +/*** SPERR_ENGINE_RESPONSE_INVALID 0x8004504b -2147200949 +* Arguments or data supplied by the engine are in an invalid format or are inconsistent. +*/ +#define SPERR_ENGINE_RESPONSE_INVALID MAKE_SAPI_ERROR(0x04b) + +/*** SPERR_SR_ENGINE_EXCEPTION 0x8004504c -2147200948 +* An exception was raised during a call to the current SR engine. +*/ +#define SPERR_SR_ENGINE_EXCEPTION MAKE_SAPI_ERROR(0x04c) + +/*** SPERR_STREAM_POS_INVALID 0x8004504d -2147200947 +* Stream position information supplied from engine is inconsistent. +*/ +#define SPERR_STREAM_POS_INVALID MAKE_SAPI_ERROR(0x04d) + +/*** SP_RECOGNIZER_INACTIVE 0x0004504e 282702 +* Operation could not be completed because the recognizer is inactive. It is inactive either +* because the recognition state is currently inactive or because no rules are active . +*/ +#define SP_RECOGNIZER_INACTIVE MAKE_SAPI_SCODE(0x04e) + +/*** SPERR_REMOTE_CALL_ON_WRONG_THREAD 0x8004504f -2147200945 +* When making a remote call to the server, the call was made on the wrong thread. +*/ +#define SPERR_REMOTE_CALL_ON_WRONG_THREAD MAKE_SAPI_ERROR(0x04f) + +/*** SPERR_REMOTE_PROCESS_TERMINATED 0x80045050 -2147200944 +* The remote process terminated unexpectedly. +*/ +#define SPERR_REMOTE_PROCESS_TERMINATED MAKE_SAPI_ERROR(0x050) + +/*** SPERR_REMOTE_PROCESS_ALREADY_RUNNING 0x80045051 -2147200943 +* The remote process is already running; it cannot be started a second time. +*/ +#define SPERR_REMOTE_PROCESS_ALREADY_RUNNING MAKE_SAPI_ERROR(0x051) + +/*** SPERR_LANGID_MISMATCH 0x80045052 -2147200942 +* An attempt to load a CFG grammar with a LANGID different than other loaded grammars. +*/ +#define SPERR_LANGID_MISMATCH MAKE_SAPI_ERROR(0x052) + +/*** SP_PARTIAL_PARSE_FOUND 0x00045053 282707 +* A grammar-ending parse has been found that does not use all available words. +*/ +#define SP_PARTIAL_PARSE_FOUND MAKE_SAPI_SCODE(0x053) + +/*** SPERR_NOT_TOPLEVEL_RULE 0x80045054 -2147200940 +* An attempt to deactivate or activate a non-toplevel rule. +*/ +#define SPERR_NOT_TOPLEVEL_RULE MAKE_SAPI_ERROR(0x054) + +/*** SP_NO_RULE_ACTIVE 0x00045055 282709 +* An attempt to parse when no rule was active. +*/ +#define SP_NO_RULE_ACTIVE MAKE_SAPI_SCODE(0x055) + +/*** SPERR_LEX_REQUIRES_COOKIE 0x80045056 -2147200938 +* An attempt to ask a container lexicon for all words at once. +*/ +#define SPERR_LEX_REQUIRES_COOKIE MAKE_SAPI_ERROR(0x056) + +/*** SP_STREAM_UNINITIALIZED 0x00045057 282711 +* An attempt to activate a rule/dictation/etc without calling SetInput +* first in the inproc case. +*/ +#define SP_STREAM_UNINITIALIZED MAKE_SAPI_SCODE(0x057) + + +// Error x058 is not used in SAPI 5.0 + + +/*** SPERR_UNSUPPORTED_LANG 0x80045059 -2147200935 +* The requested language is not supported. +*/ +#define SPERR_UNSUPPORTED_LANG MAKE_SAPI_ERROR(0x059) + +/*** SPERR_VOICE_PAUSED 0x8004505a -2147200934 +* The operation cannot be performed because the voice is currently paused. +*/ +#define SPERR_VOICE_PAUSED MAKE_SAPI_ERROR(0x05a) + +/*** SPERR_AUDIO_BUFFER_UNDERFLOW 0x8004505b -2147200933 +* This will only be returned on input (read) streams when the real time audio device +* stops returning data for a long period of time. +*/ +#define SPERR_AUDIO_BUFFER_UNDERFLOW MAKE_SAPI_ERROR(0x05b) + +/*** SPERR_AUDIO_STOPPED_UNEXPECTEDLY 0x8004505c -2147200932 +* An audio device stopped returning data from the Read() method even though it was in +* the run state. This error is only returned in the END_SR_STREAM event. +*/ +#define SPERR_AUDIO_STOPPED_UNEXPECTEDLY MAKE_SAPI_ERROR(0x05c) + +/*** SPERR_NO_WORD_PRONUNCIATION 0x8004505d -2147200931 +* The SR engine is unable to add this word to a grammar. The application may need to supply +* an explicit pronunciation for this word. +*/ +#define SPERR_NO_WORD_PRONUNCIATION MAKE_SAPI_ERROR(0x05d) + +/*** SPERR_ALTERNATES_WOULD_BE_INCONSISTENT 0x8004505e -2147200930 +* An attempt to call ScaleAudio on a recognition result having previously +* called GetAlternates. Allowing the call to succeed would result in +* the previously created alternates located in incorrect audio stream positions. +*/ +#define SPERR_ALTERNATES_WOULD_BE_INCONSISTENT MAKE_SAPI_ERROR(0x05e) + +/*** SPERR_NOT_SUPPORTED_FOR_SHARED_RECOGNIZER 0x8004505f -2147200929 +* The method called is not supported for the shared recognizer. +* For example, ISpRecognizer::GetInputStream(). +*/ +#define SPERR_NOT_SUPPORTED_FOR_SHARED_RECOGNIZER MAKE_SAPI_ERROR(0x05f) + +/*** SPERR_TIMEOUT 0x80045060 -2147200928 +* A task could not complete because the SR engine had timed out. +*/ +#define SPERR_TIMEOUT MAKE_SAPI_ERROR(0x060) + + +/*** SPERR_REENTER_SYNCHRONIZE 0x80045061 -2147200927 +* A SR engine called synchronize while inside of a synchronize call. +*/ +#define SPERR_REENTER_SYNCHRONIZE MAKE_SAPI_ERROR(0x061) + +/*** SPERR_STATE_WITH_NO_ARCS 0x80045062 -2147200926 +* The grammar contains a node no arcs. +*/ +#define SPERR_STATE_WITH_NO_ARCS MAKE_SAPI_ERROR(0x062) + +/*** SPERR_NOT_ACTIVE_SESSION 0x80045063 -2147200925 +* Neither audio output and input is supported for non-active console sessions. +*/ +#define SPERR_NOT_ACTIVE_SESSION MAKE_SAPI_ERROR(0x063) + +/*** SPERR_ALREADY_DELETED 0x80045064 -2147200924 +* The object is a stale reference and is invalid to use. +* For example having a ISpeechGrammarRule object reference and then calling +* ISpeechRecoGrammar::Reset() will cause the rule object to be invalidated. +* Calling any methods after this will result in this error. +*/ +#define SPERR_ALREADY_DELETED MAKE_SAPI_ERROR(0x064) + +/*** SP_AUDIO_STOPPED 0x00045065 282725 +* This can be returned from Read or Write calls audio streams when the stream is stopped. +*/ +#define SP_AUDIO_STOPPED MAKE_SAPI_SCODE(0x065) + +#endif //--- This must be the last line in the file diff --git a/mp/src/utils/sapi51/Include/speventq.h b/mp/src/utils/sapi51/Include/speventq.h new file mode 100644 index 00000000..b0447dcc --- /dev/null +++ b/mp/src/utils/sapi51/Include/speventq.h @@ -0,0 +1,605 @@ +/******************************************************************************* +* SPEventQ.h * +*------------* +* Description: +* This is the header file for the SAPI5 event queue implementation. +*------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*******************************************************************************/ +#ifndef SPEventQ_h +#define SPEventQ_h + +#ifndef SPHelper_h +#include +#endif + +#ifndef SPCollec_h +#include +#endif + +//=== Inline helpers for copying and deleting events ============================ + + +//=== Class definition ========================================================== + +class CSpEventNode : public CSpEvent +{ +public: + CSpEventNode * m_pNext; + static LONG Compare(const CSpEventNode * p1, const CSpEventNode *p2) + { + // Assumes offsets DO or DO NOT reset when stream number changes + if (p1->ulStreamNum < p2->ulStreamNum) + { + return -1; + } + else if (p1->ulStreamNum > p2->ulStreamNum) + { + return 1; + } + else if (p1->ullAudioStreamOffset < p2->ullAudioStreamOffset) + { + return -1; + } + else if (p1->ullAudioStreamOffset > p2->ullAudioStreamOffset) + { + return 1; + } + return 0; + } +}; + + +typedef CSpBasicQueue CSpEventList; + +#define DECLARE_SPNOTIFYSOURCE_METHODS(T) \ +STDMETHODIMP SetNotifySink(ISpNotifySink * pNotifySink) \ +{ return T._SetNotifySink(pNotifySink); } \ +STDMETHODIMP SetNotifyWindowMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) \ +{ return T._SetNotifyWindowMessage(hWnd, Msg, wParam, lParam); } \ +STDMETHODIMP SetNotifyCallbackFunction(SPNOTIFYCALLBACK * pfnCallback, WPARAM wParam, LPARAM lParam) \ +{ return T._SetNotifyCallbackFunction(pfnCallback, wParam, lParam); } \ +STDMETHODIMP SetNotifyCallbackInterface(ISpNotifyCallback * pSpCallback, WPARAM wParam, LPARAM lParam) \ +{ return T._SetNotifyCallbackInterface(pSpCallback, wParam, lParam); } \ +STDMETHODIMP SetNotifyWin32Event() \ +{ return T._SetNotifyWin32Event(); } \ +STDMETHODIMP WaitForNotifyEvent(DWORD dwMilliseconds) \ +{ return T._WaitForNotifyEvent(dwMilliseconds); } \ +STDMETHODIMP_(HANDLE) GetNotifyEventHandle() \ +{ return T._GetNotifyEventHandle(); } + +#define DECLARE_SPEVENTSOURCE_METHODS(T) \ +DECLARE_SPNOTIFYSOURCE_METHODS(T) \ +STDMETHODIMP SetInterest(ULONGLONG ullEventInterest, ULONGLONG ullQueuedInterest) \ +{ return T._SetInterest(ullEventInterest, ullQueuedInterest); } \ +STDMETHODIMP GetEvents(ULONG ulCount, SPEVENT* pEventArray, ULONG * pulFetched) \ +{ return T._GetEvents(ulCount, pEventArray, pulFetched); } \ +STDMETHODIMP GetInfo(SPEVENTSOURCEINFO *pInfo) \ +{ return T._GetInfo(pInfo); } + + + +class CSpEventSource +{ + public: + CSpEventSource(CComObjectRootEx * pParent) : + m_pParent(pParent) + { + m_ullEventInterest = 0; m_ullQueuedInterest = 0; + m_ulStreamNum = 0; + } + HRESULT _SetNotifySink(ISpNotifySink * pNotifySink); + HRESULT _SetNotifyWindowMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); + HRESULT _SetNotifyCallbackFunction(SPNOTIFYCALLBACK * pfnCallback, WPARAM wParam, LPARAM lParam); + HRESULT _SetNotifyCallbackInterface(ISpNotifyCallback * pSpCallback, WPARAM wParam, LPARAM lParam); + HRESULT _SetNotifyWin32Event(); + HRESULT _WaitForNotifyEvent(DWORD dwMilliseconds); + HANDLE _GetNotifyEventHandle(); + + HRESULT _SetInterest(ULONGLONG ullEventInterest , ULONGLONG ullQueuedInterest); + HRESULT _GetEvents( ULONG ulCount, SPEVENT* pEventArray, ULONG * pulFetched ); + HRESULT _GetInfo(SPEVENTSOURCEINFO *pInfo ); + + /*--- Non interface methods ---*/ + HRESULT _CompleteEvents( ULONGLONG ullPos = 0xFFFFFFFFFFFFFFFF ); + inline void _MoveAllToFreeList(CSpEventList * pList); + inline void _RemoveAllEvents(); + inline HRESULT _AddEvent(const SPEVENT & Event); + inline HRESULT _AddEvents(const SPEVENT* pEventArray, ULONG ulCount); + inline HRESULT _DeserializeAndAddEvent(const BYTE * pBuffer, ULONG * pcbUsed); + inline HRESULT _GetStreamNumber(const ULONGLONG ullAudioOffset, ULONG *pulStreamNum); + //=== Data members ============================== + public: + ULONGLONG m_ullEventInterest; + ULONGLONG m_ullQueuedInterest; + ULONG m_ulStreamNum; + CSpEventList m_PendingList; + CSpEventList m_CompletedList; + CSpEventList m_FreeList; + CComPtr m_cpNotifySink; + CComPtr m_cpEventTranslator; // If non-NULL then Win32 events being used + CComObjectRootEx * m_pParent; + CComAutoCriticalSection m_NotifyObjChangeCrit; // Critical section used to make sure that + // the notify object (m_cpNotifySink) not changed + // while waiting on it. + +}; + + +// +//=== Inlines ========================================================= +// + +// +// WARNING: If this logic changes, you will need to change the logic in SetNotifyWin32Event also. +// +inline HRESULT CSpEventSource::_SetNotifySink(ISpNotifySink * pNotifySink) +{ + if (SP_IS_BAD_OPTIONAL_INTERFACE_PTR(pNotifySink)) + { + return E_INVALIDARG; + } + else + { + m_pParent->Lock(); + m_NotifyObjChangeCrit.Lock(); + m_cpEventTranslator.Release(); + m_cpNotifySink = pNotifySink; + if (m_cpNotifySink && m_CompletedList.GetHead()) + { + m_cpNotifySink->Notify(); + } + m_NotifyObjChangeCrit.Unlock(); + m_pParent->Unlock(); + return S_OK; + } +} + +/**************************************************************************** +* CSpEventSource::_SetNotifyWindowMessage * +*-----------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_SetNotifyWindowMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + SPDBG_FUNC("CSpEventSource::_SetNotifyWindowMessage"); + HRESULT hr = S_OK; + CComPtr cpTranslator; + hr = cpTranslator.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTranslator->InitWindowMessage(hWnd, Msg, wParam, lParam); + } + if (SUCCEEDED(hr)) + { + hr = _SetNotifySink(cpTranslator); + } + return hr; +} +/**************************************************************************** +* CSpEventSource::_SetNotifyCallbackFunction * +*--------------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_SetNotifyCallbackFunction(SPNOTIFYCALLBACK * pfnCallback, WPARAM wParam, LPARAM lParam) +{ + SPDBG_FUNC("CSpEventSource::_SetNotifyCallbackFunction"); + HRESULT hr = S_OK; + CComPtr cpTranslator; + hr = cpTranslator.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTranslator->InitCallback(pfnCallback, wParam, lParam); + } + if (SUCCEEDED(hr)) + { + hr = _SetNotifySink(cpTranslator); + } + return hr; +} +/**************************************************************************** +* CSpEventSource::_SetNotifyCallbackInterface * +*---------------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_SetNotifyCallbackInterface(ISpNotifyCallback * pSpCallback, WPARAM wParam, LPARAM lParam) +{ + SPDBG_FUNC("CSpEventSource::_SetNotifyCallbackInterface"); + HRESULT hr = S_OK; + CComPtr cpTranslator; + hr = cpTranslator.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTranslator->InitSpNotifyCallback(pSpCallback, wParam, lParam); + } + if (SUCCEEDED(hr)) + { + hr = _SetNotifySink(cpTranslator); + } + return hr; +} +/**************************************************************************** +* CSpEventSource::_SetNotifyWin32Event * +*--------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_SetNotifyWin32Event(void) +{ + SPDBG_FUNC("CSpEventSource::_SetNotifyWin32Event"); + HRESULT hr = S_OK; + CComPtr cpTranslator; + hr = cpTranslator.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTranslator->InitWin32Event(NULL, TRUE); + } + if (SUCCEEDED(hr)) + { + // + // In this case we do NOT call _SetNotify sink since we want to set the cpEventTranslator + // + m_pParent->Lock(); + m_NotifyObjChangeCrit.Lock(); + m_cpEventTranslator = cpTranslator; + m_cpNotifySink = cpTranslator; + if (m_cpNotifySink && m_CompletedList.GetHead()) + { + m_cpNotifySink->Notify(); + } + m_NotifyObjChangeCrit.Unlock(); + m_pParent->Unlock(); + } + return hr; +} +/**************************************************************************** +* CSpEventSource::_WaitForNotifyEvent * +*-------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_WaitForNotifyEvent(DWORD dwMilliseconds) +{ + SPDBG_FUNC("CSpEventSource::_WaitForNotifyEvent"); + HRESULT hr = S_OK; + m_NotifyObjChangeCrit.Lock(); + if (m_cpEventTranslator) + { + hr = m_cpEventTranslator->Wait(dwMilliseconds); + } + else + { + if (m_cpNotifySink) + { + hr = SPERR_ALREADY_INITIALIZED; + } + else + { + hr = _SetNotifyWin32Event(); + if (SUCCEEDED(hr)) + { + hr = m_cpEventTranslator->Wait(dwMilliseconds); + } + } + } + m_NotifyObjChangeCrit.Unlock(); + return hr; +} +/**************************************************************************** +* CSpEventSource::_GetNotifyEventHandle * +*---------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HANDLE CSpEventSource::_GetNotifyEventHandle() +{ + HANDLE h = NULL; + SPDBG_FUNC("CSpEventSource::_GetNotifyEventHandle"); + m_NotifyObjChangeCrit.Lock(); + if (!m_cpNotifySink) + { + _SetNotifyWin32Event(); + } + if (m_cpEventTranslator) + { + h = m_cpEventTranslator->GetEventHandle(); + } + m_NotifyObjChangeCrit.Unlock(); + return h; +} + + +inline HRESULT CSpEventSource::_SetInterest( ULONGLONG ullEventInterest, ULONGLONG ullQueuedInterest ) +{ + HRESULT hr = S_OK; + m_pParent->Lock(); + + if(ullEventInterest && SPFEI_FLAGCHECK != (ullEventInterest & SPFEI_FLAGCHECK)) + { + hr = E_INVALIDARG; + } + else if(ullQueuedInterest && SPFEI_FLAGCHECK != (ullQueuedInterest & SPFEI_FLAGCHECK)) + { + hr = E_INVALIDARG; + } + else if ((ullQueuedInterest | ullEventInterest) != ullEventInterest) + { + hr = E_INVALIDARG; + } + else + { + m_ullEventInterest = ullEventInterest; + m_ullQueuedInterest = ullQueuedInterest; + } + m_pParent->Unlock(); + return hr; +} + + +// +// Same as AddEvents except: No param validation, and caller must take the critical section +// prior to calling. +// +inline HRESULT CSpEventSource::_AddEvents( const SPEVENT* pEventArray, ULONG ulCount ) +{ + HRESULT hr = S_OK; + for( ULONG i = 0; i < ulCount && SUCCEEDED(hr = _AddEvent(pEventArray[i])); ++i ) {} + return hr; +} + +inline HRESULT CSpEventSource::_AddEvent(const SPEVENT & Event) +{ + SPDBG_ASSERT(Event.eEventId < 64); + SPDBG_ASSERT(Event.elParamType == SPET_LPARAM_IS_UNDEFINED || + Event.elParamType == SPET_LPARAM_IS_TOKEN || + Event.elParamType == SPET_LPARAM_IS_OBJECT || + Event.elParamType == SPET_LPARAM_IS_POINTER || + Event.elParamType == SPET_LPARAM_IS_STRING); +#ifdef _DEBUG + if (Event.eEventId == SPEI_VOICE_CHANGE) + { + SPDBG_ASSERT(Event.elParamType == SPET_LPARAM_IS_TOKEN); + } + else if (Event.eEventId == SPEI_RECOGNITION || Event.eEventId == SPEI_FALSE_RECOGNITION || Event.eEventId == SPEI_HYPOTHESIS) + { + SPDBG_ASSERT(Event.elParamType == SPET_LPARAM_IS_OBJECT); + } + else if (Event.eEventId ==SPEI_REQUEST_UI || Event.eEventId == SPEI_TTS_BOOKMARK) + { + SPDBG_ASSERT(Event.elParamType == SPET_LPARAM_IS_STRING); + } +#endif + + if ( (1i64 << Event.eEventId) & m_ullEventInterest ) + { + CSpEventNode *pNode = m_FreeList.RemoveHead(); + if (pNode == NULL) + { + pNode = new CSpEventNode(); + if (pNode == NULL) + { + return E_OUTOFMEMORY; + } + } + pNode->CopyFrom(&Event); + m_PendingList.InsertSorted(pNode); + } + return S_OK; +} + +inline HRESULT CSpEventSource:: + _DeserializeAndAddEvent(const BYTE *pBuffer, ULONG * pcbUsed) +{ + HRESULT hr = S_OK; + const SPEVENT * pSrcEvent = (const SPEVENT *)pBuffer; + SPDBG_ASSERT(pSrcEvent->eEventId < 64); + if ( (1i64 << pSrcEvent->eEventId) & m_ullEventInterest ) + { + CSpEventNode *pNode = m_FreeList.RemoveHead(); + if (pNode == NULL) + { + pNode = new CSpEventNode(); + if (pNode == NULL) + { + hr = E_OUTOFMEMORY; + } + } + if (SUCCEEDED(hr)) + { + hr = pNode->Deserialize(((const SPSERIALIZEDEVENT64 *)(pBuffer)), pcbUsed); + if (SUCCEEDED(hr)) + { + m_PendingList.InsertSorted(pNode); + } + else + { + m_FreeList.InsertHead(pNode); + } + } + } + else + { +// WCE compiler does not work propertly with template +#ifndef _WIN32_WCE + *pcbUsed = SpEventSerializeSize(pSrcEvent); +#else + *pcbUsed = SpEventSerializeSize(pSrcEvent, sizeof(SPSERIALIZEDEVENT64)); +#endif + } + return hr; +} + +inline HRESULT CSpEventSource::_GetEvents( ULONG ulCount, SPEVENT* pEventArray, ULONG *pulFetched ) +{ + HRESULT hr = S_OK; + m_pParent->Lock(); + if( SPIsBadWritePtr( pEventArray, sizeof( SPEVENT ) * ulCount ) || + SP_IS_BAD_OPTIONAL_WRITE_PTR(pulFetched) ) + { + hr = E_INVALIDARG; + } + else + { + ULONG ulCopied = 0; + ULONG ulRemaining = ulCount; + CSpEventNode * pCur = m_CompletedList.m_pHead; + CSpEventNode * pLastCopied = NULL; + while (ulRemaining && pCur) + { + pCur->Detach(pEventArray + ulCopied); + pLastCopied = pCur; + ulCopied++; + pCur = pCur->m_pNext; + ulRemaining--; + } + if (ulCopied) + { + if (m_FreeList.m_pHead == NULL) + { + m_FreeList.m_pTail = pLastCopied; + } + pLastCopied->m_pNext = m_FreeList.m_pHead; + m_FreeList.m_pHead = m_CompletedList.m_pHead; + m_CompletedList.m_pHead = pCur; + m_CompletedList.m_cElements -= ulCopied; + m_FreeList.m_cElements += ulCopied; + } + if (ulCopied < ulCount) + { + hr = S_FALSE; + } + if (pulFetched) + { + *pulFetched = ulCopied; + } + } + m_pParent->Unlock(); + return hr; +} + + +inline HRESULT CSpEventSource::_GetInfo( SPEVENTSOURCEINFO * pInfo ) +{ + HRESULT hr = S_OK; + m_pParent->Lock(); + if( SP_IS_BAD_WRITE_PTR( pInfo ) ) + { + hr = E_POINTER; + } + else + { + pInfo->ulCount = m_CompletedList.GetCount(); + pInfo->ullEventInterest = m_ullEventInterest; + pInfo->ullQueuedInterest= m_ullQueuedInterest; + } + m_pParent->Unlock(); + return hr; +} + + + +// +// The caller must call this function with the critical section owned +// +inline HRESULT CSpEventSource::_CompleteEvents( ULONGLONG ullPos ) +{ + HRESULT hr = S_OK; + + if (m_PendingList.m_pHead && m_PendingList.m_pHead->ullAudioStreamOffset <= ullPos) + { + BOOL bNotify = FALSE; + while (m_PendingList.m_pHead && + m_PendingList.m_pHead->ullAudioStreamOffset <= ullPos) + { + CSpEventNode *pNode = m_PendingList.RemoveHead(); + if(pNode->ulStreamNum != m_ulStreamNum) + { + m_ulStreamNum = pNode->ulStreamNum; + } + if ( (1i64 << pNode->eEventId) & m_ullEventInterest ) + { + bNotify = TRUE; + // + // NOTE: If we're forwarding events to an event sink then we'll only + // pay attention to the Interest flags. If we're going to notify, then + // we'll only queue completed events that the user has explicitly asked + // us to store as completed events. + // + if ( (1i64 << pNode->eEventId) & m_ullQueuedInterest ) + { + m_CompletedList.InsertSorted(pNode); + } + else + { + pNode->Clear(); + m_FreeList.InsertHead(pNode); + } + } + else + { + pNode->Clear(); + m_FreeList.InsertHead(pNode); + } + } + if (bNotify && m_cpNotifySink) + { + hr = m_cpNotifySink->Notify(); + } + } + return hr; +}; + + +inline void CSpEventSource::_MoveAllToFreeList(CSpEventList * pList) +{ + CSpEventNode * pNode; + while ((pNode = pList->RemoveHead()) != NULL) + { + pNode->Clear(); + m_FreeList.InsertHead(pNode); + } +} +inline void CSpEventSource::_RemoveAllEvents( ) +{ + m_pParent->Lock(); + + _MoveAllToFreeList(&m_CompletedList); + _MoveAllToFreeList(&m_PendingList); + m_pParent->Unlock(); +} + +inline HRESULT CSpEventSource::_GetStreamNumber(const ULONGLONG ullAudioOffset, ULONG *pulStreamNum) +{ + CSpEventNode *pNode = m_PendingList.m_pHead; + *pulStreamNum = m_ulStreamNum; + for(;pNode && pNode->ullAudioStreamOffset <= ullAudioOffset; pNode = pNode->m_pNext) + { + *pulStreamNum = pNode->ulStreamNum; + } + return S_OK; +} + + + +#endif //--- This must be the last line in this file diff --git a/mp/src/utils/sapi51/Include/sphelper.h b/mp/src/utils/sapi51/Include/sphelper.h new file mode 100644 index 00000000..0e7b408f --- /dev/null +++ b/mp/src/utils/sapi51/Include/sphelper.h @@ -0,0 +1,2754 @@ +/******************************************************************************* +* SPHelper.h * +*------------* +* Description: +* This is the header file for core helper functions implementation. +*------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*******************************************************************************/ +#ifndef SPHelper_h +#define SPHelper_h + +#ifndef _INC_MALLOC +#include +#endif + +#ifndef _INC_CRTDBG +#include +#endif + +#ifndef __sapi_h__ +#include +#endif + +#ifndef __sapiddk_h__ +#include +#endif + +#ifndef SPError_h +#include +#endif + +#ifndef SPDebug_h +#include +#endif + +#ifndef _INC_LIMITS +#include +#endif + +#ifndef _INC_MMSYSTEM +#include +#endif + +#ifndef __comcat_h__ +#include +#endif + +#ifndef _INC_MMREG +#include +#endif + +#ifndef __ATLBASE_H__ +#include +#endif + +//=== Constants ============================================================== +#define sp_countof(x) ((sizeof(x) / sizeof(*(x)))) + +/*** CSpDynamicString helper class +* +*/ +class CSpDynamicString +{ +public: + + WCHAR * m_psz; + CSpDynamicString() + { + m_psz = NULL; + } + CSpDynamicString(ULONG cchReserve) + { + m_psz = (WCHAR *)::CoTaskMemAlloc(cchReserve * sizeof(WCHAR)); + } + WCHAR * operator=(const CSpDynamicString& src) + { + if (m_psz != src.m_psz) + { + ::CoTaskMemFree(m_psz); + m_psz = src.Copy(); + } + return m_psz; + } + WCHAR * operator=(const WCHAR * pSrc) + { + Clear(); + if (pSrc) + { + ULONG cbNeeded = (wcslen(pSrc) + 1) * sizeof(WCHAR); + m_psz = (WCHAR *)::CoTaskMemAlloc(cbNeeded); + SPDBG_ASSERT(m_psz); + if (m_psz) + { + memcpy(m_psz, pSrc, cbNeeded); + } + } + return m_psz; + } + + WCHAR * operator=(const char * pSrc) + { + Clear(); + if (pSrc) + { + ULONG cbNeeded = (lstrlenA(pSrc) + 1) * sizeof(WCHAR); + m_psz = (WCHAR *)::CoTaskMemAlloc(cbNeeded); + SPDBG_ASSERT(m_psz); + if (m_psz) + { + ::MultiByteToWideChar(CP_ACP, 0, pSrc, -1, m_psz, cbNeeded / sizeof(WCHAR)); + } + } + return m_psz; + } + + WCHAR * operator=(REFGUID rguid) + { + Clear(); + ::StringFromCLSID(rguid, &m_psz); + return m_psz; + } + + + /*explicit*/ CSpDynamicString(const WCHAR * pSrc) + { + m_psz = NULL; + operator=(pSrc); + } + /*explicit*/ CSpDynamicString(const char * pSrc) + { + m_psz = NULL; + operator=(pSrc); + } + /*explicit*/ CSpDynamicString(const CSpDynamicString& src) + { + m_psz = src.Copy(); + } + /*explicit*/ CSpDynamicString(REFGUID rguid) + { + ::StringFromCLSID(rguid, &m_psz); + } + + + ~CSpDynamicString() + { + ::CoTaskMemFree(m_psz); + } + unsigned int Length() const + { + return (m_psz == NULL) ? 0 : wcslen(m_psz); + } + + operator WCHAR * () const + { + return m_psz; + } + //The assert on operator& usually indicates a bug. If this is really + //what is needed, however, take the address of the m_psz member explicitly. + WCHAR ** operator&() + { + SPDBG_ASSERT(m_psz == NULL); + return &m_psz; + } + + WCHAR * Append(const WCHAR * pszSrc) + { + if (pszSrc) + { + ULONG lenSrc = wcslen(pszSrc); + if (lenSrc) + { + ULONG lenMe = Length(); + WCHAR *pszNew = (WCHAR *)::CoTaskMemAlloc((lenMe + lenSrc + 1) * sizeof(WCHAR)); + if (pszNew) + { + if (m_psz) // Could append to an empty string so check... + { + if (lenMe) + { + memcpy(pszNew, m_psz, lenMe * sizeof(WCHAR)); + } + ::CoTaskMemFree(m_psz); + } + memcpy(pszNew + lenMe, pszSrc, (lenSrc + 1) * sizeof(WCHAR)); + m_psz = pszNew; + } + else + { + SPDBG_ASSERT(FALSE); + } + } + } + return m_psz; + } + + WCHAR * Append(const WCHAR * pszSrc, const ULONG lenSrc) + { + if (pszSrc && lenSrc) + { + ULONG lenMe = Length(); + WCHAR *pszNew = (WCHAR *)::CoTaskMemAlloc((lenMe + lenSrc + 1) * sizeof(WCHAR)); + if (pszNew) + { + if (m_psz) // Could append to an empty string so check... + { + if (lenMe) + { + memcpy(pszNew, m_psz, lenMe * sizeof(WCHAR)); + } + ::CoTaskMemFree(m_psz); + } + memcpy(pszNew + lenMe, pszSrc, lenSrc * sizeof(WCHAR)); + *(pszNew + lenMe + lenSrc) = L'\0'; + m_psz = pszNew; + } + else + { + SPDBG_ASSERT(FALSE); + } + } + return m_psz; + } + + WCHAR * Append2(const WCHAR * pszSrc1, const WCHAR * pszSrc2) + { + ULONG lenSrc1 = pszSrc1 ? wcslen(pszSrc1) : 0; + ULONG lenSrc2 = pszSrc2 ? wcslen(pszSrc2) : 0; + + if (lenSrc1 || lenSrc2) + { + ULONG lenMe = Length(); + WCHAR *pszNew = (WCHAR *)::CoTaskMemAlloc((lenMe + lenSrc1 + lenSrc2 + 1) * sizeof(WCHAR)); + if (pszNew) + { + if (m_psz) // Could append to an empty string so check... + { + if (lenMe) + { + memcpy(pszNew, m_psz, lenMe * sizeof(WCHAR)); + } + ::CoTaskMemFree(m_psz); + } + // In both of these cases, we copy the trailing NULL so that we're sure it gets + // there (if lenSrc2 is 0 then we better copy it from pszSrc1). + if (lenSrc1) + { + memcpy(pszNew + lenMe, pszSrc1, (lenSrc1 + 1) * sizeof(WCHAR)); + } + if (lenSrc2) + { + memcpy(pszNew + lenMe + lenSrc1, pszSrc2, (lenSrc2 + 1) * sizeof(WCHAR)); + } + m_psz = pszNew; + } + else + { + SPDBG_ASSERT(FALSE); + } + } + return m_psz; + } + WCHAR * Copy() const + { + if (m_psz) + { + CSpDynamicString szNew(m_psz); + return szNew.Detach(); + } + return NULL; + } + CHAR * CopyToChar() const + { + if (m_psz) + { + CHAR* psz; + ULONG cbNeeded = ::WideCharToMultiByte(CP_ACP, 0, m_psz, -1, NULL, NULL, NULL, NULL); + psz = (CHAR *)::CoTaskMemAlloc(cbNeeded); + SPDBG_ASSERT(psz); + if (psz) + { + ::WideCharToMultiByte(CP_ACP, 0, m_psz, -1, psz, cbNeeded / sizeof(CHAR), NULL, NULL); + } + return psz; + } + return NULL; + } + void Attach(WCHAR * pszSrc) + { + SPDBG_ASSERT(m_psz == NULL); + m_psz = pszSrc; + } + WCHAR * Detach() + { + WCHAR * s = m_psz; + m_psz = NULL; + return s; + } + void Clear() + { + ::CoTaskMemFree(m_psz); + m_psz = NULL; + } + bool operator!() const + { + return (m_psz == NULL); + } + HRESULT CopyToBSTR(BSTR * pbstr) + { + if (m_psz) + { + *pbstr = ::SysAllocString(m_psz); + if (*pbstr == NULL) + { + return E_OUTOFMEMORY; + } + } + else + { + *pbstr = NULL; + } + return S_OK; + } + void TrimToSize(ULONG ulNumChars) + { + if (m_psz && ulNumChars < Length()) + { + m_psz[ulNumChars] = 0; + } + } + WCHAR * Compact() + { + if (m_psz) + { + ULONG cch = wcslen(m_psz); + m_psz = (WCHAR *)::CoTaskMemRealloc(m_psz, (cch + 1) * sizeof(WCHAR)); + } + return m_psz; + } + WCHAR * ClearAndGrowTo(ULONG cch) + { + if (m_psz) + { + Clear(); + } + m_psz = (WCHAR *)::CoTaskMemAlloc(cch * sizeof(WCHAR)); + return m_psz; + } + WCHAR * LTrim() + { + if (m_psz) + { + WCHAR * pszRead = m_psz; + while (iswspace(*pszRead)) + { + pszRead++; + } + if (pszRead != m_psz) + { + WCHAR * pszWrite = m_psz; + while (*pszRead) + { + *pszWrite++ = *pszRead++; + } + *pszWrite = '\0'; + } + } + return m_psz; + } + WCHAR * RTrim() + { + if (m_psz) + { + WCHAR * pszTail = m_psz + wcslen(m_psz); + WCHAR * pszZeroTerm = pszTail; + while (pszZeroTerm > m_psz && iswspace(pszZeroTerm[-1])) + { + pszZeroTerm--; + } + if (pszZeroTerm != pszTail) + { + *pszZeroTerm = '\0'; + } + } + return m_psz; + } + WCHAR * TrimBoth() + { + RTrim(); + return LTrim(); + } +}; + + + +// +// Simple inline function converts a ulong to a hex string. +// +inline void SpHexFromUlong(WCHAR * psz, ULONG ul) +{ + const static WCHAR szHexChars[] = L"0123456789ABCDEF"; + if (ul == 0) + { + psz[0] = L'0'; + psz[1] = 0; + } + else + { + ULONG ulChars = 1; + psz[0] = 0; + while (ul) + { + memmove(psz + 1, psz, ulChars * sizeof(WCHAR)); + psz[0] = szHexChars[ul % 16]; + ul /= 16; + ulChars++; + } + } +} + + +//=== Token helpers + +inline HRESULT SpGetTokenFromId( + const WCHAR * pszTokenId, + ISpObjectToken ** ppToken, + BOOL fCreateIfNotExist = FALSE) +{ + SPDBG_FUNC("SpGetTokenFromId"); + HRESULT hr; + + CComPtr cpToken; + hr = cpToken.CoCreateInstance(CLSID_SpObjectToken); + + if (SUCCEEDED(hr)) + { + hr = cpToken->SetId(NULL, pszTokenId, fCreateIfNotExist); + } + + if (SUCCEEDED(hr)) + { + *ppToken = cpToken.Detach(); + } + + if (hr != SPERR_NOT_FOUND) + { + SPDBG_REPORT_ON_FAIL(hr); + } + + return hr; +} + +inline HRESULT SpGetCategoryFromId( + const WCHAR * pszCategoryId, + ISpObjectTokenCategory ** ppCategory, + BOOL fCreateIfNotExist = FALSE) +{ + SPDBG_FUNC("SpGetCategoryFromId"); + HRESULT hr; + + CComPtr cpTokenCategory; + hr = cpTokenCategory.CoCreateInstance(CLSID_SpObjectTokenCategory); + + if (SUCCEEDED(hr)) + { + hr = cpTokenCategory->SetId(pszCategoryId, fCreateIfNotExist); + } + + if (SUCCEEDED(hr)) + { + *ppCategory = cpTokenCategory.Detach(); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpGetDefaultTokenIdFromCategoryId( + const WCHAR * pszCategoryId, + WCHAR ** ppszTokenId) +{ + SPDBG_FUNC("SpGetDefaultTokenFromCategoryId"); + HRESULT hr; + + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory); + + if (SUCCEEDED(hr)) + { + hr = cpCategory->GetDefaultTokenId(ppszTokenId); + } + + return hr; +} + +inline HRESULT SpSetDefaultTokenIdForCategoryId( + const WCHAR * pszCategoryId, + const WCHAR * pszTokenId) +{ + SPDBG_FUNC("SpSetDefaultTokenIdForCategoryId"); + HRESULT hr; + + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory); + + if (SUCCEEDED(hr)) + { + hr = cpCategory->SetDefaultTokenId(pszTokenId); + } + + return hr; +} + +inline HRESULT SpGetDefaultTokenFromCategoryId( + const WCHAR * pszCategoryId, + ISpObjectToken ** ppToken, + BOOL fCreateCategoryIfNotExist = TRUE) +{ + SPDBG_FUNC("SpGetDefaultTokenFromCategoryId"); + HRESULT hr; + + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory, fCreateCategoryIfNotExist); + + if (SUCCEEDED(hr)) + { + WCHAR * pszTokenId; + hr = cpCategory->GetDefaultTokenId(&pszTokenId); + if (SUCCEEDED(hr)) + { + hr = SpGetTokenFromId(pszTokenId, ppToken); + ::CoTaskMemFree(pszTokenId); + } + } + + return hr; +} + +inline HRESULT SpSetDefaultTokenForCategoryId( + const WCHAR * pszCategoryId, + ISpObjectToken * pToken) +{ + SPDBG_FUNC("SpSetDefaultTokenForCategoryId"); + HRESULT hr; + + WCHAR * pszTokenId; + hr = pToken->GetId(&pszTokenId); + + if (SUCCEEDED(hr)) + { + hr = SpSetDefaultTokenIdForCategoryId(pszCategoryId, pszTokenId); + ::CoTaskMemFree(pszTokenId); + } + + return hr; +} + +inline HRESULT SpSetCommonTokenData( + ISpObjectToken * pToken, + const CLSID * pclsid, + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + ISpDataKey ** ppDataKeyAttribs) +{ + SPDBG_FUNC("SpSetCommonTokenData"); + HRESULT hr = S_OK; + + // Set the new token's CLSID (if specified) + if (SUCCEEDED(hr) && pclsid) + { + CSpDynamicString dstrClsid; + hr = StringFromCLSID(*pclsid, &dstrClsid); + + if (SUCCEEDED(hr)) + { + hr = pToken->SetStringValue(SPTOKENVALUE_CLSID, dstrClsid); + } + } + + // Set the token's lang independent name + if (SUCCEEDED(hr) && pszLangIndependentName) + { + hr = pToken->SetStringValue(NULL, pszLangIndependentName); + } + + // Set the token's lang dependent name + if (SUCCEEDED(hr) && pszLangDependentName) + { + USES_CONVERSION; + + TCHAR szLangId[10]; + wsprintf(szLangId, _T("%x"), langid); + + hr = pToken->SetStringValue(T2W(szLangId), pszLangDependentName); + } + + // Open the attributes key if requested + if (SUCCEEDED(hr) && ppDataKeyAttribs) + { + hr = pToken->CreateKey(L"Attributes", ppDataKeyAttribs); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpCreateNewToken( + const WCHAR * pszTokenId, + ISpObjectToken ** ppToken) +{ + SPDBG_FUNC("SpCreateNewToken"); + HRESULT hr; + + // Forcefully create the token + hr = SpGetTokenFromId(pszTokenId, ppToken, TRUE); + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpCreateNewToken( + const WCHAR * pszCategoryId, + const WCHAR * pszTokenKeyName, + ISpObjectToken ** ppToken) +{ + SPDBG_FUNC("SpCreateNewToken"); + HRESULT hr; + + // Forcefully create the category + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory, TRUE); + + // Come up with a token key name if one wasn't specified + CSpDynamicString dstrTokenKeyName; + if (SUCCEEDED(hr)) + { + if (pszTokenKeyName == NULL) + { + GUID guidTokenKeyName; + hr = CoCreateGuid(&guidTokenKeyName); + + if (SUCCEEDED(hr)) + { + hr = StringFromCLSID(guidTokenKeyName, &dstrTokenKeyName); + } + + if (SUCCEEDED(hr)) + { + pszTokenKeyName = dstrTokenKeyName; + } + } + } + + // Build the token id + CSpDynamicString dstrTokenId; + if (SUCCEEDED(hr)) + { + dstrTokenId = pszCategoryId; + dstrTokenId.Append2(L"\\Tokens\\", pszTokenKeyName); + } + + // Forcefully create the token + if (SUCCEEDED(hr)) + { + hr = SpGetTokenFromId(dstrTokenId, ppToken, TRUE); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpCreateNewTokenEx( + const WCHAR * pszCategoryId, + const WCHAR * pszTokenKeyName, + const CLSID * pclsid, + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + ISpObjectToken ** ppToken, + ISpDataKey ** ppDataKeyAttribs) +{ + SPDBG_FUNC("SpCreateNewTokenEx"); + HRESULT hr; + + // Create the new token + hr = SpCreateNewToken(pszCategoryId, pszTokenKeyName, ppToken); + + // Now set the extra data + if (SUCCEEDED(hr)) + { + hr = SpSetCommonTokenData( + *ppToken, + pclsid, + pszLangIndependentName, + langid, + pszLangDependentName, + ppDataKeyAttribs); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpCreateNewTokenEx( + const WCHAR * pszTokenId, + const CLSID * pclsid, + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + ISpObjectToken ** ppToken, + ISpDataKey ** ppDataKeyAttribs) +{ + SPDBG_FUNC("SpCreateNewTokenEx"); + HRESULT hr; + + // Create the new token + hr = SpCreateNewToken(pszTokenId, ppToken); + + // Now set the extra data + if (SUCCEEDED(hr)) + { + hr = SpSetCommonTokenData( + *ppToken, + pclsid, + pszLangIndependentName, + langid, + pszLangDependentName, + ppDataKeyAttribs); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpEnumTokens( + const WCHAR * pszCategoryId, + const WCHAR * pszReqAttribs, + const WCHAR * pszOptAttribs, + IEnumSpObjectTokens ** ppEnum) +{ + SPDBG_FUNC("SpEnumTokens"); + HRESULT hr = S_OK; + + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory); + + if (SUCCEEDED(hr)) + { + hr = cpCategory->EnumTokens( + pszReqAttribs, + pszOptAttribs, + ppEnum); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpFindBestToken( + const WCHAR * pszCategoryId, + const WCHAR * pszReqAttribs, + const WCHAR * pszOptAttribs, + ISpObjectToken **ppObjectToken) +{ + SPDBG_FUNC("SpFindBestToken"); + HRESULT hr = S_OK; + + const WCHAR *pszVendorPreferred = L"VendorPreferred"; + const size_t ulLenVendorPreferred = wcslen(pszVendorPreferred); // no size_t + + // append VendorPreferred to the end of pszOptAttribs to force this preference + ULONG ulLen = pszOptAttribs ? wcslen(pszOptAttribs) + ulLenVendorPreferred + 1 : ulLenVendorPreferred; + WCHAR *pszOptAttribsVendorPref = (WCHAR*)_alloca((ulLen + 1) * sizeof(WCHAR)); + if (pszOptAttribsVendorPref) + { + if (pszOptAttribs) + { + wcscpy(pszOptAttribsVendorPref, pszOptAttribs); + wcscat(pszOptAttribsVendorPref, L";"); + wcscat(pszOptAttribsVendorPref, pszVendorPreferred); + } + else + { + wcscpy(pszOptAttribsVendorPref, pszVendorPreferred); + } + } + else + { + hr = E_OUTOFMEMORY; + } + + CComPtr cpEnum; + if (SUCCEEDED(hr)) + { + hr = SpEnumTokens(pszCategoryId, pszReqAttribs, pszOptAttribsVendorPref, &cpEnum); + } + + if (SUCCEEDED(hr)) + { + hr = cpEnum->Next(1, ppObjectToken, NULL); + if (hr == S_FALSE) + { + *ppObjectToken = NULL; + hr = SPERR_NOT_FOUND; + } + } + + if (hr != SPERR_NOT_FOUND) + { + SPDBG_REPORT_ON_FAIL(hr); + } + + return hr; +} + +template +HRESULT SpCreateObjectFromToken(ISpObjectToken * pToken, T ** ppObject, + IUnknown * pUnkOuter = NULL, DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateObjectFromToken"); + HRESULT hr; + + hr = pToken->CreateInstance(pUnkOuter, dwClsCtxt, __uuidof(T), (void **)ppObject); + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +template +HRESULT SpCreateObjectFromTokenId(const WCHAR * pszTokenId, T ** ppObject, + IUnknown * pUnkOuter = NULL, DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateObjectFromTokenId"); + + ISpObjectToken * pToken; + HRESULT hr = SpGetTokenFromId(pszTokenId, &pToken); + if (SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(pToken, ppObject, pUnkOuter, dwClsCtxt); + pToken->Release(); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +template +HRESULT SpCreateDefaultObjectFromCategoryId(const WCHAR * pszCategoryId, T ** ppObject, + IUnknown * pUnkOuter = NULL, DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateObjectFromTokenId"); + + ISpObjectToken * pToken; + HRESULT hr = SpGetDefaultTokenFromCategoryId(pszCategoryId, &pToken); + if (SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(pToken, ppObject, pUnkOuter, dwClsCtxt); + pToken->Release(); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +template +HRESULT SpCreateBestObject( + const WCHAR * pszCategoryId, + const WCHAR * pszReqAttribs, + const WCHAR * pszOptAttribs, + T ** ppObject, + IUnknown * pUnkOuter = NULL, + DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateBestObject"); + HRESULT hr; + + CComPtr cpToken; + hr = SpFindBestToken(pszCategoryId, pszReqAttribs, pszOptAttribs, &cpToken); + + if (SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(cpToken, ppObject, pUnkOuter, dwClsCtxt); + } + + if (hr != SPERR_NOT_FOUND) + { + SPDBG_REPORT_ON_FAIL(hr); + } + + return hr; +} + +inline HRESULT SpCreatePhoneConverter( + LANGID LangID, + const WCHAR * pszReqAttribs, + const WCHAR * pszOptAttribs, + ISpPhoneConverter ** ppPhoneConverter) +{ + SPDBG_FUNC("SpCreatePhoneConverter"); + HRESULT hr; + + if (LangID == 0) + { + hr = E_INVALIDARG; + } + else + { + CSpDynamicString dstrReqAttribs; + if (pszReqAttribs) + { + dstrReqAttribs = pszReqAttribs; + dstrReqAttribs.Append(L";"); + } + + WCHAR szLang[MAX_PATH]; + + SpHexFromUlong(szLang, LangID); + + WCHAR szLangCondition[MAX_PATH]; + wcscpy(szLangCondition, L"Language="); + wcscat(szLangCondition, szLang); + + dstrReqAttribs.Append(szLangCondition); + + hr = SpCreateBestObject(SPCAT_PHONECONVERTERS, dstrReqAttribs, pszOptAttribs, ppPhoneConverter); + } + + if (hr != SPERR_NOT_FOUND) + { + SPDBG_REPORT_ON_FAIL(hr); + } + + return hr; +} + +/**************************************************************************** +* SpHrFromWin32 * +*---------------* +* Description: +* This inline function works around a basic problem with the macro +* HRESULT_FROM_WIN32. The macro forces the expresion in ( ) to be evaluated +* two times. By using this inline function, the expression will only be +* evaluated once. +* +* Returns: +* HRESULT of converted Win32 error code +* +*****************************************************************************/ + +inline HRESULT SpHrFromWin32(DWORD dwErr) +{ + return HRESULT_FROM_WIN32(dwErr); +} + + +/**************************************************************************** +* SpHrFromLastWin32Error * +*------------------------* +* Description: +* This simple inline function is used to return a converted HRESULT +* from the Win32 function ::GetLastError. Note that using HRESULT_FROM_WIN32 +* will evaluate the error code twice so we don't want to use: +* +* HRESULT_FROM_WIN32(::GetLastError()) +* +* since that will call GetLastError twice. +* On Win98 and WinMe ::GetLastError() returns 0 for some functions (see MSDN). +* We therefore check for that and return E_FAIL. This function should only be +* called in an error case since it will always return an error code! +* +* Returns: +* HRESULT for ::GetLastError() +* +*****************************************************************************/ + +inline HRESULT SpHrFromLastWin32Error() +{ + DWORD dw = ::GetLastError(); + return (dw == 0) ? E_FAIL : SpHrFromWin32(dw); +} + + +/**************************************************************************** +* SpGetUserDefaultUILanguage * +*----------------------------* +* Description: +* Returns the default user interface language, using a method +* appropriate to the platform (Windows 9x, Windows NT, or Windows 2000) +* +* Returns: +* Default UI language +* +*****************************************************************************/ + +inline LANGID SpGetUserDefaultUILanguage(void) +{ + HRESULT hr = S_OK; + LANGID wUILang = 0; + + OSVERSIONINFO Osv; + Osv.dwOSVersionInfoSize = sizeof(Osv); + if (!GetVersionEx(&Osv)) + { + hr = SpHrFromLastWin32Error(); + } + // Get the UI language by one of three methods, depending on the system + else if (Osv.dwPlatformId != VER_PLATFORM_WIN32_NT) + { + // Case 1: Running on Windows 9x. Get the system UI language from registry: + CHAR szData[32]; + DWORD dwSize = sizeof(szData); + HKEY hKey; + + long lRet = RegOpenKeyEx( + HKEY_USERS, + _T(".Default\\Control Panel\\desktop\\ResourceLocale"), + 0, + KEY_READ, + &hKey); + +#ifdef _WIN32_WCE_BUG_10655 + if (lRet == ERROR_INVALID_PARAMETER) + { + lRet = ERROR_FILE_NOT_FOUND; + } +#endif // _WIN32_WCE_BUG_10655 + + hr = SpHrFromWin32(lRet); + + if (SUCCEEDED(hr)) + { + lRet = RegQueryValueEx( + hKey, + _T(""), + NULL, + NULL, + (BYTE *)szData, + &dwSize); + +#ifdef _WIN32_WCE_BUG_10655 + if (lRet == ERROR_INVALID_PARAMETER) + { + lRet = ERROR_FILE_NOT_FOUND; + } +#endif //_WIN32_WCE_BUG_10655 + + hr = SpHrFromWin32(lRet); + ::RegCloseKey(hKey); + } + if (SUCCEEDED(hr)) + { + // Convert string to number + wUILang = (LANGID)strtol(szData, NULL, 16); + } + } + else if (Osv.dwMajorVersion >= 5.0) + { + // Case 2: Running on Windows 2000 or later. Use GetUserDefaultUILanguage to find + // the user's prefered UI language + + + HMODULE hMKernel32 = ::LoadLibraryW(L"kernel32.dll"); + if (hMKernel32 == NULL) + { + hr = SpHrFromLastWin32Error(); + } + else + { + + LANGID(WINAPI *pfnGetUserDefaultUILanguage) () = + (LANGID(WINAPI *)(void)) +#ifdef _WIN32_WCE + GetProcAddress(hMKernel32, L"GetUserDefaultUILanguage"); +#else + GetProcAddress(hMKernel32, "GetUserDefaultUILanguage"); +#endif + + if (NULL != pfnGetUserDefaultUILanguage) + { + wUILang = pfnGetUserDefaultUILanguage(); + } + else + { // GetProcAddress failed + hr = SpHrFromLastWin32Error(); + } + ::FreeLibrary(hMKernel32); + } + } + else { + // Case 3: Running on Windows NT 4.0 or earlier. Get UI language + // from locale of .default user in registry: + // HKEY_USERS\.DEFAULT\Control Panel\International\Locale + + WCHAR szData[32]; + DWORD dwSize = sizeof(szData); + HKEY hKey; + + LONG lRet = RegOpenKeyEx(HKEY_USERS, + _T(".DEFAULT\\Control Panel\\International"), + 0, + KEY_READ, + &hKey); +#ifdef _WIN32_WCE_BUG_10655 + if (lRet == ERROR_INVALID_PARAMETER) + { + lRet = ERROR_FILE_NOT_FOUND; + } +#endif //_WIN32_WCE_BUG_10655 + + hr = SpHrFromWin32(lRet); + + if (SUCCEEDED(hr)) + { + lRet = RegQueryValueEx( + hKey, + _T("Locale"), + NULL, + NULL, + (BYTE *)szData, + &dwSize); + +#ifdef _WIN32_WCE_BUG_10655 + if (lRet == ERROR_INVALID_PARAMETER) + { + lRet = ERROR_FILE_NOT_FOUND; + } +#endif //_WIN32_WCE_BUG_10655 + + hr = SpHrFromWin32(lRet); + ::RegCloseKey(hKey); + } + + if (SUCCEEDED(hr)) + { + // Convert string to number + wUILang = (LANGID)wcstol(szData, NULL, 16); + + if (0x0401 == wUILang || // Arabic + 0x040d == wUILang || // Hebrew + 0x041e == wUILang // Thai + ) + { + // Special case these to the English UI. + // These versions of Windows NT 4.0 were enabled only, i.e., the + // UI was English. However, the registry setting + // HKEY_USERS\.DEFAULT\Control Panel\International\Locale was set + // to the respective locale for application compatibility. + wUILang = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); + } + } + } + + return (wUILang ? wUILang : ::GetUserDefaultLangID()); // In failure case, try our best! +} + + +inline HRESULT SpGetDescription(ISpObjectToken * pObjToken, WCHAR ** ppszDescription, LANGID Language = SpGetUserDefaultUILanguage()) +{ + WCHAR szLangId[10]; + SpHexFromUlong(szLangId, Language); + HRESULT hr = pObjToken->GetStringValue(szLangId, ppszDescription); + if (hr == SPERR_NOT_FOUND) + { + hr = pObjToken->GetStringValue(NULL, ppszDescription); + } + return hr; +} + + +inline HRESULT SpSetDescription(ISpObjectToken * pObjToken, const WCHAR * pszDescription, LANGID Language = SpGetUserDefaultUILanguage(), BOOL fSetLangIndependentId = TRUE) +{ + WCHAR szLangId[10]; + SpHexFromUlong(szLangId, Language); + HRESULT hr = pObjToken->SetStringValue(szLangId, pszDescription); + if (SUCCEEDED(hr) && fSetLangIndependentId) + { + hr = pObjToken->SetStringValue(NULL, pszDescription); + } + return hr; +} + +/**************************************************************************** +* SpConvertStreamFormatEnum * +*---------------------------* +* Description: +* This method converts the specified stream format into a wave format +* structure. +* +*****************************************************************************/ +inline HRESULT SpConvertStreamFormatEnum(SPSTREAMFORMAT eFormat, GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + HRESULT hr = S_OK; + + if (pFormatId == NULL || ::IsBadWritePtr(pFormatId, sizeof(*pFormatId)) + || ppCoMemWaveFormatEx == NULL || ::IsBadWritePtr(ppCoMemWaveFormatEx, sizeof(*ppCoMemWaveFormatEx))) + { + return E_INVALIDARG; + } + + const GUID * pFmtGuid = &GUID_NULL; // Assume failure case + if (eFormat >= SPSF_8kHz8BitMono && eFormat <= SPSF_48kHz16BitStereo) + { + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc(sizeof(WAVEFORMATEX)); + *ppCoMemWaveFormatEx = pwfex; + if (pwfex) + { + DWORD dwIndex = eFormat - SPSF_8kHz8BitMono; + BOOL bIsStereo = dwIndex & 0x1; + BOOL bIs16 = dwIndex & 0x2; + DWORD dwKHZ = (dwIndex & 0x3c) >> 2; + static const DWORD adwKHZ[] = { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }; + pwfex->wFormatTag = WAVE_FORMAT_PCM; + pwfex->nChannels = pwfex->nBlockAlign = (WORD)(bIsStereo ? 2 : 1); + pwfex->nSamplesPerSec = adwKHZ[dwKHZ]; + pwfex->wBitsPerSample = 8; + if (bIs16) + { + pwfex->wBitsPerSample *= 2; + pwfex->nBlockAlign *= 2; + } + pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nBlockAlign; + pwfex->cbSize = 0; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if (eFormat == SPSF_TrueSpeech_8kHz1BitMono) + { + int NumBytes = sizeof(WAVEFORMATEX) + 32; + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc(NumBytes); + *ppCoMemWaveFormatEx = pwfex; + if (pwfex) + { + memset(pwfex, 0, NumBytes); + pwfex->wFormatTag = WAVE_FORMAT_DSPGROUP_TRUESPEECH; + pwfex->nChannels = 1; + pwfex->nSamplesPerSec = 8000; + pwfex->nAvgBytesPerSec = 1067; + pwfex->nBlockAlign = 32; + pwfex->wBitsPerSample = 1; + pwfex->cbSize = 32; + BYTE* pExtra = ((BYTE*)pwfex) + sizeof(WAVEFORMATEX); + pExtra[0] = 1; + pExtra[2] = 0xF0; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if ((eFormat >= SPSF_CCITT_ALaw_8kHzMono) && + (eFormat <= SPSF_CCITT_ALaw_44kHzStereo)) + { + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc(sizeof(WAVEFORMATEX)); + *ppCoMemWaveFormatEx = pwfex; + if (pwfex) + { + memset(pwfex, 0, sizeof(WAVEFORMATEX)); + DWORD dwIndex = eFormat - SPSF_CCITT_ALaw_8kHzMono; + DWORD dwKHZ = dwIndex / 2; + static const DWORD adwKHZ[] = { 8000, 11025, 22050, 44100 }; + BOOL bIsStereo = dwIndex & 0x1; + pwfex->wFormatTag = WAVE_FORMAT_ALAW; + pwfex->nChannels = pwfex->nBlockAlign = (WORD)(bIsStereo ? 2 : 1); + pwfex->nSamplesPerSec = adwKHZ[dwKHZ]; + pwfex->wBitsPerSample = 8; + pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nBlockAlign; + pwfex->cbSize = 0; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if ((eFormat >= SPSF_CCITT_uLaw_8kHzMono) && + (eFormat <= SPSF_CCITT_uLaw_44kHzStereo)) + { + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc(sizeof(WAVEFORMATEX)); + *ppCoMemWaveFormatEx = pwfex; + if (pwfex) + { + memset(pwfex, 0, sizeof(WAVEFORMATEX)); + DWORD dwIndex = eFormat - SPSF_CCITT_uLaw_8kHzMono; + DWORD dwKHZ = dwIndex / 2; + static const DWORD adwKHZ[] = { 8000, 11025, 22050, 44100 }; + BOOL bIsStereo = dwIndex & 0x1; + pwfex->wFormatTag = WAVE_FORMAT_MULAW; + pwfex->nChannels = pwfex->nBlockAlign = (WORD)(bIsStereo ? 2 : 1); + pwfex->nSamplesPerSec = adwKHZ[dwKHZ]; + pwfex->wBitsPerSample = 8; + pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nBlockAlign; + pwfex->cbSize = 0; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if ((eFormat >= SPSF_ADPCM_8kHzMono) && + (eFormat <= SPSF_ADPCM_44kHzStereo)) + { + int NumBytes = sizeof(WAVEFORMATEX) + 32; + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc(NumBytes); + *ppCoMemWaveFormatEx = pwfex; + if (pwfex) + { + //--- Some of these values seem odd. We used what the codec told us. + static const DWORD adwKHZ[] = { 8000, 11025, 22050, 44100 }; + static const DWORD BytesPerSec[] = { 4096, 8192, 5644, 11289, 11155, 22311, 22179, 44359 }; + static const DWORD BlockAlign[] = { 256, 256, 512, 1024 }; + static const BYTE Extra811[32] = + { + 0xF4, 0x01, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, + 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF + }; + + static const BYTE Extra22[32] = + { + 0xF4, 0x03, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, + 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF + }; + + static const BYTE Extra44[32] = + { + 0xF4, 0x07, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, + 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF + }; + + static const BYTE* Extra[4] = { Extra811, Extra811, Extra22, Extra44 }; + memset(pwfex, 0, NumBytes); + DWORD dwIndex = eFormat - SPSF_ADPCM_8kHzMono; + DWORD dwKHZ = dwIndex / 2; + BOOL bIsStereo = dwIndex & 0x1; + pwfex->wFormatTag = WAVE_FORMAT_ADPCM; + pwfex->nChannels = (WORD)(bIsStereo ? 2 : 1); + pwfex->nSamplesPerSec = adwKHZ[dwKHZ]; + pwfex->nAvgBytesPerSec = BytesPerSec[dwIndex]; + pwfex->nBlockAlign = (WORD)(BlockAlign[dwKHZ] * pwfex->nChannels); + pwfex->wBitsPerSample = 4; + pwfex->cbSize = 32; + BYTE* pExtra = ((BYTE*)pwfex) + sizeof(WAVEFORMATEX); + memcpy(pExtra, Extra[dwKHZ], 32); + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if ((eFormat >= SPSF_GSM610_8kHzMono) && + (eFormat <= SPSF_GSM610_44kHzMono)) + { + int NumBytes = sizeof(WAVEFORMATEX) + 2; + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc(NumBytes); + *ppCoMemWaveFormatEx = pwfex; + if (pwfex) + { + //--- Some of these values seem odd. We used what the codec told us. + static const DWORD adwKHZ[] = { 8000, 11025, 22050, 44100 }; + static const DWORD BytesPerSec[] = { 1625, 2239, 4478, 8957 }; + memset(pwfex, 0, NumBytes); + DWORD dwIndex = eFormat - SPSF_GSM610_8kHzMono; + pwfex->wFormatTag = WAVE_FORMAT_GSM610; + pwfex->nChannels = 1; + pwfex->nSamplesPerSec = adwKHZ[dwIndex]; + pwfex->nAvgBytesPerSec = BytesPerSec[dwIndex]; + pwfex->nBlockAlign = 65; + pwfex->wBitsPerSample = 0; + pwfex->cbSize = 2; + BYTE* pExtra = ((BYTE*)pwfex) + sizeof(WAVEFORMATEX); + pExtra[0] = 0x40; + pExtra[1] = 0x01; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else + { + *ppCoMemWaveFormatEx = NULL; + switch (eFormat) + { + case SPSF_NoAssignedFormat: + break; + case SPSF_Text: + pFmtGuid = &SPDFID_Text; + break; + default: + hr = E_INVALIDARG; + break; + } + } + *pFormatId = *pFmtGuid; + return hr; +} + +class CSpStreamFormat +{ +public: + GUID m_guidFormatId; + WAVEFORMATEX * m_pCoMemWaveFormatEx; + + + static long CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX) // missing long + { + ULONG cb = sizeof(WAVEFORMATEX) + pSrc->cbSize; + *ppCoMemWFEX = (WAVEFORMATEX *)::CoTaskMemAlloc(cb); + if (*ppCoMemWFEX) + { + memcpy(*ppCoMemWFEX, pSrc, cb); + return S_OK; + } + else + { + return E_OUTOFMEMORY; + } + } + + + CSpStreamFormat() + { + m_guidFormatId = GUID_NULL; + m_pCoMemWaveFormatEx = NULL; + } + + CSpStreamFormat(SPSTREAMFORMAT eFormat, HRESULT * phr) + { + *phr = SpConvertStreamFormatEnum(eFormat, &m_guidFormatId, &m_pCoMemWaveFormatEx); + } + + CSpStreamFormat(const WAVEFORMATEX * pWaveFormatEx, HRESULT * phr) + { + SPDBG_ASSERT(pWaveFormatEx); + *phr = CoMemCopyWFEX(pWaveFormatEx, &m_pCoMemWaveFormatEx); + m_guidFormatId = SUCCEEDED(*phr) ? SPDFID_WaveFormatEx : GUID_NULL; + } + + ~CSpStreamFormat() + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + } + + void Clear() + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + m_pCoMemWaveFormatEx = NULL; + memset(&m_guidFormatId, 0, sizeof(m_guidFormatId)); + } + + const GUID & FormatId() const + { + return m_guidFormatId; + } + + const WAVEFORMATEX * WaveFormatExPtr() const + { + return m_pCoMemWaveFormatEx; + } + + + HRESULT AssignFormat(SPSTREAMFORMAT eFormat) + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + return SpConvertStreamFormatEnum(eFormat, &m_guidFormatId, &m_pCoMemWaveFormatEx); + } + + HRESULT AssignFormat(ISpStreamFormat * pStream) + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + m_pCoMemWaveFormatEx = NULL; + return pStream->GetFormat(&m_guidFormatId, &m_pCoMemWaveFormatEx); + } + + HRESULT AssignFormat(const WAVEFORMATEX * pWaveFormatEx) + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + HRESULT hr = CoMemCopyWFEX(pWaveFormatEx, &m_pCoMemWaveFormatEx); + m_guidFormatId = SUCCEEDED(hr) ? SPDFID_WaveFormatEx : GUID_NULL; + return hr; + } + + HRESULT AssignFormat(REFGUID rguidFormatId, const WAVEFORMATEX * pWaveFormatEx) + { + HRESULT hr = S_OK; + + m_guidFormatId = rguidFormatId; + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + m_pCoMemWaveFormatEx = NULL; + + if (rguidFormatId == SPDFID_WaveFormatEx) + { + if (::IsBadReadPtr(pWaveFormatEx, sizeof(*pWaveFormatEx))) + { + hr = E_INVALIDARG; + } + else + { + hr = CoMemCopyWFEX(pWaveFormatEx, &m_pCoMemWaveFormatEx); + } + + if (FAILED(hr)) + { + m_guidFormatId = GUID_NULL; + } + } + + return hr; + } + + + BOOL IsEqual(REFGUID rguidFormatId, const WAVEFORMATEX * pwfex) const + { + if (rguidFormatId == m_guidFormatId) + { + if (m_pCoMemWaveFormatEx) + { + if (pwfex && + pwfex->cbSize == m_pCoMemWaveFormatEx->cbSize && + memcmp(m_pCoMemWaveFormatEx, pwfex, sizeof(WAVEFORMATEX) + pwfex->cbSize) == 0) + { + return TRUE; + } + } + else + { + return (pwfex == NULL); + } + } + return FALSE; + } + + + + HRESULT ParamValidateAssignFormat(REFGUID rguidFormatId, const WAVEFORMATEX * pWaveFormatEx, BOOL fRequireWaveFormat = FALSE) + { + if ((pWaveFormatEx && (::IsBadReadPtr(pWaveFormatEx, sizeof(*pWaveFormatEx)) || rguidFormatId != SPDFID_WaveFormatEx)) || + (fRequireWaveFormat && pWaveFormatEx == NULL)) + { + return E_INVALIDARG; + } + return AssignFormat(rguidFormatId, pWaveFormatEx); + } + + SPSTREAMFORMAT ComputeFormatEnum() + { + if (m_guidFormatId == GUID_NULL) + { + return SPSF_NoAssignedFormat; + } + if (m_guidFormatId == SPDFID_Text) + { + return SPSF_Text; + } + if (m_guidFormatId != SPDFID_WaveFormatEx) + { + return SPSF_NonStandardFormat; + } + // + // It is a WAVEFORMATEX. Now determine which type it is and convert. + // + DWORD dwIndex = 0; + switch (m_pCoMemWaveFormatEx->wFormatTag) + { + case WAVE_FORMAT_PCM: + { + switch (m_pCoMemWaveFormatEx->nChannels) + { + case 1: + break; + case 2: + dwIndex |= 1; + break; + default: + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->wBitsPerSample) + { + case 8: + break; + case 16: + dwIndex |= 2; + break; + default: + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->nSamplesPerSec) + { + case 48000: + dwIndex += 4; // Fall through + case 44100: + dwIndex += 4; // Fall through + case 32000: + dwIndex += 4; // Fall through + case 24000: + dwIndex += 4; // Fall through + case 22050: + dwIndex += 4; // Fall through + case 16000: + dwIndex += 4; // Fall through + case 12000: + dwIndex += 4; // Fall through + case 11025: + dwIndex += 4; // Fall through + case 8000: + break; + default: + return SPSF_ExtendedAudioFormat; + } + + return static_cast(SPSF_8kHz8BitMono + dwIndex); + } + + case WAVE_FORMAT_DSPGROUP_TRUESPEECH: + { + return SPSF_TrueSpeech_8kHz1BitMono; + } + + case WAVE_FORMAT_ALAW: // fall through + case WAVE_FORMAT_MULAW: + case WAVE_FORMAT_ADPCM: + { + switch (m_pCoMemWaveFormatEx->nChannels) + { + case 1: + break; + case 2: + dwIndex |= 1; + break; + default: + return SPSF_ExtendedAudioFormat; + } + + if (m_pCoMemWaveFormatEx->wFormatTag == WAVE_FORMAT_ADPCM) + { + if (m_pCoMemWaveFormatEx->wBitsPerSample != 4) + { + return SPSF_ExtendedAudioFormat; + } + } + else if (m_pCoMemWaveFormatEx->wBitsPerSample != 8) + { + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->nSamplesPerSec) + { + case 44100: + dwIndex += 2; // Fall through + case 22050: + dwIndex += 2; // Fall through + case 11025: + dwIndex += 2; // Fall through + case 8000: + break; + default: + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->wFormatTag) + { + case WAVE_FORMAT_ALAW: + return static_cast(SPSF_CCITT_ALaw_8kHzMono + dwIndex); + case WAVE_FORMAT_MULAW: + return static_cast(SPSF_CCITT_uLaw_8kHzMono + dwIndex); + case WAVE_FORMAT_ADPCM: + return static_cast(SPSF_ADPCM_8kHzMono + dwIndex); + } + } + + case WAVE_FORMAT_GSM610: + { + if (m_pCoMemWaveFormatEx->nChannels != 1) + { + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->nSamplesPerSec) + { + case 44100: + dwIndex = 3; + break; + case 22050: + dwIndex = 2; + break; + case 11025: + dwIndex = 1; + break; + case 8000: + dwIndex = 0; + break; + default: + return SPSF_ExtendedAudioFormat; + } + + return static_cast(SPSF_GSM610_8kHzMono + dwIndex); + } + + default: + return SPSF_ExtendedAudioFormat; + break; + } + } + + void DetachTo(CSpStreamFormat & Other) + { + ::CoTaskMemFree(Other.m_pCoMemWaveFormatEx); + Other.m_guidFormatId = m_guidFormatId; + Other.m_pCoMemWaveFormatEx = m_pCoMemWaveFormatEx; + m_pCoMemWaveFormatEx = NULL; + memset(&m_guidFormatId, 0, sizeof(m_guidFormatId)); + } + + void DetachTo(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx) + { + *pFormatId = m_guidFormatId; + *ppCoMemWaveFormatEx = m_pCoMemWaveFormatEx; + m_pCoMemWaveFormatEx = NULL; + memset(&m_guidFormatId, 0, sizeof(m_guidFormatId)); + } + + HRESULT CopyTo(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWFEX) const + { + HRESULT hr = S_OK; + *pFormatId = m_guidFormatId; + if (m_pCoMemWaveFormatEx) + { + hr = CoMemCopyWFEX(m_pCoMemWaveFormatEx, ppCoMemWFEX); + if (FAILED(hr)) + { + memset(pFormatId, 0, sizeof(*pFormatId)); + } + } + else + { + *ppCoMemWFEX = NULL; + } + return hr; + } + + HRESULT CopyTo(CSpStreamFormat & Other) const + { + ::CoTaskMemFree(Other.m_pCoMemWaveFormatEx); + return CopyTo(&Other.m_guidFormatId, &Other.m_pCoMemWaveFormatEx); + } + + HRESULT AssignFormat(const CSpStreamFormat & Src) + { + return Src.CopyTo(*this); + } + + + HRESULT ParamValidateCopyTo(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWFEX) const + { + if (::IsBadWritePtr(pFormatId, sizeof(*pFormatId)) || + ::IsBadWritePtr(ppCoMemWFEX, sizeof(*ppCoMemWFEX))) + { + return E_POINTER; + } + return CopyTo(pFormatId, ppCoMemWFEX); + } + + BOOL operator==(const CSpStreamFormat & Other) const + { + return IsEqual(Other.m_guidFormatId, Other.m_pCoMemWaveFormatEx); + } + BOOL operator!=(const CSpStreamFormat & Other) const + { + return !IsEqual(Other.m_guidFormatId, Other.m_pCoMemWaveFormatEx); + } + + ULONG SerializeSize() const + { + ULONG cb = sizeof(ULONG) + sizeof(m_guidFormatId); + if (m_pCoMemWaveFormatEx) + { + cb += sizeof(WAVEFORMATEX) + m_pCoMemWaveFormatEx->cbSize + 3; // Add 3 to round up + cb -= cb % 4; // Round to DWORD + } + return cb; + } + + ULONG Serialize(BYTE * pBuffer) const + { + ULONG cb = SerializeSize(); + *((UNALIGNED ULONG *)pBuffer) = cb; + pBuffer += sizeof(ULONG); + *((UNALIGNED GUID *)pBuffer) = m_guidFormatId; + if (m_pCoMemWaveFormatEx) + { + pBuffer += sizeof(m_guidFormatId); + memcpy(pBuffer, m_pCoMemWaveFormatEx, sizeof(WAVEFORMATEX) + m_pCoMemWaveFormatEx->cbSize); + } + return cb; + } + + HRESULT Deserialize(const BYTE * pBuffer, ULONG * pcbUsed) + { + HRESULT hr = S_OK; + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + m_pCoMemWaveFormatEx = NULL; + *pcbUsed = *((UNALIGNED ULONG *)pBuffer); + pBuffer += sizeof(ULONG); + // Misaligment exception is generated for SHx platform. + // Marking pointer as UNALIGNED does not help. +#ifndef _WIN32_WCE + m_guidFormatId = *((UNALIGNED GUID *)pBuffer); +#else + memcpy(&m_guidFormatId, pBuffer, sizeof(GUID)); +#endif + if (*pcbUsed > sizeof(GUID) + sizeof(ULONG)) + { + pBuffer += sizeof(m_guidFormatId); + hr = CoMemCopyWFEX((const WAVEFORMATEX *)pBuffer, &m_pCoMemWaveFormatEx); + if (FAILED(hr)) + { + m_guidFormatId = GUID_NULL; + } + } + return hr; + } + +}; + + + +// Return the default codepage given a LCID. +// Note some of the newer locales do not have associated Windows codepages. For these, we return UTF-8. + +inline UINT SpCodePageFromLcid(LCID lcid) +{ + char achCodePage[6]; + + return (0 != GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE, achCodePage, sizeof(achCodePage))) ? atoi(achCodePage) : 65001; +} + + +inline HRESULT SPBindToFile(LPCWSTR pFileName, SPFILEMODE eMode, ISpStream ** ppStream, + const GUID * pFormatId = NULL, const WAVEFORMATEX * pWaveFormatEx = NULL, + ULONGLONG ullEventInterest = SPFEI_ALL_EVENTS) +{ + HRESULT hr = ::CoCreateInstance(CLSID_SpStream, NULL, CLSCTX_ALL, __uuidof(*ppStream), (void **)ppStream); + if (SUCCEEDED(hr)) + { + hr = (*ppStream)->BindToFile(pFileName, eMode, pFormatId, pWaveFormatEx, ullEventInterest); + if (FAILED(hr)) + { + (*ppStream)->Release(); + *ppStream = NULL; + } + } + return hr; +} /* SPBindToFile */ + +#ifndef _UNICODE +inline HRESULT SPBindToFile(const TCHAR * pFileName, SPFILEMODE eMode, ISpStream** ppStream, + const GUID * pFormatId = NULL, const WAVEFORMATEX * pWaveFormatEx = NULL, + ULONGLONG ullEventInterest = SPFEI_ALL_EVENTS) +{ + WCHAR szWcharFileName[MAX_PATH]; + ::MultiByteToWideChar(CP_ACP, 0, pFileName, -1, szWcharFileName, sp_countof(szWcharFileName)); + return SPBindToFile(szWcharFileName, eMode, ppStream, pFormatId, pWaveFormatEx, ullEventInterest); +} +#endif + +/**************************************************************************** +* SpClearEvent * +*--------------* +* Description: +* Helper function that can be used by clients that do not use the CSpEvent +* class. +* +* Returns: +* +*****************************************************************************/ + +inline void SpClearEvent(SPEVENT * pe) +{ + if (pe->elParamType != SPEI_UNDEFINED) + { + if (pe->elParamType == SPET_LPARAM_IS_POINTER || + pe->elParamType == SPET_LPARAM_IS_STRING) + { + ::CoTaskMemFree((void *)pe->lParam); + } + else if (pe->elParamType == SPET_LPARAM_IS_TOKEN || + pe->elParamType == SPET_LPARAM_IS_OBJECT) + { + ((IUnknown*)pe->lParam)->Release(); + } + } + memset(pe, 0, sizeof(*pe)); +} + +/**************************************************************************** +* SpInitEvent * +*-------------* +* Description: +* +* Returns: +* +*****************************************************************************/ + +inline void SpInitEvent(SPEVENT * pe) +{ + memset(pe, 0, sizeof(*pe)); +} + +/**************************************************************************** +* SpEventSerializeSize * +*----------------------* +* Description: +* Computes the required size of a buffer to serialize an event. The caller +* must specify which type of serialized event is desired -- either SPSERIALIZEDEVENT +* or SPSERIALIZEDEVENT64. +* +* Returns: +* Size in bytes required to seriailze the event. +* +****************************************************************************/ + +// WCE compiler does not work propertly with template +#ifndef _WIN32_WCE +template +inline ULONG SpEventSerializeSize(const SPEVENT * pEvent) + +{ + ULONG ulSize = sizeof(T); + +#else + +inline ULONG SpEventSerializeSize(const SPEVENT * pEvent, ULONG ulSize) +{ +#endif //_WIN32_WCE + + if ((pEvent->elParamType == SPET_LPARAM_IS_POINTER) && pEvent->lParam) + { + ulSize += ULONG(pEvent->wParam); + } + else if ((pEvent->elParamType == SPET_LPARAM_IS_STRING) && pEvent->lParam != NULL) + { + ulSize += (wcslen((WCHAR*)pEvent->lParam) + 1) * sizeof(WCHAR); + } + else if (pEvent->elParamType == SPET_LPARAM_IS_TOKEN) + { + CSpDynamicString dstrObjectId; + if (((ISpObjectToken*)(pEvent->lParam))->GetId(&dstrObjectId) == S_OK) + { + ulSize += (dstrObjectId.Length() + 1) * sizeof(WCHAR); + } + } + // Round up to nearest DWORD + ulSize += 3; + ulSize -= ulSize % 4; + return ulSize; +} + +/**************************************************************************** +* SpSerializedEventSize * +*-----------------------* +* Description: +* Returns the size, in bytes, used by a serialized event. The caller can +* pass a pointer to either a SPSERIAILZEDEVENT or SPSERIALIZEDEVENT64 structure. +* +* Returns: +* Number of bytes used by serizlied event +* +********************************************************************* RAL ***/ + +// WCE compiler does not work propertly with template +#ifndef _WIN32_WCE +template +inline ULONG SpSerializedEventSize(const T * pSerEvent) +{ + ULONG ulSize = sizeof(T); + + if ((pSerEvent->elParamType == SPET_LPARAM_IS_POINTER) && pSerEvent->SerializedlParam) + { + ulSize += ULONG(pSerEvent->SerializedwParam); + } + else if ((pSerEvent->elParamType == SPET_LPARAM_IS_STRING || pSerEvent->elParamType == SPET_LPARAM_IS_TOKEN) && + pSerEvent->SerializedlParam != NULL) + { + ulSize += (wcslen((WCHAR*)(pSerEvent + 1)) + 1) * sizeof(WCHAR); + } + // Round up to nearest DWORD + ulSize += 3; + ulSize -= ulSize % 4; + return ulSize; +} + +#else //_WIN32_WCE + +inline ULONG SpSerializedEventSize(const SPSERIALIZEDEVENT * pSerEvent, ULONG ulSize) +{ + if ((pSerEvent->elParamType == SPET_LPARAM_IS_POINTER) && pSerEvent->SerializedlParam) + { + ulSize += ULONG(pSerEvent->SerializedwParam); + } + else if ((pSerEvent->elParamType == SPET_LPARAM_IS_STRING || pSerEvent->elParamType == SPET_LPARAM_IS_TOKEN) && + pSerEvent->SerializedlParam != NULL) + { + ulSize += (wcslen((WCHAR*)(pSerEvent + 1)) + 1) * sizeof(WCHAR); + } + // Round up to nearest DWORD + ulSize += 3; + ulSize -= ulSize % 4; + return ulSize; +} + +inline ULONG SpSerializedEventSize(const SPSERIALIZEDEVENT64 * pSerEvent, ULONG ulSize) +{ + if ((pSerEvent->elParamType == SPET_LPARAM_IS_POINTER) && pSerEvent->SerializedlParam) + { + ulSize += ULONG(pSerEvent->SerializedwParam); + } + else if ((pSerEvent->elParamType == SPET_LPARAM_IS_STRING || pSerEvent->elParamType == SPET_LPARAM_IS_TOKEN) && + pSerEvent->SerializedlParam != NULL) + { + ulSize += (wcslen((WCHAR*)(pSerEvent + 1)) + 1) * sizeof(WCHAR); + } + // Round up to nearest DWORD + ulSize += 3; + ulSize -= ulSize % 4; + return ulSize; +} + +#endif //_WIN32_WCE + +/*** CSpEvent helper class +* +*/ +class CSpEvent : public SPEVENT +{ +public: + CSpEvent() + { + SpInitEvent(this); + } + ~CSpEvent() + { + SpClearEvent(this); + } + // If you need to take the address of a CSpEvent that is not const, use the AddrOf() method + // which will do debug checking of parameters. If you encounter this problem when calling + // GetEvents from an event source, you may want to use the GetFrom() method of this class. + const SPEVENT * operator&() + { + return this; + } + CSpEvent * AddrOf() + { + // Note: This method does not ASSERT since we assume the caller knows what they are doing. + return this; + } + void Clear() + { + SpClearEvent(this); + } + HRESULT CopyTo(SPEVENT * pDestEvent) const + { + memcpy(pDestEvent, this, sizeof(*pDestEvent)); + if ((elParamType == SPET_LPARAM_IS_POINTER) && lParam) + { + SPDBG_ASSERT(wParam && (wParam < 0x100000)); // this is too big! + pDestEvent->lParam = (LPARAM)::CoTaskMemAlloc(wParam); + if (pDestEvent->lParam) + { + memcpy((void *)pDestEvent->lParam, (void *)lParam, wParam); + } + else + { + pDestEvent->eEventId = SPEI_UNDEFINED; + return E_OUTOFMEMORY; + } + } + else if (elParamType == SPET_LPARAM_IS_STRING && lParam != NULL) + { + pDestEvent->lParam = (LPARAM)::CoTaskMemAlloc((wcslen((WCHAR*)lParam) + 1) * sizeof(WCHAR)); + if (pDestEvent->lParam) + { + wcscpy((WCHAR*)pDestEvent->lParam, (WCHAR*)lParam); + } + else + { + pDestEvent->eEventId = SPEI_UNDEFINED; + return E_OUTOFMEMORY; + } + } + else if (elParamType == SPET_LPARAM_IS_TOKEN || + elParamType == SPET_LPARAM_IS_OBJECT) + { + ((IUnknown*)lParam)->AddRef(); + } + return S_OK; + } + + HRESULT GetFrom(ISpEventSource * pEventSrc) + { + SpClearEvent(this); + return pEventSrc->GetEvents(1, this, NULL); + } + HRESULT CopyFrom(const SPEVENT * pSrcEvent) + { + SpClearEvent(this); + return static_cast(pSrcEvent)->CopyTo(this); + } + void Detach(SPEVENT * pDestEvent = NULL) + { + if (pDestEvent) + { + memcpy(pDestEvent, this, sizeof(*pDestEvent)); + } + memset(this, 0, sizeof(*this)); + } + + template + ULONG SerializeSize() const + { + return SpEventSerializeSize(this); + } + + // Call this method with either SPSERIALIZEDEVENT or SPSERIALIZEDEVENT64 + template + void Serialize(T * pSerEvent) const + { + SPDBG_ASSERT(elParamType != SPET_LPARAM_IS_OBJECT); + pSerEvent->eEventId = this->eEventId; + pSerEvent->elParamType = this->elParamType; + pSerEvent->ulStreamNum = this->ulStreamNum; + pSerEvent->ullAudioStreamOffset = this->ullAudioStreamOffset; + pSerEvent->SerializedwParam = static_cast(this->wParam); + pSerEvent->SerializedlParam = static_cast(this->lParam); + if (lParam) + { + switch (elParamType) + { + case SPET_LPARAM_IS_POINTER: + memcpy(pSerEvent + 1, (void *)lParam, wParam); + pSerEvent->SerializedlParam = sizeof(T); + break; + + case SPET_LPARAM_IS_STRING: + wcscpy((WCHAR *)(pSerEvent + 1), (WCHAR*)lParam); + pSerEvent->SerializedlParam = sizeof(T); + break; + + case SPET_LPARAM_IS_TOKEN: + { + CSpDynamicString dstrObjectId; + if (SUCCEEDED(((ISpObjectToken*)lParam)->GetId(&dstrObjectId))) + { + pSerEvent->SerializedwParam = (dstrObjectId.Length() + 1) * sizeof(WCHAR);; + memcpy(pSerEvent + 1, (void *)dstrObjectId.m_psz, static_cast(pSerEvent->SerializedwParam)); + } + pSerEvent->SerializedlParam = sizeof(T); + } + break; + + default: + break; + } + } + } + + template + HRESULT Serialize(T ** ppCoMemSerEvent, ULONG * pcbSerEvent) const + { + // WCE compiler does not work propertly with template +#ifndef _WIN32_WCE + *pcbSerEvent = SpEventSerializeSize(this); +#else + *pcbSerEvent = SpEventSerializeSize(this, sizeof(** ppCoMemSerEvent)); +#endif + *ppCoMemSerEvent = (T *)::CoTaskMemAlloc(*pcbSerEvent); + if (*ppCoMemSerEvent) + { + Serialize(*ppCoMemSerEvent); + return S_OK; + } + else + { + *pcbSerEvent = 0; + return E_OUTOFMEMORY; + } + } + + + // Call this method with either SPSERIALIZEDEVENT or SPSERIALIZEDEVENT64 + template + HRESULT Deserialize(const T * pSerEvent, ULONG * pcbUsed = NULL) + { + Clear(); + HRESULT hr = S_OK; + const UNALIGNED T * pTemp = pSerEvent; + this->eEventId = pTemp->eEventId; + this->elParamType = pTemp->elParamType; + this->ulStreamNum = pTemp->ulStreamNum; + this->ullAudioStreamOffset = pTemp->ullAudioStreamOffset; + this->wParam = static_cast(pTemp->SerializedwParam); + this->lParam = static_cast(pTemp->SerializedlParam); + if (pTemp->SerializedlParam) + { + ULONG cbAlloc = 0; + switch (pTemp->elParamType) + { + case SPET_LPARAM_IS_POINTER: + cbAlloc = static_cast(wParam); + break; + + case SPET_LPARAM_IS_STRING: + cbAlloc = sizeof(WCHAR) * (1 + wcslen((const WCHAR *)(pTemp + 1))); + break; + + case SPET_LPARAM_IS_TOKEN: + { + ULONG ulDataOffset = ULONG(lParam); + hr = SpGetTokenFromId((const WCHAR*)(pTemp + 1), + (ISpObjectToken **)&lParam); + wParam = 0; + } + break; + } + if (cbAlloc) + { + void * pvBuff = ::CoTaskMemAlloc(cbAlloc); + this->lParam = (LPARAM)pvBuff; + if (pvBuff) + { + memcpy(pvBuff, pTemp + 1, cbAlloc); + } + else + { + hr = E_OUTOFMEMORY; + } + } + } + + if (SUCCEEDED(hr) && pcbUsed) + { + // WCE compiler does not work propertly with template +#ifndef _WIN32_WCE + *pcbUsed = SpEventSerializeSize(this); +#else + *pcbUsed = SpEventSerializeSize(this, sizeof(*pTemp)); +#endif + } + return hr; + } + + // + // Helpers for access to events. Performs run-time checks in debug and casts + // data to the appropriate types + // + SPPHONEID Phoneme() const + { + SPDBG_ASSERT(eEventId == SPEI_PHONEME); + return (SPPHONEID)LOWORD(lParam); + } + SPVISEMES Viseme() const + { + SPDBG_ASSERT(eEventId == SPEI_VISEME); + return (SPVISEMES)LOWORD(lParam); + } + ULONG InputWordPos() const + { + SPDBG_ASSERT(eEventId == SPEI_WORD_BOUNDARY); + return ULONG(lParam); + } + ULONG InputWordLen() const + { + SPDBG_ASSERT(eEventId == SPEI_WORD_BOUNDARY); + return ULONG(wParam); + } + ULONG InputSentPos() const + { + SPDBG_ASSERT(eEventId == SPEI_SENTENCE_BOUNDARY); + return ULONG(lParam); + } + ULONG InputSentLen() const + { + SPDBG_ASSERT(eEventId == SPEI_SENTENCE_BOUNDARY); + return ULONG(wParam); + } + ISpObjectToken * ObjectToken() const + { + SPDBG_ASSERT(elParamType == SPET_LPARAM_IS_TOKEN); + return (ISpObjectToken *)lParam; + } + ISpObjectToken * VoiceToken() const // More explicit check than ObjectToken() + { + SPDBG_ASSERT(eEventId == SPEI_VOICE_CHANGE); + return ObjectToken(); + } + BOOL PersistVoiceChange() const + { + SPDBG_ASSERT(eEventId == SPEI_VOICE_CHANGE); + return (BOOL)wParam; + } + IUnknown * Object() const + { + SPDBG_ASSERT(elParamType == SPET_LPARAM_IS_OBJECT); + return (IUnknown*)lParam; + } + ISpRecoResult * RecoResult() const + { + SPDBG_ASSERT(eEventId == SPEI_RECOGNITION || eEventId == SPEI_FALSE_RECOGNITION || eEventId == SPEI_HYPOTHESIS); + return (ISpRecoResult *)Object(); + } + BOOL IsPaused() + { + SPDBG_ASSERT(eEventId == SPEI_RECOGNITION || eEventId == SPEI_SR_BOOKMARK); + return (BOOL)(wParam & SPREF_AutoPause); + } + BOOL IsEmulated() + { + SPDBG_ASSERT(eEventId == SPEI_RECOGNITION); + return (BOOL)(wParam & SPREF_Emulated); + } + const WCHAR * String() const + { + SPDBG_ASSERT(elParamType == SPET_LPARAM_IS_STRING); + return (const WCHAR*)lParam; + } + const WCHAR * BookmarkName() const + { + SPDBG_ASSERT(eEventId == SPEI_TTS_BOOKMARK); + return String(); + } + const WCHAR * RequestTypeOfUI() const + { + SPDBG_ASSERT(eEventId == SPEI_REQUEST_UI); + return String(); + } + SPRECOSTATE RecoState() const + { + SPDBG_ASSERT(eEventId == SPEI_RECO_STATE_CHANGE); + return static_cast(wParam); + } + const WCHAR * PropertyName() const + { + SPDBG_ASSERT((eEventId == SPEI_PROPERTY_NUM_CHANGE && elParamType == SPET_LPARAM_IS_STRING) || + (eEventId == SPEI_PROPERTY_STRING_CHANGE && elParamType == SPET_LPARAM_IS_POINTER)); + // Note: Don't use String() method here since in the case of string attributes, the elParamType + // field specifies LPARAM_IS_POINTER, but the attribute name IS the first string in this buffer + return (const WCHAR*)lParam; + } + const LONG PropertyNumValue() const + { + SPDBG_ASSERT(eEventId == SPEI_PROPERTY_NUM_CHANGE); + return static_cast(wParam); + } + const WCHAR * PropertyStringValue() const + { + // Search for the first NULL and return pointer to the char past it. + SPDBG_ASSERT(eEventId == SPEI_PROPERTY_STRING_CHANGE); + const WCHAR * psz = (const WCHAR *)lParam; // moved this from for init + for (; *psz; psz++) {} + return psz + 1; + } + SPINTERFERENCE Interference() const + { + SPDBG_ASSERT(eEventId == SPEI_INTERFERENCE); + return static_cast(lParam); + } + HRESULT EndStreamResult() const + { + SPDBG_ASSERT(eEventId == SPEI_END_SR_STREAM); + return static_cast(lParam); + } + BOOL InputStreamReleased() const + { + SPDBG_ASSERT(eEventId == SPEI_END_SR_STREAM); + return (wParam & SPESF_STREAM_RELEASED) ? TRUE : FALSE; + } +}; + +class CSpPhrasePtr +{ +public: + SPPHRASE * m_pPhrase; + CSpPhrasePtr() : m_pPhrase(NULL) {} + CSpPhrasePtr(ISpPhrase * pPhraseObj, HRESULT * phr) + { + *phr = pPhraseObj->GetPhrase(&m_pPhrase); + } + ~CSpPhrasePtr() + { + ::CoTaskMemFree(m_pPhrase); + } + //The assert on operator& usually indicates a bug. If this is really + //what is needed, however, take the address of the m_pPhrase member explicitly. + SPPHRASE ** operator&() + { + SPDBG_ASSERT(m_pPhrase == NULL); + return &m_pPhrase; + } + operator SPPHRASE *() const + { + return m_pPhrase; + } + SPPHRASE & operator*() const + { + SPDBG_ASSERT(m_pPhrase); + return *m_pPhrase; + } + SPPHRASE * operator->() const + { + return m_pPhrase; + } + bool operator!() const + { + return (m_pPhrase == NULL); + } + void Clear() + { + if (m_pPhrase) + { + ::CoTaskMemFree(m_pPhrase); + m_pPhrase = NULL; + } + } + HRESULT GetFrom(ISpPhrase * pPhraseObj) + { + Clear(); + return pPhraseObj->GetPhrase(&m_pPhrase); + } +}; + + +template +class CSpCoTaskMemPtr +{ +public: + T * m_pT; + CSpCoTaskMemPtr() : m_pT(NULL) {} + CSpCoTaskMemPtr(void * pv) : m_pT((T *)pv) {} + CSpCoTaskMemPtr(ULONG cElements, HRESULT * phr) + { + m_pT = (T *)::CoTaskMemAlloc(cElements * sizeof(T)); + *phr = m_pT ? S_OK : E_OUTOFMEMORY; + } + ~CSpCoTaskMemPtr() + { + ::CoTaskMemFree(m_pT); + } + void Clear() + { + if (m_pT) + { + ::CoTaskMemFree(m_pT); + m_pT = NULL; + } + } + HRESULT Alloc(ULONG cArrayElements = 1) + { + m_pT = (T *)::CoTaskMemRealloc(m_pT, sizeof(T) * cArrayElements); + SPDBG_ASSERT(m_pT); + return (m_pT ? S_OK : E_OUTOFMEMORY); + } + void Attach(void * pv) + { + Clear(); + m_pT = (T *)pv; + } + T * Detatch() + { + T * pT = m_pT; + m_pT = NULL; + return pT; + } + //The assert on operator& usually indicates a bug. If this is really + //what is needed, however, take the address of the m_pT member explicitly. + T ** operator&() + { + SPDBG_ASSERT(m_pT == NULL); + return &m_pT; + } + T * operator->() + { + SPDBG_ASSERT(m_pT != NULL); + return m_pT; + } + operator T *() + { + return m_pT; + } + bool operator!() const + { + return (m_pT == NULL); + } +}; + +/**** Helper function used to create a new phrase object from an array of +test words. Each word in the string is converted to a phrase element. +This is useful to create a phrase to pass to the EmulateRecognition method. +The method can convert standard words as well as words with the +"/display_text/lexical_form/pronounciation;" word format. +You can also specify the DisplayAttributes for each element if desired. +If prgDispAttribs is NULL then the DisplayAttribs for each element default to +SPAF_ONE_TRAILING_SPACE. ****/ +inline HRESULT CreatePhraseFromWordArray(const WCHAR ** ppWords, ULONG cWords, + SPDISPLYATTRIBUTES * prgDispAttribs, + ISpPhraseBuilder **ppResultPhrase, + LANGID LangId = 0, + CComPtr cpPhoneConv = NULL) +{ + SPDBG_FUNC("CreatePhraseFromWordArray"); + HRESULT hr = S_OK; + + if (cWords == 0 || ppWords == NULL || ::IsBadReadPtr(ppWords, sizeof(*ppWords) * cWords)) + { + return E_INVALIDARG; + } + + if (prgDispAttribs != NULL && ::IsBadReadPtr(prgDispAttribs, sizeof(*prgDispAttribs) * cWords)) + { + return E_INVALIDARG; + } + + ULONG cTotalChars = 0; + ULONG i; + WCHAR** pStringPtrArray = (WCHAR**)::CoTaskMemAlloc(cWords * sizeof(WCHAR *)); + if (!pStringPtrArray) + { + return E_OUTOFMEMORY; + } + for (i = 0; i < cWords; i++) + { + cTotalChars += wcslen(ppWords[i]) + 1; + } + + CSpDynamicString dsText(cTotalChars); + if (dsText.m_psz == NULL) + { + ::CoTaskMemFree(pStringPtrArray); + return E_OUTOFMEMORY; + } + CSpDynamicString dsPhoneId(cTotalChars); + if (dsPhoneId.m_psz == NULL) + { + ::CoTaskMemFree(pStringPtrArray); + return E_OUTOFMEMORY; + } + SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId); // improper casting + + SPPHRASE Phrase; + memset(&Phrase, 0, sizeof(Phrase)); + Phrase.cbSize = sizeof(Phrase); + + if (LangId == 0) + { + LangId = SpGetUserDefaultUILanguage(); + } + + if (cpPhoneConv == NULL) + { + hr = SpCreatePhoneConverter(LangId, NULL, NULL, &cpPhoneConv); + if (FAILED(hr)) + { + ::CoTaskMemFree(pStringPtrArray); + return hr; + } + } + + SPPHRASEELEMENT *pPhraseElement = new SPPHRASEELEMENT[cWords]; + if (pPhraseElement == NULL) + { + ::CoTaskMemFree(pStringPtrArray); + return E_OUTOFMEMORY; + } + memset(pPhraseElement, 0, sizeof(SPPHRASEELEMENT) * cWords); // !!! + + WCHAR * pText = dsText; + for (i = 0; SUCCEEDED(hr) && i < cWords; i++) + { + WCHAR *p = pText; + pStringPtrArray[i] = pText; + wcscpy(pText, ppWords[i]); + pText += wcslen(p) + 1; + + if (*p == L'/') + { + //This is a compound word + WCHAR* pszFirstPart = ++p; + WCHAR* pszSecondPart = NULL; + WCHAR* pszThirdPart = NULL; + + while (*p && *p != L'/') + { + p++; + } + if (*p == L'/') + { + //It means we stop at the second '/' + *p = L'\0'; + pszSecondPart = ++p; + while (*p && *p != L'/') + { + p++; + } + if (*p == L'/') + { + //It means we stop at the third '/' + *p = L'\0'; + pszThirdPart = ++p; + } + } + + pPhraseElement[i].pszDisplayText = pszFirstPart; + pPhraseElement[i].pszLexicalForm = pszSecondPart ? pszSecondPart : pszFirstPart; + + if (pszThirdPart) + { + hr = cpPhoneConv->PhoneToId(pszThirdPart, pphoneId); + if (SUCCEEDED(hr)) + { + pPhraseElement[i].pszPronunciation = pphoneId; + pphoneId += wcslen((const wchar_t *)pphoneId) + 1; // improper casting + } + } + } + else + { + //It is the simple format, only have one form, use it for everything. + pPhraseElement[i].pszDisplayText = NULL; + pPhraseElement[i].pszLexicalForm = p; + pPhraseElement[i].pszPronunciation = NULL; + } + + pPhraseElement[i].bDisplayAttributes = (BYTE)(prgDispAttribs ? prgDispAttribs[i] : SPAF_ONE_TRAILING_SPACE); + pPhraseElement[i].RequiredConfidence = SP_NORMAL_CONFIDENCE; + pPhraseElement[i].ActualConfidence = SP_NORMAL_CONFIDENCE; + } + + Phrase.Rule.ulCountOfElements = cWords; + Phrase.pElements = pPhraseElement; + Phrase.LangID = LangId; + + CComPtr cpPhrase; + if (SUCCEEDED(hr)) + { + hr = cpPhrase.CoCreateInstance(CLSID_SpPhraseBuilder); + } + + if (SUCCEEDED(hr)) + { + hr = cpPhrase->InitFromPhrase(&Phrase); + } + if (SUCCEEDED(hr)) + { + *ppResultPhrase = cpPhrase.Detach(); + } + + delete pPhraseElement; + ::CoTaskMemFree(pStringPtrArray); + + return hr; +} + +/**** Helper function used to create a new phrase object from a +test string. Each word in the string is converted to a phrase element. +This is useful to create a phrase to pass to the EmulateRecognition method. +The method can convert standard words as well as words with the +"/display_text/lexical_form/pronounciation;" word format ****/ +inline HRESULT CreatePhraseFromText(const WCHAR *pszOriginalText, + ISpPhraseBuilder **ppResultPhrase, + LANGID LangId = 0, + CComPtr cpPhoneConv = NULL) +{ + SPDBG_FUNC("CreatePhraseFromText"); + HRESULT hr = S_OK; + + //We first trim the input text + CSpDynamicString dsText(pszOriginalText); + if (dsText.m_psz == NULL) + { + return E_OUTOFMEMORY; + } + dsText.TrimBoth(); + + ULONG cWords = 0; + BOOL fInCompoundword = FALSE; + + // Set first array pointer (if *p). + WCHAR *p = dsText; + while (*p) + { + if (iswspace(*p) && !fInCompoundword) + { + cWords++; + *p++ = L'\0'; + while (*p && iswspace(*p)) + { + *p++ = L'\0'; + } + // Add new array pointer. Use vector. + } + else if (*p == L'/' && !fInCompoundword) + { + fInCompoundword = TRUE; + } + else if (*p == L';' && fInCompoundword) + { + fInCompoundword = FALSE; + *p++ = L'\0'; + // Add new array element. + } + else + { + p++; + } + } + + cWords++; + + WCHAR** pStringPtrArray = (WCHAR**)::CoTaskMemAlloc(cWords * sizeof(WCHAR *)); + if (!pStringPtrArray) + { + hr = E_OUTOFMEMORY; + } + + if (SUCCEEDED(hr)) + { + p = dsText; + for (ULONG i = 0; i +#endif + +#ifndef SPError_h +#include +#endif + +#ifndef SPDebug_h +#include +#endif + +#ifndef SPHelper_h +#include +#endif + +#ifndef __ATLBASE_H__ +#include +#endif + +#ifndef __ATLCONV_H__ +#include +#endif + +/**************************************************************************** +* +* +* +********************************************************************* RAL ***/ + +// +// Dont call this function directly. Use SpInitTokenComboBox or SpInitTokenListBox. +// +inline HRESULT SpInitTokenList(UINT MsgAddString, UINT MsgSetItemData, UINT MsgSetCurSel, + HWND hwnd, const WCHAR * pszCatName, + const WCHAR * pszRequiredAttrib, const WCHAR * pszOptionalAttrib) +{ + HRESULT hr; + ISpObjectToken * pToken; // NOTE: Not a CComPtr! Be Careful. + CComPtr cpEnum; + hr = SpEnumTokens(pszCatName, pszRequiredAttrib, pszOptionalAttrib, &cpEnum); + if (hr == S_OK) + { + bool fSetDefault = false; + while (cpEnum->Next(1, &pToken, NULL) == S_OK) + { + CSpDynamicString dstrDesc; + hr = SpGetDescription(pToken, &dstrDesc); + if (SUCCEEDED(hr)) + { + USES_CONVERSION; + LRESULT i = ::SendMessage(hwnd, MsgAddString, 0, (LPARAM)W2T(dstrDesc)); + if (i == CB_ERR || i == CB_ERRSPACE) // Note: CB_ and LB_ errors are identical values... + { + hr = E_OUTOFMEMORY; + } + else + { + ::SendMessage(hwnd, MsgSetItemData, i, (LPARAM)pToken); + if (!fSetDefault) + { + ::SendMessage(hwnd, MsgSetCurSel, i, 0); + fSetDefault = true; + } + } + } + if (FAILED(hr)) + { + pToken->Release(); + } + } + } + else + { + hr = SPERR_NO_MORE_ITEMS; + } + return hr; +} + +inline HRESULT SpInitTokenComboBox(HWND hwnd, const WCHAR * pszCatName, + const WCHAR * pszRequiredAttrib = NULL, const WCHAR * pszOptionalAttrib = NULL) +{ + return SpInitTokenList(CB_ADDSTRING, CB_SETITEMDATA, CB_SETCURSEL, hwnd, pszCatName, pszRequiredAttrib, pszOptionalAttrib); +} + +inline HRESULT SpInitTokenListBox(HWND hwnd, const WCHAR * pszCatName, + const WCHAR * pszRequiredAttrib = NULL, const WCHAR * pszOptionalAttrib = NULL) +{ + return SpInitTokenList(LB_ADDSTRING, LB_SETITEMDATA, LB_SETCURSEL, hwnd, pszCatName, pszRequiredAttrib, pszOptionalAttrib); +} + +// +// Dont call this function directly. Use SpDestoyTokenComboBox or SpDestroyTokenListBox. +// +inline void SpDestroyTokenList(UINT MsgGetCount, UINT MsgGetItemData, HWND hwnd) +{ + LRESULT c = ::SendMessage(hwnd, MsgGetCount, 0, 0); + for (LRESULT i = 0; i < c; i++) + { + IUnknown * pUnkObj = (IUnknown *)::SendMessage(hwnd, MsgGetItemData, i, 0); + if (pUnkObj) + { + pUnkObj->Release(); + } + } +} + +inline void SpDestroyTokenComboBox(HWND hwnd) +{ + SpDestroyTokenList(CB_GETCOUNT, CB_GETITEMDATA, hwnd); +} + +inline void SpDestroyTokenListBox(HWND hwnd) +{ + SpDestroyTokenList(LB_GETCOUNT, LB_GETITEMDATA, hwnd); +} + + +inline ISpObjectToken * SpGetComboBoxToken(HWND hwnd, WPARAM Index) +{ + return (ISpObjectToken *)::SendMessage(hwnd, CB_GETITEMDATA, Index, 0); +} + +inline ISpObjectToken * SpGetListBoxToken(HWND hwnd, WPARAM Index) +{ + return (ISpObjectToken *)::SendMessage(hwnd, LB_GETITEMDATA, Index, 0); +} + +inline ISpObjectToken * SpGetCurSelComboBoxToken(HWND hwnd) +{ + LRESULT i = ::SendMessage(hwnd, CB_GETCURSEL, 0, 0); + return (i == CB_ERR) ? NULL : SpGetComboBoxToken(hwnd, i); +} + +inline ISpObjectToken * SpGetCurSelListBoxToken(HWND hwnd) +{ + LRESULT i = ::SendMessage(hwnd, LB_GETCURSEL, 0, 0); + return (i == LB_ERR) ? NULL : SpGetListBoxToken(hwnd, i); +} + +// +// Don't call this directly. Use SpUpdateCurSelComboBoxToken or SpUpdateCurSelListBoxToken +// +inline HRESULT SpUpdateCurSelToken(UINT MsgDelString, UINT MsgInsertString, UINT MsgGetItemData, UINT MsgSetItemData, UINT MsgGetCurSel, UINT MsgSetCurSel, + HWND hwnd) +{ + HRESULT hr = S_OK; + LRESULT i = ::SendMessage(hwnd, MsgGetCurSel, 0, 0); + if (i != CB_ERR) + { + ISpObjectToken * pToken = (ISpObjectToken *)::SendMessage(hwnd, MsgGetItemData, i, 0); + CSpDynamicString dstrDesc; + hr = SpGetDescription(pToken, &dstrDesc); + if (SUCCEEDED(hr)) + { + USES_CONVERSION; + ::SendMessage(hwnd, MsgDelString, i, 0); + ::SendMessage(hwnd, MsgInsertString, i, (LPARAM)W2T(dstrDesc)); + ::SendMessage(hwnd, MsgSetItemData, i, (LPARAM)pToken); + ::SendMessage(hwnd, MsgSetCurSel, i, 0); + } + } + return hr; +} + +inline HRESULT SpUpdateCurSelComboBoxToken(HWND hwnd) +{ + return SpUpdateCurSelToken(CB_DELETESTRING, CB_INSERTSTRING, CB_GETITEMDATA, CB_SETITEMDATA, CB_GETCURSEL, CB_SETCURSEL, hwnd); +} + +inline HRESULT SpUpdateCurSelListBoxToken(HWND hwnd) +{ + return SpUpdateCurSelToken(LB_DELETESTRING, LB_INSERTSTRING, LB_GETITEMDATA, LB_SETITEMDATA, LB_GETCURSEL, LB_SETCURSEL, hwnd); +} + +inline HRESULT SpAddTokenToList(UINT MsgAddString, UINT MsgSetItemData, UINT MsgSetCurSel, HWND hwnd, ISpObjectToken * pToken) +{ + CSpDynamicString dstrDesc; + HRESULT hr = SpGetDescription(pToken, &dstrDesc); + if (SUCCEEDED(hr)) + { + USES_CONVERSION; + LRESULT i = ::SendMessage(hwnd, MsgAddString, 0, (LPARAM)W2T(dstrDesc)); + if (i == CB_ERR || i == CB_ERRSPACE) // Note: CB_ and LB_ errors are identical values... + { + hr = E_OUTOFMEMORY; + } + else + { + ::SendMessage(hwnd, MsgSetItemData, i, (LPARAM)pToken); + ::SendMessage(hwnd, MsgSetCurSel, i, 0); + pToken->AddRef(); + } + } + return hr; +} + +inline HRESULT SpAddTokenToComboBox(HWND hwnd, ISpObjectToken * pToken) +{ + return SpAddTokenToList(CB_ADDSTRING, CB_SETITEMDATA, CB_SETCURSEL, hwnd, pToken); +} + +inline HRESULT SpAddTokenToListBox(HWND hwnd, ISpObjectToken * pToken) +{ + return SpAddTokenToList(LB_ADDSTRING, LB_SETITEMDATA, LB_SETCURSEL, hwnd, pToken); +} + + +inline HRESULT SpDeleteCurSelToken(UINT MsgGetCurSel, UINT MsgSetCurSel, UINT MsgGetItemData, UINT MsgDeleteString, HWND hwnd) +{ + HRESULT hr = S_OK; + LRESULT i = ::SendMessage(hwnd, MsgGetCurSel, 0, 0); + if (i == CB_ERR) + { + hr = S_FALSE; + } + else + { + ISpObjectToken * pToken = (ISpObjectToken *)::SendMessage(hwnd, MsgGetItemData, i, 0); + if (pToken) + { + pToken->Release(); + } + ::SendMessage(hwnd, MsgDeleteString, i, 0); + ::SendMessage(hwnd, MsgSetCurSel, i, 0); + } + return hr; +} + +inline HRESULT SpDeleteCurSelComboBoxToken(HWND hwnd) +{ + return SpDeleteCurSelToken(CB_GETCURSEL, CB_SETCURSEL, CB_GETITEMDATA, CB_DELETESTRING, hwnd); +} + +inline HRESULT SpDeleteCurSelListBoxToken(HWND hwnd) +{ + return SpDeleteCurSelToken(LB_GETCURSEL, CB_SETCURSEL, LB_GETITEMDATA, LB_DELETESTRING, hwnd); +} + +#endif /* #ifndef SPUIHelp_h -- This must be the last line in the file */ diff --git a/mp/src/utils/sapi51/Samples/CPP/Common/componentversiondlg.cpp b/mp/src/utils/sapi51/Samples/CPP/Common/componentversiondlg.cpp new file mode 100644 index 00000000..e6355c0b --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Common/componentversiondlg.cpp @@ -0,0 +1,193 @@ +/**************************************************************************** +* ComponentVersionDlg.cpp +* This module contains the implementation details of the +* "Component Version" dialog that may be accessible from all of the +* SAPI SDK samples and tools. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#include "stdafx.h" +#include "SapiSDKCommon.h" +#include "SapiSDKCommonResources.h" + + +/********************************************************************** +* ComponentVersionsDlgProc * +*--------------------------* +* Description: +* The DlgProc for the ComponentVersions dlg. It fills the edit +* control with the version & path info of all the .dll's & .exe's +* that are loaded by the app that is using us. +* +* If you wish to have other .dll's & .exe's included, then just +* add their names to the s_aszModules_c array. The rest happens +* automatically. +* +* Return: +* TRUE if have processed the message +* FALSE otherwise +**********************************************************************/ +LRESULT CALLBACK ComponentVersionsDlgProc( HWND hDlg, UINT uiMessage, WPARAM wParam, LPARAM lParam ) +{ + //--- basic dlg proc switch statement + switch( uiMessage ) + { + case WM_INITDIALOG: + { + //--- this array contains the full list of .dll's & .exe's that we will interogate. + // just add to this list when you want to add another module to the output + static const LPCTSTR s_aszModules_c[] = + { + _T("dictpad.exe"), + _T("reco.exe"), + _T("speak.exe"), + _T("sapi.cpl"), + _T("srsvr.exe"), + _T("ttshello.exe"), + _T("wavtotext.exe"), + _T("wintts.exe"), + _T("sapi.dll"), + _T("spttseng.dll"), + _T("spcwfe.DLL"), + _T("spsreng.DLL"), + _T("spsr.DLL"), + _T("spsrx.DLL"), + _T("gramcomp.dll"), + _T("Lexicon.dll"), + _T("advapi32.DLL"), + _T("atl.DLL"), + _T("comctl32.DLL"), + _T("gdi32.DLL"), + _T("icap.DLL"), + _T("kernel32.DLL"), + _T("lz32.DLL"), + _T("mfc42.DLL"), + _T("mfc42d.DLL"), + _T("mfc42u.DLL"), + _T("mfc42ud.DLL"), + _T("msasm32.DLL"), + _T("msvcrt.DLL"), + _T("msxml.DLL"), + _T("ntdll.DLL"), + _T("ole32.DLL"), + _T("oleaut32.DLL"), + _T("riched32.DLL"), + _T("rpcrt.DLL"), + _T("rpcrt4.DLL"), + _T("shell32.DLL"), + _T("shfolder.DLL"), + _T("shlwapi.DLL"), + _T("user32.DLL"), + _T("urlmon.DLL"), + _T("version.DLL"), + _T("winmm.DLL") + }; + static const int s_iNumModules_c = sizeof( s_aszModules_c ) / sizeof( s_aszModules_c[ 0 ] ); + + TCHAR acFinalBuff[10000]; + acFinalBuff[ 0 ] = L'\0'; + + //--- spin thru all the listed modules to find the ones that are loaded by the current app + for( int i = 0; i < s_iNumModules_c; ++i ) + { + //--- main discovery point - is the current module being used, or not + HMODULE hModule = GetModuleHandle( s_aszModules_c[ i ] ); + if( hModule ) + { + //--- the current module is being used, get it's path + TCHAR acModulePath[ _MAX_PATH ]; + DWORD dwSize = GetModuleFileName( hModule, acModulePath, sizeof( acModulePath ) ); + _ASSERTE( 0 < dwSize ); + + //--- now that we have the file, get the version info size from that file. If the + // size is non-trivial, then the file contains legitimate version info + DWORD dwDummy; + dwSize = GetFileVersionInfoSize( const_cast< LPTSTR >( acModulePath ), &dwDummy ); + TCHAR acBuff[1000]; + if( 0 < dwSize ) + { + //--- real version info exists for the current module - get it + char *pcVersionInfo = new char[ dwSize ]; + _ASSERTE( NULL != pcVersionInfo ); + BOOL fSuccess = GetFileVersionInfo( const_cast< LPTSTR >( acModulePath ), + 0, dwSize, pcVersionInfo ); + _ASSERTE( fSuccess ); + + //--- now convert the version info into something intelligible + VS_FIXEDFILEINFO *pFixedVersionInfo; + UINT uiFixedVersionSize; + fSuccess = VerQueryValue( pcVersionInfo, _T( "\\" ), + reinterpret_cast< LPVOID * >( &pFixedVersionInfo ), + &uiFixedVersionSize ); + _ASSERTE( fSuccess ); + + //--- esnure we have a correct structure version! + _ASSERTE( uiFixedVersionSize == sizeof( VS_FIXEDFILEINFO ) ); + + //--- format the module name, version info & module path all nice and pretty + _stprintf( acBuff, _T( "%-15.15s: %3d.%02d.%02d.%04d %s\r\n" ), + s_aszModules_c[ i ], + HIWORD( pFixedVersionInfo->dwProductVersionMS ), + LOWORD( pFixedVersionInfo->dwProductVersionMS ), + HIWORD( pFixedVersionInfo->dwProductVersionLS ), + LOWORD( pFixedVersionInfo->dwProductVersionLS ), + acModulePath ); + + //--- clean-up + delete [] pcVersionInfo; + } + else + { + //--- no version info, but the module itself, as well as it's path, are still interesting + // to know + _stprintf( acBuff, _T( "%-15.15s: %s\r\n" ), + s_aszModules_c[ i ], + acModulePath ); + } + + //--- accummulate all the info in a single buffer + if( ( _tcslen( acFinalBuff ) + _tcslen( acBuff ) ) < ( sizeof( acFinalBuff ) - 1 ) ) + { + //--- plenty of room + _tcscat( acFinalBuff, acBuff ); + } + else + { + //--- we just escaped a buffer overflow... + _tcscpy( acFinalBuff, _T( "" ) ); + break; + } + } + } + + //--- send the fully populated buffer to the edit control + HWND hEdit = ::GetDlgItem( hDlg, IDC_VERSION_EDIT ); + ::SetWindowText( hEdit, acFinalBuff ); + } + return TRUE; + + case WM_SIZE: + { + //--- as the dlg resizes, have the edit control follow the client area's size + RECT rect; + ::GetClientRect( hDlg, &rect ); + HWND hEdit = ::GetDlgItem( hDlg, IDC_VERSION_EDIT ); + ::SetWindowPos( hEdit, NULL, rect.left, rect.top, + LOWORD(lParam), HIWORD(lParam), SWP_NOZORDER | SWP_NOACTIVATE ); + } + return TRUE; + + case WM_COMMAND: + //--- kill the dialog when we get canceled by the user + if( IDCANCEL == LOWORD( wParam ) ) + { + EndDialog( hDlg, LOWORD( wParam )); + return TRUE; + } + break; + } + + //--- we didn't process this msg, let the default behavior prevail + return FALSE; + +} /* ComponentVersions */ diff --git a/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.h b/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.h new file mode 100644 index 00000000..de23c3b5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.h @@ -0,0 +1,23 @@ +/**************************************************************************** +* SapiSDKCommon.h +* This header is the main entry point for all the utilities & +* sub-features that are common the SAPI samples & tools. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#pragma once + +//--- Includes -------------------------------------------------------------- + +//--- Forward and External Declarations ------------------------------------- + +//--- TypeDef and Enumeration Declarations ---------------------------------- + +//--- Constants ------------------------------------------------------------- + +//--- Class, Struct and Union Definitions ----------------------------------- + +//--- Function Declarations ------------------------------------------------- +LRESULT CALLBACK ComponentVersionsDlgProc( HWND, UINT, WPARAM, LPARAM ); + +//--- Inline Function Definitions ------------------------------------------- diff --git a/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.rc2 b/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.rc2 new file mode 100644 index 00000000..141fc9f5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.rc2 @@ -0,0 +1,17 @@ +/**************************************************************************** +* SapiSDKCommon.rc2 +* This file contains the resource compiler directives for the dialogs +* exposed from the SAPI SDK common directory +* +* Copyright (c) 1999 Microsoft Corporation All Rights Reserved. +*****************************************************************************/ +#include "SapiSDKCommonResources.h" + +IDD_COMPONENT_VERSION_DLG DIALOG DISCARDABLE 0, 0, 354, 228 +STYLE WS_POPUP | WS_CAPTION | WS_MAXIMIZEBOX | WS_SYSMENU | WS_THICKFRAME +CAPTION "Component Versions" +FONT 9, "Courier New" +BEGIN + EDITTEXT IDC_VERSION_EDIT,7,7,340,214,ES_MULTILINE | ES_READONLY | WS_VSCROLL | + WS_HSCROLL +END diff --git a/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommonresources.h b/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommonresources.h new file mode 100644 index 00000000..d3325db7 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommonresources.h @@ -0,0 +1,2 @@ +#define IDC_VERSION_EDIT 10000 +#define IDD_COMPONENT_VERSION_DLG 10001 diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.cpp new file mode 100644 index 00000000..6fb6b57f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.cpp @@ -0,0 +1,705 @@ +/****************************************************************************** +* candidatelist.cpp +* Implementation details for the CCandidateList object which is a +* class that manages the recognized alternatives for dictated +* text. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "candidatelist.h" +#include "dictpad.h" + +// Multi-Language Header File +#include + +#define MAX_ALTS_DISPLAYED 10 + +/***************************************************************************** +* CCandidateList::CCandidateList * +*--------------------------------* +* Description: +* Constructor for the CCandidateList class. +* Modifies the RICHEDIT_CLASS of the main +* application window to use our callback function +* and registers that window class. +*******************************************************************************/ +CCandidateList::CCandidateList( HWND hClient, CRecoEventMgr &rRecoMgr ) : + m_pwcParentClass( NULL ), + m_hMainClientWindow( hClient ), + m_hParent( NULL ), + m_hAltsList( NULL ), + // For now, set the langid to default. + // LangID can be set to something else + // later. + m_langid( ::GetUserDefaultLangID() ), + m_fMakeUIVisible( true ), + m_fPlaybackInProgress( false ), + m_pCurrentDictRun( NULL ), + m_cpTextSel( NULL ), + m_pRecoMgr( &rRecoMgr ), + m_hFont( NULL ), + m_ulNumAltsDisplayed( 0 ) +{ + m_hInst = (HINSTANCE) ::GetWindowLong( m_hMainClientWindow, GWL_HINSTANCE ); + + // Register a window class that is like the rich edit control class in every way + // except that it has space for an extra pointer and calls our wndproc + WNDCLASS wcModifiedRichEdit; + ::GetClassInfo( m_hInst, RICHEDIT_CLASS, &wcModifiedRichEdit ); + + // Bump the space by the size of a pointer + m_cbOffset = wcModifiedRichEdit.cbWndExtra; + int cbExtraSpace = sizeof(CCandidateList *); + wcModifiedRichEdit.cbWndExtra += cbExtraSpace; + + // Change the wndproc, storing the original wndproc + m_wpOrigWndProc = wcModifiedRichEdit.lpfnWndProc; + wcModifiedRichEdit.lpfnWndProc = CandidateUIProc; + + wcModifiedRichEdit.lpszClassName = MODIFIED_RICHEDIT_NAME; + ATOM atomRet = ::RegisterClass( &wcModifiedRichEdit ); + + if ( atomRet ) + { + m_pwcParentClass = new WNDCLASS; + *m_pwcParentClass = wcModifiedRichEdit; + } + + GetFontSettings(); +} /* CCandidateList::CCandidateList */ + +/****************************************************************************** +* CCandidateList::~CCandidateList * +*---------------------------------* +* Description: +* Destructor for the CCandidateListclass +*******************************************************************************/ +CCandidateList::~CCandidateList() +{ + if ( m_pwcParentClass ) + { + delete m_pwcParentClass; + } + + if (m_hFont) + { + DeleteObject(m_hFont); + } + + ::DestroyWindow( m_hButton ); + DoneWithAltsList(); +} /* CCandidateList::~CCandidateList */ + +/****************************************************************************** +* CCandidateList::GetFontSettings * +*---------------------------------* +* Description: +* Gets the font settings for the candidate list UI +*******************************************************************************/ +void CCandidateList::GetFontSettings() +{ + int iHeight = 0; // Will cause CreateFont() to use default in case we + // don't get the height below + HDC hdc = GetDC(m_hMainClientWindow); + HFONT hfontNew = 0; + + // Get the height of the text + if (hdc) + { + TEXTMETRIC tm; + + if (GetTextMetrics(hdc, &tm)) + { + iHeight = tm.tmHeight; + } + + ReleaseDC(m_hMainClientWindow, hdc); + } + + // Pick an appropriate font. On Windows 2000, let the system fontlink. + if (NT5orGreater()) + { + hfontNew = CreateFont(iHeight, 0, 0, 0, FW_NORMAL, 0, 0, 0, + DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + TEXT("Microsoft Sans Serif")); + } + else + { + LCID lcid = MAKELCID( m_langid, SORT_DEFAULT ); + UINT uiCodePage = SpCodePageFromLcid( lcid ); + + CComPtr cpMultiLanguage; + MIMECPINFO MimeCpInfo; + + if ( SUCCEEDED(cpMultiLanguage.CoCreateInstance(CLSID_CMultiLanguage)) + && SUCCEEDED(cpMultiLanguage->GetCodePageInfo(uiCodePage, &MimeCpInfo))) + { + USES_CONVERSION; + + hfontNew = CreateFont(iHeight, 0, 0, 0, FW_NORMAL, 0, 0, 0, + MimeCpInfo.bGDICharset, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + W2T(MimeCpInfo.wszProportionalFont)); + + } + } + + if (hfontNew) + { + if (m_hFont) + { + DeleteObject(m_hFont); + } + + m_hFont = hfontNew; + } +} /* CCandidateList::GetFontSettings */ + +/****************************************************************************** +* CCandidateList::SetParent * +*---------------------------* +* Description: +* Called after the parent window is created. +* Sets the parent window member and creates a button for the +* alternates UI +*******************************************************************************/ +void CCandidateList::SetParent( HWND hParent ) +{ + m_hParent = hParent; + m_hButton = ::CreateWindow( _T("BUTTON"), + _T(""), + WS_CHILD | BS_DEFPUSHBUTTON, + 0, + 0, + BUTTON_WIDTH, + BUTTON_HEIGHT, + m_hParent, + NULL, + m_hInst, + NULL ); +} /* CCandidateList::SetParent */ + +/****************************************************************************** +* CCandidateList::SetLangID * +*---------------------------* +* Description: +* Sets the m_langid and calls GetFontSettings() +*******************************************************************************/ +void CCandidateList::SetLangID( LANGID langid ) +{ + m_langid = langid; + GetFontSettings(); +} /* CCandidateList::SetLangID */ + +/****************************************************************************** +* CCandidateList::Update * +*------------------------* +* Description: +* Called whenever an EN_SELCHANGE notification is received. +* Shows the alternates button if the entire selection is +* dictated text from the same phrase. +* Return: +* If the entire selection is within a single dictated text range, returns +* the handle to the button and shows the button. +* Otherwise returns NULL and hides the button. +********************************************************************************/ +HWND CCandidateList::Update( CTextRunList *pTextRunList ) +{ + // Clicking off the alternates list should dismiss it + if ( m_hAltsList ) + { + DoneWithAltsList(); + } + + m_pCurrentDictRun = NULL; + + ::ShowWindow( m_hButton, SW_HIDE ); + ::InvalidateRect( m_hParent, NULL, true ); + + if ( !m_fMakeUIVisible ) + { + // The button should not be displayed + return NULL; + } + + if ( !m_cpTextSel || !pTextRunList || !m_hParent ) + { + // error + return NULL; + } + + long lStart; + long lEnd; + HRESULT hr = m_cpTextSel->GetStart( &lStart ); + if ( SUCCEEDED( hr ) ) + { + hr = m_cpTextSel->GetEnd( &lEnd ); + } + + // Show the alternates UI only if there is no reco computation + if ( SUCCEEDED( hr ) && m_pRecoMgr && !(m_pRecoMgr->IsProcessingPhrase()) ) + { + PTEXTRUNNODE pNode = pTextRunList->Find( lStart ); + if ( pNode && pNode->pTextRun->IsDict() && + ( lEnd <= pNode->pTextRun->GetEnd() ) ) + { + // The selection is completely contained within this dictated run. + // The button should appear at the lower right-hand + // corner of the selected text + POINT pt; + hr = m_cpTextSel->GetPoint( tomEnd | TA_BASELINE | TA_LEFT, + &(pt.x), &(pt.y) ); + if ( SUCCEEDED( hr ) ) + { + // Move the button to the new location + ::ScreenToClient( m_hParent, &pt ); + ::MoveWindow( m_hButton, pt.x, pt.y, + BUTTON_WIDTH, BUTTON_HEIGHT, true ); + ::ShowWindow( m_hButton, SW_SHOW ); + + // We know that this node contains a dictation run (see above) + m_pCurrentDictRun = + static_cast(pNode->pTextRun); + + return m_hButton; + } + } + } + + // Otherwise, hide the window and return NULL + return NULL; +} /* CCandidateList::Update */ + +/****************************************************************************** +* CCandidateList::ShowAlternates * +*--------------------------------* +* Description: +* Called whenever the alternates button is clicked. +* Hides the alternates button and displays the +* alternates dialog box. +* When the alternates dialog box is done, shows the button again. +********************************************************************************/ +void CCandidateList::ShowAlternates() +{ + _ASSERTE( m_pCurrentDictRun ); + _ASSERTE( m_cpTextSel ); + + // Get the alternates. The text for the alternates + // will have been CoTaskMemAlloced + WCHAR *apszAltsText[ALT_REQUEST_COUNT]; + bool apfFitsInRun[ ALT_REQUEST_COUNT ]; + long lAltStart; + long lAltEnd; + ULONG cAltsReturned = 0; + HRESULT hr = m_pCurrentDictRun->GetAlternatesText( + m_cpTextSel, ALT_REQUEST_COUNT, &lAltStart, &lAltEnd, + apszAltsText, apfFitsInRun, &cAltsReturned ); + + if ( FAILED(hr) ) + { + return; + } + + // Check to make sure that at least one alternate is displayable + bool fDisplayableAlts = false; + for ( ULONG ulAlt = 0; !fDisplayableAlts && (ulAlt < cAltsReturned); ulAlt++ ) + { + fDisplayableAlts = apfFitsInRun[ ulAlt ]; + } + if ( !fDisplayableAlts ) + { + // No alternates to display: Won't be doing anything here + return; + } + + // Hide and disable the alternates button + _ASSERTE( m_hParent ); + BOOL fVisible = ::ShowWindow( m_hButton, SW_HIDE ); + _ASSERTE( fVisible ); + ::EnableWindow( m_hButton, false ); + ::InvalidateRect( m_hParent, NULL, true ); + + // Create a window for the alternates list. + // The alternates list should appear at the lower + // right-hand corner of the text selection + POINT pt; + m_cpTextSel->GetPoint( tomEnd | TA_BASELINE | TA_LEFT, + &(pt.x), &(pt.y) ); + ::ScreenToClient( m_hParent, &pt ); + m_hAltsList = ::CreateWindow( _T("LISTBOX"), + _T(""), + WS_CHILD | WS_DLGFRAME | LBS_OWNERDRAWFIXED | LBS_NOTIFY | WS_VSCROLL, + pt.x, pt.y, // Dimensions will be determined by + // number and width of alternates + 0, 0, + m_hParent, + (HMENU) IDC_LIST_ALTS, + m_hInst, + NULL ); + + // Get the font with which to draw the alternates (this is an + // owner-drawn listbox) + HDC hdc = ::GetDC( m_hAltsList ); + HGDIOBJ hfontOld = m_hFont ? SelectObject(hdc, m_hFont) : 0; + + // Populate the alternates list. + ULONG ulAltIndex; + ULONG ulNumAltsDisplayed = 0; + WCHAR **ppszCoMemText; + SIZE size; + int cxMaxWidth = 0; + for ( ulAltIndex = 0, ppszCoMemText = apszAltsText; + ulAltIndex < cAltsReturned; + ulAltIndex++, ppszCoMemText++ ) + { + if ( !apfFitsInRun[ ulAltIndex ] ) + { + // This alt will not be displayed, since the alt covers elements + // not in this run + continue; + } + + // Keep track of which alternate is going into location + // cAltsListed in the alternates list + m_aulAltIndices[ ulNumAltsDisplayed ] = ulAltIndex; + + // Keep track of the widest alt so far + _ASSERTE( *ppszCoMemText ); + ::GetTextExtentPointW( + hdc, *ppszCoMemText, wcslen( *ppszCoMemText ), &size ); + cxMaxWidth = max( cxMaxWidth, size.cx ); + + // Owner-drawn list box, so the string is stored as item data (as a WCHAR *) + WCHAR *pwszListItem = wcsdup( *ppszCoMemText ); + ::SendMessage( m_hAltsList, LB_INSERTSTRING, ulNumAltsDisplayed, (LPARAM) pwszListItem ); + + ulNumAltsDisplayed++; + } + + // Keep track of how many alternates there are + m_ulNumAltsDisplayed = ulNumAltsDisplayed; + + // Get the old font back + hfontOld ? SelectObject(hdc, hfontOld) : NULL; + ::ReleaseDC( m_hAltsList, hdc ); + + // Bump up the maximum width by the list box border width and the + // vertical scroll bar width if necessary + cxMaxWidth += 2 * GetSystemMetrics( SM_CXDLGFRAME ); + if (ulNumAltsDisplayed > MAX_ALTS_DISPLAYED) + { + cxMaxWidth += GetSystemMetrics( SM_CXVSCROLL ); + } + + // The alternates text was CoTaskMemAlloced, so we must free + // it now + ULONG ul; + for ( ul = 0, ppszCoMemText = apszAltsText; + ul < cAltsReturned; + ul++, ppszCoMemText++ ) + { + if ( *ppszCoMemText ) + { + ::CoTaskMemFree( *ppszCoMemText ); + } + } + + // Resize the window to the correct width + // The alternates list should always go inside the parent window, + // so if the list is too wide, move it to the left. + RECT rectButton; + RECT rectParent; + POINT ptTopLeft; + ::GetWindowRect( m_hButton, &rectButton ); + ::GetWindowRect( m_hParent, &rectParent ); + int cyItemHeight = ::SendMessage( m_hAltsList, LB_GETITEMHEIGHT, 0, 0 ); + int cyHeight = __min(((int) ulNumAltsDisplayed + 1) * cyItemHeight, + (MAX_ALTS_DISPLAYED + 1) * cyItemHeight); + ptTopLeft.x = __min( rectButton.left, rectParent.right - cxMaxWidth ); + ptTopLeft.y = rectButton.top; + ::ScreenToClient( m_hParent, &ptTopLeft ); + ::MoveWindow( m_hAltsList, + ptTopLeft.x, + ptTopLeft.y, + cxMaxWidth, + cyHeight, + true ); + + + // Display the alternates list + ::ShowWindow( m_hAltsList, SW_SHOW ); + + // Highlight the text for the first alternate displayed + MakeTextSelReflectAlt(0); + + ::SetFocus( m_hAltsList ); +} /* CCandidateList::ShowAlternates */ + +/****************************************************************************** +* CCandidateList::ShowButton * +*----------------------------* +* Description: +* Shows/hides the alternates button. +********************************************************************************/ +void CCandidateList::ShowButton( bool bShow ) +{ + ::ShowWindow( m_hButton, bShow ? SW_SHOW : SW_HIDE ); + ::EnableWindow( m_hButton, bShow ); + ::InvalidateRect( m_hParent, NULL, true ); + m_fMakeUIVisible = bShow; +} /* CCandidateList::ShowButton */ + +/****************************************************************************** +* CCandidateList::MakeTextSelReflectAlt * +*---------------------------------------* +* Description: +* Called when an item in the alternates list is selected. +* Adjusts the text selection in order to jive with whichever +* elements that alternate replaces +********************************************************************************/ +void CCandidateList::MakeTextSelReflectAlt( ULONG ulAltIndexInList ) +{ + _ASSERTE( m_pCurrentDictRun ); + _ASSERTE( m_cpTextSel ); + _ASSERTE( ulAltIndexInList < m_ulNumAltsDisplayed ); + + long lSelStart; + long lSelEnd; + + HRESULT hr = m_pCurrentDictRun->GetAltEndpoints( + m_aulAltIndices[ ulAltIndexInList ], &lSelStart, &lSelEnd ); + + if ( SUCCEEDED(hr) ) + { + // The WM_STOPUPDATE message tells Dictpad that there is no + // new text, so it does not need to process this selection change + ::SendMessage( m_hMainClientWindow, WM_STOPUPDATE, 0, 0 ); + m_cpTextSel->SetStart( lSelStart ); + m_cpTextSel->SetEnd( lSelEnd ); + ::SendMessage( m_hMainClientWindow, WM_STARTUPDATE, 0, 0 ); + } +} /* CCandidateList::MakeTextSelReflectAlt */ + +/****************************************************************************** +* CCandidateList::AlternateChosen * +*---------------------------------* +* Description: +* Called when the user selects an alternate from the alternates UI. +* Notifies the appropriate CDictationRun that the alt has been +* chosen and changes the text. +* Dismisses the alternates list, since choosing an alternate means +* the user is done with the alternates list. +********************************************************************************/ +void CCandidateList::AlternateChosen( ULONG ulChosenAltInList ) +{ + _ASSERTE( m_hAltsList ); + _ASSERTE( m_pCurrentDictRun ); + _ASSERTE( m_cpTextSel ); + _ASSERTE( ulChosenAltInList < m_ulNumAltsDisplayed ); + + ::SendMessage( m_hMainClientWindow, WM_STOPUPDATE, 0, 0 ); + HRESULT hr = m_pCurrentDictRun->ChooseAlternate( + m_aulAltIndices[ ulChosenAltInList ] ); + ::SendMessage( m_hMainClientWindow, WM_STARTUPDATE, 0, 0 ); + + // The main window should update the alternates button + ::SendMessage( m_hMainClientWindow, WM_UPDATEALTSBUTTON, 0, 0 ); + + DoneWithAltsList(); +} /* CCandidateList::AlternateChosen */ + +/****************************************************************************** +* CCandidateList::DoneWithAltsList * +*----------------------------------* +* Description: +* Called when the alternates list no longer need be displayed. +* Either the user has chosen an alternate or the user has clicked +* off the list to dismiss it. +********************************************************************************/ +void CCandidateList::DoneWithAltsList() +{ + if ( !m_hAltsList ) + { + return; + } + + int cItems = ::SendMessage( m_hAltsList, LB_GETCOUNT, 0, 0 ); + for ( int i = 0; i < cItems; i++ ) + { + // Free the memory used for the strings in the list box + WCHAR *pwszListItem = (WCHAR *) ::SendMessage( + m_hAltsList, LB_GETITEMDATA, i, 0 ); + if ( pwszListItem ) + { + free( pwszListItem ); + ::SendMessage( m_hAltsList, LB_SETITEMDATA, i, NULL ); + } + } + + m_ulNumAltsDisplayed = 0; + + ::DestroyWindow( m_hAltsList ); + m_hAltsList = 0; + m_pCurrentDictRun = NULL; + + // Bring the button back + ::EnableWindow( m_hButton, true ); +} /* CCandidateList::DoneWithAltsList */ + +/****************************************************************************** +* CandidateUIProc() * +*-------------------* +* Description: +* Subclassing procedure for the richedit control so that it can process +* messages from the candidate list UI. +*******************************************************************************/ +LRESULT APIENTRY CandidateUIProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + static int cbOffset = 0; // Where the data to be used by this + // wndproc starts + // The window long points to the associated instance of the candidate list UI + CCandidateList *pCandidateList = + ( CCandidateList * ) ::GetWindowLong( hWnd, cbOffset ); + + switch( message ) + { + case WM_NCCREATE: + { + // lParam points to a CREATESTRUCT with the CCandidateList * object + // as its lpCreateParams + pCandidateList = (CCandidateList *) + ((LPCREATESTRUCT) lParam)->lpCreateParams; + + // Get the class info and find the offset that will give us + // the very end of the extra space + WNDCLASS wc; + TCHAR pszClassName[ MAX_CLASS_NAME ]; + ::GetClassName( hWnd, pszClassName, MAX_CLASS_NAME ); + ::GetClassInfo( (HINSTANCE) ::GetWindowLong( hWnd, GWL_HINSTANCE ), + pszClassName, &wc ); + _ASSERTE( wc.cbWndExtra >= sizeof( CCandidateList *) ); + if ( wc.cbWndExtra < sizeof( CCandidateList * ) ) + { + // No space for the CCandidateList * in the window long + return -1; + } + cbOffset = wc.cbWndExtra - sizeof( CCandidateList *); + + // Set the window long + ::SetWindowLong( hWnd, cbOffset, (long) pCandidateList ); + + // Tell the candidate list about the parent window + pCandidateList->SetParent( hWnd ); + + break; + } + + case WM_KEYDOWN: + case WM_CHAR: + // Ignore keystrokes as a recognition is being processed + if ( pCandidateList->m_pRecoMgr->IsProcessingPhrase() + || ( pCandidateList->IsPlaybackInProgress() && ( VK_ESCAPE != wParam )) ) + { + // Dropping these messages + return 0; + } + break; + + case WM_IME_STARTCOMPOSITION: + if ( pCandidateList->m_pRecoMgr->IsProcessingPhrase() + || ( pCandidateList->IsPlaybackInProgress() && ( VK_ESCAPE != wParam )) ) + { + HIMC himc = ::ImmGetContext( hWnd ); + ::ImmNotifyIME( himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 ); + } + break; + + case WM_COMMAND: + switch ( HIWORD( wParam ) ) + { + case BN_CLICKED: + // Clicking on the alternates button + pCandidateList->ShowAlternates(); + break; + + case LBN_SELCHANGE: + // Selecting a different alternate in the alternates list + pCandidateList->MakeTextSelReflectAlt( + ::SendMessage( pCandidateList->m_hAltsList, LB_GETCURSEL, 0, 0 ) ); + break; + + case LBN_DBLCLK: + // Choosing an alternate + pCandidateList->AlternateChosen( + ::SendMessage( pCandidateList->m_hAltsList, LB_GETCURSEL, 0, 0 ) ); + break; + + case LBN_SETFOCUS: + // When the alternates list first appears, we give it the input + // focus. The first alternate should start out selected + ::SendMessage( pCandidateList->m_hAltsList, LB_SETCURSEL, 0, 0 ); + break; + + default: + break; + } + break; + + case WM_DRAWITEM: + // Since we have an owner-draw list box we need to process this + // message + if (wParam == IDC_LIST_ALTS) + { + LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam; + + HGDIOBJ hfontOld = pCandidateList->m_hFont ? + SelectObject( pdis->hDC, pCandidateList->m_hFont ) : NULL; + UINT oldTextAlign = GetTextAlign(pdis->hDC); + + UINT options = ETO_OPAQUE | ETO_CLIPPED; + + // Strings are stored as item data + HWND hwndList = pCandidateList->m_hAltsList; + WCHAR *pwszItemText = (WCHAR *) ::SendMessage( hwndList, + LB_GETITEMDATA, pdis->itemID, 0 ); + + int cStringLen = wcslen( pwszItemText ); + + SetTextAlign(pdis->hDC, TA_UPDATECP); + MoveToEx(pdis->hDC, pdis->rcItem.left, pdis->rcItem.top, NULL); + ExtTextOutW(pdis->hDC, + pdis->rcItem.left, pdis->rcItem.top, + options, + &pdis->rcItem, + pwszItemText, + cStringLen, + NULL); + + + SetTextAlign(pdis->hDC, oldTextAlign); + + if (hfontOld) + { + SelectObject(pdis->hDC, hfontOld); + } + } + break; + + default: + break; + + } + + // Call the original WndProc + return ::CallWindowProc( pCandidateList->m_wpOrigWndProc, + hWnd, message, wParam, lParam ); +} /* CandidateUIProc */ + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.h new file mode 100644 index 00000000..c3ad013f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.h @@ -0,0 +1,108 @@ +/**************************************************************************** +* candidatelist.h +* This module contains the definition support for CCandidateList, +* the candidate list UI for Dictpad +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#ifndef __CANDIDATELIST_H +#define __CANDIDATELIST_H +#pragma once + +#include +#include +#include "resource.h" +#include "sapi.h" +#include "TextRunList.h" +#include "recomgr.h" + +#define BUTTON_WIDTH 16 +#define BUTTON_HEIGHT 16 +#define MODIFIED_RICHEDIT_NAME _T("modified_richedit") +#define MAX_CLASS_NAME 50 + + +/**************************************************************************** +* CCandidateList +* Handles the UI for the alternate list +*****************************************************************************/ +class CCandidateList +{ +public: + CCandidateList( HWND hClient, CRecoEventMgr &rRecoMgr ); + ~CCandidateList(); + + void GetFontSettings(); + + const WNDCLASS *GetParentClass() + { return m_pwcParentClass; } + void SetParent( HWND hParent ); + void SetTextSel( ITextSelection *pTextSel ) + { m_cpTextSel = pTextSel; } + void SetLangID( LANGID langid ); + + HWND Update( CTextRunList *pTextRunList ); + void ShowButton( bool fShow ); + + void StartPlayback() {m_fPlaybackInProgress = true;}; + void EndPlayback() {m_fPlaybackInProgress = false;}; + bool IsPlaybackInProgress() { return m_fPlaybackInProgress; }; + + friend LRESULT APIENTRY CandidateUIProc( + HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + + bool FHasAlternates() { return (m_pCurrentDictRun != NULL) && (m_cpTextSel != NULL); }; + +private: + void ShowAlternates(); + void MakeTextSelReflectAlt( ULONG ulAltIndexInList ); + void AlternateChosen( ULONG ulChosenAltInList ); + void DoneWithAltsList(); + +// Data members + + WNDCLASS *m_pwcParentClass; // The window class registered by the + // call to the constructor for a candidate list + // (a modified RichEdit control). + // The parent window will belong to this window class. + HINSTANCE m_hInst; + HWND m_hMainClientWindow;// Main application window + HWND m_hParent; // Parent window of the UI (richedit control) + int m_cbOffset; // Offset of the extra space in the parent window + WNDPROC m_wpOrigWndProc; // The wndproc of the parent window that will be + // subclassed + HWND m_hButton; // The button that triggers the alternates UI + HWND m_hAltsList; // Handle to the alternates list + LANGID m_langid; // Language of dictation + HFONT m_hFont; // Font for the owner-drawn alternates listbox + bool m_fMakeUIVisible; // If false, button and list not shown + bool m_fPlaybackInProgress; + // If true, richedit window needs to ignore keystrokes + + CDictationRun *m_pCurrentDictRun; + // The last dictation run that the alternates button + // corresponded to + + CComPtr m_cpTextSel; + CRecoEventMgr *m_pRecoMgr; + ULONG m_aulAltIndices[ ALT_REQUEST_COUNT ]; + ULONG m_ulNumAltsDisplayed; + // A map from indices in the list to alternate indices +}; + +// Subclassing wndproc for the richedit control (parent window of the candidate UI +LRESULT APIENTRY CandidateUIProc( + HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + +// Helper function for locale and font settings +inline BOOL NT5orGreater() +{ + DWORD dwVersion = GetVersion(); + + return !(dwVersion & 0x80000000) && LOBYTE(LOWORD(dwVersion)) >= 5; +} + + + +#endif // __CANDIDATELIST_H \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_cmdmode.xml b/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_cmdmode.xml new file mode 100644 index 00000000..c4361b43 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_cmdmode.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +

scroll

+

move

+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+ + + + + +

page

+

pages

+

line

+

lines

+

paragraph

+

paragraphs

+
+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+

+ +

+ +

page

+

line

+

paragraph

+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+

+ +
+ + + +

+ +

+

+

+ +

+ + + +

+
+
+ + + + +

go home

+

scroll home

+

go end

+

scroll end

+

?move left

+

scroll left

+

?move right

+

scroll right

+

word left

+

word right

+

?line end

+

?line home

+

?line start

+

?line beginning

+
+
+ + + + +

file

+

new

+

open

+

save

+

save as

+

exit

+

edit

+

cut

+

copy

+

paste

+

voice

+

listen for dictation

+

?start dictation

+

start dictating

+

end ?of command mode

+

listen for command

+

listen for commands

+

stop dictation

+

end ?of dictation

+

stop dictating

+

?turn microphone off

+

?turn mike off

+

close microphone

+

microphone on

+

grammars active

+

grammars inactive

+

activate grammars

+

deactivate grammars

+

play

+

play back

+

add ?and delete word

+

select whole word

+

select whole words

+

shared engine

+

shared recognition engine

+

shared reco engine

+

?voice training

+

microphone setup

+

help

+

about

+

cancel

+

escape

+
+
+ + + + +

twenty

+

thirty

+

forty

+

fifty

+

sixty

+

seventy

+

eighty

+

ninety

+
+
+ + + +

one

+

two

+

three

+

four

+

five

+

six

+

seven

+

eight

+

nine

+
+
+ + + +

+ +

+ +

zero

+

ten

+

eleven

+

twelve

+

thirteen

+

fourteen

+

fifteen

+

sixteen

+

seventeen

+

eighteen

+

nineteen

+
+
+
+ + +
diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictmode.xml b/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictmode.xml new file mode 100644 index 00000000..05d6c493 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictmode.xml @@ -0,0 +1,15 @@ + + + + + + + + + +

command

+

computer

+
+
+ +
diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictpad.rc b/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictpad.rc new file mode 100644 index 00000000..576630e8 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictpad.rc @@ -0,0 +1,137 @@ +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_DICTPAD MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "E&xit\tCtrl+X", IDM_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Voice" + BEGIN + MENUITEM "Listen for &Dictation", IDM_DICTATION_MODE, CHECKED + MENUITEM "Listen for &Commands", IDM_COMMAND_MODE + MENUITEM "&Grammars active\tCtrl+M", IDM_MIC_TOGGLE + MENUITEM "Play&back\tCtrl+P", IDM_PLAY + MENUITEM SEPARATOR + MENUITEM "&Add/Delete Word(s)...", IDM_ADDREMOVEWORDS + MENUITEM SEPARATOR + MENUITEM "Select &Whole Words", IDM_WHOLE_WORDS, CHECKED + MENUITEM "S&hared recognition engine", IDM_SHAREDENGINE + MENUITEM SEPARATOR + MENUITEM "&Voice Training...", IDM_VOICE_TRAINING + MENUITEM "Micro&phone Setup...", IDM_MICROPHONE_SETUP + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_DICTPAD ACCELERATORS MOVEABLE PURE +BEGIN + "/", IDM_ABOUT, ASCII, ALT, NOINVERT + "?", IDM_ABOUT, ASCII, ALT, NOINVERT + "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "C", IDM_COMMAND_MODE, VIRTKEY, ALT, NOINVERT + "D", IDM_DICTATION_MODE, VIRTKEY, ALT, NOINVERT + "M", IDM_MIC_TOGGLE, VIRTKEY, CONTROL, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_PLAY, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 113 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_DICTPAD,IDC_MYICON,14,9,20,20 + LTEXT "DictPad Version",IDC_STATIC,49,10,58,8,SS_NOPREFIX + LTEXT "(c) 2001 Microsoft Corporation. All rights reserved.", + IDC_STATIC,49,20,177,11 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP + LTEXT "",IDC_ABOUT_DICTPAD_VERSION,107,10,79,8 + PUSHBUTTON "Components",IDC_ABOUT_COMPONENTS,176,54,49,11,NOT + WS_VISIBLE +END + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_COMMAND_MODE_CFG SRGRAMMAR DISCARDABLE "chs_cmdmode.cfg" +IDR_DICTATION_MODE_CFG SRGRAMMAR DISCARDABLE "chs_dictmode.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Dictpad" + IDC_DICTPAD "DICTPAD" + IDM_PLAY "Play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_FONT "Allow selection of a different font " + IDM_DICTATION_MODE "Dictation" + IDM_COMMAND_MODE "Command" + IDS_WAITING "..." + IDS_INVALIDFILEFORMAT "Invalid file format" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_MIC_TOGGLE "Grammars active/inactive" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CANNOTOPEN "This file cannot be opened by Dictpad" + IDS_ERRORSAVING "Dictpad encountered an error while saving to this file" + IDS_CANNOTSAVE "Error saving to file" + IDS_CONFIRMCLOSE "The text of this file has changed since the last save. Do you wish to save this file?" + IDS_MICROPHONESETUPWIZARD "Microphone Setup Wizard" + IDS_ACCESSDENIED "Cannot save to file: Access denied." + IDS_CANNOTSWITCHMODES "Error switching modes" + IDS_CANNOTFILENEW "A new file could not be opened." + IDS_UPDATEERROR "An error occurred updating the Dictpad document. Dictpad will now exit." + IDS_UNSUPPORTEDLANG "Error: The language of the engine is unsupported" +END + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/cmdmode.xml b/mp/src/utils/sapi51/Samples/CPP/DictPad/cmdmode.xml new file mode 100644 index 00000000..03ff4414 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/cmdmode.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +

scroll

+

move

+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+ + + + + +

page

+

pages

+

line

+

lines

+

paragraph

+

paragraphs

+
+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+

+ +

+ +

page

+

line

+

paragraph

+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+

+ +
+ + + +

+ +

+

+

+ +

+ + + +

+
+
+ + + + +

go home

+

scroll home

+

go end

+

scroll end

+

?move left

+

scroll left

+

?move right

+

scroll right

+

word left

+

word right

+

?line end

+

?line home

+

?line start

+

?line beginning

+
+
+ + + + +

file

+

new

+

open

+

save

+

save as

+

exit

+

edit

+

cut

+

copy

+

paste

+

voice

+

listen for dictation

+

?start dictation

+

start dictating

+

end ?of command mode

+

listen for command

+

listen for commands

+

stop dictation

+

end ?of dictation

+

stop dictating

+

?turn microphone off

+

?turn mike off

+

close microphone

+

microphone on

+

grammars active

+

grammars inactive

+

activate grammars

+

deactivate grammars

+

play

+

play back

+

add ?and delete word

+

select whole word

+

select whole words

+

shared engine

+

shared recognition engine

+

shared reco engine

+

?voice training

+

microphone setup

+

help

+

about

+

cancel

+

escape

+
+
+ + + + +

twenty

+

thirty

+

forty

+

fifty

+

sixty

+

seventy

+

eighty

+

ninety

+
+
+ + + +

one

+

two

+

three

+

four

+

five

+

six

+

seven

+

eight

+

nine

+
+
+ + + +

+ +

+ +

zero

+

ten

+

eleven

+

twelve

+

thirteen

+

fourteen

+

fifteen

+

sixteen

+

seventeen

+

eighteen

+

nineteen

+
+
+
+ + +
diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.cpp new file mode 100644 index 00000000..042c91ff --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.cpp @@ -0,0 +1,2060 @@ +/****************************************************************************** +* DictationRun.cpp +* This module contains the implementation details of the CDictationRun +* class which handles the dictation-specfic issues for a dictation +* text run. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "DictationRun.h" + +/****************************************************************************** +* CDictationRun::CDictationRun * +*------------------------------* +* Description: +* Constructor. +* +* Return: +* +******************************************************************************/ +CDictationRun::CDictationRun() : m_ulStartElement( 0 ), + m_cElements( 0 ), + m_fAltsGotten( false ), + m_pPhraseReplacement( NULL ), + m_pulElementOffsets( NULL ), + m_pResultContainer( NULL ) +{} /* CDictationRun::CDictationRun */ + +/****************************************************************************** +* CDictationRun::~CDictationRun * +*-------------------------------* +* Description: +* Destructor. +* +* Return: +* +******************************************************************************/ +CDictationRun::~CDictationRun( void ) +{ + // See CDictationRun::SetTextRange(), where this is allocated + delete[] m_pulElementOffsets; + + // Tell the result object (which might be shared with other DictationRuns) + // that we no longer need it. + if ( m_pResultContainer ) + { + m_pResultContainer->DeleteOwner( *this ); + } + + // The CPhraseReplacement object is going to need to stay around + // for as long as the CResultContainer does; thus when all + // CDictationRuns depending on this result object are deleted, + // the associated CPhraseReplacement object will also be deleted. + +} /* CDictationRun::~CDictationRun */ + +/****************************************************************************** +* CDictationRun::Initialize * +*---------------------------* +* Description: +* Constructor. +* This is the initialization routine that is called when a DictationRun +* is being created from scratch, either from a serialized DictationRun +* (if the optional param pDictHdr is NULL) or from newly-dictated text. +* Initializes the phrase element information and sets up the +* phrase data. +* +* Return: +* S_OK +* E_OUTOFMEMORY +* Return value of CPhraseReplacement::Initialize() +******************************************************************************/ +HRESULT CDictationRun::Initialize( ISpRecoResult &rRecoResult, DICTHEADER *pDictHdr ) +{ + // Get the phrase element information from the serialized header, if available + if ( pDictHdr ) + { + m_ulStartElement = pDictHdr->ulStartElement; + m_cElements = pDictHdr->cElements; + } + + // If this is a new DictationRun (not recreated from a serialized DictationRun), + // the element count will get properly initialized + // when the text range is set. + + // Create and initialize the phrase replacement info + m_pPhraseReplacement = new CPhraseReplacement(); + if ( !m_pPhraseReplacement ) + { + return E_OUTOFMEMORY; + } + HRESULT hr = m_pPhraseReplacement->Initialize( rRecoResult ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Create a CResultContainer to hold the result object + m_pResultContainer = new CResultContainer( rRecoResult, *this, + *m_pPhraseReplacement ); + if ( !m_pResultContainer ) + { + return E_OUTOFMEMORY; + } + + return S_OK; + +} /* CDictationRun::Initialize */ + +/****************************************************************************** +* CDictationRun::Initialize * +*---------------------------* +* Description: +* Constructor. +* This is the initialization routine that is called when a DictationRun +* is being created from the contents of another DictationRun +* (i.e. a DictationRun is being split). +* All of the phrase information is already contained in the +* CResultContainer. +* +* Return: +* S_OK +******************************************************************************/ +HRESULT CDictationRun::Initialize( CResultContainer &rResultContainer ) +{ + // Get the phrase element and result object information from the + // CResultContainer + m_pResultContainer = &rResultContainer; + m_pPhraseReplacement = rResultContainer.GetPhraseReplacement(); + + // The caller needs to call rResultContainer.AddOwner(). + + return S_OK; +} /* CDictationRun::Initialize */ + +/****************************************************************************** +* CDictationRun::SetTextRange * +*-----------------------------* +* Description: +* Stores the ITextRange * for this run. +* Creates the array of element offsets and initializes +* the entries. +* The two cases in which this function can be called are +* * New DictationRun, in which presumably all of +* the elements will be found +* * A DictationRun formed by being split off an old +* DictationRun, in which case not all of the elements +* will be present +* Return: +* S_OK +* E_POINTER +* E_OUTOFMEMORY +* Return value of ITextRange::FindTextStart() +******************************************************************************/ +HRESULT CDictationRun::SetTextRange( ITextRange *pTextRange ) +{ + if ( !pTextRange ) + { + return E_POINTER; + } + m_cpTextRange = pTextRange; + + if ( !m_pPhraseReplacement || !m_pResultContainer ) + { + return E_OUTOFMEMORY; + } + + // If we do not already know how many phrase elements we have, then + // this is a new run, so get it from the phrase replacement object + if ( !m_cElements ) + { + m_cElements = m_pPhraseReplacement->GetNumReplacementElements(); + } + + // Allocate enough space in our element offsets to hold information + // for all the elements. + // Each entry in this array will indicate where the given element + // starts (given as an offset from the start of the range) + m_pulElementOffsets = + new ULONG[ m_pPhraseReplacement->GetNumReplacementElements() ]; + if ( !m_pulElementOffsets ) + { + return E_OUTOFMEMORY; + } + + // Fill the array with an impossible value, right now the length of + // this range (since nothing can have an offset tha big) + const ULONG ulBogusVal = GetEnd() - GetStart(); + ULONG ulElement; + for ( ulElement = 0; + ulElement < m_pPhraseReplacement->GetNumReplacementElements(); + ulElement++ ) + { + m_pulElementOffsets[ ulElement ] = ulBogusVal; + } + + // Loop through the elements finding the character offset in the range + // for each one, if it is there. + // We will use a duplicate ITextRange and ITextRange::FindTextStart() + BSTR bstrElement; + long lStart = GetStart(); + long lElementStart; + CComPtr cpRangeDup; + HRESULT hr = pTextRange->GetDuplicate( &cpRangeDup ); + if ( !cpRangeDup ) + { + return E_OUTOFMEMORY; + } + for ( ulElement = 0; + SUCCEEDED( hr ) && + ( ulElement < m_pPhraseReplacement->GetNumReplacementElements() ); + ulElement++ ) + { + // Get the element text + BYTE bDisplayAttributes; + bstrElement = ::SysAllocString( + m_pPhraseReplacement->GetDisplayText( ulElement, &bDisplayAttributes ) ); + if ( !bstrElement ) + { + return E_OUTOFMEMORY; + } + + // Look for the element. + long lLength; + hr = cpRangeDup->FindTextStart( bstrElement, 0, 0, &lLength ); + + ::SysFreeString( bstrElement ); + + if ( lLength ) + { + // The element was found in cpRangeDup + + // The start of the cpRangeDup is now the start of the element + cpRangeDup->GetStart( &lElementStart ); + + // Give the offset relative to the start of the range + m_pulElementOffsets[ulElement] = lElementStart - lStart; + + // Advance the start past this word + cpRangeDup->MoveStart( tomCharacter, lLength, NULL ); + } + } + + return hr; +} /* CDictationRun::SetTextRange */ + +/********************************************************************** +* CDictationRun::Split * +*----------------------* +* Description: +* Splits up a DictationRun so that this text run now ends at +* lFirstEnd and a second dictation run (*ppTextRun) begins at +* lSecondBegin. +* "This" will now be a shorter range (it will end sooner), +* and *ppTextRun will point to the new text run for which +* space will be allocated here. +* In general, the phrase element information for the two +* DictationRuns will NOT be correct after exiting this +* function. The caller must call CorrectPhraseElementsAndRange +* to ensure that the phrase element information correctly reflects +* the new range, which it in general will not after this function. +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG: *plFirstEnd, *plSecondBegin out of bounds or +* in the wrong order +* E_OUTOFMEMORY +* Return value of CDictationRun::Initialize() +* Return value of ITextDocument::Range() +* Return value of CResultContainer::AddOwner() +**********************************************************************/ +HRESULT CDictationRun::Split( long *plFirstEnd, + long *plSecondBegin, + ITextDocument *cpTextDoc, + CTextRun **ppTextRun ) +{ + if ( !plFirstEnd || !plSecondBegin || !cpTextDoc || !ppTextRun ) + { + return E_POINTER; + } + if ( !m_cpTextRange || !m_pResultContainer ) + { + return E_UNEXPECTED; + } + + long lFirstEnd = *plFirstEnd; + long lSecondBegin = *plSecondBegin; + + if ( !WithinRange( lFirstEnd ) || (lFirstEnd > lSecondBegin) ) + { + // Cannot split somewhere that is not in the range + return E_INVALIDARG; + } + + if ( (GetStart() == lSecondBegin) || (GetEnd() == lFirstEnd) || + (lSecondBegin > GetEnd()) ) + { + // Don't need to do anything, since we are trying to split on a + // run boundary + *ppTextRun = NULL; + return S_OK; + } + + // Create a new dictation run to hold the text from lSecondBegin until + // the end of the original range. + // We create this new DictationRun off the same result object + // in m_pResultContainer + *ppTextRun = new CDictationRun(); + CDictationRun *pDictRun = (CDictationRun *) *ppTextRun; + if ( !pDictRun ) + { + return E_OUTOFMEMORY; + } + HRESULT hr = pDictRun->Initialize( *m_pResultContainer ); + if ( FAILED( hr ) ) + { + return hr; + } + + // This DictationRun should be on the owner list for this result container + hr = m_pResultContainer->AddOwner( *pDictRun ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Adjust the latter range so that it starts at lSecondBegin + // and ends where "this" used to end + long lEnd = GetEnd(); + CComPtr cpLatterRange; + hr = cpTextDoc->Range( lSecondBegin, lEnd, &cpLatterRange ); + if ( FAILED( hr ) ) + { + return hr; + } + hr = pDictRun->SetTextRange( cpLatterRange ); + + // Adjust the range of "this" so that it ends at lFirstEnd + m_cpTextRange->SetEnd( lFirstEnd ); + + // Just copy over the phrase element information, which will + // in general be incorrect until we call CorrectPhraseEltsAndRange() + pDictRun->m_ulStartElement = m_ulStartElement; + pDictRun->m_cElements = m_cElements; + + return hr; + +} /* CDictationRun::Split */ + +/********************************************************************** +* CDictationRun::Concatenate * +*----------------------------* +* Description: +* If bConcatenateAfter is true, pTextRun's range is appended +* to "this"'s range; else it is prepended. +* Concatenation happens according to the following rules: +* * If pTextRun is a DictationRun that refers to the same +* result object as "this" and its phrase elements adjoin +* ours, then concatenation is possible. +* * If pTextRun is a plain TextRun, then we try +* concatenating the whole thing on and seeing if +* some of that text can be appropriated as phrase elements +* Return: +* E_NOMERGE if no merging was possible +* E_PARTIALMERGE if some but not all of pTextRun's range +* could be appropriated by this +* E_FULLMERGE if all of pTextRun's range was appropriated +* E_LESSTEXT if by joining pText onto "this", we reduce +* the number of phrase elements that "this" has +* (e.g. pTextRun's text runs onto the end of "this"'s +* last phrase element, thus making that last word no +* longer a true phrase element) +***********************************************************************/ +MERGERESULT CDictationRun::Concatenate( CTextRun *pTextRun, + bool fConcatAfter ) +{ + // Validate params + if ( !pTextRun || !m_cpTextRange || !m_pResultContainer ) + { + _ASSERTE( false ); + return E_NOMERGE; + } + + // Check that the runs are indeed adjacent in the text + if (( fConcatAfter && ( GetEnd() != pTextRun->GetStart() ) ) || + ( !fConcatAfter && ( GetStart() != pTextRun->GetEnd() ) )) + { + // Non-consecutive runs can't be concatenated + _ASSERTE( false ); + return E_NOMERGE; + } + + if ( pTextRun->IsDict() ) + { + // pTextRun is a dictation run. + // This merge is easy to do: Check that the two DictationRuns + // share the same result object, then check if e.g. the + // first one has elements 2 through 4 and the second one + // has elements 5 through 8. + + // We know this is a DictationRun so do the cast + CDictationRun *pDictRun = (CDictationRun *) pTextRun; + + // Check to see if the result objects are the same (if they + // are then they'll point to the same CResultContainer + if ( pDictRun->m_pResultContainer != m_pResultContainer ) + { + // Dictation runs with different result objects + // cannot be concatenated + return E_NOMERGE; + } + + // See if phrase elements are consecutive + if ( fConcatAfter ) + { + // pDictRun's elements need to follow "this"'s + + if ( (m_ulStartElement + m_cElements) == + pDictRun->m_ulStartElement ) + { + // These can be merged, since pDictRun picks + // up where we leave off + + // Store the start indices so that we can update + // the element offsets + long lThisStart = GetStart(); + long lDictRunStart = pDictRun->GetStart(); + + // Adjust the ranges so that "this" contains + // all of pDictRun's text and so that + // pDictRun will be degenerate + SetEnd( pDictRun->GetEnd() ); + pDictRun->SetStart( pDictRun->GetEnd() ); + + // Update the element offsets for the new elements introduced by + // pDictRun. + // We will need to update every element accounted for + // by pDictRun to be relative to the start of this run rather + // than the start of pDictRun + for ( ULONG ulElement = pDictRun->m_ulStartElement; + ulElement < (pDictRun->m_ulStartElement + pDictRun->m_cElements); + ulElement++ ) + { + // Shift the offset of the new element. + // Add lDictRunStart to get an absolute offset (within the document), + // then subtract lThisStart for an offset relative to "this" + m_pulElementOffsets[ulElement] = + pDictRun->m_pulElementOffsets[ulElement] + + lDictRunStart - lThisStart; + } + + // Adjust the phrase element info so that "this" contains all of + // pDictRun's phrase elements + m_cElements += pDictRun->m_cElements; + + // pDictRun should now contain no elements + pDictRun->m_ulStartElement = m_ulStartElement + m_cElements; + pDictRun->m_cElements = 0; + + return E_FULLMERGE; + } + } + else + { + // Same as above, just in the opposite direction. + // Here pDictRun is being prepended to this run. + + if ( m_ulStartElement == + (pDictRun->m_ulStartElement + pDictRun->m_cElements) ) + { + // Store the start indices so that we can update + // the element offsets + long lThisStart = GetStart(); + long lDictRunStart = pDictRun->GetStart(); + + // Adjust the ranges so that "this" contains + // all of pDictRun's text and so that + // pDictRun will be degenerate + SetStart( pDictRun->GetStart() ); + pDictRun->SetEnd( pDictRun->GetStart() ); + + // Update the element offsets for the new elements introduced by + // pDictRun. + // The offsets in pDictRun are correct, since they are relative + // to the earlier start. + // The offsets for "this" need to be updated + ULONG ulElement; + for ( ulElement = pDictRun->m_ulStartElement; + ulElement < + (pDictRun->m_ulStartElement + pDictRun->m_cElements); + ulElement++ ) + { + // Copy over element offsets from pDictRun + m_pulElementOffsets[ulElement] = + pDictRun->m_pulElementOffsets[ulElement]; + } + + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + // Shift the offset of the element. + // Add lThisStart to get an absolute offset (within the document), + // then subtract lDictRunStart (the new start of the text range) + // for an offset relative to the new start + m_pulElementOffsets[ulElement] += + lThisStart - lDictRunStart; + } + + // Adjust the phrase element info so that "this" contains all of + // pDictRun's phrase elements + m_cElements += pDictRun->m_cElements; + m_ulStartElement = pDictRun->m_ulStartElement; + + // pDictRun should now contain no elements + pDictRun->m_cElements = 0; + + return E_FULLMERGE; + } + } + + // If we got here, then both runs are CDictationRuns pointing to the same + // CResultContainer but they did not contain adjacent elements + return E_NOMERGE; + } + + + // Merging a text run onto "this" + + // To do this, we first "guess" that the entire text run should go + // with "this". CorrectPhraseEltsAndRange() corrects this assumption + // if the entire phrase cannot in fact be used. + + if ( fConcatAfter ) + { + // Add on all of the text in pTextRun to the end of "this" + + // For determining how much of a merge will have taken place + long lOldBorder = pTextRun->GetStart(); + + // Temporarily set the range of "this" to the end of pTextRun, + // thus incorporating all of pTextRun's text into "this" + SetEnd( pTextRun->GetEnd() ); + + // Cut out whatever is not a phrase element. + // This may push back the end of "this"'s range + bool fCorrectionResult; + HRESULT hr = CorrectPhraseEltsAndRange( true, &fCorrectionResult ); + if ( FAILED( hr ) ) + { + return E_NOMERGE; + } + + // Now have pTextRun pick up where "this" leaves off, + // so that it includes everything that could not be + // merged into "this" + pTextRun->SetStart( GetEnd() ); + + if ( fCorrectionResult ) + { + // The entire range of pTextRun was appropriated by this + _ASSERTE( pTextRun->IsDegenerate() ); + return E_FULLMERGE; + } + else + { + if ( pTextRun->GetStart() == lOldBorder ) + { + // None of pTextRun's range was appropriated + return E_NOMERGE; + } + else + { + // If pTextRun starts earlier than it did before, + // then concatenating pTextRun onto "this" + // reduced the number of phrase elements it + // contained. + // If pTextRun starts later than it did before, + // then "this" appropriated some part of it as + // phrase elements. + return (pTextRun->GetStart() < lOldBorder) ? + E_LESSTEXT : E_PARTIALMERGE; + } + } + } + else + { + // Same as above, only in the reverse direction (try to merge + // pTextRun onto the beginning of "this" + + // For determining how much of a merge will have taken place + long lOldBorder = pTextRun->GetEnd(); + + // Temporarily set the range of "this" to include pTextRun, + // thus incorporating all of pTextRun's text into "this" + SetStart( pTextRun->GetStart() ); + + // Cut out whatever is not a phrase element. + // This may push forward the start of "this"'s range + bool fCorrectionResult; + HRESULT hr = CorrectPhraseEltsAndRange( false, &fCorrectionResult ); + if ( FAILED( hr ) ) + { + return E_NOMERGE; + } + + // Now have pTextRun end where "this" starts, + // so that it includes everything that could not be + // merged into "this" + pTextRun->SetEnd( GetStart() ); + + if ( fCorrectionResult ) + { + // The entire range of pTextRun was appropriated by this + _ASSERTE( pTextRun->IsDegenerate() ); + return E_FULLMERGE; + } + else + { + if ( pTextRun->GetEnd() == lOldBorder ) + { + // None of pTextRun's range was appropriated + return E_NOMERGE; + } + else + { + // If pTextRun ends later than it did before, + // then concatenating pTextRun onto "this" + // reduced the number of phrase elements it + // contained. + // If pTextRun ends earlier than it did before, + // then "this" appropriated some part of it as + // phrase elements. + return (pTextRun->GetEnd() > lOldBorder) ? + E_LESSTEXT : E_PARTIALMERGE; + } + } + } +} /* CDictationRun::Concatenate */ + + +/********************************************************************** +* CDictationRun::CorrectPhraseEltsAndRange * +*------------------------------------------* +* Description: +* Ensures that the m_ulStartElement and m_cElements correctly +* reflect the text range. If not, adjusts the phrase element +* info and the range so that they agree. +* +* Depending on whether fForward is true, either goes forwards +* from m_ulStartElement or backwards from +* m_ulStartElement + m_cElements in matching up the phrases. +* If fForward is true, then includes any between-word space +* after the last element it matches, if that space was +* included in the original range. +* +* If fForward is true, the end of "this"'s range may be +* pushed back if there is some text at the end of the +* range that does not match phrase elements. +* If fForward is false, the start of "this"'s range may be +* pushed forward. +* +* Note that the range will never be expanded here, only +* possibly contracted. +* +* *pfCorrectionResult will be true iff the phrase element info +* and range did not have to be changed +* Return: +* S_OK +* E_POINTER +* Return value of ITextRange::GetDuplicate() +**********************************************************************/ +HRESULT CDictationRun::CorrectPhraseEltsAndRange( bool fForward, + bool *pfCorrectionResult ) +{ + // Make sure current state is what we expect + _ASSERTE( m_pPhraseReplacement && m_pResultContainer ); + + // Store range and phrase element info. + // We will use these values later on to determine what has changed + const long lOldStart = GetStart(); + const long lOldEnd = GetEnd(); + const ULONG ulOldStartElement = m_ulStartElement; + const ULONG cOldElements = m_cElements; + +#ifdef _DEBUG + BSTR bstrRangeText; + m_cpTextRange->GetText( &bstrRangeText ); +#endif + + // Degenerate range case: Number of elements should be 0. + if ( IsDegenerate() ) + { + if ( m_cElements ) + { + // Phrase information is incorrect since it says + // that we contain some phrase elements + m_cElements = 0; + + if ( pfCorrectionResult ) + { + *pfCorrectionResult = false; + } + } + else + { + if ( pfCorrectionResult ) + { + *pfCorrectionResult = true; + } + } + return S_OK; + } + + // Nondegenerate case + + // Create a duplicate range. + // This range will correspond to text we skip during + // our search for phrase elements + CComPtr pSkippedRange; + HRESULT hr = m_cpTextRange->GetDuplicate( &pSkippedRange ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Depending on the direction, we will either want to start + // at the earliest element supposedly contained in this range + // (if fForward == true) or at the last element. + const ULONG ulFirstElement = fForward ? m_ulStartElement : + (m_ulStartElement + m_cElements - 1); + ULONG ulElement = ulFirstElement; + + long cch, lOldBound; + BSTR bstrElement, bstrSkippedText; + + // For each phrase element, find it in the range. + // We will use the start (resp. end) of "this"'s range + // in the calls to ITextRange::FindTextStart() + // which will move the start (or end) of our range just past + // each element that is found + while (ulElement < m_pPhraseReplacement->GetNumReplacementElements()) + { + // Get the next phrase element that we are expecting + BYTE bDisplayAttributes = 0; + bstrElement = ::SysAllocString( + m_pPhraseReplacement->GetDisplayText( ulElement, &bDisplayAttributes ) ); + + // Remember where "this"'s range started (resp. ended) + lOldBound = fForward ? GetStart() : GetEnd(); + + // Either move the start to right before this word + // or move the end to right after this word. + // Note that we want to match entire words only if the display attributes + // don't tell us to consume leading spaces (like a comma or something) + if ( GetStart() == GetEnd() ) + { + cch = 0; + } + else + { + fForward ? + m_cpTextRange->FindTextStart( + bstrElement, + 0, + (bDisplayAttributes & SPAF_CONSUME_LEADING_SPACES) ? 0 : tomMatchWord, + &cch ) + : m_cpTextRange->FindTextEnd( + bstrElement, + 0, + (bDisplayAttributes & SPAF_CONSUME_LEADING_SPACES) ? 0 : tomMatchWord, + &cch ); + } + + + ::SysFreeString( bstrElement ); + +#ifdef _DEBUG + ::SysFreeString( bstrRangeText ); + m_cpTextRange->GetText( &bstrRangeText ); +#endif + + // Set pSkippedRange to include whatever text is between + // the old start (resp end) of m_cpTextRange (which is at the + // end (resp start) of the last phrase element we found) + // and the new start (resp end) of m_cpTextRange (which is at the start + // (resp end) of the phrase element we just found, if we did + // indeed find one) + pSkippedRange->SetStart( fForward ? lOldBound : GetEnd() ); + pSkippedRange->SetEnd( fForward ? GetStart() : lOldBound ); + + // If this skipped range contains any text that is not whitespace, + // then there was something between the last phrase element and + // this phrase element that we just found. + pSkippedRange->GetText( &bstrSkippedText ); + if ( ContainsNonWhitespace( bstrSkippedText ) ) + { + // Contains some non-spaces, so this element should not + // count as found, since there is some text between + // where we are and the phrase element + cch = 0; + + // Set the start (resp. end) to the old bound, since we + // don't want to include this text (it does not consist + // solely of phrase elements + fForward ? SetStart( lOldBound ) : SetEnd( lOldBound ); + } + ::SysFreeString( bstrSkippedText ); + + if ( !cch ) + { + // Phrase element not found: + // Break out of the loop + break; + } + + // The phrase element was found; update the element + // offset array. + // For the time being, these are absolute indices + // (since if fForward is FALSE, then we don't yet know + // what the start of the range is. + // Later in the function they will be adjusted + // to be relative indices. + if ( fForward ) + { + // Because of ITextRange::FindTextStart(), + // the start of this range is the start of this element + m_pulElementOffsets[ ulElement ] = GetStart(); + } + else + { + // Because of ITextRange::FindTextEnd(), + // the end of this range is the end of this element. + // Subtract cch since cch is the length of the element + m_pulElementOffsets[ ulElement ] = GetEnd() - cch; + } + + // Move the start (resp. the end) past the phrase element + // (whose length is cch) + fForward ? m_cpTextRange->MoveStart( tomCharacter, cch, NULL ) : + m_cpTextRange->MoveEnd( tomCharacter, -cch, NULL ); + + +#ifdef _DEBUG + ::SysFreeString( bstrRangeText ); + m_cpTextRange->GetText( &bstrRangeText ); +#endif + + // Increment (decrement) ulElement to look for the next element + fForward ? ulElement++ : ulElement--; + } // (while loop) + +#ifdef _DEBUG + ::SysFreeString( bstrRangeText ); +#endif + + if ( fForward ) + { + // If all of the elements were there, ulElement is equal + // to the old start element plus the old number of elements. + // Otherwise, ulElement is equal to the first phrase element + // after ulFirstElement that was not found. + + // Adjust the phrase element information to reflect + // what we found + m_cElements = ulElement - ulFirstElement; + + // Adjust the end so that only phrase elements are in this range. + // This is where the start of the range is right now (since we + // just moved the start past the last phrase element + // that was found. + SetEnd( GetStart() ); + + // Reset the start to its original location (it was moved around + // by ITextRange::FindTextStart()) + SetStart( lOldStart ); + + // Now try to include any between-word space that can be included. + // up until the old end limit. + // We do not want to do this if there are no phrase elements found + // at all (in this case, the range should be degenerate). + if ( m_cElements ) + { + m_cpTextRange->MoveEnd( tomWord, 1, NULL ); + if ( GetEnd() > lOldEnd ) + { + // We overshot the old end, so we should just end at the old end + SetEnd( lOldEnd ); + } + } + } + else + { + // If all of the elements were there, ulElement is equal + // to the old start element - 1. + // Otherwise, ulElement is equal to the first phrase element + // going backwards from ulFirstElement that was not found. + + // Must adjust both the start element and the number of elements + m_ulStartElement = ulElement + 1; + m_cElements = ulFirstElement - ulElement; + + // Adjust the start so that only phrase elements are in this range. + // This is where the end of the range is right now (since we + // just moved the end before the last phrase element + // that was found. + SetStart( GetEnd() ); + + // Reset the end to its original location (it was moved around + // by ITextRange::FindTextEnd()) + SetEnd( lOldEnd ); + + // Do not include spaces leading up to this phrase + } + + // If no elements were found in the range, then set the range to be degenerate + if ( !m_cElements ) + { + fForward ? SetEnd( lOldStart ) : SetStart( lOldEnd ); + } + +#ifdef _DEBUG + // Fill the array with the bogus phrase element offset value wherever + // there is an element that did not fall into the "found" range + // of elements + const ULONG ulBogusVal = GetEnd() - GetStart(); + for ( ulElement = 0; + ulElement < m_pPhraseReplacement->GetNumReplacementElements(); + ulElement++ ) + { + if ( (ulElement < m_ulStartElement) || + (ulElement >= (m_ulStartElement + m_cElements)) ) + { + m_pulElementOffsets[ ulElement ] = ulBogusVal; + } + } +#endif + + // All elements in the range should have had their offsets updated above + // to be absolute locations within the document. + // Since we now know the start of the range, we can update the offsets + // of elements we have found relative to that. + long lStart = GetStart(); + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + // Element is in the range; make its index + // relative to the start index of the range + m_pulElementOffsets[ ulElement ] -= lStart; + } + + // Should return true iff nothing has changed (i.e. everything was already + // correct) + if ( pfCorrectionResult ) + { + *pfCorrectionResult = (( lOldStart == GetStart() ) && + ( lOldEnd == GetEnd() ) && + ( ulOldStartElement == m_ulStartElement ) && + ( cOldElements == m_cElements )); + } + return S_OK; + +} /* CDictationRun::CorrectPhraseEltsAndRange */ + +/********************************************************************** +* CDictationRun::GetAlternatesText * +*----------------------------------* +* Description: +* Called to get the alternates for the given range. +* Since pRangeForAlts does not necessarily line up +* with element boundaries, this method will get the +* alternates for the closest range it can get that +* contains whole elements. +* plAltStart and plAltEnd will point to the start +* and end of the range for which alternates are +* actually being returned. +* The text for the alternates is given in an array +* of CoTaskMemAlloced WCHAR *'s, and pcPhrasesReturned +* points to a count of how many of them there are. +* apfFitsInRun will be an array of bools indicating +* which alternates actually do fit in "this"'s range +* (since some may cover more phrase elements than +* are actually in our range right now) +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG +* Return value of CDictationRun::FindNearestWholeElementRange() +* Return value of CResultContainer::GetAlternatesText() +**********************************************************************/ +HRESULT CDictationRun::GetAlternatesText( ITextRange *pRangeForAlts, + ULONG ulRequestCount, + long *plAltStart, + long *plAltEnd, + WCHAR **ppszCoMemText, + bool *apfFitsInRun, + ULONG *pcPhrasesReturned ) +{ + if ( !pRangeForAlts || !plAltStart || !plAltEnd || + !ppszCoMemText || !pcPhrasesReturned || !apfFitsInRun ) + { + return E_POINTER; + } + + if ( !m_pResultContainer ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + + // Validate the pRangeForAlts param + long lRangeStart; + long lRangeEnd; + pRangeForAlts->GetStart( &lRangeStart ); + pRangeForAlts->GetEnd( &lRangeEnd ); + if ( !( WithinRange( lRangeStart ) && WithinRange( lRangeEnd ) ) ) + { + // Asking for alternates from an invalid range + return E_INVALIDARG; + } + + // Expand the range to the smallest range containing it that + // contains whole elements + ULONG ulStartElement; + ULONG cElements; + HRESULT hr = FindNearestWholeElementRange( lRangeStart, lRangeEnd, + plAltStart, plAltEnd, &ulStartElement, &cElements ); + + *pcPhrasesReturned = 0; + if ( SUCCEEDED( hr ) ) + { + // Get the alternates text from the result object + hr = m_pResultContainer->GetAlternatesText( + ulStartElement, cElements, ulRequestCount, ppszCoMemText, + pcPhrasesReturned ); + } + + if ( SUCCEEDED( hr ) ) + { + // Remember what these are alternates for + m_fAltsGotten = true; + m_ulStartAltElt = ulStartElement; + m_cAltElt = cElements; + } + + // For each alternate, mark whether or not it fits in the run + ULONG ulStartInParent; + ULONG cEltsInParent; + HRESULT hrAltInfo; + for ( ULONG ulAlt = 0; ulAlt < *pcPhrasesReturned; ulAlt++ ) + { + // Find out which elements this alternate covers + hrAltInfo = m_pResultContainer->GetAltInfo( ulStartElement, cElements, ulAlt, + &ulStartInParent, &cEltsInParent ); + + // Check if it falls within our m_ulStartElement and m_cElements + apfFitsInRun[ ulAlt ] = SUCCEEDED(hrAltInfo) && + ( ulStartInParent >= m_ulStartElement ) && + ( (ulStartInParent + cEltsInParent) <= (m_ulStartElement + m_cElements) ); + + // See if we got a NULL alternate back, if we did then mark it so it gets ignored. + if ( ppszCoMemText[ ulAlt ] == NULL ) + { + apfFitsInRun[ ulAlt ] = false; + } + } + + return hr; +} /* CDictationRun::GetAlternatesText */ + +/********************************************************************** +* CDictationRun::GetAltEndpoints * +*--------------------------------* +* Description: +* Returns the start and end points of the text in the document +* that the alternate (from the last call to GetAlternatesText()) +* would replace +* Return: +* S_OK +* return value of CResultContainer::GetAltInfo() +**********************************************************************/ +HRESULT CDictationRun::GetAltEndpoints( ULONG ulAlt, + long *plReplaceStart, + long *plReplaceEnd ) +{ + _ASSERTE( m_fAltsGotten ); + _ASSERTE( m_pResultContainer ); + if ( !m_fAltsGotten || !m_pResultContainer ) + { + return E_UNEXPECTED; + } + + // Find out which elements this alternate covers + ULONG ulReplaceStartElt; + ULONG cReplacedElts; + HRESULT hr = m_pResultContainer->GetAltInfo( + m_ulStartAltElt, m_cAltElt, ulAlt, + &ulReplaceStartElt, &cReplacedElts ); + if ( FAILED(hr) ) + { + return hr; + } + _ASSERTE( (ulReplaceStartElt + cReplacedElts) <= + m_pPhraseReplacement->GetNumReplacementElements() ); + + if ( plReplaceStart ) + { + // Get the start position of the first element that would be replaced + *plReplaceStart = GetStart() + m_pulElementOffsets[ ulReplaceStartElt ]; + } + + if ( plReplaceEnd ) + { + // The range that would be replaced ends where the first element that + // won't be replaced starts. + // Get the start position of the first element that would not be + // replaced (the endpoint), or the end of the run if the last element + // would be replaced. + if ( (ulReplaceStartElt + cReplacedElts) == (m_ulStartElement + m_cElements) ) + { + // The last element in the run would be replaced + *plReplaceEnd = GetEnd(); + } + else + { + // The last element in the run would not be replaced + *plReplaceEnd = GetStart() + + m_pulElementOffsets[ ulReplaceStartElt + cReplacedElts ]; + } + } + return S_OK; +} /* CDictationRun::GetAltEndpoints */ + +/********************************************************************** +* CDictationRun::ChooseAlternate * +*--------------------------------* +* Description: +* Called when the user wishes to commit an alternate +* from the last group obtained via GetAlternatesText() +* Return: +* S_OK +* return value of CResultContainer::ChooseAlternate +**********************************************************************/ +HRESULT CDictationRun::ChooseAlternate( ULONG ulAlt ) +{ + _ASSERTE( m_fAltsGotten && m_pResultContainer ); + if ( !m_fAltsGotten || !m_pResultContainer ) + { + return E_UNEXPECTED; + } + + // Find out which elements will be replaced + ULONG ulActualAltStart; + ULONG cActualAltElts; + HRESULT hr = m_pResultContainer->GetAltInfo( + m_ulStartAltElt, m_cAltElt, ulAlt, &ulActualAltStart, &cActualAltElts ); + + // Get the text for the alternate that will replace these elements + CSpDynamicString dstrText; + BYTE bDisplayAttributes = 0; + if (SUCCEEDED(hr)) + { + hr = m_pResultContainer->GetAltText( m_ulStartAltElt, m_cAltElt, + ulAlt, &dstrText, &bDisplayAttributes ); + } + + // cpRangeToReplace will cover the text of the elements to replace + CComPtr cpRangeToReplace; + if (SUCCEEDED(hr)) + { + hr = m_cpTextRange->GetDuplicate( &cpRangeToReplace ); + } + + // Set the range of cpRangeToReplace to contain the correct text + if (SUCCEEDED(hr)) + { + // The start is the start of the first element covered by the alternate + cpRangeToReplace->SetStart( GetStart() + m_pulElementOffsets[ulActualAltStart] ); + + // The end is the start of the first element not covered by the alternate, + // or the end of this DictationRun's range, if the last element in the run + // is covered by the alternate + if ( (ulActualAltStart + cActualAltElts) == (m_ulStartElement + m_cElements) ) + { + // The last element in the run is covered + cpRangeToReplace->SetEnd( GetEnd() ); + } + else + { + // The last element in the run is not covered + cpRangeToReplace->SetEnd( GetStart() + + m_pulElementOffsets[ulActualAltStart + cActualAltElts] ); + } + } + + // Deal with display attributes: + + // pwszTextToInsert will contain the actual text to insert, with the + // correct spaces + // At most, it will need space for the recognized text, a terminating nul, + // two spaces before, and two spaces after + WCHAR *pwszTextToInsert = new WCHAR[ wcslen( dstrText ) + 5 ]; + if ( !pwszTextToInsert ) + { + return E_OUTOFMEMORY; + } + pwszTextToInsert[0] = 0; + + // Consume spaces before the alternate if necessary, + // or add spaces before the alternate. + // To be safe, we will not consume leading spaces outside of + // this run + if ( (ulActualAltStart > m_ulStartElement) && + (SPAF_CONSUME_LEADING_SPACES & bDisplayAttributes) ) + { + // Move the start of the range back until is is + // right after a non-space character + HRESULT hrMove; + long lFirstChar; + do + { + hrMove = cpRangeToReplace->MoveStart( -1, tomCharacter, NULL ); + + // Look at the first character that is now in the range + lFirstChar = 0; + cpRangeToReplace->GetChar( &lFirstChar ); + + } while (( S_OK == hrMove ) && ( L' ' == ((WCHAR) lFirstChar) )); + + if ( S_OK == hrMove ) + { + // We have found a non-space character to the left of the start, + // move just past it + cpRangeToReplace->MoveStart( 1, tomCharacter, NULL ); + } + } + else + { + // If the previous element calls for trailing spaces and there aren't + // any, we need to add them + UINT uiNumLeadingSpacesNeeded = 1; + BYTE bPreviousDisplayAttributes = 0; + if (( ulActualAltStart > 0 ) && ( ulActualAltStart > m_ulStartElement )) + { + m_pPhraseReplacement->GetDisplayText( ulActualAltStart - 1, + &bPreviousDisplayAttributes ); + if ( bPreviousDisplayAttributes & SPAF_ONE_TRAILING_SPACE ) + { + uiNumLeadingSpacesNeeded = 1; + } + else if ( bPreviousDisplayAttributes & SPAF_TWO_TRAILING_SPACES ) + { + uiNumLeadingSpacesNeeded = 2; + } + else + { + uiNumLeadingSpacesNeeded = 0; + } + } + + if ( uiNumLeadingSpacesNeeded > 0 ) + { + // Now look back to previous characters + CComPtr cpDupRange; + if ( FAILED( cpRangeToReplace->GetDuplicate( &cpDupRange ) ) ) + { + hr = E_OUTOFMEMORY; + } + long lDupRangeStart = 0; + cpDupRange->GetStart( &lDupRangeStart ); + + if ( lDupRangeStart > 0 ) + { + cpDupRange->MoveStart( tomCharacter, -1, NULL ); + lDupRangeStart--; + + long lFirstChar = 0; + cpDupRange->GetChar( &lFirstChar ); + if ( !iswspace( (WCHAR) lFirstChar ) ) + { + wcscat( pwszTextToInsert, + (1 == uiNumLeadingSpacesNeeded) ? L" " : L" " ); + } + else if ( 2 == uiNumLeadingSpacesNeeded ) + { + // If two spaces are called for but only one is there, + // we need an additional space + if ( lDupRangeStart > 0 ) + { + cpDupRange->GetChar( &lFirstChar ); + if ( !iswspace( (WCHAR) lFirstChar ) ) + { + wcscat( pwszTextToInsert, L" " ); + } + } + } + } + } + } + + // Get the display attributes for the element to follow. + // (If the alt covers the last element, CPhraseReplacement::GetDisplayText() + // will return NULL) + BYTE bFollowingDisplayAttributes = 0; + const WCHAR *pwszText = m_pPhraseReplacement->GetDisplayText( + ulActualAltStart + cActualAltElts, + &bFollowingDisplayAttributes ); + bool fConsumeLeadingSpacesAfterAlt = + pwszText && (bFollowingDisplayAttributes & SPAF_CONSUME_LEADING_SPACES); + + // Append spaces if necessary: That is, if the attribute itself + // calls for trailing spaces and the next element is not + // CONSUME_LEADING_SPACES + if ( !fConsumeLeadingSpacesAfterAlt ) + { + if ( SPAF_TWO_TRAILING_SPACES & bDisplayAttributes ) + { + dstrText.Append( L" " ); + } + else if ( SPAF_ONE_TRAILING_SPACE & bDisplayAttributes ) + { + dstrText.Append( L" " ); + } + } + + // Get the recognized text and any trailing spaces + wcscat( pwszTextToInsert, dstrText ); + + if ( SUCCEEDED( hr ) ) + { + BSTR bstrText = ::SysAllocString( pwszTextToInsert ); + + // Change the text + hr = cpRangeToReplace->SetText( bstrText ); + + ::SysFreeString( bstrText ); + } + + delete[] pwszTextToInsert; + + if ( SUCCEEDED( hr ) ) + { + // Notify the common reco result so that all runs sharing + // this result can adjust their offset maps if necessary + // (as the indices of elements may have changed) + BYTE b; + hr = m_pResultContainer->ChooseAlternate( + m_ulStartAltElt, m_cAltElt, ulAlt, &b ); + } + + // At this point the alternate has been committed to the phrase, + // and our PhraseReplacement object knows about the committed alternate + + if ( SUCCEEDED( hr ) ) + { + // This will get us the new offsets for the phrase elements we + // now have + hr = CorrectPhraseEltsAndRange( true ); + } + + return hr; +} /* CDictationRun::ChooseAlternate */ + + +/********************************************************************** +* CDictationRun::OnAlternateCommit * +*----------------------------------* +* Description: +* Called right before an alternate is committed on this +* DictationRun's RecoResult. +* If the commit has resulted in an increase in the +* number of elements, the offset map will need to be freed +* and allocated again. +* Move the element offset information so that it is correct. +* Return: +* S_OK +* E_OUTOFMEMORY +**********************************************************************/ +HRESULT CDictationRun::OnAlternateCommit( ULONG ulStartEltToBeReplaced, + ULONG cEltsToBeReplaced, + ULONG cElementsInPhraseAfterCommit ) +{ + // Determine the change in element count (i.e. whether there will now be + // more, fewer, or the same number of elements) + long lElementShift = cElementsInPhraseAfterCommit + - m_pPhraseReplacement->GetNumReplacementElements(); + + if ( !lElementShift ) + { + // Nothing needs to be done + return S_OK; + } + + if ( (ulStartEltToBeReplaced + cEltsToBeReplaced) > + m_pPhraseReplacement->GetNumReplacementElements() ) + { + // Out-of-bounds arguments + _ASSERTE( false ); + return E_UNEXPECTED; + } + + if ( lElementShift > 0 ) + { + // The number of elements has increased: need to reallocate + ULONG *pulNewOffsets = new ULONG[ cElementsInPhraseAfterCommit ]; + if ( !pulNewOffsets ) + { + return E_OUTOFMEMORY; + } + ULONG ulElement; + +#ifdef _DEBUG + // Fill the element offsets with a bogus value + const ULONG ulBogusVal = GetEnd() - GetStart(); + for( ulElement = 0; + ulElement < cElementsInPhraseAfterCommit; + ulElement++ ) + { + pulNewOffsets[ulElement] = ulBogusVal; + } +#endif + + // Copy over the relevant elements. + if ( (m_ulStartElement + m_cElements) <= ulStartEltToBeReplaced ) + { + // The replacement occurs after this run + // so we can just copy over the entries. + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + pulNewOffsets[ulElement] = m_pulElementOffsets[ulElement]; + } + } + else if ( m_ulStartElement >= (ulStartEltToBeReplaced + cEltsToBeReplaced) ) + { + // The replacement occurs before this run, so shifting is necessary + // Shift the entries to the right (recall that lElementShift > 0) + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + pulNewOffsets[ulElement + lElementShift] = m_pulElementOffsets[ulElement]; + } + + // The start element also needs to be shifted + m_ulStartElement += lElementShift; + } + + // If this run is the run in which the replacement will take place, + // do not do anything here, as this run will later do its own thing to + // recalculate its element offsets + + // Delete the old map, and make the element offset map point to the new map + delete[] m_pulElementOffsets; + m_pulElementOffsets = pulNewOffsets; + } + else + { + // The number of phrase elements has decreased, so we already have + // enough space allocated for the map + + // Sanity check: We had better not be shifting back past zero + if ( (lElementShift < 0) && ((ulStartEltToBeReplaced + cEltsToBeReplaced) < (ULONG)(-lElementShift)) ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + + // Copy over the offset info if necessary + ULONG ulElement; + if ( m_ulStartElement >= (ulStartEltToBeReplaced + cEltsToBeReplaced) ) + { + // The replacement occurs before this run. + // Shift the entries to the left (recall that lElementShift < 0, + // and that is why we are adding lElementShift, not subtracting) + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + m_pulElementOffsets[ulElement + lElementShift] = + m_pulElementOffsets[ulElement]; + } + + // The start element also needs to be shifted + m_ulStartElement += lElementShift; + } + + // If the replacement occurs after this run, all of the phrase + // element information is already correct. + + // If this is the run in which the alternate was committed, do not + // do anything here, as this run will later do its own thing to + // recalculate its element offsets + } + + return S_OK; +} /* CDictationRun::OnAlternateCommit */ + +/********************************************************************** +* CDictationRun::Speak * +*----------------------* +* Description: +* Speaks all of the audio associated with this text run. Uses +* TTS if there's a problem speaking the audio data. +* +* Return: +* S_OK +* S_FALSE for a degenerate run +* Return value of CResultContainer::SpeakAudio() +**********************************************************************/ +HRESULT CDictationRun::Speak( ISpVoice &rVoice ) +{ + _ASSERTE( m_pResultContainer && m_pPhraseReplacement && m_cpTextRange ); + if ( !m_pResultContainer || !m_pPhraseReplacement || !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + if ( !m_cElements ) + { + // This run is just a place-holder, no need to speak it + return S_FALSE; + } + + // Try to speak it as audio + HRESULT hr = m_pResultContainer->SpeakAudio( + m_ulStartElement, m_cElements ); + + if( FAILED( hr ) ) + { + // Speak it as text + hr = CTextRun::Speak( rVoice ); + } + return hr; + +} /* CDictationRun::Speak */ + +/********************************************************************** +* CDictationRun::Speak * +*----------------------* +* Description: +* Finds the smallest range that contains *plStart -> *plEnd +* and still contains whole elements. Returns the start +* and end of the text it actually spoke in *plStart and *plEnd. +* Speaks the audio associated with this range within this text run. +* Uses TTS if there's a problem speaking the audio data. +* +* Out-of-bounds *plStart causes the range to be spoken from +* the start. +* Out-of-bounds *plEnd causes the range to be spoken all the +* way to the end. +* Return: +* S_OK +* E_POINTER +* E_OUTOFMEMORY +* Return value of CDictationRun::FindNearestWholeElementRange() +* Return value of ITextRange::{Get,Set}{Start,End}() +* Return value of CDictationRun::Speak() +**********************************************************************/ +HRESULT CDictationRun::Speak( ISpVoice &rVoice, + long *plStart, + long *plEnd ) +{ + if ( !plStart || !plEnd ) + { + return E_POINTER; + } + + // This function actually temporarily shrinks this DictationRun's + // range, so we need to store all of its information before + // proceeding. + + // Save the old range + const long lOldStart = GetStart(); + const long lOldEnd = GetEnd(); + + // Save the old phrase element information + const ULONG ulOldStartElement = m_ulStartElement; + const ULONG cOldElements = m_cElements; + + // Save the element offsets + const ULONG ulOffsetArraySize = + sizeof(ULONG) * m_pPhraseReplacement->GetNumReplacementElements(); + ULONG *pulOldElementOffsets = new ULONG[ ulOffsetArraySize ]; + if ( !pulOldElementOffsets ) + { + return E_OUTOFMEMORY; + } + memcpy( pulOldElementOffsets, m_pulElementOffsets, ulOffsetArraySize ); + + // Fix out-of-bounds limits, since these mean to speak the entire run + if ( !WithinRange( *plStart ) ) + { + *plStart = lOldStart; + } + if ( !WithinRange( *plEnd ) ) + { + *plEnd = lOldEnd; + } + + // Find the smallest range containing this range that contains only + // whole elements + long lWholeEltStart; + long lWholeEltEnd; + HRESULT hr = FindNearestWholeElementRange( + *plStart, *plEnd, &lWholeEltStart, &lWholeEltEnd, NULL, NULL ); + + // Set the end to the end of the range to speak + if ( SUCCEEDED( hr ) ) + { + // The limits of this whole-element range are what we are going to speak + *plStart = lWholeEltStart; + *plEnd = lWholeEltEnd; + + hr = m_cpTextRange->SetEnd( *plEnd ); + } + + // Find out what phrase elements are now contained + if ( SUCCEEDED( hr ) ) + { + hr = CorrectPhraseEltsAndRange( true ); + } + + if ( SUCCEEDED( hr ) ) + { + // CDictationRun::CorrectPhraseEltsAndRange() might have moved the end + hr = m_cpTextRange->GetEnd( plEnd ); + } + + // Set the start to the start of the range to speak + if ( SUCCEEDED( hr ) ) + { + hr = m_cpTextRange->SetStart( *plStart ); + } + + // Find out what phrase elements are now contained + if ( SUCCEEDED( hr ) ) + { + hr = CorrectPhraseEltsAndRange( false ); + } + + if ( SUCCEEDED( hr ) ) + { + // CDictationRun::CorrectPhraseEltsAndRange() might have moved the start + hr = m_cpTextRange->GetStart( plStart ); + } + + if ( SUCCEEDED( hr ) ) + { + // Pass to CDictationRun::Speak() in order to speak the entire range, + // which now consists solely of what we want to speak + hr = Speak( rVoice ); + } + + // Restore old range and phrase element info + SetStart( lOldStart ); + SetEnd( lOldEnd ); + m_ulStartElement = ulOldStartElement; + m_cElements = cOldElements; + memcpy( m_pulElementOffsets, pulOldElementOffsets, ulOffsetArraySize ); + delete[] pulOldElementOffsets; + + return hr; +} /* CDictationRun::Speak */ + +/********************************************************************** +* CDictationRun::Serialize * +*--------------------------* +* Description: +* Serializes the text and audio data for this run. +* Writes the data to the pStream. +* There are two headers to precede the seralized run; +* one containing information about the run as a generic +* text run, and one containing information about the +* run and its dictation-specific information. +* Return: +* S_OK +* E_POINTER +* Return value of CResultContainer::Serialize() +* Return value of ISequentialStream::Write() +**********************************************************************/ +HRESULT CDictationRun::Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ) +{ + if ( !pStream || !pRecoCtxt ) + { + return E_POINTER; + } + _ASSERTE( m_cpTextRange && m_pResultContainer ); + if ( !m_cpTextRange || !m_pResultContainer ) + { + return E_UNEXPECTED; + } + + // Make the relevant headers + + // This header deals with the run as a generic text run + RUNHEADER runHdr; + runHdr.lStart = GetStart(); + runHdr.lEnd = GetEnd(); + runHdr.bResultFollows = true; + + // This header deals with the run as a CDictationRun + DICTHEADER dictHdr; + dictHdr.ulStartElement = m_ulStartElement; + dictHdr.cElements = m_cElements; + + // Get the phrase blob from the recoresult + SPSERIALIZEDRESULT * pResultBlock; + HRESULT hr = m_pResultContainer->Serialize( &pResultBlock ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Get the size of the result block + dictHdr.cbSize = pResultBlock->ulSerializedSize; + + // Write the headers and the phrase blob to the stream + ULONG cbWritten; + hr = pStream->Write( &runHdr, sizeof( RUNHEADER ), &cbWritten ); + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Write( &dictHdr, sizeof( DICTHEADER ), &cbWritten ); + } + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Write( pResultBlock, dictHdr.cbSize, &cbWritten ); + } + + return hr; +} /* CDictationRun::Serialize */ + +/********************************************************************** +* CDictationRun::IsConsumeLeadingSpaces * +*---------------------------------------* +* Description: +* Sets *pfConsumeLeadingSpaces to true iff any text inserted +* at lPos would have to consume a space that follows it. +* This value will be false UNLESS lPos is the first +* position of a phrase element that has the attribute +* SPAF_CONSUME_LEADING_SPACES +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if lPos is out of range +* return value of CDictationRun::FindNearestWholeElementRange() +* E_FAIL if the CPhraseReplacement::GetDisplayText() fails +**********************************************************************/ +HRESULT CDictationRun::IsConsumeLeadingSpaces( const long lPos, + bool *pfConsumeLeadingSpaces ) +{ + if ( !pfConsumeLeadingSpaces ) + { + return E_POINTER; + } + if ( !WithinRange( lPos ) ) + { + return E_INVALIDARG; + } + *pfConsumeLeadingSpaces = false; // by default + + // Expand lPos to the nearest element + long lEltStartPos; + long lEltEndPos; + ULONG ulStartElt; + ULONG cElts; + HRESULT hr = FindNearestWholeElementRange( lPos, lPos, + &lEltStartPos, &lEltEndPos, &ulStartElt, &cElts ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Should have found only one element + _ASSERTE( 1 == cElts ); + + // We definitely don't want to consume leading spaces unless + // this is the beginning of the element + if ( lPos != lEltStartPos ) + { + return S_OK; + } + + // Get the text and attributes for that element + BYTE bDisplayAttributes; + const WCHAR *pwszEltText = m_pPhraseReplacement->GetDisplayText( + ulStartElt, &bDisplayAttributes ); + if ( !pwszEltText ) + { + return E_FAIL; + } + + // Check for the CONSUME_LEADING_SPACES attribute + if ( SPAF_CONSUME_LEADING_SPACES & bDisplayAttributes ) + { + *pfConsumeLeadingSpaces = true; + } + + return S_OK; +} /* CDictationRun::IsConsumeLeadingSpaces */ + +/********************************************************************** +* CDictationRun::HowManySpacesAfter * +*-----------------------------------* +* Description: +* Returns the number of spaces that would need to precede text +* if text were to be inserted at position lPos. +* This number goes in the out param puiSpaces. +* The value returned will be zero UNLESS lPos immediately +* follows the text of a phrase element that has +* SPAF_ONE_TRAILING_SPACE or SPAF_TWO_TRAILINGSPACES attributes +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if lPos is out of range +* return value of CDictationRun::FindNearestWholeElementRange() +* E_FAIL if the CPhraseReplacement::GetDisplayText() fails +**********************************************************************/ +HRESULT CDictationRun::HowManySpacesAfter( const long lPos, + UINT *puiSpaces ) +{ + if ( !puiSpaces ) + { + return E_POINTER; + } + if ( !WithinRange( lPos ) ) + { + return E_INVALIDARG; + } + *puiSpaces = 0; // by default + + // Expand lPos to the nearest element + long lEltStartPos; + long lEltEndPos; + ULONG ulStartElt; + ULONG cElts; + HRESULT hr = FindNearestWholeElementRange( lPos, lPos, + &lEltStartPos, &lEltEndPos, &ulStartElt, &cElts ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Should have found only one element + _ASSERTE( 1 == cElts ); + + // Get the text and attributes for that element + BYTE bDisplayAttributes; + const WCHAR *pwszEltText = m_pPhraseReplacement->GetDisplayText( + ulStartElt, &bDisplayAttributes ); + if ( !pwszEltText ) + { + return E_FAIL; + } + + // If that element asks for leading spaces to be consumed and + // lPos is at the beginning of that element, we actually + // want to be looking at the element for the previous space, + // since those two elements may run together. + // (For instance, if lPos fell between the 'd' and the '.' in + // "This sentence ends with a period." We want attributes for + // "period", not ".") + if (( bDisplayAttributes & SPAF_CONSUME_LEADING_SPACES ) + && ( lPos == lEltStartPos ) + && ( lPos > GetStart() )) + { + // Get the element that (lPos - 1) is on + hr = FindNearestWholeElementRange( lPos - 1, lPos - 1, + &lEltStartPos, &lEltEndPos, &ulStartElt, &cElts ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Should have found only one element + _ASSERTE( 1 == cElts ); + + // Get the text and attributes for that element + pwszEltText = m_pPhraseReplacement->GetDisplayText( + ulStartElt, &bDisplayAttributes ); + if ( !pwszEltText ) + { + return E_FAIL; + } + } + + // Now look for attributes if lPos falls at the end of this element + if ( (lEltStartPos + (long) wcslen( pwszEltText )) == lPos ) + { + // lPos immediately follows the element text, + // so pay attention to the display attributes + if ( SPAF_ONE_TRAILING_SPACE & bDisplayAttributes ) + { + *puiSpaces = 1; + } + else if ( SPAF_TWO_TRAILING_SPACES & bDisplayAttributes ) + { + *puiSpaces = 2; + } + } + else if ( (lEltStartPos + (long) wcslen( pwszEltText ) + 1) == lPos ) + { + // lPos is the position after the position immediately following + // the element text. We care about this situation only if + // we want two trailing spaces, in which case we need only one more + if ( SPAF_TWO_TRAILING_SPACES & bDisplayAttributes ) + { + *puiSpaces = 1; + } + } + + // Otherwise text can be inserted right at lPos + + return S_OK; +} /* CDictationRun::HowManySpacesAfter */ + + +/********************************************************************** +* CDictationRun::FindNearestWholeElementRange * +*---------------------------------------------* +* Description: +* Finds the start and end of the smallest range containing +* the range with lStart and lEnd that contains whole elements. +* Upon return, pulStartElement and pcElements will point +* to information about the elements to which the range +* best corresponds. +* Upon return, plResultStart and plResultEnd will point +* to the start and end indices (in the document) of this +* element range. +* Return: +* S_OK +* E_POINTER +* E_FAIL if there are no elements in this range +* E_INVALIDARG if the range lStart...lEnd is not contained +* within our range +**********************************************************************/ +HRESULT CDictationRun::FindNearestWholeElementRange( long lStart, + long lEnd, + long *plResultStart, + long *plResultEnd, + ULONG *pulStartElement, + ULONG *pcElements ) +{ + if ( !plResultStart || !plResultEnd ) + { + return E_POINTER; + } + _ASSERTE( m_cpTextRange && m_pulElementOffsets ); + if ( !m_cpTextRange || !m_pulElementOffsets ) + { + return E_UNEXPECTED; + } + + if ( !m_cElements ) + { + return E_FAIL; + } + + if ( !( WithinRange( lStart ) && WithinRange( lEnd ) ) ) + { + // Asking for out-of-range text + return E_INVALIDARG; + } + + ULONG ulThisRunStart = (ULONG) GetStart(); + ULONG ulStart = (ULONG)lStart; + + // Find the last element offset that is + // less than or equal to lStart. + // This is accomplished by going backwards through the + // elements until we find one with an offset that is <= lStart, + // or until we hit the start element + ULONG ulElement; + for ( ulElement = m_ulStartElement + m_cElements - 1; + (ulElement > m_ulStartElement) && ((ulThisRunStart + m_pulElementOffsets[ulElement]) > ulStart); + ulElement-- ) + ; + ULONG ulStartElement = ulElement; + _ASSERTE( m_pulElementOffsets[ulStartElement] <= ulStart ); + + // Get the result into the out params + *plResultStart = ulThisRunStart + m_pulElementOffsets[ulStartElement]; + if ( pulStartElement ) + { + *pulStartElement = ulStartElement; + } + + // Find the first element offset that is + // greater than or equal to lEnd. + // This is the first element that we will not include. + ULONG ulEnd = (ULONG) lEnd; + for ( ulElement = ulStartElement; + (ulElement < m_ulStartElement + m_cElements) && + ((ulThisRunStart + m_pulElementOffsets[ulElement]) < ulEnd); + ulElement++ ) + ; + _ASSERTE( ulElement >= ulStartElement ); + if ( ulElement == ulStartElement ) + { + // The range was degenerate and at the beginning of a phrase element; + // we should include one element + ulElement++; + } + + // Get the result into the out params + if ( (m_ulStartElement + m_cElements) == ulElement ) + { + // Our range contains part of the final element, + // so get the end of the range from the end of + // the document + *plResultEnd = GetEnd(); + } + else + { + // Get the end of the range from the offset of the + // first element not included. + *plResultEnd = ulThisRunStart + m_pulElementOffsets[ulElement]; + } + if ( pcElements ) + { + // ulElement is the index of the first element not included. + // If the last element in the run was included, then ulElement will + // be one more than that. + *pcElements = ulElement - ulStartElement; + } + + return S_OK; +} /* CDictationRun::FindNearestWholeElementRange */ + +// Helper function + +/********************************************************************* +* ContainsNonWhitespace() * +*-------------------------* +* Description: +* Returns true iff some character in the string is +* not whitespace. +**********************************************************************/ +bool ContainsNonWhitespace( const WCHAR *pwsz ) +{ + if ( !pwsz ) + { + return false; + } + + const WCHAR *pwc; + for ( pwc = pwsz; *pwc; pwc++ ) + { + if ( !iswspace( *pwc ) ) + { + return true; + } + } + + // Did not hit a whitespace character + return false; +} /* ContainsNonWhitespace */ diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.h new file mode 100644 index 00000000..9088518d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.h @@ -0,0 +1,141 @@ +/****************************************************************************** +* DictationRun.h +* This module contains the definition of CDictationRun. CDictationRun +* keeps track of the dictation-specific items that go with runs of test +* that were dictated to DictPad. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "TextRun.h" +#include "phrasereplace.h" +#include "resultcontainer.h" + +// Forward definition +class CResultContainer; + +// Header for serialized CDictationRuns +typedef struct DICTHEADER +{ + ULONG cbSize; // Size of the reco result to follow + ULONG ulStartElement; + ULONG cElements; +} DICTHEADER; + +/****************************************************************************** +* CDictationRun * +*---------------* +* Description: +* This class inherits from CTextRun (in textrun.h). It handles +* a consecutive run of text in the document that was dictated. +* It can be a full dictated phrase or part of a phrase that +* was dictated, but all of the text in a CDictationRun exists +* exactly as it had originally been dictated. +********************************************************************************/ +class CDictationRun : public CTextRun +{ + public: + CDictationRun(); + virtual ~CDictationRun(); + + // Initialization methods + HRESULT Initialize( ISpRecoResult &rRecoResult, DICTHEADER *pDictHdr = NULL ); + HRESULT Initialize( CResultContainer &rResultContainer ); + HRESULT SetTextRange( ITextRange *pTextRange ); + + // Phrase element-related methods + HRESULT Split( long *plFirstEnd, long *plSecondBegin, + ITextDocument *cpTextDoc, CTextRun **ppTextRun ); + MERGERESULT Concatenate( CTextRun *pTextRun, bool fConcatAfter ); + HRESULT CorrectPhraseEltsAndRange( bool fForward, bool *pfCorrectionResult = NULL ); + // Adjust the phrase element members + // and the range so that they are + // consistent + + // Alternates methods + HRESULT GetAlternatesText( ITextRange *pRangeForAlts, + ULONG ulRequestCount, + long *plAltStart, + long *plAltEnd, + WCHAR **ppszCoMemText, + bool *apfFitsInRun, + ULONG *pcPhrasesReturned ); + // Get the text of the alternates + // for the closest range possible + HRESULT GetAltEndpoints( ULONG ulAlt, + long *plReplaceStart, + long *plReplaceEnd ); + // Get the start and end of the + // range that would be replaced by + // alternate ulAlt from the last time + // GetAlternatesText() was called + HRESULT ChooseAlternate( ULONG ulAlt ); + // Choose alternate number ulAlt + // from the last time GetAlternatesText() + // was called + void DoneWithAlternates() { m_fAltsGotten = false; } + // Called when the last set of alternates + // obtained is no longer needed + HRESULT OnAlternateCommit( ULONG ulFirstEltToBeReplaced, ULONG cEltsToBeReplaced, + ULONG cElementsInPhraseAfterCommit ); + // Called right before an alternate + // is committed somewhere in the + // associated result object's phrase + + + // Playback methods + HRESULT Speak( ISpVoice &rVoice ); // Speak the entire block + HRESULT Speak( ISpVoice &rVoice, long *plStart, long *plEnd ); + // Speak part of the block + + // Serialization method + HRESULT Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ); + // Write the phrase blob to a stream + + // Display attributes methods + HRESULT IsConsumeLeadingSpaces( const long lPos, bool *pfConsumeLeadingSpaces ); + // Do leading spaces need to be + // consumed at lPos? + HRESULT HowManySpacesAfter( const long lPos, UINT *puiSpaces ); + // How many spaces would need to be + // at lPos if new text were inserted there? + + bool IsDict() { return true; }; + + + + private: + HRESULT FindNearestWholeElementRange( long lStart, + long lEnd, + long *plResultStart, + long *plResultEnd, + ULONG *pulStartElement, + ULONG *pcElements ); + // Finds the nearest range containing + // pRange that contains entire elements + + // data members + private: + + ULONG m_ulStartElement; // Where in the RecoResult this dictation run starts + ULONG m_cElements; // How many elements are in this run + + bool m_fAltsGotten; // Whether alternates have been requested for some range + // of elements + ULONG m_ulStartAltElt; // These two members indicate the range of elements + ULONG m_cAltElt; // for which alternates were last requested + + CPhraseReplacement *m_pPhraseReplacement; // Phrase replacement (ITN) info + ULONG *m_pulElementOffsets; // Where each element starts + // relative to the start of the range + CResultContainer *m_pResultContainer; // Holds the result object +}; + + +// Helper functions + +bool ContainsNonWhitespace( const WCHAR *pwsz );// Return true iff some + // character in the string + // is not whitespace + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictmode.xml b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictmode.xml new file mode 100644 index 00000000..60be24ef --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictmode.xml @@ -0,0 +1,15 @@ + + + + + + + + + +

command

+

computer

+
+
+ +
diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.cpp new file mode 100644 index 00000000..fcd530be --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.cpp @@ -0,0 +1,2135 @@ +/****************************************************************************** +* dictpad.cpp +* This file contains the entry point for the Dictpad application +* and some of the definitions for methods of CDictationPad, the +* main object. +* dictpad_sapi.cpp contains the methods of CDictationPad that +* pertain to the SAPI interfaces used in this app. +* +* Copyright (c) 2001 Microsoft Corporation. All Rights Reserved. +******************************************************************************/ + +#include "stdafx.h" +#include +#include +#include +#include "dictpad.h" + +// Stream names for saving and opening Dictpad files +#define DICTPAD_TEXT L"dictpad_text" +#define DICTPAD_RECORESULTS L"dictpad_recoresults" + +/************************************************************************ +* WinMain() * +*-----------* +* Description: +* Main entry point for the application +**************************************************************************/ +int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow ) +{ + int iRet = 0; + HRESULT hr = CoInitialize( NULL ); + if( SUCCEEDED( hr ) ) + { + CDictationPad *pDictPad = new CDictationPad( hInstance ); + if( pDictPad ) + { + if ( pDictPad->Initialize( nCmdShow, lpCmdLine ) ) + { + iRet = pDictPad->Run(); + } + + delete pDictPad; + } + CoUninitialize(); + } + + return iRet; +} /* WinMain */ + +/**************************************************************************** +* CDictationPad::CDictationPad() * +*--------------------------------* +* Description: +* Constructor +*****************************************************************************/ +CDictationPad::CDictationPad( HINSTANCE hInst ) : + m_hAccelTable( NULL ), + m_hInst( hInst ), + m_hRtfLib( NULL ), + m_hEdit( NULL ), + m_hToolBar( NULL ), + m_hStatusBar( NULL ), + m_hFont( NULL ), + m_hAltsButton( NULL ), + m_dwFlags( DP_SHARED_RECOGNIZER ), + m_ullDictInterest( +#ifdef _DEBUG + // Dictpad doesn't actually need SOUND_START + // or SOUND_END + SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | +#endif + SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | + SPFEI(SPEI_RECO_OTHER_CONTEXT) | + SPFEI(SPEI_FALSE_RECOGNITION) | SPFEI(SPEI_HYPOTHESIS) | + SPFEI(SPEI_INTERFERENCE) | SPFEI(SPEI_RECO_STATE_CHANGE) ), + m_ullCCInterest( SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | + SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | + SPFEI(SPEI_INTERFERENCE) | SPFEI(SPEI_RECO_STATE_CHANGE) ), + m_pCandidateList( NULL ), + m_pszFile( NULL ) +{ + // Zero out the various STRUCTs we are using + memset( (void *) &m_LastSelInfo, 0, sizeof( SELINFO ) ); + memset( (void *) &m_CurSelInfo, 0, sizeof( SELINFO ) ); + memset( (void *) &m_SpeakInfo, 0, sizeof( SPEAKINFO ) ); +} + +/**************************************************************************** +* CDictationPad::~CDictationPad() * +*---------------------------------* +* Description: +* Destructor +*****************************************************************************/ +CDictationPad::~CDictationPad() +{ + // Release the richedit/TOM objects. These need to be released before + // the RTF library gets freed. + m_cpRichEdit = NULL; + m_cpTextDoc = NULL; + m_cpTextSel = NULL; + + // Delete objects we have new-ed + if ( m_pTextRunList ) + { + delete m_pTextRunList; + } + if ( m_pCandidateList ) + { + delete m_pCandidateList; + } + if ( m_pRecoEventMgr ) + { + delete m_pRecoEventMgr; + } + + if( m_hFont ) + { + ::DeleteObject( m_hFont ); + } + if( m_hRtfLib ) + { + ::FreeLibrary( m_hRtfLib ); + } +} + +/**************************************************************************** +* CDictationPad::Initialize * +*---------------------------* +* Description: +* Set up the windows, as well as the RichEdit objects. +* Calls InitializeSAPIObjs, which in initializes the SAPI objects +* and sets up notification for SAPI events. +*****************************************************************************/ +BOOL CDictationPad::Initialize( int nCmdShow, LPSTR lpCmdLine ) +{ + TCHAR szTitle[MAX_LOADSTRING]; // The title bar text + TCHAR szWindowClass[MAX_LOADSTRING]; + BOOL bRet = false; // assume failure + + // Initialize window strings + ::LoadString( m_hInst, IDS_APP_TITLE, szTitle, MAX_LOADSTRING ); + ::LoadString( m_hInst, IDC_DICTPAD, szWindowClass, MAX_LOADSTRING ); + + // register our window class + WNDCLASSEX wcex; + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = m_hInst; + wcex.hIcon = ::LoadIcon(m_hInst, (LPCTSTR)IDI_DICTPAD); + wcex.hCursor = ::LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = (LPCTSTR)IDC_DICTPAD; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = ::LoadIcon( wcex.hInstance, (LPCTSTR)IDI_SMALL ); + ATOM atomRet = ::RegisterClassEx( &wcex ); + + HRESULT hr = E_FAIL; + if( atomRet ) + { + // Set up the text run list and the reco event manager + m_pTextRunList = new CTextRunList(); + m_pRecoEventMgr = new CRecoEventMgr( m_hInst ); + if ( !m_pTextRunList || !m_pRecoEventMgr ) + { + return false; + } + + // Load DLL for Rich Edit 3.0 + m_hRtfLib = LoadLibrary( _T("RICHED20.DLL") ); + + // Create the main application window + m_hClient = ::CreateWindow( szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, m_hInst, this ); + + // The richedit window (m_hEdit) will have been created by the WM_CREATE + // message-handling in the WNDPROC for the main window + if( m_hClient && m_hEdit ) + { + // Set interest in various events from the richedit control + ::SendMessage( m_hEdit, EM_SETEVENTMASK, 0, + ENM_KEYEVENTS | ENM_MOUSEEVENTS | ENM_CHANGE | ENM_UPDATE | ENM_SELCHANGE | ENM_SCROLL ); + + // Show the window if it is supposed to be shown upon startup + ::ShowWindow( m_hClient, nCmdShow ); + + // Update the window so that the window is drawn without having to + // wait for all of the SAPI initialization + ::UpdateWindow( m_hClient ); + + // Accelerators + m_hAccelTable = ::LoadAccelerators( m_hInst, (LPCTSTR)IDC_DICTPAD ); + + // Get the TOM objects (an ITextDocument and an ITextSelection) + // from the richedit control + ::SendMessage( m_hEdit, EM_GETOLEINTERFACE, 0, (LPARAM)(LPVOID FAR *)&m_cpRichEdit ); + if ( !m_cpRichEdit ) + { + ::MessageBox( m_hClient, _T("Error getting the RichEdit interface"), NULL, MB_OK ); + return false; + } + hr = m_cpRichEdit->QueryInterface( IID_ITextDocument, (void**)&m_cpTextDoc ); + if( SUCCEEDED( hr ) ) + { + // Hand the pointer to the ITextDocument for this document to the + // data members that need that pointer. + m_pTextRunList->SetTextDoc( m_cpTextDoc ); + + hr = m_cpTextDoc->GetSelection( &m_cpTextSel ); + } + else + { + ::MessageBox( m_hClient, _T("Error getting ITextDocument"), NULL, MB_OK ); + } + + if ( SUCCEEDED( hr ) ) + { + // Hand the pointer to the TOM objects for this document to the + // data members that need that pointer. + m_pRecoEventMgr->SetTextSel( m_cpTextSel ); + m_pCandidateList->SetTextSel( m_cpTextSel ); + } + else + { + ::MessageBox( m_hClient, _T("Error getting ITextSelection"), NULL, MB_OK ); + } + + + // Do the initialization of SAPI objects + if ( SUCCEEDED( hr ) ) + { + hr = InitializeSAPIObjs(); + } + } + } + + if ( FAILED( hr ) ) + { + // Bail, since some initialization did not happen correctly + ::MessageBox( m_hClient, _T("Cannot initialize Dictpad; exiting."), NULL, MB_OK ); + ::DestroyWindow( m_hClient ); + } + + if ( SUCCEEDED( hr ) && lpCmdLine && *lpCmdLine ) + { + // lpInitialFileName will come surrounded by quotation marks, + // which we need to strip off + USES_CONVERSION; + TCHAR *pszFileName = _tcsdup( A2T(lpCmdLine) ); + if ( !pszFileName ) + { + return E_OUTOFMEMORY; + } + TCHAR *pchBeginQuote = _tcschr( pszFileName, _T('\"') ); + if ( pchBeginQuote ) + { + // Copy everything after the first quote + _tcscpy( pszFileName, pchBeginQuote + 1 ); + + TCHAR *pchEndQuote = _tcschr( pszFileName, _T('\"') ); + if ( pchEndQuote ) + { + // Cut it off at the end quote + *pchEndQuote = 0; + } + } + + hr = DoFileOpen( pszFileName ); + + free( pszFileName ); + } + + return SUCCEEDED( hr ); +} /* CDictationPad::Initialize */ + +/**************************************************************************************** +* CDictationPad::Run() * +*----------------------* +* Description: +* Contains the message loop for the application +*****************************************************************************************/ +int CDictationPad::Run() +{ + // Main message loop: + MSG msg; + while( ::GetMessage( &msg, NULL, 0, 0 ) ) + { + if( !::TranslateAccelerator( m_hClient, m_hAccelTable, &msg ) ) + { + ::TranslateMessage( &msg ); + ::DispatchMessage( &msg ); + } + } + + return msg.wParam; +} /* CDictationPad::Run */ + + +/***************************************************************************************** +* CDictationPad::WndProc() * +*--------------------------* +* Description: +* Main message handler for Dictpad. +******************************************************************************************/ +LRESULT CALLBACK CDictationPad::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + int wmId, wmEvent; + HRESULT hr; + HMENU hMenu; + + // The CDictationPad object was set to be the USERDATA in the window long + // associated with this window when WM_CREATE was called + CDictationPad * pThis = (CDictationPad *)::GetWindowLong( hWnd, GWL_USERDATA ); + + switch( message ) + { + case WM_CREATE : + { + // store pointer to the object that created this window + pThis = (CDictationPad *)(((LPCREATESTRUCT)lParam)->lpCreateParams); + _ASSERTE(pThis); + ::SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis); + + // This call draws the toolbar buttons, gets the richedit control, etc. + if ( !( pThis->InitializeWindow( hWnd ) ) ) + { + ::DestroyWindow( hWnd ); + break; + } + + ::SetFocus( pThis->m_hEdit ); + + // Indicate whether whole words are being selected + hMenu = ::GetMenu( hWnd ); + ::CheckMenuItem( hMenu, IDM_WHOLE_WORDS, + (pThis->m_dwFlags & DP_WHOLE_WORD_SEL) ? MF_CHECKED : MF_UNCHECKED ); + + // Set the appropriate menu info for the type of engine + ::CheckMenuItem( hMenu, IDM_SHAREDENGINE, + (pThis->m_dwFlags & DP_SHARED_RECOGNIZER) ? MF_CHECKED : MF_UNCHECKED ); + + //--- get us into dictation mode + ::SendMessage( hWnd, WM_COMMAND, IDM_DICTATION_MODE, 0 ); + + break; + } + + case WM_SIZE: + { + // If the frame changes size, change the size of the edit control, + // taking the toolbar & status bar into consideration + RECT r; + ::GetWindowRect( pThis->m_hToolBar, &r ); + LONG lToolBarHeight = r.bottom - r.top; + + ::GetWindowRect( pThis->m_hStatusBar, &r ); + LONG lStatusBarHeight = r.bottom - r.top; + + ::SetWindowPos( pThis->m_hToolBar, hWnd, 0, 0, LOWORD(lParam), + lToolBarHeight, SWP_NOMOVE | SWP_NOZORDER ); + ::SetWindowPos( pThis->m_hEdit, hWnd, 0, 0, LOWORD(lParam), + HIWORD(lParam) - lToolBarHeight - lStatusBarHeight, + SWP_NOMOVE | SWP_NOZORDER ); + ::SetWindowPos( pThis->m_hStatusBar, hWnd, 0, + HIWORD(lParam) - lStatusBarHeight, LOWORD(lParam), lStatusBarHeight, + SWP_NOZORDER ); + break; + } + + case WM_COMMAND: + // If the SR engine is currently cranking, then save this message for later + if ( pThis->m_pRecoEventMgr->IsProcessingPhrase() ) + { + // The message will get handled later, when the result comes back + pThis->m_pRecoEventMgr->QueueCommand( hWnd, message, wParam, lParam ); + break; + } + + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + + // Look for notifications from the edit control about gaining and losing + // input focus + if ( ((HWND) lParam) == pThis->m_hEdit ) + { + switch ( wmEvent ) + { + case EN_KILLFOCUS: + if ( pThis->m_dwFlags & DP_DICTATION_MODE ) + { + // Turn off the "mic" + pThis->SetGrammarState( false ); + } + break; + + case EN_SETFOCUS: + if ( pThis->m_dwFlags & DP_DICTATION_MODE ) + { + // Restore the "mic" to its state when we last lost focus + pThis->SetGrammarState( pThis->m_dwFlags & DP_MICROPHONE_ON ); + } + + // Trigger an update so that the alternates button appears + // if appropriate + pThis->m_hAltsButton = pThis->m_pCandidateList->Update( + pThis->m_pTextRunList ); + break; + } + break; + } + + + // Handle menu item selections + switch (wmId) + { + //---------------------- + // FILE + //---------------------- + case ID_FILE_NEW: + { + hr = pThis->DoFileNew(); + if ( FAILED( hr ) ) + { + MessageBoxFromResource( hWnd, IDS_CANNOTFILENEW, NULL, MB_ICONEXCLAMATION ); + ::DestroyWindow( hWnd ); + } + + break; + } + case ID_FILE_OPEN: + { + hr = pThis->DoFileOpen( NULL ); + + if ( FAILED( hr ) ) + { + MessageBoxFromResource( hWnd, IDS_CANNOTOPEN, NULL, MB_ICONEXCLAMATION ); + + // Open a new file instead + ::SendMessage( pThis->m_hClient, WM_COMMAND, ID_FILE_NEW, 0 ); + } + + break; + } + + case ID_FILE_SAVE: + case ID_FILE_SAVEAS: + { + if ( (ID_FILE_SAVE == wmId) && pThis->m_pszFile ) + { + // The file already has a name. + // Just save under the existing name + hr = pThis->DoFileSave(); + } + else + { + // Need to get a name + hr = pThis->DoFileSaveAs(); + } + + if (FAILED(hr)) + { + TCHAR pszCaptionText[ MAX_LOADSTRING ]; + ::LoadString( pThis->m_hInst, IDS_CANNOTSAVE, + pszCaptionText, MAX_LOADSTRING ); + + if (STG_E_ACCESSDENIED == hr) + { + // The user has a readonly file open + MessageBoxFromResource( hWnd, IDS_ACCESSDENIED, pszCaptionText, + MB_ICONEXCLAMATION ); + + // Ask user to save under a different name + ::SendMessage( pThis->m_hClient, WM_COMMAND, ID_FILE_SAVEAS, 0 ); + } + else + { + MessageBoxFromResource( hWnd, IDS_ERRORSAVING, pszCaptionText, + MB_ICONEXCLAMATION ); + } + } + + // Return 1 only if we saved the file + return (S_OK == hr); + + break; + } + + case IDM_EXIT: + ::SendMessage( hWnd, WM_CLOSE, 0, 0 ); + break; + + case ID_EDIT_CUT: + // Cut the selected text to the clipboard + pThis->m_cpTextSel->Cut( NULL ); + break; + + case ID_EDIT_COPY: + // Copy the selected text to the clipboard + pThis->m_cpTextSel->Copy( NULL ); + break; + + case ID_EDIT_PASTE: + // Paste the text from the clipboard into the document + + // This flag will be used when the selection changed is processed. + // It will indicate that there is new text present, even if the + // length of the text in the document has not changed. + pThis->m_dwFlags |= DP_JUST_PASTED_TEXT; + pThis->m_cpTextSel->Paste( NULL, 0 ); + pThis->m_dwFlags &= ~DP_JUST_PASTED_TEXT; + break; + + case IDM_FONT: + { + LOGFONT lf; + CHOOSEFONT cf; + ZeroMemory( &cf, sizeof(cf) ); + cf.lStructSize = sizeof(cf); + cf.lpLogFont = &lf; + cf.Flags = CF_SCREENFONTS; + if( ::ChooseFont( &cf ) ) // Display the choose font dialog + { + ::DeleteObject( (HGDIOBJ)pThis->m_hFont ); + pThis->m_hFont = ::CreateFontIndirect( &lf ); + ::SendMessage( pThis->m_hEdit, WM_SETFONT, (WPARAM)pThis->m_hFont, MAKELPARAM(true, 0) ); + ::SetFocus( pThis->m_hEdit ); + } + } + break; + + case IDM_DICTATION_MODE: + case IDM_COMMAND_MODE: + // Choose between dictation mode and command mode + hr = pThis->SetMode( IDM_DICTATION_MODE == wmId ); + if (FAILED(hr)) + { + MessageBoxFromResource( hWnd, IDS_CANNOTSWITCHMODES, NULL, + MB_ICONEXCLAMATION ); + } + break; + + case IDM_VOICE_TRAINING: + { + // Brings up the SR-engine-specific user training UI + pThis->m_cpRecoEngine->DisplayUI(hWnd, NULL, SPDUI_UserTraining, NULL, 0); + } + break; + + case IDM_MICROPHONE_SETUP: + { + // Brings up the SR-engine-specific mic training UI + pThis->m_cpRecoEngine->DisplayUI(hWnd, NULL, SPDUI_MicTraining, NULL, 0); + } + break; + + case IDM_ADDREMOVEWORDS: + // Brings up the SR-engine-specific Add/Remove Words UI + pThis->RunAddDeleteUI(); + break; + + case IDM_MODE_TOGGLE: + // Toggles between dictation mode and command mode + hMenu = ::GetMenu( hWnd ); + if( pThis->m_dwFlags & DP_DICTATION_MODE ) + { + ::SendMessage( hWnd, WM_COMMAND, IDM_COMMAND_MODE, 0 ); + } + else + { + ::SendMessage( hWnd, WM_COMMAND, IDM_DICTATION_MODE, 0 ); + } + break; + + case IDM_WHOLE_WORDS: + // Toggles between selecting whole words and normal selection + hMenu = ::GetMenu( hWnd ); + if( pThis->m_dwFlags & DP_WHOLE_WORD_SEL ) + { + pThis->m_dwFlags &= ~DP_WHOLE_WORD_SEL; + ::CheckMenuItem( hMenu, IDM_WHOLE_WORDS, MF_UNCHECKED ); + } + else + { + pThis->m_dwFlags |= DP_WHOLE_WORD_SEL; + ::CheckMenuItem( hMenu, IDM_WHOLE_WORDS, MF_CHECKED ); + } + break; + + case IDM_SHAREDENGINE: + // Toggles between inproc reco engine and shared reco engine + hMenu = ::GetMenu( hWnd ); + if ( pThis->m_dwFlags & DP_SHARED_RECOGNIZER ) + { + pThis->m_dwFlags &= ~DP_SHARED_RECOGNIZER; + ::CheckMenuItem( hMenu, IDM_SHAREDENGINE, MF_UNCHECKED ); + } + else + { + pThis->m_dwFlags |= DP_SHARED_RECOGNIZER; + ::CheckMenuItem( hMenu, IDM_SHAREDENGINE, MF_CHECKED ); + } + + // When the reco engine changes, all of the SAPI objects need + // to be unplugged and reinitialized. + if ( FAILED(pThis->InitializeSAPIObjs()) ) + { + // New SAPI objects couldn't get set up: need to bail + ::DestroyWindow( hWnd ); + } + break; + + case IDM_PLAY: + // if we're already speaking then stop + if( pThis->m_dwFlags & DP_IS_SPEAKING ) + { + pThis->EndSpeaking(); + } + else + { + pThis->DoPlay(); + } + break; + + case IDM_MIC_TOGGLE: + { + DWORD dwOldFlags = pThis->m_dwFlags; + if ( !(pThis->m_dwFlags & DP_GRAMMARS_ACTIVE) ) + { + // If the user sees the microphone button not pressed and tries + // to press it, the grammars should be activated regardless + // of what the state is + pThis->m_dwFlags |= DP_MICROPHONE_ON; + } + else + { + // Flip the microphone flag + pThis->m_dwFlags ^= DP_MICROPHONE_ON; + } + + if ( pThis->m_dwFlags & DP_MICROPHONE_ON ) + { + // Since the grammars are active, we want the dictation + // window to have the input focus + ::SetFocus( pThis->m_hEdit ); + } + + // Set the microphone accordingly + hr = pThis->SetGrammarState( pThis->m_dwFlags & DP_MICROPHONE_ON ); + + if ( FAILED( hr ) ) + { + // Couldn't do this: switch the microphone flag back + pThis->m_dwFlags = dwOldFlags; + } + + break; + } + + case IDM_ABOUT: + ::DialogBox( pThis->m_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About ); + break; + + default: + return ::DefWindowProc( hWnd, message, wParam, lParam ); + } + + break; + + case WM_KILLFOCUS: + OutputDebugString( _T("Kill focus\r\n") ); + + if ( pThis->m_dwFlags & DP_DICTATION_MODE ) + { + // No focus, no microphone + pThis->SetGrammarState( false ); + } + break; + + case WM_CLOSE: + if ( S_OK == pThis->DoFileClose() ) + { + ::DestroyWindow( hWnd ); + } + break; + + case WM_DESTROY: + ::PostQuitMessage( 0 ); + break; + + // The following three window messages were defined by the call to + // ISpNotifyTranslator::InitWindowMessage() in + // CDictationPad::InitSAPICallback (see dictpad_sapi.cpp) to be + // the messages this window receives whenever SAPI wants to + // notify us of one of the events in which we said we were interested + + case WM_DICTRECOEVENT: + { + // Something happened with the dictation recognition context + bool fSuccess = pThis->SRDictEventHandler(); + + // We expect this to succeed; otherwise exit + _ASSERTE( fSuccess ); + if ( !fSuccess ) + { + MessageBoxFromResource( hWnd, IDS_UPDATEERROR, + NULL, MB_ICONEXCLAMATION ); + ::SendMessage( hWnd, WM_CLOSE, 0, 0 ); + } + break; + } + + case WM_CCRECOEVENT: + // Something happened with the command-and-control reco context + pThis->SRCCEventHandler(); + break; + + case WM_TTSEVENT: + // Some TTS event happened + pThis->TTSEventHandler(); + break; + + // The following two messages have to do with "updating", which is + // Dictpad's way of dealing with selection changes in the richedit + // control (which is how Dictpad knows that the text in the document + // has changed + + case WM_STOPUPDATE: + pThis->m_dwFlags |= DP_SKIP_UPDATE; + break; + + case WM_STARTUPDATE: + pThis->m_dwFlags &= ~DP_SKIP_UPDATE; + break; + + case WM_UPDATEALTSBUTTON: + pThis->m_hAltsButton = pThis->m_pCandidateList->Update( pThis->m_pTextRunList ); + break; + + // Notifications from the richedit control + case WM_NOTIFY: + + // Set the tooltips if that is what this notification is about + pThis->SetTooltipText( lParam ); + + switch ( ((LPNMHDR)lParam)->code) + { + case EN_MSGFILTER: + { + MSGFILTER *pMsgFilter = (MSGFILTER*)lParam; + pThis->ProcessMsgFilter( pMsgFilter ); + break; + } + + case EN_SELCHANGE: + // Selection has changed; Dictpad needs to update + // its state + hr = pThis->ProcessSelChange( (SELCHANGE *) lParam ); + + // We expect this to succeed; otherwise exit + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + MessageBoxFromResource( hWnd, IDS_UPDATEERROR, + NULL, MB_ICONEXCLAMATION ); + ::SendMessage( hWnd, WM_CLOSE, 0, 0 ); + } + break; + } + break; + + + default: + return ::DefWindowProc( hWnd, message, wParam, lParam ); + break; + } + return 0; +} /* CDictationPad::WndProc */ + + +/**************************************************************************************** +* CDictationPad::InitializeWindow() * +*-----------------------------------* +* Description: +* Sets up and creates the application window, along with the toolbar, +* status bar, and richedit control. +* In order for the alternates list UI to trap window messages from +* the richedit control, we subclass the richedit control so that it +* actually uses the WndProc in candidatelist.cpp +* Return: +* TRUE iff successful +*****************************************************************************************/ +BOOL CDictationPad::InitializeWindow( HWND hWnd ) +{ + // Create a toolbar + m_hToolBar = ::CreateToolbarEx( hWnd, WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS, + IDR_TOOLBAR, 5, m_hInst, IDR_TOOLBAR, NULL, 0, 0, 0, 0, 0, sizeof(TBBUTTON) ); + if ( !m_hToolBar ) + { + return FALSE; + } + + // add the buttons + TBBUTTON tbButtons[5]; + + tbButtons[0].iBitmap = 0; + tbButtons[0].idCommand = IDM_DICTATION_MODE; + tbButtons[0].fsState = TBSTATE_ENABLED; + tbButtons[0].fsStyle = TBSTYLE_BUTTON; + tbButtons[0].dwData = 0; + tbButtons[0].iString = 0; + + tbButtons[1].iBitmap = 1; + tbButtons[1].idCommand = IDM_COMMAND_MODE; + tbButtons[1].fsState = TBSTATE_ENABLED; + tbButtons[1].fsStyle = TBSTYLE_BUTTON; + tbButtons[1].dwData = 0; + tbButtons[1].iString = 0; + + tbButtons[2].iBitmap = 0; + tbButtons[2].idCommand = 0; + tbButtons[2].fsState = TBSTATE_ENABLED; + tbButtons[2].fsStyle = TBSTYLE_SEP; + tbButtons[2].dwData = 0; + tbButtons[2].iString = 0; + + tbButtons[3].iBitmap = 2; + tbButtons[3].idCommand = IDM_PLAY; + tbButtons[3].fsState = TBSTATE_ENABLED; + tbButtons[3].fsStyle = TBSTYLE_BUTTON; + tbButtons[3].dwData = 0; + tbButtons[3].iString = 0; + + tbButtons[4].iBitmap = 3; + tbButtons[4].idCommand = IDM_MIC_TOGGLE; + tbButtons[4].fsState = TBSTATE_ENABLED; + tbButtons[4].fsStyle = TBSTYLE_BUTTON; + tbButtons[4].dwData = 0; + tbButtons[4].iString = 0; + + + ::SendMessage( m_hToolBar, TB_ADDBUTTONS, 5, (LONG)tbButtons ); + ::SendMessage( m_hToolBar, TB_AUTOSIZE, 0, 0 ); + + // Create a status bar + m_hStatusBar = ::CreateStatusWindow( WS_CHILD | WS_VISIBLE, NULL, hWnd, IDC_STATUSBAR ); + if ( !m_hStatusBar ) + { + return FALSE; + } + + // Set up the candidate list UI manager. + // This will register a window class to which our richedit control should belong + m_pCandidateList = new CCandidateList( hWnd, *m_pRecoEventMgr ); + if ( !m_pCandidateList ) + { + return FALSE; + } + + // Create a rich edit control from the candidate UI object's registered parent class + + // The richedit control should fill the client area, taking the toolbar & status bar + // into consideration + POINT ptToolBar; + RECT r; + LONG lToolBarHeight; + LONG lStatusBarHeight; + ::GetWindowRect( m_hToolBar, &r ); + lToolBarHeight = r.bottom - r.top; + ptToolBar.x = r.left; + ptToolBar.y = r.bottom; + ::ScreenToClient( hWnd, &ptToolBar ); + + ::GetWindowRect( m_hStatusBar, &r ); + lStatusBarHeight = r.bottom - r.top; + + ::GetClientRect (hWnd, &r); + + // Get the modified richedit window class registered by m_pCandidateList + const WNDCLASS *pwcEditWindowClass = m_pCandidateList->GetParentClass(); + if ( pwcEditWindowClass ) + { + // Create the modified richedit control. + // We pass the candidate UI manager in as lParam + m_hEdit = ::CreateWindowEx( WS_EX_CLIENTEDGE, + pwcEditWindowClass->lpszClassName, + _T(""), + WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE | + WS_VSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL, + 0, + ptToolBar.y, r.right, + ( r.bottom - ( lToolBarHeight + lStatusBarHeight ) ), + + hWnd, + (HMENU)1, + m_hInst, + (LPVOID) m_pCandidateList ); + } + + if ( !m_hEdit ) + { + return FALSE; + } + + return TRUE; +} /* CDictationPad::InitializeWindow() */ + +/**************************************************************************************** +* CDictationPad::SetTooltipText() * +*---------------------------------* +* Description: +* Puts the appropriate tooltip text into the LTOOLTIPTEXT struct pointed to +* by lParam. +******************************************************************************************/ +void CDictationPad::SetTooltipText( LPARAM lParam ) +{ + LPTOOLTIPTEXT pToolTipText; + static TCHAR szBuffer[64]; + + pToolTipText = (LPTOOLTIPTEXT)lParam; + if( pToolTipText->hdr.code == TTN_NEEDTEXT ) + { + ::LoadString( m_hInst, pToolTipText->hdr.idFrom, szBuffer, sizeof(szBuffer) ); + pToolTipText->lpszText = szBuffer; + } +} /* CDictationPad::SetTooltipText */ + +/*************************************************************************************** +* CDictationPad::UpdateList * +*---------------------------* +* Description: +* Updates the TextRunList by inserting a TextRun that has the given range. +* This is called when the RichEdit control notifies us of some change to the +* text. The node added to the TextRunList is to be a TextRun -- not a +* DictationRun -- since the case of dictated text is handled separately in +* ProcessDictation() +* Return: +* Return value of CTextRunList::Insert() +****************************************************************************************/ +HRESULT CDictationPad::UpdateList( long lStart, long lEnd ) +{ + _ASSERTE( m_pTextRunList ); + + // Create a new CTextRun for the text in the range lStart->lEnd + CTextRun *pTextRun = new CTextRun(); + if ( !pTextRun ) + { + return E_OUTOFMEMORY; + } + + // Create a range for that text. + CComPtr pTextRange; + HRESULT hr = m_cpTextDoc->Range( lStart, lEnd, &pTextRange ); + if ( FAILED(hr) ) + { + return hr; + } + + // Hand the range to the pTextRun + pTextRun->SetTextRange( pTextRange ); + + // Any text entering the TextRunList should be the normal font. + // This is necessary in the case of typing and hypotheses occurring + // in the same place at the same time in the text. + CComPtr cpFont; + hr = pTextRange->GetFont( &cpFont ); + if ( SUCCEEDED( hr ) ) + { + cpFont->SetForeColor( tomAutoColor ); + pTextRange->SetFont( cpFont ); + } + + // Insert the new CTextRun into the TextRunList + hr = m_pTextRunList->Insert( pTextRun ); + + // The alternate UI needs to be notified of this change + if ( SUCCEEDED( hr ) && m_pCandidateList ) + { + m_hAltsButton = m_pCandidateList->Update( m_pTextRunList ); + } + + return hr; +} /* CDictationPad::UpdateList */ + +/**************************************************************************************** +* CDictationPad::ProcessMsgFilter() * +*-----------------------------------* +* Description: +* Called whenever one of the events that we set in our event mask +* for the edit window happened +******************************************************************************************/ +void CDictationPad::ProcessMsgFilter( MSGFILTER *pMsgFilter ) +{ + switch( pMsgFilter->msg ) + { + case WM_CHAR: + { + switch( pMsgFilter->wParam ) + { + case VK_BACK: + if( m_dwFlags & DP_WHOLE_WORD_SEL ) + { + // Delete whole words at a time + + // Use the information on the last selection + // to see whether a selected range was being deleted + // or whether the selection was an IP + long lStart = m_LastSelInfo.selchange.chrg.cpMin; + long lEnd = m_LastSelInfo.selchange.chrg.cpMax; + if ( lStart == lEnd ) + { + // Select and then delete the current word + m_cpTextSel->MoveStart( tomWord, -1, NULL ); + m_cpTextSel->MoveEnd( tomWord, 1, NULL ); + m_cpTextSel->Delete(tomWord, 0, NULL); + } + } + break; + + case VK_ESCAPE: + if ( m_dwFlags & DP_IS_SPEAKING ) + { + // Esc stops a playback + EndSpeaking(); + } + break; + + default: + break; + } + break; + } + case WM_LBUTTONDOWN: + { + if( m_dwFlags & DP_WHOLE_WORD_SEL ) + { + // Mouse capture will expand the text selection to + // include whole words when the left button is back up + ::SetCapture( m_hClient ); + } + + else if ( m_dwFlags & DP_IS_SPEAKING ) + { + // Clicking anywhere in the document should kill the speak + EndSpeaking(); + } + + break; + } + case WM_LBUTTONUP: + { + if( m_dwFlags & DP_WHOLE_WORD_SEL ) + { + // Get the selection, expanded to whole words + ::ReleaseCapture(); + m_cpTextSel->Expand( tomWord, NULL ); + } + + break; + } + default: + break; + } +} /* CDictationPad::ProcessMsgFilter */ + +/**************************************************************************************** +* CDictationPad::ProcessSelChange() * +*-----------------------------------* +* Description: +* Called whenever there is an EN_SELCHANGE notification. Updates the state +* info and processes new non-dictated text. +* New text is detected by comparing the current state of the document +* against the state when this function was last called. +* Return: +* S_OK +* E_POINTER +* return value of CDictationPad::UpdateList() +******************************************************************************************/ +HRESULT CDictationPad::ProcessSelChange( SELCHANGE *pSelChange ) +{ + _ASSERTE( m_cpTextSel ); + if ( !pSelChange ) + { + return E_POINTER; + } + + // Store the previous selection info into m_LastSelInfo + // and the previous text length into lLastTextLen + m_LastSelInfo = m_CurSelInfo; + const long lLastTextLen = m_LastSelInfo.lTextLen; + + // Get the current selection info and document length + + m_CurSelInfo.selchange = *pSelChange; + + long lCurrentTextLen; + GETTEXTLENGTHEX gtl; + gtl.flags = GTL_PRECISE | GTL_NUMCHARS; + gtl.codepage = CP_ACP; + lCurrentTextLen = ::SendMessage( m_hEdit, + EM_GETTEXTLENGTHEX, (WPARAM) >l, 0 ); + m_CurSelInfo.lTextLen = lCurrentTextLen; + + // These variables are here for the purpose of clarity + const SELCHANGE lastSelChange = m_LastSelInfo.selchange; + const SELCHANGE curSelChange = m_CurSelInfo.selchange; + + // Move the alternates button to the new location + if ( !( m_dwFlags & DP_SKIP_UPDATE ) ) + { + m_hAltsButton = m_pCandidateList->Update( m_pTextRunList ); + } + + // The DP_SKIP_UPDATE flag is set when Dictpad is elsewhere making + // changes to the document (or moving around the selection) + // but handling the changes itself. + if (( m_dwFlags & DP_SKIP_UPDATE ) || ( m_dwFlags & DP_IS_SPEAKING )) + { + // Nothing needs to be done + return S_OK; + } + + // Tell the recoevent manager if the selection is being + // moved around, because it is possible that if an utterance + // is currently being processed that we may want it to appear + // here. + if ( lCurrentTextLen == lLastTextLen ) + { + m_dwFlags |= DP_SKIP_UPDATE; + HRESULT hr = m_pRecoEventMgr->SelNotify( *m_cpTextSel ); + m_dwFlags &= ~DP_SKIP_UPDATE; + if ( FAILED( hr ) ) + { + return hr; + } + } + + // Find out if this selection is editable (it is not if there is + // hypothesis text here) + CComPtr cpNextEditableRange; + if ( !(m_pRecoEventMgr->IsEditable( m_cpTextSel, &cpNextEditableRange )) ) + { + // Move the selection to an IP at the next point that can be edited + long lStart; + long lEnd; + if ( cpNextEditableRange ) + { + cpNextEditableRange->GetStart( &lStart ); + cpNextEditableRange->GetEnd( &lEnd ); + } + else + { + // This is an error: means IsEditable() ran out of memory + // (see recomgr.cpp) + lStart = lEnd = m_pTextRunList->GetTailEnd(); + } + ::SendMessage( m_hEdit, EM_SETSEL, lStart, lEnd ); + + // We can return now, since there is no way that text could have + // been added to a non-editable range + return S_OK; + } + + // The following works backwards to determine what must have happened since + // the last time this function was called and whether there is new text + // to deal with (or text that has been deleted). + + // Consider all combinations of {nondegenerate, degenerate} among the current + // selection and the last selection + HRESULT hr = E_FAIL; + if ( lastSelChange.chrg.cpMin == lastSelChange.chrg.cpMax ) + { + // Last selection was degenerate (an IP). + if ( lCurrentTextLen < lLastTextLen ) + { + // Something was deleted; insert the current (degenerate) range + long lStart; + long lEnd; + lStart = lEnd = curSelChange.chrg.cpMax; + hr = UpdateList( lStart, lEnd ); + } + else if ( lCurrentTextLen > m_LastSelInfo.lTextLen ) + { + // Something has been inserted. The start of the new text + // is the start of the old text selection, + // and the end of the new text is the end of the current + // text selection + long lStart = lastSelChange.chrg.cpMin;; + long lEnd = curSelChange.chrg.cpMax; + hr = UpdateList( lStart, lEnd ); + } + else + { + // If the text length has not changed, then no text was changed + hr = S_OK; + } + } + else + { + // Last selection was not degenerate. + + // The new text starts at the start of the last selection and ends at the + // end of the current selection (think about what happens when you + // highlight some text and type over it) + long lStart = lastSelChange.chrg.cpMin; + long lEnd = curSelChange.chrg.cpMax; + + // If the text length has stayed the same, unless we just did a paste, + // there is no new text to deal with + if (( lLastTextLen == lCurrentTextLen ) && !(m_dwFlags & DP_JUST_PASTED_TEXT) ) + { + return S_OK; + } + + // Something changed, so we need to update + hr = UpdateList( lStart, lEnd ); + } + + return hr; +} /* CDictationPad::ProcessSelChange */ + +/*************************************************************************************** +* CDictationPad::DoPlay * +*-----------------------* +* Description: +* Does a playback according to the following rules. +* If the selection is an IP: +* If it's at the end of the document, speak the entire document +* Otherwise speak from the IP until the end of the document. +* Otherwise speak the selection. +* Return: +* S_OK +* S_FALSE if there is nothing to speak +* Return value of CDictationRun::StartSpeaking() +* Return value of CTextRunList::Speak() +****************************************************************************************/ +HRESULT CDictationPad::DoPlay() +{ + _ASSERTE( m_cpTextSel && m_pTextRunList ); + + if ( m_pTextRunList->GetTailEnd() == 0 ) + { + // Nothing to speak + return S_FALSE; + } + + // Save the info on the selection so that we can restore it after + // tracking the spoken text. + // This will occur in CDictationPad::EndSpeaking() + long lSpeakStart = 0; + long lSpeakEnd = 0; + m_cpTextSel->GetStart( &lSpeakStart ); + m_cpTextSel->GetEnd( &lSpeakEnd ); + m_SpeakInfo.lSelStart = lSpeakStart; + m_SpeakInfo.lSelEnd = lSpeakEnd; + + if( lSpeakStart == lSpeakEnd ) // denotes insertion point + { + if ( lSpeakStart >= m_pTextRunList->GetTailEnd() ) + { + // IP is at the end of the document: + // Speak from beginning to end + lSpeakStart = 0; + } + // Else lSpeakStart is already correct + + // Speak all the way to the end + lSpeakEnd = m_pTextRunList->GetTailEnd(); + } + + // This will deactivate the grammars and set things up for + // a playback + HRESULT hr = StartSpeaking( lSpeakStart, lSpeakEnd ); + if ( S_OK != hr ) + { + EndSpeaking(); + return hr; + } + + // Do the playback. + // If we are in the middle of a word or a dictated phrase element, + // the endpoints of the speak will be expanded + hr = m_pTextRunList->Speak( *m_cpVoice, &lSpeakStart, &lSpeakEnd ); + if (S_OK != hr) + { + // Something went wrong, or there was nothing to speak; bail out + EndSpeaking(); + } + else + { + // If the start and end have been tweaked by m_pTextRunList->Speak(), + // then adjust them so that text tracking looks right + _ASSERTE( m_SpeakInfo.pSpeakRange ); + m_SpeakInfo.pSpeakRange->SetStart( lSpeakStart ); + m_SpeakInfo.pSpeakRange->SetEnd( lSpeakEnd ); + } + + return hr; + +} /* CDictationPad::DoPlay */ + +/*************************************************************************************** +* CDictationPad::StartSpeaking * +*------------------------------* +* Description: +* Called when a playback is about to begin. +* Initializes the speak info. +* Return: +* S_OK +* Return value of ITextDocument::Range() +* Return value of CDictationPad::SetGrammarState() +* Return value of ITextRange::Collapse() +****************************************************************************************/ +HRESULT CDictationPad::StartSpeaking( long lStartSpeakRange, long lEndSpeakRange ) +{ + // Stop being interested in SR events for the time being + SetSREventInterest( false ); + + // Cancel any current IME stuff + HIMC himc = ::ImmGetContext( m_hClient ); + ::ImmNotifyIME( himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 ); + + // Hide the alternates UI for the duration of the speak + m_pCandidateList->ShowButton( false ); + + // Tell the candidate list UI to turn off character input + m_pCandidateList->StartPlayback(); + + // Set the range for the playback state info + _ASSERTE( !m_SpeakInfo.pSpeakRange ); + HRESULT hr = m_cpTextDoc->Range( lStartSpeakRange, lEndSpeakRange, + &(m_SpeakInfo.pSpeakRange) ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Set the flag and the toolbar buttons + m_dwFlags |= DP_IS_SPEAKING; + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED | TBSTATE_PRESSED, 0 ) ); + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_MIC_TOGGLE, + MAKELONG( 0, 0 ) ); + + // Disable all the menu items + HMENU hMenu = ::GetMenu( m_hClient ); + int nItems = ::GetMenuItemCount( hMenu ); + for ( int i=0; i < nItems; i++ ) + { + ::EnableMenuItem( hMenu, i, MF_BYPOSITION | MF_GRAYED ); + } + ::DrawMenuBar( m_hClient ); + + // The focus will remain in the edit window. + // If the user types anything, it will just appear at the beginning + // of the spoken text. + + // Deactivate the grammars + hr = SetGrammarState( false ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Set the speak info + m_SpeakInfo.ulCurrentStream = 1; + m_SpeakInfo.pCurrentNode = + m_pTextRunList->Find( lStartSpeakRange ); + + _ASSERTE( !(lStartSpeakRange) || m_SpeakInfo.pCurrentNode ); + if ( lStartSpeakRange && !m_SpeakInfo.pCurrentNode ) + { + return E_UNEXPECTED; + } + + // Move the selection to an IP at the beginning of the selection for the + // time being (so that the highlighting can still be seen if the selection is + // nondegenerate. + m_cpTextSel->Collapse( tomStart ); + + return S_OK; +} /* CDictationPad::StartSpeaking */ + +/*************************************************************************************** +* CDictationPad::EndSpeaking * +*----------------------------* +* Description: +* Called when a playback has ended (whether it has +* ended on its own or by the user interrupting it. +* Restores the selection to what it was before +* the playback started +****************************************************************************************/ +void CDictationPad::EndSpeaking() +{ + // This forces the voice to stop speaking + m_cpVoice->Speak( NULL, SPF_PURGEBEFORESPEAK, NULL ); + + // Bring back the candidate list UI + m_pCandidateList->ShowButton( true ); + + // Set the flag and the toolbar buttons + m_dwFlags &= ~DP_IS_SPEAKING; + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_MIC_TOGGLE, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + + // Re-enable all the menu items + HMENU hMenu = ::GetMenu( m_hClient ); + int nItems = ::GetMenuItemCount( hMenu ); + for ( int i=0; i < nItems; i++ ) + { + ::EnableMenuItem( hMenu, i, MF_BYPOSITION | MF_ENABLED ); + } + ::DrawMenuBar( m_hClient ); + + // Restore the default background color + CComPtr cpFont; + HRESULT hr = m_SpeakInfo.pSpeakRange->GetFont( &cpFont ); + if ( SUCCEEDED( hr ) ) + { + cpFont->SetBackColor( tomAutoColor ); + m_SpeakInfo.pSpeakRange->SetFont( cpFont ); + } + + // Restore the selection to what it was before the playback started + m_cpTextSel->SetRange( m_SpeakInfo.lSelStart, + m_SpeakInfo.lSelEnd ); + + // If the selection is no longer visible, then scroll it into view + POINT pt; + hr = m_cpTextSel->GetPoint( tomEnd | TA_BOTTOM | TA_RIGHT, + &(pt.x), &(pt.y) ); + if ( hr == S_FALSE ) + { + // Out of view + m_cpTextSel->ScrollIntoView( tomStart ); + } + + // There is no current speaking node + m_SpeakInfo.pCurrentNode = NULL; + + // Release the current speaking range + m_SpeakInfo.pSpeakRange->Release(); + m_SpeakInfo.pSpeakRange = NULL; + + // Restore the input focus and place the candidate button in the + // appropriate place + ::SetFocus( m_hEdit ); + m_hAltsButton = m_pCandidateList->Update( m_pTextRunList ); + + // Restore the mic if it was on before the playback started + SetGrammarState( m_dwFlags & DP_MICROPHONE_ON ); + + // Re-allow character input + m_pCandidateList->EndPlayback(); + + // Become interested in SR events again + SetSREventInterest( true ); + +} /* CDictationPad::EndSpeaking */ + +/*************************************************************************************** +* CDictationPad::DoFileNew * +*--------------------------* +* Description: +* Opens a new file, closing any file that's already open. +* Return: +* S_OK +* S_FALSE if the user cancelled +* E_OUTOFMEMORY +* Return value of CDictationPad::DoFileClose() +* Return value of ITextDocument::New() +****************************************************************************************/ +HRESULT CDictationPad::DoFileNew() +{ + HRESULT hr = DoFileClose(); + if ( S_FALSE == hr ) + { + return S_FALSE; + } + + if ( S_OK == hr ) + { + // DoFileClose() better have deleted m_pTextRunList + // and m_pszFile + _ASSERTE( !m_pTextRunList && !m_pszFile ); + + // Notify m_cpTextDoc that this is a new file, + // and create a new CTextRunList off of m_cpTextDoc. + // Note that we do not want the current TextRunList updated, since + // we threw it away + m_dwFlags |= DP_SKIP_UPDATE; + hr = m_cpTextDoc->New(); + m_pTextRunList = new CTextRunList(); + m_dwFlags &= ~DP_SKIP_UPDATE; + + if ( !m_pTextRunList ) + { + return E_OUTOFMEMORY; + } + } + + // The TextRunList now uses a different ITextDocument + if ( SUCCEEDED( hr ) ) + { + m_pTextRunList->SetTextDoc( m_cpTextDoc ); + } + + return hr; + +} /* CDictationPad::DoFileNew */ + + +/*************************************************************************************** +* CDictationPad::DoFileOpen * +*---------------------------* +* Description: +* Opens the file whose full path is lpFileName, or if lpFileName is NULL +* gets the name by using the GetOpenFileName common control. +* Attempts to open the file in the Dictpad format +* (an IStorage with two IStreams, one for text, and one with the +* serialized TextRunList). +* Failing that, opens the file as text. +* Return: +* S_OK +* S_FALSE if the user cancelled +* E_FAIL if the GetOpenFileName() function fails +* Return value of CDictationPad::DoFileClose() +* Return value of ITextDocument::Open() +****************************************************************************************/ +HRESULT CDictationPad::DoFileOpen( LPTSTR lpFileName ) +{ + if ( !m_hClient ) + { + return E_FAIL; + } + + // Stop listening for dictation, and do not start listening + // again unless the user explicitly asks to do so + if ( m_dwFlags & DP_MICROPHONE_ON ) + { + ::SendMessage( m_hClient, WM_COMMAND, IDM_MIC_TOGGLE, 0 ); + } + + // Close whatever file is currently open + HRESULT hr; + if ( (hr = DoFileClose()) != S_OK ) + { + // User cancelled + return hr; + } + + if ( lpFileName ) + { + m_pszFile = _tcsdup( lpFileName ); + } + else + { + // Start an "Open" dialog box + TCHAR pszFileName[ MAX_PATH ]; + *pszFileName = 0; + OPENFILENAME ofn; + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + ZeroMemory( &ofn, ofnsize); + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hClient; + ofn.hInstance = m_hInst; + ofn.lpstrFilter = _T("Dictpad Files (*.dpd;*.txt)\0*.dpd;*.txt\0All Files (*.*)\0*.*\0\0"); + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = pszFileName; + ofn.nMaxFile = MAX_PATH; + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrFileTitle = NULL; + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = NULL; + ofn.Flags = OFN_CREATEPROMPT; + ofn.lpstrDefExt = _T("dpd"); + BOOL fSuccess = ::GetOpenFileName( &ofn ); + + if ( !fSuccess ) + { + // Check what caused fSuccess to be false + DWORD dwErr = ::CommDlgExtendedError(); + + if ( 0 == dwErr ) + { + // User cancelled the open + + // If there isn't a file currently open, then put up a new file + if ( !m_pszFile ) + { + hr = DoFileNew(); + } + + if ( FAILED( hr ) ) + { + return hr; + } + else + { + return S_FALSE; + } + } + else + { + // Error saving + return E_FAIL; + } + } + + // Store the file name + _ASSERTE( !m_pszFile ); + m_pszFile = _tcsdup( ofn.lpstrFile ); + } + + if ( !m_pszFile ) + { + return E_OUTOFMEMORY; + } + + // Open the new file into this document + + // We do not want to trigger updates for introducing this new text, + // since we will take care of constructing the CTextRunList + // for this file below. + m_dwFlags |= DP_SKIP_UPDATE; + + // Attempt to open an IStorage from that file + USES_CONVERSION; + IStorage *pStorage = NULL; + hr = ::StgOpenStorage( T2W(m_pszFile), NULL, STGM_READ | STGM_TRANSACTED, + NULL, 0, &pStorage ); + + // Attempt to open an IStream from the IStorage + IStream *pStream = NULL; + if ( SUCCEEDED( hr ) && pStorage ) + { + // Open an IStream off that storage + hr = pStorage->OpenStream( DICTPAD_TEXT, 0, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, + 0, &pStream ); + } + + // Read in from that IStream + if ( SUCCEEDED( hr ) && pStream ) + { + // Set up a callback function (defined below) that will accept + // the text from the IStream and put it into the document + EDITSTREAM es; + es.dwCookie = (DWORD) pStream; + es.pfnCallback = (EDITSTREAMCALLBACK) EditStreamCallbackReadIn; + ::SendMessage( m_hEdit, EM_STREAMIN, SF_RTF, (LPARAM) &es ); + + // Release the stream + pStream->Release(); + pStream = NULL; + } + else + { + // Reading in the text in from the IStorage failed; just open this file as text + CComVariant var; + USES_CONVERSION; + BSTR bstrFile = ::SysAllocString( T2W( m_pszFile ) ); + var = bstrFile; + hr = m_cpTextDoc->Open( &var, tomReadOnly | tomOpenAlways, 0 ); + ::SysFreeString( bstrFile ); + } + + // Create a TextRunList + _ASSERTE( !m_pTextRunList ); + m_pTextRunList = new CTextRunList(); + m_pTextRunList->SetTextDoc( m_cpTextDoc ); + + if ( SUCCEEDED( hr ) && pStorage ) + { + // We will be here if we could open the DICTPAD_TEXT stream + // from pStorage + + // Open the IStream with the serialized result objects + hr = pStorage->OpenStream( DICTPAD_RECORESULTS, 0, + STGM_READWRITE | STGM_SHARE_EXCLUSIVE, + 0, &pStream ); + } + if ( SUCCEEDED( hr ) && pStream ) + { + // Recreate the TextRunList using this stream + hr = m_pTextRunList->Deserialize( pStream, m_cpDictRecoCtxt ); + } + //else + if ( FAILED( hr ) || !pStream ) + { + // All of the text in this document will be treated as typed + // text + hr = m_pTextRunList->CreateSimpleList(); + } + + // We need to know how long the text run list is starting out + m_CurSelInfo.lTextLen = m_pTextRunList->GetTailEnd(); + + if ( pStream ) + { + pStream->Release(); + } + if ( pStorage ) + { + pStorage->Release(); + } + + // Turn updates back on + m_dwFlags &= ~DP_SKIP_UPDATE; + + // Set the saved flag in m_cpTextDoc to true to indicate that + // there are no outstanding changes + m_cpTextDoc->SetSaved( tomTrue ); + + return hr; +} /* CDictationPad::DoFileOpen */ + +/*************************************************************************************** +* CDictationPad::DoFileSave * +*---------------------------* +* Description: +* Saves the file in the Dictpad format, unless fTextOnly is set, +* in which case the file is just saved as text +* Return: +* S_OK +* E_FAIL if there is no file name to save to +* E_OUTOFMEMORY +* Return value of ITextDocument::Save() +* Return value of StgCreateDocfile() +* Return value of IStorage::CreateStream() +* Return value of IStream::Commit() +* Return value of CTextRunList::Serialize() +* Return value of IStorage::Commit() +****************************************************************************************/ +HRESULT CDictationPad::DoFileSave( bool fTextOnly ) +{ + if ( !m_pszFile ) + { + return E_FAIL; + } + + // Stop listening for dictation, and do not start listening + // again unless the user explicitly asks to do so + if ( m_dwFlags & DP_MICROPHONE_ON ) + { + ::SendMessage( m_hClient, WM_COMMAND, IDM_MIC_TOGGLE, 0 ); + } + + if ( fTextOnly ) + { + // Just do a simple save as text + + // Get the file name into a VARIANT for ITextDocument::Save() + USES_CONVERSION; + BSTR bstrFile = ::SysAllocString( T2W( m_pszFile ) ); + if ( !bstrFile ) + { + return E_OUTOFMEMORY; + } + CComVariant var = bstrFile; + + HRESULT hr = m_cpTextDoc->Save( &var, tomCreateAlways | tomText, 0 ); + + ::SysFreeString( bstrFile ); + + if ( SUCCEEDED( hr ) ) + { + m_cpTextDoc->SetSaved( tomTrue ); + } + + return hr; + } + + // Associate an IStorage with this file + IStorage *pStorage = NULL; + USES_CONVERSION; + HRESULT hr = ::StgCreateDocfile( T2W(m_pszFile), + STGM_CREATE | STGM_READWRITE | STGM_TRANSACTED, + 0, &pStorage ); + + // Create a stream for the text of the document in the storage object + IStream *pStream = NULL; + if ( SUCCEEDED( hr ) ) + { + hr = pStorage->CreateStream( DICTPAD_TEXT, + STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); + } + + if ( SUCCEEDED( hr ) ) + { + // Write the text out to pStream. + // EditStreamCallbackWriteOut() is a callback function (defined below) + // that will suck the text into pStream + EDITSTREAM es; + es.dwCookie = (DWORD) pStream; + es.pfnCallback = (EDITSTREAMCALLBACK) EditStreamCallbackWriteOut; + ::SendMessage( m_hEdit, EM_STREAMOUT, SF_RTF, (LPARAM) &es ); + + // Commit the changes to the IStream + hr = pStream->Commit( STGC_DEFAULT ); + } + + if ( pStream ) + { + pStream->Release(); + pStream = NULL; + } + + if ( SUCCEEDED( hr ) ) + { + // The text document has been saved (if this doesn't succeed then + // we will just be prompted to save next time, even if we didn't make + // any changes; this is not serious. + m_cpTextDoc->SetSaved( tomTrue ); + } + + // Serialize the TextRunList into a separate stream + _ASSERTE( m_pTextRunList ); + if ( SUCCEEDED(hr) ) + { + hr = pStorage->CreateStream( DICTPAD_RECORESULTS, + STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); + } + if ( SUCCEEDED( hr ) ) + { + hr = m_pTextRunList->Serialize( pStream, m_cpDictRecoCtxt ); + } + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Commit( STGC_DEFAULT ); + } + + if ( pStream ) + { + pStream->Release(); + } + + // Commit the changes to the IStorage + if ( SUCCEEDED( hr ) ) + { + hr = pStorage->Commit( STGC_DEFAULT ); + } + + if ( pStorage ) + { + pStorage->Release(); + } + + return hr; +} /* CDictationPad::DoFileSave */ + +/*************************************************************************************** +* CDictationPad::DoFileSaveAs * +*-----------------------------* +* Description: +* Saves the file, using the GetSaveFileName common control. +* Return: +* S_OK +* S_FALSE if user cancelled save +* E_FAIL if no client window or if unsuccessful at obtaining the file name +* Return value of CDictationPad::DoFileSave() +****************************************************************************************/ +HRESULT CDictationPad::DoFileSaveAs() +{ + if ( !m_hClient ) + { + return E_FAIL; + } + + // Stop listening for dictation, and do not start listening + // again unless the user explicitly asks to do so + if ( m_dwFlags & DP_MICROPHONE_ON ) + { + ::SendMessage( m_hClient, WM_COMMAND, IDM_MIC_TOGGLE, 0 ); + } + + // Launch the Save As... common control + TCHAR pszFileName[ MAX_PATH ]; + *pszFileName = 0; + OPENFILENAME ofn; + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + ZeroMemory( &ofn, ofnsize); + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hClient; + ofn.hInstance = m_hInst; + ofn.lpstrFilter = + _T("Dictpad Files (*.dpd)\0*.dpd\0Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0"); + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = pszFileName; + ofn.nMaxFile = MAX_PATH; + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrFileTitle = NULL; + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = NULL; + ofn.Flags = OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT; + ofn.lpstrDefExt = _T("dpd"); + BOOL fSuccess = ::GetSaveFileName( &ofn ); + + if ( fSuccess ) + { + // Get the name of the file to save to + if ( m_pszFile ) + { + // If there is already a file name in use, ditch its name + free( m_pszFile ); + } + m_pszFile = _tcsdup( ofn.lpstrFile ); + + // If the filter index is 2, that means the user wants a ".txt" extension + return DoFileSave( 2 == ofn.nFilterIndex ); + } + else + { + // Check what caused fSuccess to be false + DWORD dwErr = ::CommDlgExtendedError(); + + if ( 0 == dwErr ) + { + // User cancelled the save + return S_FALSE; + } + else + { + // Error saving + return E_FAIL; + } + } +} /* CDictationPad::DoFileSaveAs */ + + +/*************************************************************************************** +* CDictationPad::DoFileClose * +*----------------------------* +* Description: +* If there is currently an open file, closes the file (checking to see if +* it needs saving). +* Always frees the file name string if successful +* Return: +* S_OK +* S_FALSE if the user cancelled the close +* E_FAIL if there is no associated window +****************************************************************************************/ +HRESULT CDictationPad::DoFileClose() +{ + if ( !m_hClient ) + { + return E_FAIL; + } + + if ( m_pCandidateList ) + { + m_pCandidateList->ShowButton( false ); + } + + // Have unsaved changes been made? + long lSaved = tomFalse; + m_cpTextDoc->GetSaved( &lSaved ); + + // If there is something to save, then confirm the close with the user + int iResult = IDNO; + if ( (lSaved != tomTrue) && m_pTextRunList && (m_pTextRunList->GetTailEnd() > 0) ) + { + // Find out whether the user wants to save the current file + TCHAR pszCaption[ MAX_LOADSTRING ]; + ::LoadString( m_hInst, IDS_APP_TITLE, pszCaption, MAX_LOADSTRING ); + int iResult = MessageBoxFromResource( m_hClient, IDS_CONFIRMCLOSE, pszCaption, + MB_YESNOCANCEL | MB_ICONEXCLAMATION ); + + if ( IDCANCEL == iResult ) + { + return S_FALSE; + } + else if ( IDYES == iResult ) + { + // Save the file before closing it. + int iSaved = ::SendMessage( m_hClient, WM_COMMAND, ID_FILE_SAVE, 0 ); + if ( !iSaved ) + { + // Save cancelled or did not work + return S_FALSE; + } + } + else + { + // The user said don't save. + // If we opened the file via ITextDocument::Open(), TOM will save + // the file anyways, unless we set the saved flag, which we do here + m_cpTextDoc->SetSaved( tomTrue ); + } + } + + // Free the memory associated with this file + if ( m_pszFile ) + { + free( m_pszFile ); + m_pszFile = NULL; + } + if ( m_pTextRunList ) + { + delete m_pTextRunList; + m_pTextRunList = NULL; + } + + return S_OK; +} /* CDictationPad::DoFileClose */ + +/***************************************************************************************** +* EditStreamCallbackReadIn() * +*----------------------------* +* Description: +* Repeatedly called by RichEdit when an EM_STREAMIN message is sent. +* dwCookie is the IStream from which we will be reading +* pbBuff is the buffer into which we will put the bytes from the IStream +* cb is the number of bytes we are requested to read, and *pcb is the +* number of bytes actually read. +* This function ceases to be called when it returns a nonzero value or sets +* *pcb to 0. +* Return values: +* 0 if successful +* -1 if error +*******************************************************************************************/ +DWORD CALLBACK EditStreamCallbackReadIn( DWORD dwCookie, LPBYTE pbBuff, ULONG cb, ULONG *pcb ) +{ + if ( !dwCookie || !pbBuff || !pcb ) + { + // Error: invalid stream + return -1; + } + IStream *pStream = (IStream *) dwCookie; + + HRESULT hr = pStream->Read( pbBuff, cb, pcb ); + if ( SUCCEEDED( hr ) ) + { + return 0; + } + else + { + return -1; + } +} + +/***************************************************************************************** +* EditStreamCallbackWriteOut() * +*------------------------------* +* Description: +* Repeatedly called by RichEdit when an EM_STREAMOUT message is sent. +* dwCookie is the IStream to which we will be writing +* pbBuff is the buffer from which we will get the bytes to write to the IStream +* cb is the number of bytes we are requested to write, and *pcb is the +* number of bytes actually written. +* This function ceases to be called when it returns a nonzero value or sets +* *pcb to 0. +* Return values: +* 0 if successful +* -1 if error +*******************************************************************************************/ +DWORD CALLBACK EditStreamCallbackWriteOut( DWORD dwCookie, LPBYTE pbBuff, ULONG cb, ULONG *pcb ) +{ + if ( !dwCookie || !pbBuff || !pcb ) + { + // Error: invalid stream + return -1; + } + IStream *pStream = (IStream *) dwCookie; + + HRESULT hr = pStream->Write( pbBuff, cb, pcb ); + if ( SUCCEEDED( hr ) ) + { + return 0; + } + else + { + return -1; + } +} + +/***************************************************************************************** +* MessageBoxFromResource() * +*--------------------------* +* Description: +* Calls a message box with text loaded from the resource with ID uID. +* Return values: +* error value of LoadString() or return value of MessageBox() +*******************************************************************************************/ +int MessageBoxFromResource( HWND hWnd, UINT uID, LPCTSTR lpCaption, UINT uType ) +{ + TCHAR pszMessageBoxText[ MAX_LOADSTRING ]; + int iRet = ::LoadString( (HINSTANCE) ::GetWindowLong( hWnd, GWL_HINSTANCE ), + uID, pszMessageBoxText, MAX_LOADSTRING ); + if ( iRet ) + { + iRet = ::MessageBox( hWnd, pszMessageBoxText, lpCaption, uType ); + } + return iRet; +} /* MessageBoxFromResource */ + + +/***************************************************************************************** +* About() * +*---------* +* Description: +* Message handler for the "About" box. +******************************************************************************************/ +LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch( message ) + { + case WM_COMMAND: + { + WORD wId = LOWORD(wParam); + WORD wEvent = HIWORD(wParam); + + switch( wId ) + { + case IDOK: + case IDCANCEL: + EndDialog( hDlg, LOWORD(wParam) ); + return TRUE; + } + + break; + } + } + return FALSE; +} /* About */ + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.dsp b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.dsp new file mode 100644 index 00000000..5995fbf9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.dsp @@ -0,0 +1,443 @@ +# Microsoft Developer Studio Project File - Name="dictpad" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=dictpad - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "dictpad.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dictpad.mak" CFG="dictpad - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dictpad - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "dictpad - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dictpad___Win32_Debug_x86" +# PROP BASE Intermediate_Dir "dictpad___Win32_Debug_x86" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\ddk\include" /I "..\..\..\include" /I "..\Common" /I "..\..\Common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib version.lib imm32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBCMTD" /pdbtype:sept /libpath:"..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "dictpad___Win32_Release_x86" +# PROP BASE Intermediate_Dir "dictpad___Win32_Release_x86" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\ddk\include" /I "..\..\..\..\patch\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /Zi /O2 /I "..\Common" /I "..\..\Common" /I "..\..\..\..\ddk\include" /I "..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib version.lib imm32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBCMT" /libpath:"..\..\..\lib\i386" /debugtype:cv,fixup +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "dictpad - Win32 Debug x86" +# Name "dictpad - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\candidatelist.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ComponentVersionDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\DictationRun.cpp +# End Source File +# Begin Source File + +SOURCE=.\dictpad.cpp + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# ADD CPP /I "..\common" + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dictpad.rc +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 /i "..\..\..\..\build" /i "..\Common" /i "..\..\Common" +# End Source File +# Begin Source File + +SOURCE=.\dictpad_sapi.cpp +# End Source File +# Begin Source File + +SOURCE=.\phrasereplace.cpp +# End Source File +# Begin Source File + +SOURCE=.\recomgr.cpp +# End Source File +# Begin Source File + +SOURCE=.\resultcontainer.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\textrun.cpp +# End Source File +# Begin Source File + +SOURCE=.\TextRunList.cpp +# End Source File +# Begin Source File + +SOURCE=.\tom_i.c +# SUBTRACT BASE CPP /YX /Yc /Yu +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\candidatelist.h +# End Source File +# Begin Source File + +SOURCE=.\DictationRun.h +# End Source File +# Begin Source File + +SOURCE=.\dictpad.h +# End Source File +# Begin Source File + +SOURCE=.\phrasereplace.h +# End Source File +# Begin Source File + +SOURCE=.\recomgr.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\resultcontainer.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\textrun.h +# End Source File +# Begin Source File + +SOURCE=.\TextRunList.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\bitmap1.bmp +# End Source File +# Begin Source File + +SOURCE=.\cursor1.cur +# End Source File +# Begin Source File + +SOURCE=.\dictpad.ico +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\chs_cmdmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +InputDir=. +InputPath=.\chs_cmdmode.xml + +"$(InputDir)\chs_cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +InputDir=. +InputPath=.\chs_cmdmode.xml + +"$(InputDir)\chs_cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\chs_dictmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +InputDir=. +InputPath=.\chs_dictmode.xml + +"$(InputDir)\chs_dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +InputDir=. +InputPath=.\chs_dictmode.xml + +"$(InputDir)\chs_dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\cmdmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\cmdmode.xml +InputName=cmdmode + +BuildCmds= \ + ..\..\..\bin\gc /h cmdmode.h $(InputName) + +"$(ProjDir)\cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cmdmode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\cmdmode.xml +InputName=cmdmode + +BuildCmds= \ + ..\..\..\bin\gc /h cmdmode.h $(InputName) + +"$(ProjDir)\cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cmdmode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dictmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\dictmode.xml +InputName=dictmode + +BuildCmds= \ + ..\..\..\bin\gc /h dictmode.h $(InputName) + +"$(ProjDir)\dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\dictmode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\dictmode.xml +InputName=dictmode + +BuildCmds= \ + ..\..\..\bin\gc /h dictmode.h $(InputName) + +"$(ProjDir)\dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\dictmode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\jpn_cmdmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +InputDir=. +InputPath=.\jpn_cmdmode.xml + +"$(InputDir)\jpn_cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +InputDir=. +InputPath=.\jpn_cmdmode.xml + +"$(InputDir)\jpn_cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\jpn_dictmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +InputDir=. +InputPath=.\jpn_dictmode.xml + +"$(InputDir)\jpn_dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +InputDir=. +InputPath=.\jpn_dictmode.xml + +"$(InputDir)\jpn_dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\cmdmode.cfg +# End Source File +# Begin Source File + +SOURCE=.\dictmode.cfg +# End Source File +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.h new file mode 100644 index 00000000..8a4e4ed5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.h @@ -0,0 +1,202 @@ +/****************************************************************************** +* DictPad.h +* This module contains the base definitions for the DictPad SAPI 5 +* premier app. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" +#include "candidatelist.h" + +// Flags that determine the state of the app +typedef enum DPFLAGS +{ + DP_DICTATION_MODE = ( 1L << 0 ), // Toggles between dictation and command mode + DP_WHOLE_WORD_SEL = ( 1L << 1 ), // Indicates that whole words should be selected + DP_MICROPHONE_ON = ( 1L << 2 ), // Indicates that the "mic" is on (really that + // the appropriate grammars are active + DP_SHARED_RECOGNIZER = ( 1L << 3 ), // Shared reco engine (false if engine is inproc) + DP_IS_SPEAKING = ( 1L << 4 ), // Indicates that we are in the midst of a playback + DP_GRAMMARS_ACTIVE = ( 1L << 5 ), // Indicates the the "mic" is on + DP_JUST_PASTED_TEXT = ( 1L << 6 ), // Indicates that text has just been pasted + DP_SKIP_UPDATE = ( 1L << 7 ) // Indicates that selection changes should not be processed +} DPFLAGS; + +// There are three grammars loaded +typedef enum GRAMMARIDS +{ + GID_DICTATION, // ID for the dictation grammar + GID_DICTATIONCC, // ID for the C&C grammar that's active during dictation + GID_CC // ID for the C&C grammar that's active when dictation is not +}; + +// State having to do with the text selection +typedef struct SELINFO +{ + SELCHANGE selchange; // SELCHANGE struct + long lTextLen; // Total text length +} SELINFO; + +// State having to do with an ongoing playback +typedef struct SPEAKINFO +{ + long lSelStart, lSelEnd; + ITextRange *pSpeakRange; + PTEXTRUNNODE pCurrentNode; + ULONG ulCurrentStream; // The stream number we are currently on +} SPEAKINFO; + +// A way of mapping between recognized voice command and window messages. +// The details of what gets executed in response to voice-enable menus is very consistent and predictable. +// Effectively, we will send a message to the client window, simulating the menu item itself. +// This structure is used for bundling these details. +// An instance of this map is created in dictpad_sapi.cpp +struct PROPERTYMAP +{ + DWORD dwPropertyID; // The specific property Id + UINT uiMessage; // Speicific msg that will be sent to the apps client window + WPARAM wParam; // First param - value is dependent upon the msg + LPARAM lParam; // Second param - value is dependent upon the msg +}; + +// Constants +#define MAX_LOADSTRING 1000 +#define WM_DICTRECOEVENT WM_USER + 1 +#define WM_CCRECOEVENT WM_USER + 2 +#define WM_TTSEVENT WM_USER + 3 +#define WM_STOPUPDATE WM_USER + 4 +#define WM_STARTUPDATE WM_USER + 5 +#define WM_UPDATEALTSBUTTON WM_USER + 6 + +class CDictationPad +{ +public: + CDictationPad( HINSTANCE hInst = NULL ); + ~CDictationPad(); + + // Functions for running Dictpad (in dictpad.cpp) + BOOL Initialize( int nCmdShow, LPSTR lpCmdLine ); + int Run( void ); + +private: + // In dictpad.cpp: + + // Window proc + static LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + + // Initialization methods + BOOL InitializeWindow( HWND hWnd ); + void SetTooltipText( LPARAM lParam ); + + // Methods to process typed input and other notifications from the edit window + HRESULT UpdateList( long lStart, long lEnd ); // Updates the list by inserting a block + void ProcessMsgFilter( MSGFILTER *pMsgFilter ); // Handle the various notificaton events + // that we were interested in + HRESULT ProcessSelChange( SELCHANGE *pSelChange); + // Handle notification of selection change + // (this is how keyboard input gets processed) + + // Playback + HRESULT DoPlay(); // Executes a playback + HRESULT StartSpeaking( long lStartSpeakRange, // Called before a playback starts + long lEndSpeakRange); + void EndSpeaking(); // Called when a playback is through + + // File new/open/save/close + HRESULT DoFileNew(); // Opens a new file + HRESULT DoFileOpen( LPTSTR lpFileName ); // Opens a file from GetOpenFileName + HRESULT DoFileSave( bool fTextOnly = false ); // Saves a file in the appropriate format + HRESULT DoFileSaveAs(); // Gets a name from GetSaveFileName and saves + HRESULT DoFileClose(); // Closes the file if there is currently one open + + // In dictpad_sapi.cpp: + + // Initialization methods + HRESULT InitializeSAPIObjs(); // Set up the SAPI objects + HRESULT InitSAPICallback( HWND hWnd ); // Hook up the client window for SAPI notifications + HRESULT LoadGrammars(); // Load the various grammars + + // SR and TTS notification functions + bool SRDictEventHandler( void ); // Handle notifications from the dictation context + bool SRCCEventHandler( void ); // Handle notifications from the C&C context + void TTSEventHandler( void ); // Handle notifications from the voice + void SetSREventInterest( bool fOn ); // Sets/unsets interest in SR notification events + + // Methods to process events from the SR engine + bool ProcessDictationModeCommands( ISpRecoResult &rResult ); + // Process commands recognized while in dictation mode + bool ProcessCommandModeCommands( ISpRecoResult &rResult ); + // Process commands recognized while in command mode + bool ProcessDictation( ISpRecoResult &rResult, int eEventId ); + // Process dictation recognitions + bool ProcessDictationHypothesis( ISpRecoResult &rResult ); + // Process dictation hypotheses + + // Switching between the two recognition contexts + HRESULT SetMode( bool fDictationMode ); // Switches between dictation and command modes + + // Controlling the "mic" (really, whether grammar rules are active) + HRESULT SetGrammarState( BOOL bOn ); // Sets the grammar rules to the desired state + + // Add/delete Words UI + HRESULT RunAddDeleteUI(); // Starts up the Add/Delete words UI + // with in params as appropriate +private: + // Win32-related handles + HACCEL m_hAccelTable; // handle to the accelerators + HINSTANCE m_hInst; // handle to the current instance + HMODULE m_hRtfLib; // handle to the rich edit control dll + HWND m_hClient; // handle to the app's client window + HWND m_hEdit; // handle to the rich edit control + HWND m_hToolBar; // handle to the toolbar + HWND m_hStatusBar; // handle to the status bar + HFONT m_hFont; // handle to the current font + HWND m_hAltsButton; // handle to alternates UI button + + // Application state + DWORD m_dwFlags; // DPFLAGS (see above) + SELINFO m_LastSelInfo; // Information on the last selection + SELINFO m_CurSelInfo; // Information on the current selection + SPEAKINFO m_SpeakInfo; // Information about the current speaking state + TCHAR *m_pszFile; // Name of the current file + + + // Richedit/TOM + CComPtr m_cpRichEdit; // OLE interface to the rich edit control + CComPtr m_cpTextDoc; + CComPtr m_cpTextSel; + + // SAPI objects + CComPtr m_cpRecoEngine; // SR engine + CComPtr m_cpDictRecoCtxt; // Recognition context for dictation + CComPtr m_cpCCRecoCtxt; // Recognition context for C&C + CComPtr m_cpDictGrammar; // Dictation grammar + CComPtr m_cpDictCCGrammar; // Grammar for the few commands that are accessible while dictating + CComPtr m_cpCCGrammar; // Grammar for full command & control mode + CComPtr m_cpVoice; // TTS voice + + // Event interests + const ULONGLONG m_ullDictInterest; // Events in which Dictpad will be interested in + const ULONGLONG m_ullCCInterest; + + // Classes related to CDictationPad + CTextRunList *m_pTextRunList; // List of dictated and non-dictated runs (textrunlist.cpp) + CRecoEventMgr *m_pRecoEventMgr; // Handles placement of recognized text (recomgr.cpp) + CCandidateList *m_pCandidateList; // Handles alternates UI (candidatelist.cpp) +}; + + +//--- Function Prototypes ----------------------------------------------------- + +// In dictpad.cpp +LRESULT CALLBACK About( HWND, UINT, WPARAM, LPARAM ); +DWORD CALLBACK EditStreamCallbackReadIn( DWORD dwCookie, LPBYTE pbBuff, ULONG cb, ULONG *pcb ); +DWORD CALLBACK EditStreamCallbackWriteOut( DWORD dwCookie, LPBYTE pbBuff, ULONG cb, ULONG *pcb ); +int MessageBoxFromResource( HWND hWnd, UINT uID, LPCTSTR lpCaption, UINT uType ); + +// In dictpad_sapi.cpp +void HighlightAndBringIntoView( ITextDocument &rTextDoc, long lStart, long lEnd ); +void DumpCommandToScreen( HWND hwndClient, ISpPhrase &rPhrase ); + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.ico b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.ico new file mode 100644 index 00000000..feea2daa Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.rc b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.rc new file mode 100644 index 00000000..1285a014 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.rc @@ -0,0 +1,257 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_DICTPAD ICON DISCARDABLE "dictpad.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_DICTPAD MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "E&xit\tCtrl+X", IDM_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Voice" + BEGIN + MENUITEM "Listen for &Dictation", IDM_DICTATION_MODE, CHECKED + MENUITEM "Listen for &Commands", IDM_COMMAND_MODE + MENUITEM "&Grammars active\tCtrl+M", IDM_MIC_TOGGLE + MENUITEM "Play&back\tCtrl+P", IDM_PLAY + MENUITEM SEPARATOR + MENUITEM "&Add/Delete Word(s)...", IDM_ADDREMOVEWORDS + MENUITEM SEPARATOR + MENUITEM "Select &Whole Words", IDM_WHOLE_WORDS, CHECKED + MENUITEM "S&hared recognition engine", IDM_SHAREDENGINE + MENUITEM SEPARATOR + MENUITEM "&Voice Training...", IDM_VOICE_TRAINING + MENUITEM "Micro&phone Setup...", IDM_MICROPHONE_SETUP + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_DICTPAD ACCELERATORS MOVEABLE PURE +BEGIN + "/", IDM_ABOUT, ASCII, ALT, NOINVERT + "?", IDM_ABOUT, ASCII, ALT, NOINVERT + "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "C", IDM_COMMAND_MODE, VIRTKEY, ALT, NOINVERT + "D", IDM_DICTATION_MODE, VIRTKEY, ALT, NOINVERT + "M", IDM_MIC_TOGGLE, VIRTKEY, CONTROL, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_PLAY, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 62 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_DICTPAD,IDC_MYICON,14,9,20,20 + LTEXT "DictPad ",IDC_STATIC,49,10,58,8,SS_NOPREFIX + LTEXT "(c) 2001 Microsoft Corporation.",IDC_STATIC,49,23,177, + 11 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP + LTEXT "All rights reserved.",IDC_STATIC,49,39,177,11 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""SapiSDKCommon.rc2""\r\n" + "#include ""chs_dictpad.rc""\r\n" + "#include ""jpn_dictpad.rc""\r\n" + "#include ""version.rc2""\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""chs_dictpad.rc""\r\n" + "#include ""jpn_dictpad.rc""\r\n" + "\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_COMMAND_MODE_CFG SRGRAMMAR DISCARDABLE "cmdmode.cfg" +IDR_DICTATION_MODE_CFG SRGRAMMAR DISCARDABLE "dictmode.cfg" + + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_TOOLBAR TOOLBAR DISCARDABLE 16, 16 +BEGIN + BUTTON IDB_DICTMODE + BUTTON IDB_COMMANDMODE + SEPARATOR + BUTTON IDB_PLAY + BUTTON IDB_MICTOGGLE + BUTTON 65535 + BUTTON 65535 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_TOOLBAR BITMAP DISCARDABLE "toolbar1.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Dictpad" + IDC_DICTPAD "DICTPAD" + IDM_PLAY "Play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_FONT "Allow selection of a different font " + IDM_DICTATION_MODE "Dictation" + IDM_COMMAND_MODE "Command" + IDS_ADD "Add" + IDS_CHANGE "Change" + IDS_NONEWWORDS "No new words" + IDS_NOWORDSADDED "No new words have been added to the lexicon." + IDS_WAITING "..." + IDS_INVALIDFILEFORMAT "Invalid file format" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_MIC_TOGGLE "Grammars active/inactive" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CANNOTOPEN "This file cannot be opened by Dictpad" + IDS_ERRORSAVING "Dictpad encountered an error while saving to this file" + IDS_CANNOTSAVE "Error saving to file" + IDS_CONFIRMCLOSE "The text of this file has changed since the last save. Do you wish to save this file?" + IDS_MICROPHONESETUPWIZARD "Microphone Setup Wizard" + IDS_ACCESSDENIED "Cannot save to file: Access denied." + IDS_CANNOTSWITCHMODES "Error switching modes" + IDS_CANNOTFILENEW "A new file could not be opened." + IDS_UPDATEERROR "An error occurred updating the Dictpad document. Dictpad will now exit." + IDS_UNSUPPORTEDLANG "Error: The language of the engine is unsupported" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "SapiSDKCommon.rc2" +#include "chs_dictpad.rc" +#include "jpn_dictpad.rc" +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad_sapi.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad_sapi.cpp new file mode 100644 index 00000000..af18b593 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/dictpad_sapi.cpp @@ -0,0 +1,2024 @@ +/****************************************************************************** +* dictpad_sapi.cpp +* This file contains the methods of CDictationPad that +* pertain to the SAPI interfaces used in this app. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "dictpad.h" +#include "cmdmode.h" +#include "dictmode.h" +#include +#include + +#define SAPIINITERR _T("SAPI Inititalization Error") + +#ifndef _DEBUG + #define DUMP_EVENT_NAME(x) +#else + void DumpEventName(int id); // forward definition + #define DUMP_EVENT_NAME(x) DumpEventName(x) +#endif + +/**************************************************************************** +* CDictationPad::InitializeSAPIObjs() * +*-------------------------------------* +* Description: +* "Unplugs" any SAPI objects that we may currently have around. +* Set up the SR and TTS objects and obtains the relevant information +* about them. +* If any errors occur in the initialization, compains. +* Return: +* S_OK +* failed HRESULTs of the various SAPI initialization routines +*****************************************************************************/ +HRESULT CDictationPad::InitializeSAPIObjs() +{ + HRESULT hr = S_OK; + + // If we're waiting for a recognition, give up on it. + if ( m_pRecoEventMgr->IsProcessingPhrase() && (m_dwFlags & DP_DICTATION_MODE) ) + { + m_pRecoEventMgr->FalseRecognition(); + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + if ( m_pCandidateList ) + { + m_pCandidateList->ShowButton( true ); + } + + // This will unleash any WM_COMMANDs that were waiting + m_pRecoEventMgr->DoneProcessingPhrase(); + } + SetGrammarState( FALSE ); + + + // Before releasing the dictation reco context, serialize all of the current + // reco results that depend on this reco context. + // All of the active reco results live in the text-run list. + CComPtr cpTextRunListStream; + if ( m_cpDictRecoCtxt ) + { + if ( !m_pTextRunList ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + + // Create an IStream for the text-run list and write the serialized + // text-run list to that stream + hr = ::CreateStreamOnHGlobal( NULL, TRUE, &cpTextRunListStream ); + if ( SUCCEEDED( hr ) ) + { + hr = m_pTextRunList->Serialize( + cpTextRunListStream, m_cpDictRecoCtxt ); + } + + // Commit the changes to the stream so that we can read them later + if ( SUCCEEDED( hr ) ) + { + hr = cpTextRunListStream->Commit( STGC_DEFAULT ); + } + + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error serializing the text run list"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + } + + // Release the SAPI object in the reverse order in which they + // were created. This will ensure that everything really does + // get released + if ( m_cpVoice ) + { + m_cpVoice.Release(); + } + if ( m_cpCCRecoCtxt ) + { + m_cpCCRecoCtxt.Release(); + } + if ( m_cpDictRecoCtxt ) + { + m_cpDictRecoCtxt.Release(); + } + if ( m_cpRecoEngine ) + { + m_cpRecoEngine.Release(); + } + + // Set up the SR engine + hr = S_OK; + HMENU hMenu = ::GetMenu( m_hClient ); + if ( ::GetMenuState( hMenu, IDM_SHAREDENGINE, MF_BYCOMMAND ) == MF_CHECKED ) + { + // Shared reco engine. + // For a shared reco engine, the audio gets setup automatically + hr = m_cpRecoEngine.CoCreateInstance( CLSID_SpSharedRecognizer ); + } + else + { + // Inproc reco engine. + hr = m_cpRecoEngine.CoCreateInstance( CLSID_SpInprocRecognizer ); + + // For an inproc reco engine, we need to call ISpRecognizer::SetInput() + // ourselves. + CComPtr cpAudioToken; + if (SUCCEEDED(hr)) + { + // Get a token for the default audio input + hr = SpGetDefaultTokenFromCategoryId(SPCAT_AUDIOIN, &cpAudioToken); + } + if (SUCCEEDED(hr)) + { + hr = m_cpRecoEngine->SetInput(cpAudioToken, TRUE); + } + } + + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error creating reco engine"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + + // Create the recognition contexts (one for dictation mode and one for command mode). + // An ISpRecoContext is created off an ISpRecognizer + hr = m_cpRecoEngine->CreateRecoContext( &m_cpDictRecoCtxt ); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error creating dictation reco context"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + hr = m_cpRecoEngine->CreateRecoContext( &m_cpCCRecoCtxt ); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error creating C&C reco context"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + + // Now that there is a recognition context, deserialize the text-run list + // (serialized before any pre-existing recognition context was released) + // using the new reco context + if ( cpTextRunListStream ) + { + // Move the seek pointer in the stream to the beginning, since + // that is where we want to start reading from + LARGE_INTEGER li0; + ::memset( (void *) &li0, 0, sizeof( li0 ) ); + hr = cpTextRunListStream->Seek( li0, STREAM_SEEK_SET, NULL ); + + // Deserialize the text-run list using the new reco context + if ( SUCCEEDED( hr ) ) + { + hr = m_pTextRunList->Deserialize( cpTextRunListStream, m_cpDictRecoCtxt ); + } + + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error deserializing the text run list"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + } + + // Create an ISpVoice for TTS + // This is the voice associated with our recognition context + hr = m_cpDictRecoCtxt->GetVoice(&m_cpVoice); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error creating voice"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + + // Set up the reco context for retaining audio in the dictation reco context. + // Get the stream format for 8kHz, 8-bit mono + GUID guidFormatId = GUID_NULL; + WAVEFORMATEX *pWaveFormatEx = NULL; + hr = SpConvertStreamFormatEnum(SPSF_8kHz8BitMono, &guidFormatId, &pWaveFormatEx); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error converting stream format"), SAPIINITERR, MB_OK ); +#endif + } + else + { + // Tell the reco contexts to retain its audio in this format + hr = m_cpDictRecoCtxt->SetAudioOptions( SPAO_RETAIN_AUDIO, &guidFormatId, pWaveFormatEx ); + } +#ifdef _DEBUG + if ( FAILED( hr ) ) + { + ::MessageBox( m_hClient, _T("Error setting retained audio data option for dictation reco context"), SAPIINITERR, MB_OK ); + } +#endif + ::CoTaskMemFree(pWaveFormatEx); + if ( FAILED( hr ) ) + { + return hr; + } + + // Now that we have a reco engine, we can get its LangID and give that to + // the candidate list UI, which needs it for locale information + if ( m_pCandidateList ) + { + SPRECOGNIZERSTATUS stat; + ZeroMemory( &stat, sizeof( stat ) ); + hr = m_cpRecoEngine->GetStatus( &stat ); + m_pCandidateList->SetLangID( stat.aLangID[0] ); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error getting the status of the reco engine"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + } + else + { + return E_OUTOFMEMORY; + } + + // This allows the main window to be notified of SAPI events + hr = InitSAPICallback( m_hClient ); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error setting up SAPI event notification"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + + // Load the appropriate grammars + hr = LoadGrammars(); + if ( FAILED( hr ) ) + { + HRESULT hr2 = ERROR_RESOURCE_LANG_NOT_FOUND; + if (( SPERR_UNSUPPORTED_LANG == hr ) || ( ERROR_RESOURCE_LANG_NOT_FOUND == (0xffff & hr))) + { + MessageBoxFromResource( m_hClient, IDS_UNSUPPORTEDLANG, SAPIINITERR, MB_ICONEXCLAMATION ); + } +#ifdef _DEBUG + else + { + ::MessageBox( m_hClient, _T("Error loading the grammars"), SAPIINITERR, MB_OK ); + } +#endif + return hr; + } + + // Update menu items that are engine specific + // Errors in this realm are not horrible, so we carry on happily afterward + BOOL fSupported; + + // User training UI + HRESULT hrUISupport = m_cpRecoEngine->IsUISupported( SPDUI_UserTraining, NULL, 0, &fSupported); +#ifdef _DEBUG + if (FAILED( hrUISupport ) ) + { + ::MessageBox( m_hClient, _T("Querying engine for 'SPDUI_UserTraining' support failed"), SAPIINITERR, MB_OK ); + } +#endif + ::EnableMenuItem( hMenu, IDM_VOICE_TRAINING, + ( (SUCCEEDED(hrUISupport) && fSupported) ? MF_ENABLED: MF_GRAYED ) ); + + // Mic training UI + hrUISupport = m_cpRecoEngine->IsUISupported( SPDUI_MicTraining, NULL, 0, &fSupported ); +#ifdef _DEBUG + if (FAILED( hrUISupport ) ) + { + ::MessageBox( m_hClient, _T("Querying engine for 'SPDUI_MicTraining' support failed"), SAPIINITERR, MB_OK ); + } +#endif + ::EnableMenuItem( hMenu, IDM_MICROPHONE_SETUP, + ( (SUCCEEDED(hrUISupport) && fSupported) ? MF_ENABLED: MF_GRAYED ) ); + + // Add/Remove words UI + hrUISupport = m_cpRecoEngine->IsUISupported( SPDUI_AddRemoveWord, NULL, 0, &fSupported ); +#ifdef _DEBUG + if (FAILED( hrUISupport ) ) + { + ::MessageBox( m_hClient, _T("Querying engine for 'SPDUI_AddRemoveWord' support failed"), SAPIINITERR, MB_OK ); + } +#endif + ::EnableMenuItem( hMenu, IDM_ADDREMOVEWORDS, + ( (SUCCEEDED(hrUISupport) && fSupported) ? MF_ENABLED: MF_GRAYED ) ); + + return S_OK; +} /* CDictationPad::InitializeSAPIObjs */ + + +/****************************************************************************************** +* CDictationPad::InitSAPICallback() * +*-----------------------------------* +* Description: +* Sets up the notification mechanisms for dictation, C&C, +* and TTS. We will be using window messages as our +* notification method +* Indicates which SR and TTS events we are interested in. +* Also sets up the dictation and C&C grammars +* Return value: +* S_OK +* Error code from any of the calls to SAPI +********************************************************************************************/ +HRESULT CDictationPad::InitSAPICallback( HWND hWnd ) +{ + // Set recognition notification for dictation + CComPtr cpDictNotify; + HRESULT hr = cpDictNotify.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpDictNotify->InitWindowMessage(hWnd, WM_DICTRECOEVENT, 0, 0); + } + if (SUCCEEDED(hr)) + { + hr = m_cpDictRecoCtxt->SetNotifySink(cpDictNotify); + } + + // Set recognition notification for C & C + CComPtr cpCCNotify; + hr = cpCCNotify.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpCCNotify->InitWindowMessage(hWnd, WM_CCRECOEVENT, 0, 0); + } + if (SUCCEEDED(hr)) + { + hr = m_cpCCRecoCtxt->SetNotifySink(cpCCNotify); + } + + // Set recognition notification for TTS + CComPtr cpTTSNotify; + hr = cpTTSNotify.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTTSNotify->InitWindowMessage(hWnd, WM_TTSEVENT, 0, 0); + } + if (SUCCEEDED(hr)) + { + hr = m_cpVoice->SetNotifySink(cpTTSNotify); + } + + // ISpRecoContext::SetInterest() allows the caller to indicate + // which types of SAPI events it wants to be notified about. + // Initially set interest in no events for the recognition contexts; + // The event interests will be set when the grammars are first activated + if ( SUCCEEDED( hr ) ) + { + hr = m_cpDictRecoCtxt->SetInterest( m_ullDictInterest, m_ullDictInterest ); + } + if ( SUCCEEDED( hr ) ) + { + hr = m_cpCCRecoCtxt->SetInterest( m_ullCCInterest, m_ullCCInterest ); + } + + // Set interest for voice events + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->SetInterest(SPFEI_ALL_TTS_EVENTS, SPFEI_ALL_TTS_EVENTS); + } + + return hr; +} /* CDictationPad::InitSAPICallback */ + +/****************************************************************************************** +* CDictationPad::LoadGrammars() * +*-------------------------------* +* Description: +* Loads the grammars for dictation and C&C. +* (Note that the grammars still need to be activated +* in order for anything to be recognized from them) +* Return value: +* S_OK +* Return value of ISpRecoContext::CreateGrammar() +* Return value of ISpRecoGrammar::LoadDictation() +* Return value of ISpRecoGrammar::LoadCmdFromResource() +********************************************************************************************/ +HRESULT CDictationPad::LoadGrammars() +{ + // Create the grammar for general dictation, and make it the statistical + // language model for dictation + m_cpDictGrammar.Release(); + HRESULT hr = m_cpDictRecoCtxt->CreateGrammar(GID_DICTATION, &m_cpDictGrammar); + if (SUCCEEDED(hr)) + { + hr = m_cpDictGrammar->LoadDictation(NULL, SPLO_STATIC); + } + if (FAILED(hr)) + { + m_cpDictGrammar.Release(); + } + + // We need a langid from the engine in order to load the grammars in the correct language + SPRECOGNIZERSTATUS Stat; + LANGID langid = 0; + ::memset( &Stat, 0, sizeof( Stat ) ); + if ( SUCCEEDED( hr ) ) + { + hr = m_cpRecoEngine->GetStatus( &Stat ); + } + if ( SUCCEEDED( hr ) ) + { + langid = Stat.aLangID[0]; + } + + + // Create the grammar for the commands that are available for dictation mode. + // The compiled C&C grammars are resources in this project + if( SUCCEEDED( hr ) ) + { + m_cpDictCCGrammar.Release(); + hr = m_cpDictRecoCtxt->CreateGrammar(GID_DICTATIONCC, &m_cpDictCCGrammar); + if (SUCCEEDED(hr)) + { + hr = m_cpDictCCGrammar->LoadCmdFromResource(NULL, (const WCHAR*)MAKEINTRESOURCE(IDR_DICTATION_MODE_CFG), + L"SRGRAMMAR", langid, + SPLO_STATIC); + } + if (FAILED(hr)) + { + m_cpDictCCGrammar.Release(); + } + } + + // Create the grammar for command mode + if( SUCCEEDED( hr ) ) + { + m_cpCCGrammar.Release(); + hr = m_cpCCRecoCtxt->CreateGrammar(GID_CC, &m_cpCCGrammar); + if (SUCCEEDED(hr)) + { + hr = m_cpCCGrammar->LoadCmdFromResource(NULL, (const WCHAR*)MAKEINTRESOURCE( IDR_COMMAND_MODE_CFG ), + L"SRGRAMMAR", langid, + SPLO_STATIC); + } + if (FAILED(hr)) + { + m_cpCCGrammar.Release(); + } + } + + return hr; +} /* CDictationPad::LoadGrammars */ + + +/************************************************************************************** +* CDictationPad::SRDictEventHandler() * +*-------------------------------------* +* Description: +* Called whenever there is an SR event from the dictation +* reco context. +* Processes the event appropriately. +* Return: +* true iff successful +****************************************************************************************/ +bool CDictationPad::SRDictEventHandler() +{ + // There may be multiple events that come through in one notification, so we must + // look for all of them + CSpEvent event; + while ( event.GetFrom(m_cpDictRecoCtxt) == S_OK ) + { + DUMP_EVENT_NAME(event.eEventId); + + switch (event.eEventId) + { + // PHRASE_START: The engine heard the start of sounds that it thinks + // is recognizable speech. + // This event is guaranteed to be followed eventually by either an + // SPEI_RECOGNITION or an SPEI_FALSE_RECOGNITION + case SPEI_PHRASE_START: + { + // We don't expect SR events during a playback + _ASSERTE( !(m_dwFlags & DP_IS_SPEAKING) ); + + HIMC himc = ::ImmGetContext( m_hClient ); + ::ImmNotifyIME( himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 ); + + // Throw out this event unless our grammars are active + // and we are in dictation mode. + // This will get rid of PHRASE_STARTs from other reco contexts + if ( !(m_dwFlags & DP_GRAMMARS_ACTIVE) || !(m_dwFlags & DP_DICTATION_MODE) ) + { + break; + } + + // Alternates UI and playback should be disabled + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, MAKELONG(TBSTATE_INDETERMINATE, 0) ); + if ( m_pCandidateList ) + { + m_pCandidateList->ShowButton( false ); + } + + // Tell the recoevent manager about what the selection is now, + // and move the selection to an IP at the end of the "waiting" text (...) + // This move should not trigger an update + m_dwFlags |= DP_SKIP_UPDATE; + HRESULT hr = m_pRecoEventMgr->PhraseStart( *m_cpTextSel ); + m_dwFlags &= ~DP_SKIP_UPDATE; + if ( FAILED( hr ) ) + { + return false; + } + + // Status bar update + { + USES_CONVERSION; + CSpDynamicString dstr; + dstr = L"Dictation mode"; + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)W2T( dstr ) ); + } + break; + } + + // SPEI_RECO_STATE_CHANGE: For whatever reason, SAPI found it necessary to change the + // reco state. + // This can happen e.g. if a shared recognizer is running and some other context using + // that recognizer changes its RecoState + case SPEI_RECO_STATE_CHANGE: + if (event.RecoState() == SPRST_INACTIVE) + SetGrammarState( (event.RecoState() != SPRST_INACTIVE) ); + break; + + // FALSE_RECOGNITION: The engine thought this utterance might be recognizable speech, + // but it turned out not to be + // RECO_OTHER_CONTEXT: This will happen in the shared case. If some other app + // is using the engine at the same time, and it gets a recognition, then Dictpad + // will get this message to indicate that the utterance was recognized, just for + // someone else + case SPEI_FALSE_RECOGNITION: + case SPEI_RECO_OTHER_CONTEXT: + // Throw out this event unless our grammars are active + // and we are in dictation mode. + // This will get rid of PHRASE_STARTs from other reco contexts + if ( !(m_dwFlags & DP_GRAMMARS_ACTIVE) || !(m_dwFlags & DP_DICTATION_MODE) ) + { + break; + } + + m_pRecoEventMgr->FalseRecognition(); + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + if ( m_pCandidateList ) + { + m_pCandidateList->ShowButton( m_pCandidateList->FHasAlternates() ); + } + + // This will unleash any WM_COMMANDs that were waiting + m_pRecoEventMgr->DoneProcessingPhrase(); + + break; + + // HYPOTHESIS: One of a set of ongoing "guesses" that the engine makes. + // Any number of these can precede an SPEI_RECOGNITION + // RECOGNITION: The engine is done processing the utterance and has a result + case SPEI_HYPOTHESIS: + case SPEI_RECOGNITION: + { + if ( m_dwFlags & DP_IS_SPEAKING ) + { + // Don't handle reco notifications if a playback is going on + break; + } + + ISpRecoResult *pResult = event.RecoResult(); + if ( !pResult ) + { + // We expect these events to come with reco results + return false; + } + + // The result can be either from the dictation grammar + // or from the dictation-mode C&C grammar + SPPHRASE * pPhrase = NULL; + HRESULT hr = pResult->GetPhrase( &pPhrase ); + + bool fSuccess = false; + if ( SUCCEEDED( hr ) ) + { + switch( pPhrase->ullGrammarID ) + { + case GID_DICTATION: + + // Put the hypotesis or recognition into the edit window + fSuccess = ProcessDictation( *pResult, event.eEventId ); + break; + + case GID_DICTATIONCC: + + // Don't handle hypotheses, since this is just a command + if ( event.eEventId == SPEI_HYPOTHESIS ) + { + fSuccess = true; + break; + } + + // Carry out the command + fSuccess = ProcessDictationModeCommands( *pResult ); + break; + + default: + // We should not be seeing any events from other grammars + _ASSERTE( false ); + fSuccess = false; + break; + } + ::CoTaskMemFree(pPhrase); + } + + if ( SPEI_RECOGNITION == event.eEventId ) + { + // The playback option will have been disabled by the + // PHRASE_START event for this utterance. + // Since we are done processing this utterance, + // playback can now be re-enabled + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + } + + if ( !fSuccess || FAILED( hr ) ) + { + // Bail: something went wrong + return false; + } + + break; + } + + default: + break; + } + } + + return true; +} /* CDictationPad::SRDictEventHandler */ + + +/************************************************************************************** +* CDictationPad::SRCCEventHandler() * +*-----------------------------------* +* Description: +* Called whenever there is an SR or a TTS event. +* Processes the event appropriately. +* Return: +* true iff successful +****************************************************************************************/ +bool CDictationPad::SRCCEventHandler() +{ + // Numerous events may have come at once, hence the loop + CSpEvent event; + while (S_OK == event.GetFrom(m_cpCCRecoCtxt)) + { + DUMP_EVENT_NAME(event.eEventId); + + if ( SPEI_RECOGNITION == event.eEventId ) + { + // Get the reco result from the event + ISpRecoResult *pResult; + pResult = event.RecoResult(); + if ( !pResult ) + { + return false; + } + + bool fSuccess = ProcessCommandModeCommands( *pResult ); + + if ( !fSuccess ) + { + // We really expect to succeed + _ASSERTE( false ); + return false; + } + } + else if ( SPEI_RECO_STATE_CHANGE == event.eEventId ) + { + // SPEI_RECO_STATE_CHANGE: For whatever reason, SAPI found it necessary to change the + // reco state + if (event.RecoState() == SPRST_INACTIVE) + SetGrammarState( (event.RecoState() != SPRST_INACTIVE) ); + } + } + + return true; +} /* CDictationPad::SRCCEventHandler */ + + +/****************************************************************************** +* CDictationPad::TTSEventHandler * +*--------------------------------* +* Description: +* This method gets called when we receive a TTS event. +* We use TTS events mostly for the "follow-the-bouncing- +* ball" text tracking during a playback. +* Return: +* none. If this function fails, the text tracking will be +* wrong, which is not serious. +******************************************************************************/ +void CDictationPad::TTSEventHandler() +{ + CSpEvent event; + + // Process the TTS events only if we are speaking, + // otherwise just take them off the queue + if ( !(m_dwFlags & DP_IS_SPEAKING) ) + { + // Empty the queue of all waiting events + while ( S_OK == event.GetFrom( m_cpVoice ) ) + { + } + + return; + } + + // CDictationPad::StartSpeaking() should have been called before the playback + // begins. This would have set m_SpeakInfo.pCurrentNode to the appropriate + // start node in the TextRunList + _ASSERTE( m_SpeakInfo.pCurrentNode ); + if ( !m_SpeakInfo.pCurrentNode ) + { + // Error: bail + return; + } + + // There might be numerous events coming at once, hence the loop + SPVOICESTATUS Stat; + HRESULT hr = m_cpVoice->GetStatus( &Stat, NULL ); + while ( SUCCEEDED( hr ) && (event.GetFrom(m_cpVoice) == S_OK) ) + { + switch( event.eEventId ) + { + // Each TextRun in the TextRunList gets its own call to + // ISpVoice::Speak() (or ISpVoice::SpeakAudio()), and + // thus each one will generate its own SPEI_START_INPUT_STREAM + // and SPEI_END_INPUT_STREAM + + case SPEI_START_INPUT_STREAM: + + // If the node is a dictation node, highlight the whole thing + if ( m_SpeakInfo.pCurrentNode->pTextRun->IsDict() ) + { + // Find out where the speaking range starts and ends + // (since these might be somewhere within this TextRun + long lSpeakRangeStart, lSpeakRangeEnd; + m_SpeakInfo.pSpeakRange->GetStart( &lSpeakRangeStart ); + m_SpeakInfo.pSpeakRange->GetEnd( &lSpeakRangeEnd ); + + // The highlighting should start at the beginning of the speaking range + // and end at the end of pCurrentNode's run or the end of the speaking + // range, whichever comes first + HighlightAndBringIntoView( *m_cpTextDoc, lSpeakRangeStart, + __min( m_SpeakInfo.pCurrentNode->pTextRun->GetEnd(), lSpeakRangeEnd ) ); + } + + break; + + case SPEI_END_INPUT_STREAM: + + // Stat.ulLastStreamQueued is the index of the last TextRun we have asked + // to speak (starting with the first one in the TextRunList that we asked + // to speak). + if ( m_SpeakInfo.ulCurrentStream >= Stat.ulLastStreamQueued ) + { + // We just got to the end of the final input stream + // for this speak. + EndSpeaking(); + } + else + { + // We have moved on to the next stream, so move the pCurrentNode along + m_SpeakInfo.pCurrentNode = m_SpeakInfo.pCurrentNode->pNext; + m_SpeakInfo.ulCurrentStream++; + } + + break; + + // SPEI_WORD_BOUNDARY events are generated from calls to ISpVoice::Speak(), + // and the status of the voice indicates offsets in the text input to that + // call to tell us where the voice is. + // ISpVoice::SpeakAudio() does not generate these events + case SPEI_WORD_BOUNDARY: + { + // Highlight the word being spoken + + // The voice's status will tell us where the word is relative + // to the start of the current run (in characters) + // and how long it is (in bytes) + ULONG ulWordPos = Stat.ulInputWordPos; + ULONG ulWordLen = Stat.ulInputWordLen / sizeof( char ); + + // Find out where the speak started to determine whether + // it started somewhere in this run + long lSpeakRangeStart; + m_SpeakInfo.pSpeakRange->GetStart( &lSpeakRangeStart ); + if (m_SpeakInfo.pCurrentNode->pTextRun->WithinRange( lSpeakRangeStart )) + { + // This run is the first run we are speaking, + // and thus the start of the speak range may not + // be the same as the start of this run. + // The position of the word is relative to the start of the + // speak range + ulWordPos += lSpeakRangeStart; + } + else + { + // This is not the first textrun in this speaking range. + // The word position is relative to the start of this run. + ulWordPos += m_SpeakInfo.pCurrentNode->pTextRun->GetStart(); + } + + // The highlighting will end at the end of this word + long lHighlightEnd; + lHighlightEnd = ulWordPos + ulWordLen; + + // Highlight from the beginning of the speak range to the end of + // this word + HighlightAndBringIntoView( *m_cpTextDoc, lSpeakRangeStart, lHighlightEnd ); + + break; + } + + default: + break; + } + } +} /* CDictationPad::TTSEventHandler */ + +/************************************************************************************ +* CDictationPad::SetSREventInterest() * +*-------------------------------------* +* Description: +* Sets/unsets interest in SR events for both SR contexts. +*************************************************************************************/ +void CDictationPad::SetSREventInterest( bool fOn ) +{ + ULONGLONG ullInterest = fOn ? m_ullDictInterest : 0; + m_cpDictRecoCtxt->SetInterest( ullInterest, ullInterest ); + + ullInterest = fOn ? m_ullCCInterest : 0; + m_cpCCRecoCtxt->SetInterest( ullInterest, ullInterest ); +} /* CDictationPad::SetSREventInterest */ + +/************************************************************************************ +* CDictationPad::ProcessDictationModeCommands() * +*-----------------------------------------------* +* Description: +* Processes commands spoken while in dictation mode (i.e. from the +* DictCC grammar. +* Return: +* true iff successful +*************************************************************************************/ +bool CDictationPad::ProcessDictationModeCommands( ISpRecoResult &rResult ) +{ + // Get the phrase associated with this reco result. + // This SPPHRASE gets CoTaskMemAlloced, and we free it below. + SPPHRASE *pPhrase = NULL; + HRESULT hr = rResult.GetPhrase( &pPhrase ); + if ( FAILED( hr ) ) + { + // Couldn't get the phrase + return false; + } + + // Set the status bar text + CSpDynamicString dstr = L"Dictation Mode: "; + if( pPhrase->Rule.pszName ) + { + dstr.Append( pPhrase->Rule.pszName ); + } + else + { + dstr.Append( L"" ); + } + USES_CONVERSION; + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)W2T( dstr ) ); + + // We are done processing this utterance + m_pRecoEventMgr->DoneProcessingPhrase(); + + // The Rule.ulId member of an SPPHRASE tells which C&C rule needs to be fired + switch( pPhrase->Rule.ulId ) + { + case PID_DictMode: + // This rule sends us to command mode + ::SendMessage( m_hClient, WM_COMMAND, IDM_COMMAND_MODE, 0 ); + break; + + default: + { + // Default - just dump the command to the screen + DumpCommandToScreen( m_hClient, rResult ); + break; + } + } + + ::CoTaskMemFree( pPhrase ); + + // Success + return( true ); + +} /* CDictationPad::ProcessDictationModeCommands */ + +/************************************************************************************ +* DATA FOR PROCESSING COMMANDS * +*************************************************************************************/ +// This array bundles the responses for all of the voice-enabled menu & toolbar items accessible during command mode. +// NOTE: Items that use the WM_NULL uiMessage are place holders. When the app actually implements those features, +// then those lines will need to be updated +static PROPERTYMAP s_aCmdModePropertyMap[] = +{ + { PID_CmdMenuFile, WM_SYSCOMMAND, SC_KEYMENU, 'f' }, + { PID_CmdMenuEdit, WM_SYSCOMMAND, SC_KEYMENU, 'e' }, + { PID_CmdMenuVoice, WM_SYSCOMMAND, SC_KEYMENU, 'v' }, + { PID_CmdMenuHelp, WM_SYSCOMMAND, SC_KEYMENU, 'h' }, + { PID_CmdNew, WM_COMMAND, ID_FILE_NEW, 0 }, + { PID_CmdOpen, WM_COMMAND, ID_FILE_OPEN, 0 }, + { PID_CmdSave, WM_COMMAND, ID_FILE_SAVE, 0 }, + { PID_CmdSaveAs, WM_COMMAND, ID_FILE_SAVEAS, 0 }, + { PID_CmdExit, WM_COMMAND, IDM_EXIT, 0 }, + { PID_CmdCut, WM_COMMAND, ID_EDIT_CUT, 0 }, + { PID_CmdCopy, WM_COMMAND, ID_EDIT_COPY, 0 }, + { PID_CmdPaste, WM_COMMAND, ID_EDIT_PASTE, 0 }, + { PID_CmdDictationMode, WM_COMMAND, IDM_DICTATION_MODE, 0 }, + { PID_CmdCommandMode, WM_COMMAND, IDM_COMMAND_MODE, 0 }, + { PID_CmdMicrophone, WM_COMMAND, IDM_MIC_TOGGLE, 0 }, + { PID_CmdPlayback, WM_COMMAND, IDM_PLAY, 0 }, + { PID_CmdAddDeleteWords, WM_COMMAND, IDM_ADDREMOVEWORDS, 0 }, + { PID_CmdSelectWholeWords, WM_COMMAND, IDM_WHOLE_WORDS, 0 }, + { PID_CmdSharedRecoEngine, WM_COMMAND, IDM_SHAREDENGINE, 0 }, + { PID_CmdVoiceTraining, WM_COMMAND, IDM_VOICE_TRAINING, 0 }, + { PID_CmdMicrophoneSetup, WM_COMMAND, IDM_MICROPHONE_SETUP, 0 }, + { PID_CmdAbout, WM_COMMAND, IDM_ABOUT, 0 }, + { PID_CmdEscape, WM_KEYDOWN, VK_ESCAPE, 0x10001} +}; +static const int s_iCmdModePropertyMapSize_c = sizeof( s_aCmdModePropertyMap ) / sizeof( *s_aCmdModePropertyMap ); + + +/************************************************************************************ +* CDictationPad::ProcessCommandModeCommands() * +*---------------------------------------------* +* Description: +* Processes commands spoken while in command mode. +* Return: +* true iff successful +*************************************************************************************/ +bool CDictationPad::ProcessCommandModeCommands( ISpRecoResult &rResult ) +{ + SPPHRASE *pPhrase = NULL; + HRESULT hr = rResult.GetPhrase( &pPhrase ); + if ( FAILED( hr ) || pPhrase->ullGrammarID != GID_CC ) + { + ::CoTaskMemFree(pPhrase); + return false; + } + + // Set the status bar text + CSpDynamicString dstr; + dstr = L"Command Mode: "; + dstr.Append( pPhrase->Rule.pszName ); + USES_CONVERSION; + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0, (LPARAM)W2T( dstr ) ); + if( pPhrase->Rule.pszName ) + { + dstr.Append( pPhrase->Rule.pszName ); + } + else + { + dstr.Append( L"" ); + } + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)W2T( dstr ) ); + + switch( pPhrase->Rule.ulId ) + { + case PID_CmdMenu: + { + _ASSERTE( pPhrase->pProperties ); + + // Spin through the property map array to figure out + // which voice-enabled menu item just got triggered + for( int i = 0; i < s_iCmdModePropertyMapSize_c; ++i ) + { + if( pPhrase->pProperties[0].vValue.ulVal == s_aCmdModePropertyMap[ i ].dwPropertyID ) + { + // WM_CANCELMODE will destroy any active popup menus, which is what we want + // if the user selects a menu item + if ( WM_SYSCOMMAND != s_aCmdModePropertyMap[ i ].uiMessage ) + { + ::SendMessage( m_hClient, WM_CANCELMODE, 0, 0 ); + + // Turn off grammars while we are processing this command, + // unless this is a command to deactivate the grammars + if ( IDM_MIC_TOGGLE != s_aCmdModePropertyMap[ i ].wParam ) + { + SetGrammarState( FALSE ); + } + + } + + // When we've discovered which voice-enabled menu item just got triggered, we'll + // use our property map to figure out how we simulate that menu item + ::SendMessage( m_hClient, + s_aCmdModePropertyMap[ i ].uiMessage, + s_aCmdModePropertyMap[ i ].wParam, + s_aCmdModePropertyMap[ i ].lParam ); + + if (( WM_SYSCOMMAND != s_aCmdModePropertyMap[ i ].uiMessage ) + && ( IDM_MIC_TOGGLE != s_aCmdModePropertyMap[ i ].wParam )) + { + // Reactivate grammars + SetGrammarState( TRUE ); + } + + break; + } + } + + } + break; + + case PID_CmdNavigationVertical: + { + // Vertical navigation has 3 components: direction, unit of travel & number of units. + // The grammar was created to allow some flexibility in the way the user says these 3 components. + // So, the first task is to figure out which components the user actually said - default values will + // be used for the component not explicitly mentioned. + + // Default values: scroll down 1 page + long lUnit = tomScreen; + long lCount = 1; + BOOL bDown = TRUE; + const SPPHRASEPROPERTY *pProp = pPhrase->pProperties; + + // Spin thru all of the properties, identifying the individual components + // It is possible to have the 'direction' specified twice - the last value will be used. + while( pProp ) + { + switch( pProp->ulId ) + { + case PID_CmdDirection: + if( PID_CmdUp == pProp->vValue.ulVal ) + { + bDown = FALSE; + } + else + { + bDown = TRUE; + } + break; + + case PID_CmdUnits: + switch( pProp->vValue.ulVal ) + { + case PID_CmdPage: + lUnit = tomScreen; + break; + + case PID_CmdLine: + lUnit = tomLine; + break; + + case PID_CmdParagraph: + lUnit = tomParagraph; + break; + } + break; + + case PID_CmdNumber: + // Calculate the number. + // See cmdmode.xml for details on how this grammar is constructed. + // It consists of an optional tens value followed by a ones value. + _ASSERTE( pProp->pFirstChild ); + const SPPHRASEPROPERTY *pPropNum; + lCount = 0; + for ( pPropNum = pProp->pFirstChild; pPropNum; pPropNum = pPropNum->pNextSibling ) + { + lCount += pPropNum->vValue.uiVal; + } + break; + + default: + _ASSERTE( FALSE ); + break; + } + + // Get the next property. A 'NULL' value terminates our hunt + pProp = pProp->pNextSibling; + } + + // Now, actually navigate. + if( bDown ) + { + m_cpTextSel->MoveDown( lUnit, lCount, 0, NULL ); + } + else + { + m_cpTextSel->MoveUp( lUnit, lCount, 0, NULL ); + } + } + break; + + case PID_CmdNavigationOther: + // This handles the rule that covers the extraneous navigation + // not explicitly handled in PID_CmdNavigation1 + if( pPhrase->pProperties ) + { + switch( pPhrase->pProperties[0].vValue.ulVal ) + { + case PID_CmdCharacterLeft: + m_cpTextSel->MoveLeft( tomCharacter, 1, 0, NULL ); + break; + case PID_CmdCharacterRight: + m_cpTextSel->MoveRight( tomCharacter, 1, 0, NULL ); + break; + case PID_CmdWordLeft: + m_cpTextSel->MoveLeft( tomWord, 1, 0, NULL ); + break; + case PID_CmdWordRight: + m_cpTextSel->MoveRight( tomWord, 1, 0, NULL ); + break; + + case PID_CmdLineEnd: + m_cpTextSel->EndKey( tomLine, 0, NULL ); + break; + case PID_CmdLineHome: + m_cpTextSel->HomeKey( tomLine, 0, NULL ); + break; + case PID_CmdScrollEnd: + m_cpTextSel->EndKey( tomStory, 0, NULL ); + break; + case PID_CmdScrollHome: + m_cpTextSel->HomeKey( tomStory, 0, NULL ); + break; + } + } + else + { + _ASSERTE( pPhrase->pProperties ); + } + break; + + default: + // Default - just dump the command to the screen + DumpCommandToScreen( m_hClient, rResult ); + break; + } + + ::CoTaskMemFree( pPhrase ); + + // Success + return( true ); + +} /* CDictationPad::ProcessCommandModeCommands */ + + +/************************************************************************************ +* CDictationPad::ProcessDictation() * +*-----------------------------------* +* Description: +* Processes recognized and hypothesized dictation. +* Types the dictated text to where the selection was when the text was +* dictated. Inserts spaces on either side of the dictated text as +* necessary (observing the display attributes) +* +* Return: +* true iff successful +*************************************************************************************/ +bool CDictationPad::ProcessDictation( ISpRecoResult &rResult, int eEventId ) +{ + _ASSERTE(( eEventId == SPEI_RECOGNITION ) || ( eEventId == SPEI_HYPOTHESIS )); + if ( eEventId == SPEI_HYPOTHESIS ) + { + // A separate method to handle hypotheses + return ProcessDictationHypothesis( rResult ); + } + + // Set the flag to indicate that the next insertion will be a dictation run + // and so Dictpad does not need to process the next selection change + m_dwFlags |= DP_SKIP_UPDATE; + + // Get the range to replace from the RecoEventManager. + // In order to do this, we need to tell m_pRecoEventMgr when this + // dictation was spoken. + // Why we need this: If the user moved the IP around while dictating + // this phrase, we want to put the text where the IP was when he actually + // dictated this phrase. + SPRECORESULTTIMES times; + rResult.GetResultTimes( × ); + ITextRange *pRecoRange = NULL; + HRESULT hr = m_pRecoEventMgr->Recognition( times.ftStreamTime, &pRecoRange ); + if ( FAILED( hr ) ) + { + return false; + } + else if ( S_FALSE == hr ) + { + // For whatever reason, this recognition was thrown out. + // So there's nothing to display. + return true; + } + else if ( !pRecoRange ) + { + // unexpected error + return false; + } + + // Does the current selection overlap or adjoin the range in + // which the recognized text will go? + bool bRecoAndSelDisjoint = AreDisjointRanges( pRecoRange, m_cpTextSel ); + + ITextRange *pOldSel = NULL; + if ( bRecoAndSelDisjoint ) + { + // The recognized text will appear in an entirely different part of + // the document from the current selection. + // Remember where the text selection was. + // If this call fails, then it is not serious; the text selection + // will simply not be restored to this location + m_cpTextSel->GetDuplicate( &pOldSel ); + } + + // Set the text selection to be the range in which dictated + // text should appear. + // lStart and lEnd indicate where the dictation should go. + long lStart, lEnd; + pRecoRange->GetStart( &lStart ); + pRecoRange->GetEnd( &lEnd ); + m_cpTextSel->SetRange( lStart, lEnd ); + + // Determine whether whatever is currently at lEnd wants leading spaces + // (i.e. the spaces at the end of this newly-dictated text) consumed + bool fConsumeLeadingSpaces; + HRESULT hrConsumeSpaces = m_pTextRunList->IsConsumeLeadingSpaces( + lEnd, &fConsumeLeadingSpaces ); + + // Get the text and display attributes from the result object + CSpDynamicString dstrText; + BYTE dwAttributes; + hr = rResult.GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, &dwAttributes ); + if ( FAILED( hr ) ) + { + return false; + } + + bool bRet = false; + + // Deal with the display attributes of the text: + + // Determine how much space should follow the result text. + // Space should not follow the text if leading spaces at lEnd are to + // be consumed + if ( !( SUCCEEDED( hrConsumeSpaces ) && fConsumeLeadingSpaces ) ) + { + long lIsDelimiter = + ::SendMessage( m_hEdit, EM_FINDWORDBREAK, WB_ISDELIMITER, lEnd ); + if ( !lIsDelimiter ) + { + // If the dictated text is put here, it will run into whatever + // follows it. + // Add as many trailing spaces as the attributes call for + if ( dwAttributes & SPAF_ONE_TRAILING_SPACE ) + { + dstrText.Append( L" " ); + } + else if ( dwAttributes & SPAF_TWO_TRAILING_SPACES ) + { + dstrText.Append( L" " ); + } + + } + else + { + // There is at least one space here. If there isn't a second + // space and the attributes call for two trailing spaces, + // add another space. + if ( (dwAttributes & SPAF_TWO_TRAILING_SPACES) && + !::SendMessage( m_hEdit, EM_FINDWORDBREAK, WB_ISDELIMITER, lEnd+1 ) ) + { + dstrText.Append( L" " ); + } + } + } + + // Determine how much space should precede the new text + UINT uiSpacesNeeded = 0; + bool fSpacePrepended = false; + if ( lStart > 0 ) + { + // This call determines how many spaces would be needed if + // we inserted text at lStart. + // If this call fails, we'll get the spacing wrong + m_pTextRunList->HowManySpacesAfter( lStart, &uiSpacesNeeded ); + _ASSERTE( uiSpacesNeeded <= 2 ); + } + if ( (dwAttributes & SPAF_CONSUME_LEADING_SPACES) && (lStart > 0) ) + { + // This result requires that we consume leading space; + // move the start back until we have consumed all leading spaces + + // Create a degenerate range one space before + ITextRange *pRange; + hr = m_cpTextDoc->Range( lStart - 1, lStart - 1, &pRange ); + + if ( SUCCEEDED( hr ) ) + { + // Push the start and pRange back until the first character of + // pRange is no longer whitespace. + long lChar = 0; + pRange->GetChar( &lChar ); + while ( (lStart >= 0) && (L' ' == ((WCHAR) lChar )) ) + { + lStart--; + pRange->MoveStart( tomCharacter, -1, NULL ); + + pRange->GetChar( &lChar ); + } + + // The character at lStart is now not space + m_cpTextSel->SetStart( lStart ); + + pRange->Release(); + } + } + else + { + // Prepend a space, since we must make sure + // that this does not run into the text preceding it + // as we are adding it + fSpacePrepended = true; + + // Temporarily turn off the SkipUpdate flag in order to add a space + // and have Dictpad handle the new space + m_dwFlags &= ~DP_SKIP_UPDATE; + + // Insert a space at the beginning of the range. + // We do this right now even if the space is not needed + // so that the dictated text is inserted intact (not running + // into anything else). + // If the space is not needed, we get rid of it below + m_cpTextSel->SetText( L"" ); + BSTR bstrSpace = ::SysAllocString( L" " ); + hr = m_cpTextSel->TypeText( bstrSpace ); + ::SysFreeString( bstrSpace ); + + // Restore the SkipUpdate flag + m_dwFlags |= DP_SKIP_UPDATE; + } + if ( FAILED( hr ) ) + { + return false; + } + + // lWhereNewTextBegins is the beginning of the new text (not the space + // that may precede it) + const long lWhereNewTextBegins = lStart; + + // Get the text of the reco result + BSTR bstrText = ::SysAllocString( dstrText ); + if ( !bstrText ) + { + return false; + } + + // Create a dictation run to contain the new text + CDictationRun *pRun = new CDictationRun(); + if ( !pRun ) + { + return false; + } + hr = pRun->Initialize( rResult ); + if ( FAILED( hr ) ) + { + return false; + } + + // Type the text into the document + m_cpTextSel->SetText( L"" ); + hr = m_cpTextSel->TypeText( bstrText ); + ::SysFreeString( bstrText ); + + // Get the dictated range (it ends wherever the text selection ends now), + // and give it to the new dictation run + long lDictRunEnd; + m_cpTextSel->GetEnd( &lDictRunEnd ); + ITextRange *pDictRunRange; + hr = m_cpTextDoc->Range( lWhereNewTextBegins, lDictRunEnd, &pDictRunRange ); + if ( SUCCEEDED( hr ) ) + { + hr = pRun->SetTextRange( pDictRunRange ); + } + if ( FAILED( hr ) ) + { + return false; + } + + // Set the font back to normal (in case hypotheses had changed the font + CComPtr cpFont; + hr = pDictRunRange->GetFont( &cpFont ); + if ( SUCCEEDED( hr ) ) + { + cpFont->SetForeColor( tomAutoColor ); + pDictRunRange->SetFont( cpFont ); + } + + // Release pDictRunRange, since this range is now the run's responsibility + pDictRunRange->Release(); + + // Now that the range is set, can insert it into the TextRunList. + hr = m_pTextRunList->Insert( pRun ); + + if ( SUCCEEDED( hr ) ) + { + if (( 0 == uiSpacesNeeded ) && fSpacePrepended ) + { + // Need to get rid of this space, since we prepended a + // space but no space is needed. + // Dictpad should handle the deletion of this space. + // If the deletion fails, the spacing will be wrong. + m_cpTextSel->SetRange( lWhereNewTextBegins, lWhereNewTextBegins ); + m_dwFlags &= ~DP_SKIP_UPDATE; + m_cpTextSel->Delete( tomCharacter, 1, NULL ); + m_dwFlags |= DP_SKIP_UPDATE; + + // Restore the selection, realizing that it is going to be + // one behind because of the deletion + m_cpTextSel->SetRange( lDictRunEnd - 1, lDictRunEnd - 1 ); + } + else if (( uiSpacesNeeded > 0 ) && + !(dwAttributes & SPAF_CONSUME_LEADING_SPACES) ) // SPAF_CONSUME_LEADING_SPACES + // trumps the trailing spaces + // attribs of previous runs + { + // Determine how many more spaces are needed, since we + // may have already taken care of it if we already prepended + // a space + INT iAdditionalSpacesNeeded = uiSpacesNeeded - (fSpacePrepended ? 1 : 0); + _ASSERTE( (iAdditionalSpacesNeeded >= 0) + && (iAdditionalSpacesNeeded <= 2) ); + + if ( iAdditionalSpacesNeeded ) + { + // Type in those spaces where the text begins. + // Dictpad should handle the insertion of this space. + // If the insertion fails, the spacing will be wrong + m_cpTextSel->SetRange( lWhereNewTextBegins, lWhereNewTextBegins ); + m_dwFlags &= ~DP_SKIP_UPDATE; + BSTR bstrSpaces = ::SysAllocString( + (1 == iAdditionalSpacesNeeded) ? L" " : L" " ); + m_cpTextSel->TypeText( bstrSpaces ); + ::SysFreeString( bstrSpaces ); + m_dwFlags |= DP_SKIP_UPDATE; + + // Restore the selection, realizing that it's going to be further along + // than it was because of the spaces + m_cpTextSel->SetRange( lDictRunEnd + iAdditionalSpacesNeeded, + lDictRunEnd + iAdditionalSpacesNeeded ); + } + } + } + + // Success + bRet = SUCCEEDED(hr); + + // If the recognized text was placed into a range that overlaps or abuts + // the current selection, then the selection will have been moved to an IP + // at the end of the recognized text. + // If the recognized text and the original text selection were disjoint, then + // move the selection back to the old selection. + if ( bRecoAndSelDisjoint ) + { + // Restore the old selection + pOldSel->GetStart( &lStart ); + pOldSel->GetEnd( &lEnd ); + m_cpTextSel->SetRange( lStart, lEnd ); + + pOldSel->Release(); + } + + if ( m_pCandidateList ) + { + // Show the alternates button and update it with the changed TextRunList + m_pCandidateList->ShowButton( true ); + m_hAltsButton = m_pCandidateList->Update( m_pTextRunList ); + } + + // This will unleash any WM_COMMANDs that were waiting + m_pRecoEventMgr->DoneProcessingPhrase(); + + // We're done, and Dictpad should now be processing updates again. + m_dwFlags &= ~DP_SKIP_UPDATE; + + return bRet; + +} /* CDictationPad::ProcessDictation */ + +/*************************************************************************************** +* CDictationPad::ProcessDictationHypothesis * +*-------------------------------------------* +* Description: +* Called when a hypothesis notification is received. +* Puts the text in the appropriate location +* Return: +* true iff successful +****************************************************************************************/ +bool CDictationPad::ProcessDictationHypothesis( ISpRecoResult &rResult ) +{ + // Set the flag to indicate that the next insertion will be a dictation run + m_dwFlags |= DP_SKIP_UPDATE; + + // Get the text + CSpDynamicString dstrText; + HRESULT hr = rResult.GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, NULL ); + if ( FAILED( hr ) ) + { + return false; + } + + // Get the range to replace from the RecoEventManager. + // Just like in CDictationPad::ProcessDictation() above, when the + // utterance was occurred determines where it will go. + SPRECORESULTTIMES times; + rResult.GetResultTimes( × ); + ITextRange *pRecoRange = m_pRecoEventMgr->Hypothesis( times.ftStreamTime ); + if ( !pRecoRange ) + { + // For whatever reason the hypothesis was dropped, and nothing needs + // to be done with it. + return true; + } + + // Put the text in the range. + // If this fails, then we just won't see the hypothesis. + BSTR bstrText = ::SysAllocString( dstrText ); + pRecoRange->SetText( bstrText ); + ::SysFreeString( bstrText ); + + // Check if the selection now interferes with some non-editable range. + // (A range is not editable if it currently contains hypotheses) + // If so, move it to the end of that range + CComPtr cpNextEditableRange; + if ( !(m_pRecoEventMgr->IsEditable( m_cpTextSel, &cpNextEditableRange )) ) + { + if ( !cpNextEditableRange ) + { + // This indicates an out-of-memory error condition + // (see recomgr.cpp) + return false; + } + + // Move the selection to the next editable phrase + long lStart, lEnd; + cpNextEditableRange->GetStart( &lStart ); + cpNextEditableRange->GetEnd( &lEnd ); + m_cpTextSel->SetStart( lStart ); + m_cpTextSel->SetEnd( lEnd ); + } + + // Make the hypothesized text gray + CComPtr cpFont; + pRecoRange->GetFont( &cpFont ); + if ( cpFont ) + { + cpFont->SetForeColor( PALETTERGB( 128, 128, 128 ) ); + pRecoRange->SetFont( cpFont ); + } + + // Dictpad should resume processing selection changes + m_dwFlags &= ~DP_SKIP_UPDATE; + + return SUCCEEDED( hr ); +} /* CDictationPad::ProcessDictationHypothesis */ + +/**************************************************************************************** +* CDictationPad::SetMode() * +*--------------------------* +* Description: +* Switches to dictation or to command mode (depending +* on the value of fDictationMode). +* Updates the toolbar/statusbar accordingly. +* Switching between dictation and command mode involves +* activating and deactivating grammars +* Return: +* S_OK +* Return value of CDictationPad::SetMode() +*****************************************************************************************/ +HRESULT CDictationPad::SetMode( bool fDictationMode ) +{ + bool fAlreadyInDictMode = m_dwFlags & DP_DICTATION_MODE; + if ( fAlreadyInDictMode != fDictationMode ) + { + // Request to change the mode + + // Deactivate any currently-active grammars + HRESULT hr = SetGrammarState( false ); + + if ( SUCCEEDED( hr ) ) + { + // Flip the mode flag + m_dwFlags ^= DP_DICTATION_MODE; + + // Since the flags are now set to the mode that the + // user wanted to switch to, this will now activate the + // rules in the correct grammar (if the user had the + // mic on when he switched grammars + hr = SetGrammarState( m_dwFlags & DP_MICROPHONE_ON ); + } + + _ASSERTE(SUCCEEDED(hr)); + if ( FAILED(hr) ) + { + return hr; + } + } + + + // Keep the toolbar button in sync with the current mode + ::SendMessage( m_hToolBar, TB_PRESSBUTTON, IDM_DICTATION_MODE, MAKELONG( fDictationMode, 0 ) ); + ::SendMessage( m_hToolBar, TB_PRESSBUTTON, IDM_COMMAND_MODE, MAKELONG( !fDictationMode, 0 ) ); + + // Keep the menu items in sync with the current mode + HMENU hMenu = ::GetMenu( m_hClient ); + ::CheckMenuItem( hMenu, IDM_DICTATION_MODE, fDictationMode ? MF_CHECKED : MF_UNCHECKED ); + ::CheckMenuItem( hMenu, IDM_COMMAND_MODE, fDictationMode ? MF_UNCHECKED : MF_CHECKED ); + + // Keep the status bar in sync with the current mode + { + USES_CONVERSION; + CSpDynamicString dstr; + dstr = fDictationMode ? L"Dictation mode" : L"Command mode"; + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0, (LPARAM)W2T( dstr ) ); + } + + return S_OK; +} /* CDictationPad::SetMode */ + +/**************************************************************************************** +* CDictationPad::SetGrammarState() * +*--------------------------------* +* Description: +* Sets the rules in the relevant grammars to the desired state +* (active or inactive). +* If the edit window does not have the input focus and we are +* turning the grammars on, set the input focus to the edit +* window. +* Sets the microphone button to reflect whether the rules are active +* Return: +* Return value of ISpRecognizer::SetRecoState() +* Return value of ISpRecoGrammar::SetRuleState() +* Return value of ISpRecoGrammar::SetDictationState() +*****************************************************************************************/ +HRESULT CDictationPad::SetGrammarState( BOOL bOn ) +{ + // Check the reco state, to make sure that the reco state is active. + // If not, activate it. + if ( bOn ) + { + SPRECOSTATE rs; + HRESULT hrRecoState = m_cpRecoEngine->GetRecoState( &rs ); + if ( SUCCEEDED( hrRecoState ) && (SPRST_INACTIVE == rs) ) + { + // Set the reco state to active + hrRecoState = m_cpRecoEngine->SetRecoState( SPRST_ACTIVE ); + } + + if ( FAILED( hrRecoState ) ) + { + return hrRecoState; + } + } + + // Check to make sure that we're actually making a change + const BOOL fGrammarsActive = m_dwFlags & DP_GRAMMARS_ACTIVE; + if ( fGrammarsActive == bOn ) + { + // Asking for the current state; nothing needs to be done + return S_OK; + } + +#ifdef _DEBUG + TCHAR debugstring[100]; + wsprintf( debugstring, _T("Trying to %s grammars..."), bOn ? _T("activate") : _T("deactivate") ); + OutputDebugString( debugstring ); +#endif + + HRESULT hr = S_OK; + if ( m_dwFlags & DP_DICTATION_MODE ) + { + // We are in dictation mode. + + if ( !m_cpDictCCGrammar || !m_cpDictGrammar ) + { + return E_FAIL; + } + + // Dictation and the dictation-mode command rules should be (in)active + hr = m_cpDictCCGrammar->SetRuleState(NULL, NULL, bOn ? SPRS_ACTIVE : SPRS_INACTIVE); + if ( SUCCEEDED( hr ) ) + { + hr = m_cpDictGrammar->SetDictationState(bOn ? SPRS_ACTIVE : SPRS_INACTIVE); + } + } + else + { + // We are in command mode + + if ( !m_cpCCGrammar ) + { + return E_FAIL; + } + // Command-mode command rules should be (in)active + hr = m_cpCCGrammar->SetRuleState(NULL, NULL, bOn ? SPRS_ACTIVE : SPRS_INACTIVE); + } + + if ( SUCCEEDED( hr ) ) + { + // Grammars successfully (de)activated, set the flag + bOn ? ( m_dwFlags |= DP_GRAMMARS_ACTIVE ) + : ( m_dwFlags &= ~DP_GRAMMARS_ACTIVE ); +#ifdef _DEBUG + OutputDebugString( _T("success\r\n") ); +#endif + } + else + { + return hr; + } + + // Update the menu items + HMENU hMenu = ::GetMenu( m_hClient ); + ::CheckMenuItem( hMenu, IDM_MIC_TOGGLE, bOn ? MF_CHECKED : MF_UNCHECKED ); + + // Update the toolbar button + long lButtonState; + if ( bOn ) + { + if ( DP_IS_SPEAKING & m_dwFlags ) + { + lButtonState = MAKELONG( TBSTATE_PRESSED, 0 ); + } + else + { + lButtonState = MAKELONG( TBSTATE_ENABLED | TBSTATE_PRESSED, 0 ); + } + } + else + { + if ( DP_IS_SPEAKING & m_dwFlags ) + { + lButtonState = MAKELONG( 0, 0 ); + } + else + { + lButtonState = MAKELONG( TBSTATE_ENABLED, 0 ); + } + } + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_MIC_TOGGLE, lButtonState ); + + if ( bOn && ( ::GetFocus() != m_hEdit ) ) + { + // Asking to turn the microphone on, but the edit window does not have + // the input focus: Set the input focus to the edit window + ::SetFocus( m_hEdit ); + } + + return S_OK; +} /* CDictationPad::SetGrammarState() */ + +/*************************************************************************************** +* CDictationPad::RunAddDeleteUI * +*-------------------------------* +* Description: +* Gets the first word in the current selection, if the selection +* contains any words. +* Displays the UI for adding and deleting words with the word as +* a parameter. +* Return: +* S_OK +* Return value of CDictationPad::SetGrammarState() +* Return value of ISpRecognizer::DisplayUI() +****************************************************************************************/ +HRESULT CDictationPad::RunAddDeleteUI() +{ + HRESULT hr; + + // Stop listening + hr = SetGrammarState( false ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Get the word nearest the beginning of the selection + // If these calls fail, we just won't get the word. + + CComPtr cpFirstWordRange; + BSTR bstrFirstWordSelected = NULL; + long lStart = m_pTextRunList->GetTailEnd(); + hr = m_cpTextSel->GetDuplicate( &cpFirstWordRange ); + if ( SUCCEEDED(hr) ) + { + hr = cpFirstWordRange->Collapse( true ); + cpFirstWordRange->GetStart( &lStart ); + } + if ( SUCCEEDED(hr) ) + { + hr = cpFirstWordRange->Expand( tomWord, NULL ); + } + // If lStart is equal to m_pTextRunList, we don't get useful + // text in bstrFirstWordSelected + if ( SUCCEEDED(hr) && (lStart < m_pTextRunList->GetTailEnd()) ) + { + hr = cpFirstWordRange->GetText( &bstrFirstWordSelected ); + } + + WCHAR *pwszNewWord = NULL; + if ( bstrFirstWordSelected ) + { + pwszNewWord = wcsdup( bstrFirstWordSelected ); + ::SysFreeString( bstrFirstWordSelected ); + } + + ULONG ulDataSize = pwszNewWord ? + (sizeof(WCHAR) * wcslen( pwszNewWord )) : 0; + + USES_CONVERSION; + hr = m_cpRecoEngine->DisplayUI( + m_hClient, NULL, SPDUI_AddRemoveWord, pwszNewWord, ulDataSize ); + + if ( pwszNewWord ) + { + free(pwszNewWord); + } + + return hr; +} /* CDictationPad::RunAddDeleteUI */ + + + +/****************************************************************************** +* HighlightAndBringIntoView * +*---------------------------* +* Description: +* Highlight the given text in the document and bring it into view +* Return: +* none. If this function fails, the text tracking will be +* wrong, which is not serious. +******************************************************************************/ +void HighlightAndBringIntoView( ITextDocument &rTextDoc, long lStart, long lEnd ) +{ + CComPtr cpWordRange; + HRESULT hr = rTextDoc.Range( lStart, lEnd, &cpWordRange ); + + CComPtr cpHighlightFont; + if ( SUCCEEDED( hr ) ) + { + hr = cpWordRange->GetFont( &cpHighlightFont ); + } + if ( SUCCEEDED( hr ) ) + { + cpHighlightFont->SetBackColor( PALETTERGB( 255, 255, 0 ) ); + cpWordRange->SetFont( cpHighlightFont ); + } + + // Bring the most recently-spoken text into view + POINT pt; + hr = cpWordRange->GetPoint( tomEnd | TA_BOTTOM | TA_RIGHT, + &(pt.x), &(pt.y) ); + if ( hr == S_FALSE ) + { + // An S_FALSE return value from ITextRange::GetPoint() means that + // the requested point is not visible + cpWordRange->ScrollIntoView( tomEnd ); + } +} /* HighlightAndBringIntoView */ + +/****************************************************************************** +* DumpCommandToScreen * +*---------------------* +* Description: +* Dumps the command whose spoken text is in the phrase object +* rPhrase to the screen +* Return: +* none. If this function fails, the command will not be dumped. +******************************************************************************/ +void DumpCommandToScreen( HWND hwndClient, ISpPhrase &rPhrase ) +{ + // Get the rule name + SPPHRASE *pPhrase = NULL; + HRESULT hr = rPhrase.GetPhrase( &pPhrase ); + if ( FAILED( hr ) ) + { + return; + } + CSpDynamicString dstr = L"Rule: \""; + if( pPhrase->Rule.pszName ) + { + dstr.Append( pPhrase->Rule.pszName ); + } + ::CoTaskMemFree( pPhrase ); + + // Now get the text + WCHAR *pwszSpokenText = NULL; + BYTE b; + hr = rPhrase.GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, true, + &pwszSpokenText, &b ); + if ( FAILED( hr ) ) + { + return; + } + dstr.Append( L"\"\nSpoken Text: \"" ); + _ASSERTE( pwszSpokenText ); + if( pwszSpokenText ) + { + dstr.Append( pwszSpokenText ); + } + dstr.Append( L"\"" ); + ::CoTaskMemFree( pwszSpokenText ); + + USES_CONVERSION; + ::MessageBox( hwndClient, W2T( dstr ), _T("Command Mode"), MB_OK ); + +} /* DumpCommandToScreen */ + +/****************************************************************************** +* DEBUG CODE * +******************************************************************************/ +#ifdef _DEBUG +const char * apszTtsEventNames[] = +{ + "SPEI_START_INPUT_STREAM", // = 1 + "SPEI_END_INPUT_STREAM", // = 2 + "SPEI_VOICE_CHANGE", // = 3 + "SPEI_BOOKMARK", // = 4 + "SPEI_WORDBOUNDARY", // = 5 + "SPEI_PHONEME", // = 6 + "SPEI_SENTENCEBOUNDARY", // = 7 + "SPEI_VISEME", // = 8 + "SPEI_TTS_UNDEFINED_0", // = 9 + "SPEI_TTS_UNDEFINED_1", // = 10 + "SPEI_TTS_UNDEFINED_2", // = 11 + "SPEI_TTS_UNDEFINED_3", // = 12 + "SPEI_TTS_UNDEFINED_4", // = 13 + "SPEI_TTS_UNDEFINED_5", // = 14 + "SPEI_TTS_UNDEFINED_6", // = 15 +}; + +const char * apszSrEventNames[] = +{ + "SPEI_END_SR_STREAM", // = 34 + "SPEI_SOUNDSTART", // = 35 + "SPEI_SOUNDEND", // = 36 + "SPEI_PHRASESTART", // = 37 + "SPEI_RECOGNITION", // = 38 + "SPEI_HYPOTHESIS", // = 39 + "SPEI_ATTRIBCHANGED", // = 40 + "SPEI_SR_BOOKMARK", // = 41 + "SPEI_ASYNC_COMPLETED", // = 42 + "SPEI_FALSERECOGNITION", // = 43 + "SPEI_INTERFERENCE", // = 44 + "SPEI_REQUESTUI", // = 45 + "SPEI_RECO_STATE_CHANGE", // = 46 + "SPEI_SR_UNDEFINED_1", // = 47 +}; + +void DumpEventName(int id) +{ + SPDBG_FUNC( "DictPad - DumpEventName" ); + + const char * pszEventName; + + if (id >= SPEI_MIN_SR && id <= SPEI_MAX_SR) + { + pszEventName = apszSrEventNames[id - SPEI_MIN_SR]; + } + else if (id >= SPEI_MIN_TTS && id <= SPEI_MAX_TTS) + { + pszEventName = apszTtsEventNames[id - SPEI_MIN_TTS]; + } + else + { + pszEventName = NULL; + } + + if (pszEventName) + { + SPDBG_DMSG1("dictpad: event = %s\r\n", pszEventName); + } + else + { + SPDBG_DMSG1("dictpad: event = #%d\r\n", id); + } +} +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_cmdmode.xml b/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_cmdmode.xml new file mode 100644 index 00000000..15c24529 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_cmdmode.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +

scroll

+

move

+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+ + + + + +

page

+

pages

+

line

+

lines

+

paragraph

+

paragraphs

+
+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+

+ +

+ +

page

+

line

+

paragraph

+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+

+ +
+ + + +

+ +

+

+

+ +

+ + + +

+
+
+ + + + +

go home

+

scroll home

+

go end

+

scroll end

+

?move left

+

scroll left

+

?move right

+

scroll right

+

word left

+

word right

+

?line end

+

?line home

+

?line start

+

?line beginning

+
+
+ + + + +

file

+

new

+

open

+

save

+

save as

+

exit

+

edit

+

cut

+

copy

+

paste

+

voice

+

listen for dictation

+

?start dictation

+

start dictating

+

end ?of command mode

+

listen for command

+

listen for commands

+

stop dictation

+

end ?of dictation

+

stop dictating

+

?turn microphone off

+

?turn mike off

+

close microphone

+

microphone on

+

grammars active

+

grammars inactive

+

activate grammars

+

deactivate grammars

+

play

+

play back

+

add ?and delete word

+

select whole word

+

select whole words

+

shared engine

+

shared recognition engine

+

shared reco engine

+

?voice training

+

microphone setup

+

help

+

about

+

cancel

+

escape

+
+
+ + + + +

twenty

+

thirty

+

forty

+

fifty

+

sixty

+

seventy

+

eighty

+

ninety

+
+
+ + + +

one

+

two

+

three

+

four

+

five

+

six

+

seven

+

eight

+

nine

+
+
+ + + +

+ +

+ +

zero

+

ten

+

eleven

+

twelve

+

thirteen

+

fourteen

+

fifteen

+

sixteen

+

seventeen

+

eighteen

+

nineteen

+
+
+
+ + +
diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictmode.xml b/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictmode.xml new file mode 100644 index 00000000..3e7399c3 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictmode.xml @@ -0,0 +1,15 @@ + + + + + + + + + +

command

+

computer

+
+
+ +
diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictpad.rc b/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictpad.rc new file mode 100644 index 00000000..790f6755 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictpad.rc @@ -0,0 +1,111 @@ +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_DICTPAD MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "E&xit\tCtrl+X", IDM_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Voice" + BEGIN + MENUITEM "Listen for &Dictation", IDM_DICTATION_MODE, CHECKED + MENUITEM "Listen for &Commands", IDM_COMMAND_MODE + MENUITEM "&Grammars active\tCtrl+M", IDM_MIC_TOGGLE + MENUITEM "Play&back\tCtrl+P", IDM_PLAY + MENUITEM SEPARATOR + MENUITEM "&Add/Delete Word(s)...", IDM_ADDREMOVEWORDS + MENUITEM SEPARATOR + MENUITEM "Select &Whole Words", IDM_WHOLE_WORDS, CHECKED + MENUITEM "S&hared recognition engine", IDM_SHAREDENGINE + MENUITEM SEPARATOR + MENUITEM "&Voice Training...", IDM_VOICE_TRAINING + MENUITEM "Micro&phone Setup...", IDM_MICROPHONE_SETUP + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_DICTPAD ACCELERATORS MOVEABLE PURE +BEGIN + "/", IDM_ABOUT, ASCII, ALT, NOINVERT + "?", IDM_ABOUT, ASCII, ALT, NOINVERT + "C", IDM_COMMAND_MODE, VIRTKEY, ALT, NOINVERT + "D", IDM_DICTATION_MODE, VIRTKEY, ALT, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 62 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_DICTPAD,IDC_MYICON,14,9,20,20 + LTEXT "DictPad ",IDC_STATIC,49,10,58,8,SS_NOPREFIX + LTEXT "(c) 2001 Microsoft Corporation.",IDC_STATIC,49,23,177, + 11 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP + LTEXT "All rights reserved.",IDC_STATIC,49,39,177,11 +END + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_COMMAND_MODE_CFG SRGRAMMAR DISCARDABLE "jpn_cmdmode.cfg" +IDR_DICTATION_MODE_CFG SRGRAMMAR DISCARDABLE "jpn_dictmode.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "dictpad" + IDC_DICTPAD "DICTPAD" + IDM_PLAY "Play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_FONT "Allow selection of a different font " + IDM_DICTATION_MODE "Dictation" + IDS_ADD "Add" + IDS_CHANGE "Change" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_MIC_TOGGLE "Grammars active/inactive" +END + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.cpp new file mode 100644 index 00000000..da1fed4a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.cpp @@ -0,0 +1,548 @@ +/****************************************************************************** +* phrasereplace.cpp +* Implementation details for the CPhraseReplacement object which +* does the bookkeeping to translate between a phrase as +* displayed with ITN replacements and a phrase as seen +* by the associated RecoResult. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "phrasereplace.h" + +/***************************************************************************** +* CPhraseReplacement::CPhraseReplacement * +*----------------------------------------* +* Description: +* Constructor for the CPhraseReplacement class +*******************************************************************************/ +CPhraseReplacement::CPhraseReplacement() : m_fUseMaps( false ), + m_fSuccessfulSetup( false ), + m_pPhrase( NULL ), + m_cReplacementElements( 0 ), + m_pulPreToPostTable( NULL ), + m_pulPostToPreTable( NULL ), + m_pulPostToReplacementTable( NULL ) +{} /* CPhraseReplacement::CPhraseReplacement */ + +/***************************************************************************** +* CPhraseReplacement::~CPhraseReplacement * +*-----------------------------------------* +* Description: +* Destructor for the CPhraseReplacement class +* Deletes the tables and frees the SPPHRASE. +*******************************************************************************/ +CPhraseReplacement::~CPhraseReplacement() +{ + // If memory was allocated for these, then free + delete[] m_pulPreToPostTable; + delete[] m_pulPostToPreTable; + delete[] m_pulPostToReplacementTable; + + if ( m_pPhrase ) + { + // The SPPHRASE was CoTaskMemAlloc()ed by CPhraseReplacement::Initialize() + // so it needs to be freed + ::CoTaskMemFree( m_pPhrase ); + } +} /* CPhraseRepalcement::~CPhraseReplacement */ + + +/***************************************************************************** +* CPhraseReplacement::Initialize * +*--------------------------------* +* Description: +* Gets the phrase from the ISpPhrase object and calls SetUpMaps(). +* This initialization routine can be called either from a +* client with a new CPhraseReplacement object or +* when an alternate is committed (or the recoresult has +* otherwise changed). +* Return: +* Return value of ISpRecoResult::GetPhrase() +* Return value of CPhraseReplacement::SetUpMaps() +*******************************************************************************/ +HRESULT CPhraseReplacement::Initialize( ISpPhrase &rPhrase ) +{ + // Get (or re-get) the phrase + if ( m_pPhrase ) + { + ::CoTaskMemFree( m_pPhrase ); + } + HRESULT hr = rPhrase.GetPhrase( &m_pPhrase ); + if ( FAILED( hr ) ) + { + return hr; + } + + hr = SetUpMaps(); + m_fSuccessfulSetup = SUCCEEDED( hr ); + m_fUseMaps = (S_OK == hr); + + return hr; +} /* CPhraseReplacement::Initialize */ + +/***************************************************************************** +* CPhraseReplacement::SetUpMaps * +*-------------------------------* +* Description: +* Initializes the various maps in the CPhraseReplacement object. +* Called from within the initialization routines. +* Return: +* S_OK +* S_FALSE if no maps necessary +* E_OUTOFMEMORY +*******************************************************************************/ +HRESULT CPhraseReplacement::SetUpMaps() +{ + _ASSERTE( m_pPhrase ); + if ( !m_pPhrase ) + { + return E_UNEXPECTED; + } + + if ( !m_pPhrase->cReplacements ) + { + // No phrase replacements; nothing needs to be done for this phrase + m_cReplacementElements = m_pPhrase->Rule.ulCountOfElements; + return S_FALSE; + } + + // Temporary place to keep replacement info: + // This array will indicate which elements in the original (non-replaced) + // phrase start off a replacement. + // For instance, in the phrase "I have three dollars", pulPreToReplacementTable[2] + // would indicate that "three" starts off a replacement; there is one replacement + // ($3), so pulPreToReplacementTable[2] would have the value 0. + ULONG *pulPreToReplacementTable = + new ULONG[ m_pPhrase->Rule.ulCountOfElements ]; + if ( !pulPreToReplacementTable ) + { + return E_OUTOFMEMORY; + } + + // Set the value to that will indicate that no replacement starts with this element: + // Since there are m_pPhrase->cReplacements replacements, + // no replacement is going to have the index m_pPhrase->cReplacements + m_ulNoReplacementValue = m_pPhrase->cReplacements; + + // Initialize this array to indicate that no elements kick off replacements + for ( ULONG ul = 0; ul < m_pPhrase->Rule.ulCountOfElements; ul++ ) + { + pulPreToReplacementTable[ul] = m_ulNoReplacementValue; + } + + // Fill in the temporary array that maps pre-replacement elements to the + // replacements they start (if any). + // Count up the number of elements that get replaced. + ULONG cReplacedElements = 0; + for ( ULONG ulReplacement = 0; + ulReplacement < m_pPhrase->cReplacements; + ulReplacement++ ) + { + // Record the replacement's index in the ulFirstElement'th position in the + // temporary array + pulPreToReplacementTable[(m_pPhrase->pReplacements[ulReplacement]).ulFirstElement] + = ulReplacement; + + // Bump the number of replaced elements + cReplacedElements += + (m_pPhrase->pReplacements[ulReplacement]).ulCountOfElements; + } + + // Calculate how many phrase elements there will be after replacement. + // Note that each replacement will be counted as only one element ("$3" is + // one element, as is "June 28, 1977") + m_cReplacementElements = m_pPhrase->Rule.ulCountOfElements + + m_pPhrase->cReplacements - cReplacedElements ; + + // Allocate the appropriate amount of space for the tables. + // Note that a CPhraseReplace object may be initialized more than once + // in its lifetime, so we may need to free up memory previously + // allocated for these tables. + delete[] m_pulPreToPostTable; + delete[] m_pulPostToPreTable; + delete[] m_pulPostToReplacementTable; + + // This table maps from pre-replacement elements to post-replacement elements + // There are ulCountOfElements elements in the pre-replacement phrase + m_pulPreToPostTable = new ULONG[ m_pPhrase->Rule.ulCountOfElements ]; + + // This table maps from post-replacement elements to pre-replacement elements + // There are m_cReplacementElements elements in the post-replacement phrase + m_pulPostToPreTable = new ULONG[ m_cReplacementElements ]; + + // This table maps from post-replacement elements to the replacement (if any) + // to which they correspond. + m_pulPostToReplacementTable = new ULONG[ m_cReplacementElements]; + + // Check to make sure we haven't run into any memory issues + if ( !m_pulPreToPostTable || !m_pulPostToPreTable || !m_pulPostToReplacementTable ) + { + delete[] pulPreToReplacementTable; + + return E_OUTOFMEMORY; + } + + // Fill in the tables. + // There will be two counters + // ulPreReplElement which walks through the elements of the original phrase; + // ulPostReplElement which walks through the elements of the post-replacement phrase. + // Usually with replacements, a post-replacement elements ($3) corresponds to more + // than one pre-replacement element ("three dollars") + ULONG ulPreReplElement = 0; + for ( ULONG ulPostReplElement = 0; + ulPostReplElement < m_cReplacementElements; + ulPostReplElement++ ) + { + // Right now, ulPreReplElement and upPostReplElement are referring to the + // same element (though they may have different values, of course) + m_pulPostToPreTable[ulPostReplElement] = ulPreReplElement; + m_pulPostToReplacementTable[ulPostReplElement] = + pulPreToReplacementTable[ulPreReplElement]; + + if ( m_pulPostToReplacementTable[ulPostReplElement] < m_ulNoReplacementValue ) + { + // This is a replaced element; so several of the pre-replacement + // elements will correspond to this post-replacement element. + + // Use the element-to-replacement info to determine which one, so that + // we know how many pre-replacement elements to grab. + const SPPHRASEREPLACEMENT *pRepl = m_pPhrase->pReplacements + + m_pulPostToReplacementTable[ulPostReplElement]; + + // For each element covered by the replacement, make another pre-replacement + // element map to this post-replacement element and increment + // ulPreReplElement. + // (i.e. both "three" and "dollars" would map to "$3") + for ( ULONG ul = 0; ul < pRepl->ulCountOfElements; ul++, ulPreReplElement++ ) + { + _ASSERTE( ulPreReplElement < m_pPhrase->Rule.ulCountOfElements ); + m_pulPreToPostTable[ulPreReplElement] = ulPostReplElement; + } + } + else + { + // This is not a replaced element, so there is a 1-1 relationship + // between it and the ulPreReplElement'th pre-replacement element + _ASSERTE( ulPreReplElement < m_pPhrase->Rule.ulCountOfElements ); + m_pulPreToPostTable[ulPreReplElement++] = ulPostReplElement; + } + + } + + // Free up temporary array + delete[] pulPreToReplacementTable; + + return S_OK; +} /* CPhraseReplacement::SetUpMaps */ + +/******************************************************************************** +* CPhraseReplacement::GetNumNoReplacementElements * +*-------------------------------------------------* +* Description: +* Gets the number of elements as seen from the recoresult's point of view +* (i.e., without replacement) +**********************************************************************************/ +ULONG CPhraseReplacement::GetNumNoReplacementElements() +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return 0; + } + + return m_pPhrase->Rule.ulCountOfElements; +} /* CPhraseReplacement::GetNumReplacementElements */ + + +/******************************************************************************** +* CPhraseReplacement::GetNumReplacementElements * +*-----------------------------------------------* +* Description: +* Gets the number of elements as seen from the caller's point of view +* (i.e., with replacement) +**********************************************************************************/ +ULONG CPhraseReplacement::GetNumReplacementElements() +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return 0; + } + + if ( m_fUseMaps ) + { + // There are replacements + return m_cReplacementElements; + } + else + { + // There are no replacements + return m_pPhrase->Rule.ulCountOfElements; + } +} /* CPhraseReplacement::GetNumReplacementElements */ + +/******************************************************************************** +* CPhraseReplacement::GetDisplayText * +*------------------------------------* +* Description: +* Hands back the text associated with the given phrase "element" +* If bUseReplacedElements is false or this phrase has no replacements, +* simply returns the display text for the appropriate element. +* Otherwise, consults the element mappings and returns the +* replacement text or the display text for the ulElement'th pre- +* replacement element, as appropriate. +* Return: +* Pointer to a text buffer containing the display text +* NULL if failed +**********************************************************************************/ +const WCHAR * CPhraseReplacement::GetDisplayText( ULONG ulElement, + BYTE *pbDisplayAttributes, + bool bUseReplacedElements ) +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return NULL; + } + + const WCHAR *pwszRetText = NULL; + BYTE bDisplayAttributes = 0; + + if ( !m_fUseMaps || !bUseReplacedElements ) + { + // Do not map; just hand back the display text for the requested + // element + if ( ulElement < m_pPhrase->Rule.ulCountOfElements ) + { + bDisplayAttributes = + m_pPhrase->pElements[ulElement].bDisplayAttributes; + pwszRetText = m_pPhrase->pElements[ulElement].pszDisplayText; + } + } + else + { + // Caller is using a post-replacement index and wants the text from that + // replacement + if ( ulElement < m_cReplacementElements ) + { + if ( m_pulPostToReplacementTable[ulElement] < m_pPhrase->cReplacements ) + { + // This is a replaced element; hand back the replacement text + // and attributes + const SPPHRASEREPLACEMENT *pRepl = m_pPhrase->pReplacements + + m_pulPostToReplacementTable[ulElement]; + pwszRetText = pRepl->pszReplacementText; + bDisplayAttributes = pRepl->bDisplayAttributes; + } + else + { + // This element has not been replaced; hand back the text + // and attributes corresponding to the appropriate + // pre-replacement element + ULONG ulPreReplElement = m_pulPostToPreTable[ulElement]; + pwszRetText = m_pPhrase->pElements[ulPreReplElement].pszDisplayText; + bDisplayAttributes = + m_pPhrase->pElements[ulPreReplElement].bDisplayAttributes; + } + } + } + + if ( pbDisplayAttributes ) + { + *pbDisplayAttributes = bDisplayAttributes; + } + + // In case of error, this remains NULL + return pwszRetText; + +} /* CPhraseReplacement::GetDisplayText */ + +/******************************************************************************** +* CPhraseReplacement::PreToPostReplacementIndex * +*-----------------------------------------------* +* Description: +* Converts from a pre-replacement index to a with-replacement index. +* If ulSPPHRASEIndex is equal to the number of (pre-replacement) elements +* will return the number of post-replacement elements in +* *pulReplacedPhraseIndex +* Return: +* S_OK +* E_POINTER +* E_FAIL +* E_INVALIDARG if ulSPPHRASEIndex is out-of-bounds +**********************************************************************************/ +HRESULT CPhraseReplacement::PreToPostReplacementIndex( ULONG ulSPPHRASEIndex, + ULONG *pulReplacedPhraseIndex) +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return E_FAIL; + } + + if ( !pulReplacedPhraseIndex ) + { + return E_POINTER; + } + if ( ulSPPHRASEIndex > m_pPhrase->Rule.ulCountOfElements ) + { + // Out of bounds index + return E_INVALIDARG; + } + + if ( ulSPPHRASEIndex == m_pPhrase->Rule.ulCountOfElements ) + { + *pulReplacedPhraseIndex = m_fUseMaps ? + m_cReplacementElements : m_pPhrase->Rule.ulCountOfElements; + } + else + { + // If the maps are valid, do a lookup; + // otherwise just return the original index + *pulReplacedPhraseIndex = m_fUseMaps ? + m_pulPreToPostTable[ulSPPHRASEIndex] : ulSPPHRASEIndex; + } + + return S_OK; +} /* CPhraseReplacement::PreToPostReplacementIndex */ + +/******************************************************************************** +* CPhraseReplacement::PostToPreReplacementIndex * +*-----------------------------------------------* +* Description: +* Converts from a with-replacement index to a pre-replacement index +* If ulReplacedPhraseIndex is equal to the number of (post-replacement) +* elements, will return the number of pre-replacement elements in +* *pulSPPHRASEIndex +* Return: +* S_OK +* E_POINTER +* E_FAIL +* E_INVALIDARG if ulReplacedPhraseIndex is out-of-bounds +**********************************************************************************/ +HRESULT CPhraseReplacement::PostToPreReplacementIndex( ULONG ulReplacedPhraseIndex, + ULONG *pulSPPHRASEIndex ) +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return E_FAIL; + } + + if ( !pulSPPHRASEIndex ) + { + return E_POINTER; + } + if ( ulReplacedPhraseIndex > m_cReplacementElements ) + { + // Out of bounds index + return E_INVALIDARG; + } + + if ( ulReplacedPhraseIndex == m_cReplacementElements ) + { + *pulSPPHRASEIndex = m_pPhrase->Rule.ulCountOfElements; + } + else + { + // If the maps are valid, do a lookup; + //otherwise just return the original index + *pulSPPHRASEIndex = m_fUseMaps ? + m_pulPostToPreTable[ulReplacedPhraseIndex] : ulReplacedPhraseIndex; + } + + return S_OK; +} /* CPhraseReplacement::PostToPreReplacementIndex */ + +/******************************************************************************** +* CPhraseReplacement::ExpandToIncludeWholeReplacements * +*------------------------------------------------------* +* Description: +* Takes pre-replacement indices in the in/out params pulPreReplStart and +* pcPreReplElts and expands them, if necessary, to contain entire +* replacements. +* Example: "Thirty nine is the first uninteresting number." +* If *pulPreReplStart = 1 and *pcPreReplElts = 4, then when this +* function returns *pulPreReplStart = 0 and *pcPreReplElts = 5 (in order +* to include "thirty" at the beginning) +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if *pulPreReplStart and *pcPreReplElts indicate an +* out-of-bounds range or if *pcPreReplElts is 0 +**********************************************************************************/ +HRESULT CPhraseReplacement::ExpandToIncludeWholeReplacements( ULONG *pulPreReplStart, + ULONG *pcPreReplElts ) +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return E_FAIL; + } + + if ( !pulPreReplStart || !pcPreReplElts ) + { + return E_POINTER; + } + + if ( !m_fUseMaps ) + { + // Don't need to do anything since there are no maps + return S_OK; + } + + // Validate params + if ( (*pulPreReplStart >= GetNumNoReplacementElements()) || + (0 == *pcPreReplElts) || + ((*pulPreReplStart + *pcPreReplElts) > GetNumNoReplacementElements()) ) + { + // Out-of-bounds range or degenerate element range + return E_INVALIDARG; + } + + // Convert the start to a post-replacement value and see if that + // element has any replacement associated with it + ULONG ulPostReplStart; + HRESULT hr = PreToPostReplacementIndex( *pulPreReplStart, &ulPostReplStart ); + if ( SUCCEEDED( hr ) ) + { + ULONG ulReplacement = m_pulPostToReplacementTable[ ulPostReplStart ]; + if ( ulReplacement < m_ulNoReplacementValue ) + { + // There is an associated replacement + // Move back *pulPreReplStart to the beginning of what that replacement replaces + const SPPHRASEREPLACEMENT *pRepl = m_pPhrase->pReplacements + ulReplacement; + *pulPreReplStart = pRepl->ulFirstElement; + } + } + else + { + return hr; + } + + // Do the same for the last element + ULONG ulPreReplLast = *pulPreReplStart + *pcPreReplElts - 1; + ULONG ulPostReplLast; + hr = PreToPostReplacementIndex( ulPreReplLast, &ulPostReplLast ); + if ( SUCCEEDED( hr ) ) + { + ULONG ulReplacement = m_pulPostToReplacementTable[ ulPostReplLast ]; + if ( ulReplacement < m_ulNoReplacementValue ) + { + // There is an associated replacement + // Advance ulPreReplLast to the last element that the replacement replaces + const SPPHRASEREPLACEMENT *pRepl = m_pPhrase->pReplacements + ulReplacement; + ulPreReplLast = pRepl->ulFirstElement + pRepl->ulCountOfElements - 1; + } + } + else + { + return hr; + } + + // Adjust the count of elements + *pcPreReplElts = ulPreReplLast - *pulPreReplStart + 1; + + return S_OK; +} /* CPhraseReplacement::ExpandToIncludeWholeReplacements */ diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.h new file mode 100644 index 00000000..24f9f629 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.h @@ -0,0 +1,61 @@ +/**************************************************************************** +* phrasereplace.h +* This module contains the definition support for CPhraseReplacement, +* which does the bookkeeping to translate between a phrase as +* displayed with ITN replacements and a phrase as thought of +* by the associated RecoResult +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#pragma once + +#ifndef __PHRASEREPLACE_H +#define __PHRASEREPLACE_H + +class CPhraseReplacement +{ +public: + CPhraseReplacement(); + ~CPhraseReplacement(); + + HRESULT Initialize( ISpPhrase &rSpPhrase ); + + ULONG GetNumNoReplacementElements(); + ULONG GetNumReplacementElements(); + + // Gets the text of a given element + const WCHAR * GetDisplayText( ULONG ulElement, + BYTE *pbDisplayAttributes = NULL, + bool bUseReplacedElements = true ); + + // Conversion methods + HRESULT PreToPostReplacementIndex( ULONG ulSPPHRASEIndex, + ULONG *pulReplacePhraseIndex ); + HRESULT PostToPreReplacementIndex( ULONG ulReplacedPhraseIndex, + ULONG *pulSPPHRASEIndex ); + HRESULT ExpandToIncludeWholeReplacements( ULONG *pulPreReplStart, + ULONG *pcPreReplElts ); + +private: + HRESULT SetUpMaps(); // Does the real initialization work + + bool m_fUseMaps; // Indicates whether to use the maps + bool m_fSuccessfulSetup; // Indicates the this object is usable + + SPPHRASE *m_pPhrase; + ULONG m_cReplacementElements; // Number of elements after + // replacements have been made + ULONG *m_pulPreToPostTable; // Given the index of an element in the phrase, + // contains the index of that element with + // replacements + ULONG *m_pulPostToPreTable; // Given the index of an element with replacements, + // contains the index of that element in the + // original phrase + ULONG *m_pulPostToReplacementTable; // Given the index of an element with replacements, + // indicates which replacement (if any) that + // element corresponds to + ULONG m_ulNoReplacementValue; // Value in tables to indicate that no + // replacement corresponds to this element. +}; // class CPhraseReplacement + +#endif // __PHRASEREPLACE_H \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/readme.txt b/mp/src/utils/sapi51/Samples/CPP/DictPad/readme.txt new file mode 100644 index 00000000..99fd1c7d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/readme.txt @@ -0,0 +1,56 @@ +======================================================================== + WIN32 APPLICATION : dictpad +======================================================================== + + +AppWizard has created this dictpad application for you. + +This file contains a summary of what you will find in each of the files that +make up your dictpad application. + +dictpad.cpp + This is the main application source file. + +dictpad.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + + +///////////////////////////////////////////////////////////////////////////// +AppWizard has created the following resources: + +dictpad.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +res\dictpad.ico + This is an icon file, which is used as the application's icon (32x32). + This icon is included by the main resource file dictpad.rc. + +small.ico + %%This is an icon file, which contains a smaller version (16x16) + of the application's icon. This icon is included by the main resource + file dictpad.rc. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named dictpad.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.cpp new file mode 100644 index 00000000..5ba94243 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.cpp @@ -0,0 +1,546 @@ +/**************************************************************************** +* recomgr.cpp +* Support for queuing insertion points and correctly placing +* recognized text +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include +#include "recomgr.h" + +/**************************************************************************** +* CRecoEventMgr::CRecoEventMgr * +*------------------------------* +* Description: +* Constructor for the recoevent manager +*****************************************************************************/ +CRecoEventMgr::CRecoEventMgr( HINSTANCE hInstance ) : + m_hInst( hInstance ), + m_fPhraseStarted( false ), + m_pTextSel( NULL ), + m_pHeadLP( NULL ), + m_pHeadWM( NULL ), + m_pTailWM( NULL ) +{ +} /* CRecoEventMgr::CRecoEventMgr */ + +/**************************************************************************** +* CRecoEventMgr::~CRecoEventMgr * +*-------------------------------* +* Description: +* Destructor for the recoevent manager +*****************************************************************************/ +CRecoEventMgr::~CRecoEventMgr() +{ + CleanUp(); +} /* CRecoEventMgr::~CRecoEventMgr */ + + +/**************************************************************************** +* CRecoEventMgr::PhraseStart * +*----------------------------* +* Description: +* Sets the flag to indicate that a phrase has been started. +* Drops a listen point by calling SelNotify() +* Return: +* S_OK +* E_OUTOFMEMORY +* Return value of CRecoEventMgr::SelNotify() +*****************************************************************************/ +HRESULT CRecoEventMgr::PhraseStart( ITextRange &rSelRange ) +{ + // There should not be any phrases in progress or any listen points + _ASSERTE( !m_fPhraseStarted && !m_pHeadLP ); + m_fPhraseStarted = true; + + // Should add a listening point right now + HRESULT hr = SelNotify( rSelRange ); + if ( FAILED( hr ) ) + { + return hr; + } + + if ( !m_pHeadLP ) + { + return E_OUTOFMEMORY; + } + + m_pHeadLP->fFromPhraseStart = true; + + return S_OK; +} /* CRecoEventMgr::PhraseStart */ + +/**************************************************************************** +* CRecoEventMgr::SelNotify * +*--------------------------* +* Description: +* Called whenever the selection changes. +* Drops a new listening point onto the list of listening points for +* this phrase if there is a phrase currently being processed +* being listened to. +* Hands back the range to be eventually replaced by recognized +* text (or deleted). +* Return: +* S_OK +* S_FALSE if nothing had to be done +* E_OUTOFMEMORY +* Return value of ITextRange::GetDuplicate() +* Return value of ITextRange::Collapse() +*****************************************************************************/ +HRESULT CRecoEventMgr::SelNotify( ITextRange &rSelRange ) +{ + // Only want to queue this listen if we are listening to a phrase + HRESULT hr = S_FALSE; + if ( m_fPhraseStarted ) + { + // Get the time now + FILETIME ftNow; + ::CoFileTimeNow( &ftNow ); + + // Does this range overlap any of the existing ranges in the list? + LISTENPOINT *p; + for ( p = m_pHeadLP; + p && AreDisjointRanges( &rSelRange, p->cpRangeToReplace ); + p = p->pNext ) + ; + + // If p is not NULL, that means that there is already some listen point + // that is adjacent to or overlaps this range, so another listen point + // is not necessary + if ( !p ) + { + // Add a new listen point + LISTENPOINT *pNewPoint = new LISTENPOINT; + if ( !pNewPoint ) + { + return E_OUTOFMEMORY; + } + + // Get the ranges + hr = rSelRange.GetDuplicate( &(pNewPoint->cpRangeToReplace) ); + + // Get the timestamp + pNewPoint->ftTime = ftNow; + + // This flag will be set by PhraseStart() if appropriate + pNewPoint->fFromPhraseStart = false; + + // No hypothesis text here yet + pNewPoint->fHasHypothesisText = false; + + // Put this new listenpoint onto the head of the list + pNewPoint->pNext = m_pHeadLP; + m_pHeadLP = pNewPoint; + + long lEndOfRangeToReplace; + pNewPoint->cpRangeToReplace->GetEnd( &lEndOfRangeToReplace ); + + // The selection should be forced to the end of the range to replace; + // this keeps the selection out of ranges that might be replaced + // by recognized text + m_pTextSel->SetRange( + lEndOfRangeToReplace, lEndOfRangeToReplace ); + + // If we got here, we were successful + hr = S_OK; + } + } + return hr; +} /* CRecoEventMgr::SelNotify */ + +/**************************************************************************** +* CRecoEventMgr::IsEditable * +*---------------------------* +* Description: +* Determines whether pRange overlaps any of the current listen points. +* If it does, and if pNextEditableRange is non-NULL, sets +* pNextEditableRange to the next range that can be edited with +* impunity +* Return: +* true iff the RecoEventMgr is okay with this text being edited +*****************************************************************************/ +bool CRecoEventMgr::IsEditable( ITextRange *pRange, + ITextRange **ppNextEditableRange ) +{ + if ( !pRange ) + { + return false; + } + if ( !m_fPhraseStarted ) + { + // Always editable if there's no reco computation + return true; + } + + // Does this range overlap or abut any of the existing ranges in the list? + LISTENPOINT *p; + for ( p = m_pHeadLP; + p && AreDisjointRanges( pRange, p->cpRangeToReplace ); + p = p->pNext ) + ; + + if ( p ) + { + // There is a phrase that overlaps or abuts this one. + // If pRange dovetails onto the end of it, then the + // range is editable; otherwise it is not + long lRangeStart = 0; + long lLPEnd = 0; + pRange->GetStart( &lRangeStart ); + p->cpRangeToReplace->GetEnd( &lLPEnd ); + + if ( lRangeStart < lLPEnd ) + { + // If pNextEditableRange is non-NULL, set it a degenerate range + // at the end of the listen point range + if ( ppNextEditableRange ) + { + // Release whatever is already there + if ( *ppNextEditableRange ) + { + (*ppNextEditableRange)->Release(); + } + + // Get a duplicate of the range to replace and collapse at the end + HRESULT hr = p->cpRangeToReplace->GetDuplicate( ppNextEditableRange ); + if ( SUCCEEDED( hr ) ) + { + (*ppNextEditableRange)->Collapse( tomEnd ); + } + else + { + *ppNextEditableRange = NULL; + } + } + return false; + } + } + + // pRange is editable + // Leave ppNextEditableRange, whatever it is + + return true; +} /* CRecoEventMgr::IsEditable */ + +/**************************************************************************** +* CRecoEventMgr::QueueCommand * +*-----------------------------* +* Description: +* Called when the engine is currently processing a phrase. +* Puts the command at the tail of the command queue. +*****************************************************************************/ +void CRecoEventMgr::QueueCommand( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + if ( !m_fPhraseStarted ) + { + // Don't queue commands unless a phrase is being processed + return; + } + + QUEUEDWM *pWM = new QUEUEDWM; + if ( !pWM ) + { + // Out of memory: This WM_COMMAND will get dropped + return; + } + pWM->hWnd = hWnd; + pWM->message = message; + pWM->wParam = wParam; + pWM->lParam = lParam; + pWM->pNext = NULL; + + if ( m_pTailWM ) + { + // Non-empty queue + m_pTailWM->pNext = pWM; + m_pTailWM = pWM; + } + else + { + // Empty queue + m_pHeadWM = m_pTailWM = pWM; + } +} /* CRecoEventMgr::QueueCommand */ + +/**************************************************************************** +* CRecoEventMgr::Hypothesis * +*---------------------------* +* Description: +* Called whenever a hypothesis comes back to Dictpad. +* Looks for the latest listening point whose timestamp predates ftRecoTime +* or for the phrase-start-generated listening point, +* whichever came later. +* Hands back the range to be replaced by the recognized text, or NULL +* if this hypothesis is to be dropped (i.e. did not come between +* a PHRASE_START and a RECOGNITION/FALSE_RECOGNITION +* Return: +* A pointer to an ITextRange in which the hypothesis should go. +* NULL in case of error. +*****************************************************************************/ +ITextRange * CRecoEventMgr::Hypothesis( FILETIME ftRecoTime ) +{ + if ( !m_fPhraseStarted || !m_pHeadLP ) + { + // This hypothesis did not come between a PHRASE_START and a RECOGNITION, + // so we drop it + return NULL; + } + + // Since the listen points are ordered by most recent first, we are + // looking for the first element whose timestamp predates ftRecoTime + LISTENPOINT *p = m_pHeadLP; + for ( p = m_pHeadLP; + p && (CompareFiletimes( ftRecoTime, p->ftTime ) < 0) && + !(p->fFromPhraseStart); + p = p->pNext ) + ; + + if ( !p ) + { + // Should not happen! There should at least be a listen point queued + // from PhraseStart() on this phrase + _ASSERTE( false ); + return NULL; + } + + // This listen point has now been marked to receive hypothesis text + p->fHasHypothesisText = true; + + return p->cpRangeToReplace; +} /* CRecoEventMgr::Hypothesis */ + +/**************************************************************************** +* CRecoEventMgr::Recognition * +*----------------------------* +* Description: +* Called whenever a recognition comes back to Dictpad. +* Looks for the latest listening point whose timestamp predates +* ftRecoTime or for the phrase-start-generated listening point, +* whichever came later. +* Deletes all earlier listening points. +* Hands back a duplicate of the range to be replaced by the recognized +* text. +* Return: +* S_OK +* S_FALSE if the recognition was from some phrase that was started +* when our grammars were inactive. +* Return value from ITextRange::GetDuplicate() +*****************************************************************************/ +HRESULT CRecoEventMgr::Recognition( FILETIME ftRecoTime, ITextRange **ppRecoRange ) +{ + + // A SPEI_RECOGNITION without a SPEI_PHRASE_START means that the phrase was + // started when our grammars were inactive, so we'd like to ignore this one. + if ( !m_fPhraseStarted || !m_pHeadLP ) + { + return S_FALSE; + } + + // Since the listen points are ordered by most recent first, we are + // looking for the first element whose timestamp predates ftRecoTime + LISTENPOINT *p = m_pHeadLP; + for ( p = m_pHeadLP; + p && (CompareFiletimes( ftRecoTime, p->ftTime ) < 0) && !(p->fFromPhraseStart); + p = p->pNext ) + ; + + _ASSERTE( p ); + if ( !p ) + { + // Should not happen! + return E_UNEXPECTED; + } + + // Get rid of all subsequent (earlier) listening points + DeleteAfter( p ); + + // Get the range to return. + // Make a duplicate, since this range will be destroyed before the caller + // can AddRef it. + HRESULT hr = p->cpRangeToReplace->GetDuplicate( ppRecoRange ); + + // This listen point will now contain real (non-hypothesis) text + p->fHasHypothesisText = false; + + // p will get cleaned up later when DoneProcessingPhrase() is called + + return hr; +} /* CRecoEventMgr::Recognition */ + +/**************************************************************************** +* CRecoEventMgr::FalseRecognition * +*---------------------------------* +* Description: +* Called whenever a false recognition comes back to Dictpad. +* Finds the phrase-start-marked listen point +* and deletes everything after it +*****************************************************************************/ +void CRecoEventMgr::FalseRecognition() +{ + if ( !m_fPhraseStarted || !m_pHeadLP ) + { + // This means that this is a RECO_OTHER_CONTEXT, or a recognition for + // a grammar other than dictation within our own context, neither of + // which we care about + return; + } + + // Clean up anything that happened before the start of this utterance + for ( LISTENPOINT *p = m_pHeadLP; p && !(p->fFromPhraseStart); p = p->pNext ) + { + ; + } + if ( p ) + { + DeleteAfter( p ); + } + + // p will get cleaned up later when DoneProcessingPhrase() is called + +} /* CRecoEventMgr::FalseRecognition */ + +/**************************************************************************** +* CRecoEventMgr::DoneProcessingPhrase * +*-------------------------------------* +* Description: +* Sets m_fPhraseStarted to false. +* Calls CleanUp() to clean up the listen point list +* and WM_COMMAND queue. +*****************************************************************************/ +void CRecoEventMgr::DoneProcessingPhrase() +{ + m_fPhraseStarted = false; + CleanUp(); +} /* CRecoEventMgr::DoneProcessingPhrase */ + +/**************************************************************************** +* CRecoEventMgr::CleanUp * +*------------------------* +* Description: +* Deletes all nodes. +* Resends the queued messages and cleans up the queue +*****************************************************************************/ +void CRecoEventMgr::CleanUp() +{ + m_fPhraseStarted = false; + + // Remove any hypothesis text + for ( LISTENPOINT *p = m_pHeadLP; p; p = p->pNext ) + { + if ( p->fHasHypothesisText && p->cpRangeToReplace ) + { + p->cpRangeToReplace->SetText( L"" ); + } + } + + // Clean up the listen point list + if ( m_pHeadLP ) + { + DeleteAfter( m_pHeadLP ); + delete m_pHeadLP; + m_pHeadLP = NULL; + } + + // Resend the WM_x messages that had been waiting during the computation + // on the phrase and clean up the queue + QUEUEDWM *pWM; + while ( m_pHeadWM ) + { + pWM = m_pHeadWM; + ::SendMessage( pWM->hWnd, pWM->message, pWM->wParam, pWM->lParam ); + + m_pHeadWM = m_pHeadWM->pNext; + delete pWM; + } + m_pHeadWM = m_pTailWM = NULL; +} /* CRecoEventMgr::CleanUp */ + + +/**************************************************************************** +* CRecoEventMgr::DeleteAfter * +*----------------------------* +* Description: +* Deletes all nodes after pCutoff. +*****************************************************************************/ +void CRecoEventMgr::DeleteAfter( LISTENPOINT *pCutoff ) +{ + if ( pCutoff ) + { + LISTENPOINT *p, *pNextInLine; + for ( p = pCutoff->pNext; p; p = pNextInLine ) + { + pNextInLine = p->pNext; + delete p; + } + } + + pCutoff->pNext = NULL; +} /* CRecoEventMgr::DeleteAfter */ + +/**************************************************************************** +* CompareFiletimes * +*------------------* +* Return: +* -1 if ft1 is earlier than ft2 +* 0 if ft1 == ft2 +* 1 if ft1 is greater than ft2 +*****************************************************************************/ +int CompareFiletimes( FILETIME ft1, FILETIME ft2 ) +{ + if ( ft1.dwHighDateTime < ft2.dwHighDateTime ) + { + return -1; + } + else if ( ft1.dwHighDateTime > ft2.dwHighDateTime ) + { + return 1; + } + else + { + if ( ft1.dwLowDateTime < ft2.dwLowDateTime ) + { + return -1; + } + else if ( ft1.dwLowDateTime > ft2.dwLowDateTime ) + { + return 1; + } + else + { + return 0; + } + } +} /* CompareFiletimes */ + +/**************************************************************************** +* AreDisjointRanges * +*-------------------* +* Description: +* Suppose Range1 has limits cpMin1, cpMax1. +* Suppose Range2 has limits cpMin2, cpMax2. +* Range1 and Range2 are disjoint iff +* cpMin2 > cpMax1 OR cpMax2 < cpMin1. +* That is, they are disjoint iff there is no overlap and they do not +* dovetail. +* Return: +* true iff the two ranges neither overlap nor abut. +*****************************************************************************/ +bool AreDisjointRanges( ITextRange *pRange1, ITextRange *pRange2 ) +{ + if ( !( pRange1 && pRange2 ) ) + { + return true; + } + + long cpMin1, cpMax1, cpMin2, cpMax2; + pRange1->GetStart( &cpMin1 ); + pRange1->GetEnd( &cpMax1 ); + pRange2->GetStart( &cpMin2 ); + pRange2->GetEnd( &cpMax2 ); + + return (( cpMin2 > cpMax1 ) || ( cpMax2 < cpMin1 )); +} /* AreDisjointRanges */ diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.h new file mode 100644 index 00000000..bda1facd --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.h @@ -0,0 +1,101 @@ +/**************************************************************************** +* recomgr.h +* Support for queuing insertion points and correctly placing +* recognized text +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#pragma once + +#ifndef __RECOMGR_H +#define __RECOMGR_H + +// A structure that represents a range waiting for a possible dictation result +typedef struct LISTENPOINT +{ + CComPtr cpRangeToReplace; // The entire range to be replaced + // when a recognition comes back + FILETIME ftTime; + bool fFromPhraseStart; // Indicates that this + // listening point was added + // because a phrasestart + // happened + bool fHasHypothesisText; // Indicates that this listen point + // has some hypothesis text associated + // with it + LISTENPOINT *pNext; +} LISTENPOINT; + +// A queued message +typedef struct QUEUEDWM +{ + HWND hWnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + QUEUEDWM *pNext; +} QUEUEDWM; + + +/***************************************************************************** +* CRecoEventMgr * +*---------------* +* Handles the placement of recognized text according to the timing of +* the events +******************************************************************************/ +class CRecoEventMgr +{ + public: + CRecoEventMgr( HINSTANCE hInstance ); + ~CRecoEventMgr(); + + void SetTextSel( ITextSelection *pTextSel ) { m_pTextSel = pTextSel; } + bool IsProcessingPhrase() { return m_fPhraseStarted; } + + // Methods called by app to notify CRecoEventMgr of events + HRESULT PhraseStart( ITextRange &rSelRange ); + // Called when a PHRASE_START + // notification is received + HRESULT SelNotify( ITextRange &rSelRange ); // Called whenever the + // selection has changed + bool IsEditable( ITextRange *pRange, ITextRange **ppNextEditableRange ); + // Returns false iff there is + // currently a reco computation + // going on and the current sel + // overlaps a listen point + void QueueCommand( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + // Called when a WM_ messsage + // is received during a + // reco computation + ITextRange * Hypothesis( FILETIME ftRecoTime ); + HRESULT Recognition( FILETIME ftRecoTime, ITextRange **ppRecoRange ); + void FalseRecognition(); + + // Methods called by app when phrase-computation is over + void DoneProcessingPhrase(); // Turns off m_fPhraseStarted + // and cleans up the list + private: + void CleanUp(); // Frees up the lists and + // unleashes the waiting WM_s + + void DeleteAfter( LISTENPOINT *pCutoff ); + // Will delete all points in + // in the listening point list + // after pCutoff + // the head of the list + + HINSTANCE m_hInst; // HINSTANCE for LoadString() + bool m_fPhraseStarted; // true iff there is a phrase being processed + ITextSelection *m_pTextSel; // The selection in dictpad's window + LISTENPOINT *m_pHeadLP; // List of listening points, most recent first + QUEUEDWM *m_pHeadWM; // Queue of WM_s + QUEUEDWM *m_pTailWM; + +}; /* class CRecoEventMgr */ + +// Helper function +int CompareFiletimes( FILETIME ft1, FILETIME ft2 ); +bool AreDisjointRanges( ITextRange *pRange1, ITextRange *pRange2 ); +bool AreNonOverlappingRanges( ITextRange *pRange1, ITextRange *pRange2 ); + +#endif // __RECOMGR_H \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/resource.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/resource.h new file mode 100644 index 00000000..c831321e --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/resource.h @@ -0,0 +1,136 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by dictpad.rc +// +#define IDC_MYICON 2 +#define IDC_REMOVEFROMLEX 3 +#define IDC_ADDBACKTOLEX 4 +#define IDD_DICTPAD_DIALOG 101 +#define IDD_ABOUTBOX 102 +#define IDS_APP_TITLE 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDS_HELLO 106 +#define IDI_DICTPAD 107 +#define IDI_SMALL 108 +#define IDC_DICTPAD 109 +#define IDC_TOOLBAR 110 +#define IDM_PLAY 111 +#define IDM_MIC_TOGGLE 112 +#define IDC_STATUSBAR 113 +#define IDR_MAINFRAME 128 +#define IDB_BITMAP2 132 +#define IDB_BITMAP1 134 +#define IDR_TOOLBAR 135 +#define IDB_BITMAP3 139 +#define IDR_DICTATION_MODE_CFG 140 +#define IDR_COMMAND_MODE_CFG 141 +#define IDD_ADDREMOVEWORDS 142 +#define IDD_ADDREMOVEBOX 142 +#define IDD_WORDPRONUNCIATIONBOX 142 +#define IDD_ADDREMOVEWORDSBOX 146 +#define IDD_REVIEWPRONUNCIATIONSBOX 147 +#define IDD_USERLEXBOX 148 +#define IDR_TOOLBAR1 149 +#define IDD_ALTERNATES 154 +#define IDC_ABOUT_DICTPAD_VERSION 1000 +#define IDC_ABOUT_COMPONENTS 1001 +#define IDC_CHANGE 1006 +#define IDC_DELETE 1007 +#define IDC_PLAY 1009 +#define IDC_SOUNDSLIKE 1011 +#define IDC_WORD 1013 +#define IDC_COMBO_AUDIO 1014 +#define IDC_COMBO_POS 1018 +#define IDC_LIST_PRONS 1025 +#define IDC_ADD 1027 +#define IDC_RADIO_SINGLEWORD 1030 +#define IDC_RADIO_ADDFROMDOC 1031 +#define IDC_LIST_NEWWORDS 1031 +#define IDC_RADIO_ADDFROMSEL 1032 +#define IDC_RADIO_ADDFROMSPELLING 1033 +#define IDC_REMOVE 1034 +#define IDC_LIST_WORDSINLEX 1034 +#define IDC_LIST_WORDSOUTOFLEX 1035 +#define IDC_LIST1 1037 +#define IDC_CANDIDATELIST 1037 +#define IDM_FONT 32771 +#define IDM_DICTATION_MODE 32772 +#define IDS_TB0 32773 +#define IDM_COMMAND_MODE 32774 +#define ID_VOICE_ADDREMOVEWORDS 32775 +#define IDM_VOICE_ADDREMOVEWORDS 32776 +#define IDM_ADDREMOVEWORDS 32776 +#define IDM_COMMANDS 32777 +#define IDS_ADD 32778 +#define IDM_VOICE_TRAINING 32779 +#define IDS_CHANGE 32779 +#define IDM_WHOLE_WORDS 32780 +#define IDS_NONEWWORDS 32780 +#define IDM_AUTO_PLAYBACK 32781 +#define IDS_NOWORDSADDED 32781 +#define IDS_TB1 32782 +#define IDS_WAITING 32782 +#define IDM_MODE_TOGGLE 32783 +#define IDS_INVALIDFILEFORMAT 32783 +#define IDS_CANNOTOPEN 32784 +#define IDS_ERRORSAVING 32785 +#define IDS_CANNOTSAVE 32786 +#define IDS_CONFIRMCLOSE 32787 +#define IDS_MICROPHONESETUPWIZARD 32791 +#define IDS_ACCESSDENIED 32793 +#define IDS_CANNOTSWITCHMODES 32794 +#define IDS_CANNOTFILENEW 32795 +#define ID_BUTTON32796 32796 +#define IDS_UPDATEERROR 32796 +#define ID_BUTTON32797 32797 +#define IDS_UNSUPPORTEDLANG 32797 +#define ID_BUTTON32798 32798 +#define ID_BUTTON32799 32799 +#define ID_BUTTON32800 32800 +#define ID_BUTTON32801 32801 +#define ID_BUTTON32802 32802 +#define ID_BUTTON32803 32803 +#define ID_BUTTON32804 32804 +#define ID_BUTTON32805 32805 +#define ID_BUTTON32806 32806 +#define ID_BUTTON32807 32807 +#define ID_BUTTON32808 32808 +#define ID_BUTTON32809 32809 +#define ID_BUTTON32810 32810 +#define ID_BUTTON32811 32811 +#define ID_BUTTON32812 32812 +#define ID_BUTTON32813 32813 +#define ID_BUTTON32814 32814 +#define ID_BUTTON32815 32815 +#define ID_FILE_OPEN 32816 +#define ID_FILE_SAVE 32817 +#define ID_FILE_SAVEAS 32818 +#define ID_FILE_NEW 32819 +#define ID_EDIT_UNDO 32820 +#define ID_EDIT_REDO 32821 +#define ID_EDIT_CUT 32822 +#define ID_EDIT_COPY 32823 +#define ID_EDIT_PASTE 32824 +#define ID_HELP_CONTENTS 32825 +#define ID_HELP_SEARCH 32826 +#define ID_HELP_INDEX 32827 +#define IDM_USERLEX 32828 +#define IDB_DICTMODE 32829 +#define IDB_COMMANDMODE 32830 +#define IDB_PLAY 32831 +#define IDB_MICTOGGLE 32832 +#define IDM_MICROPHONE_SETUP 32835 +#define IDM_SHAREDENGINE 32836 +#define IDC_LIST_ALTS 32837 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 157 +#define _APS_NEXT_COMMAND_VALUE 32839 +#define _APS_NEXT_CONTROL_VALUE 1038 +#define _APS_NEXT_SYMED_VALUE 114 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.cpp new file mode 100644 index 00000000..d952ab66 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.cpp @@ -0,0 +1,755 @@ +/****************************************************************************** +* resultcontainer.cpp +* This module contains the definition of CResultContainer. +* CResultContainer makes all of the recognition-object- +* specific SAPI5 calls +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resultcontainer.h" + +/********************************************************************** +* CResultContainer::CResultContainer * +*------------------------------------* +* Description: +* Constructor for the CResultContainer class. +* A CResultContainer is created by the first CDictationRun +* to be created for a given result object. +**********************************************************************/ +CResultContainer::CResultContainer( ISpRecoResult &rResult, + CDictationRun &rFirstOwner, + CPhraseReplacement &rPhraseReplacement ) : + m_cpRecoResult( &rResult ), + m_pPhraseReplacement( &rPhraseReplacement ), + m_pOwnerListHead( NULL ), + m_cLastRequestedAltsReturned( 0 ), + m_ulStartOfLastRequestedAlts( 0 ), + m_cElementsInLastRequestedAlts( 0 ) +{ + // The owner should go onto the list + m_pOwnerListHead = new OWNERNODE; + if ( m_pOwnerListHead ) + { + m_pOwnerListHead->pOwner = &rFirstOwner; + m_pOwnerListHead->pNext = NULL; + } + // If the allocation failed, all calls that need it + // will return E_OUTOFMEMORY + + // Zero out the requested phrase alternates array + memset( (void *) m_apLastRequestedPhraseAlts, 0, + ALT_REQUEST_COUNT * sizeof( ISpPhraseAlt *) ); +} /* CResultContainer::CResultContainer */ + +/********************************************************************** +* CResultContainer::~CResultContainer * +*-------------------------------------* +* Description: +* Destructor for the CResultContainer class. +* This object gets destroyed when there are no longer +* any CDictationRuns referencing it. +**********************************************************************/ +CResultContainer::~CResultContainer() +{ + _ASSERTE( !m_pOwnerListHead ); + + if ( m_pPhraseReplacement ) + { + delete m_pPhraseReplacement; + } + + // Release any ISpPhraseAlt's that are still around from the + // last call to ISpPhrase::GetAlternates() + for (int i = 0; i < ALT_REQUEST_COUNT; i++) + { + if (m_apLastRequestedPhraseAlts[i]) + { + m_apLastRequestedPhraseAlts[i]->Release(); + } + } +} /* CResultContainer::~CResultContainer */ + +/********************************************************************** +* CResultContainer::AddOwner * +*----------------------------* +* Description: +* Called whenever a new CDictationRun is created to use this +* same RecoResult. Adds that CDictationRun to the front of +* the list of owners. +* Return: +* S_OK +* E_OUTOFMEMORY +**********************************************************************/ +HRESULT CResultContainer::AddOwner( CDictationRun &rNewOwner ) +{ + if ( !m_pOwnerListHead ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + + OWNERNODE *pNode = new OWNERNODE; + if ( pNode ) + { + pNode->pNext = m_pOwnerListHead; + pNode->pOwner = &rNewOwner; + m_pOwnerListHead = pNode; + + return S_OK; + } + else + { + return E_OUTOFMEMORY; + } +} /* CResultContainer::AddOwner */ + +/********************************************************************** +* CResultContainer::DeleteOwner * +*-------------------------------* +* Description: +* Called whenever a DictationRun using this RecoResult +* has been deleted. Removes the CDictationRun from the +* list and deletes itself if that was the last owner +**********************************************************************/ +void CResultContainer::DeleteOwner( CDictationRun &rOldOwner ) +{ + _ASSERTE( m_pOwnerListHead ); + if ( !m_pOwnerListHead ) + { + return; + } + + OWNERNODE **ppNode; + for ( ppNode = &m_pOwnerListHead; + (*ppNode) && ((*ppNode)->pOwner != &rOldOwner); + ppNode = &((*ppNode)->pNext) ) + ; + + if ( *ppNode ) + { + // Found: Delete it + OWNERNODE *pNodeToDelete = *ppNode; + *ppNode = (*ppNode)->pNext; + delete pNodeToDelete; + } + else + { + // Should be on the list! + _ASSERTE( false ); + } + + if ( !m_pOwnerListHead ) + { + // There are no more CDictationRuns referencing this + delete this; + } +} /* CResultContainer::DeleteOwner */ + +/********************************************************************** +* CResultContainer::SpeakAudio * +*------------------------------* +* Description: +* Calls ISpRecoResult::SpeakAudio() on the recoresult. +* Converts the arguments to pre-replacement elements +* Return: +* S_OK +* S_FALSE if no elements are to be spoken. +* Return value of CPhraseReplacement conversion routines +* Return value of ISpRecoResult::SpeakAudio() +**********************************************************************/ +HRESULT CResultContainer::SpeakAudio( ULONG ulStartElement, + ULONG cElements ) +{ + if (!cElements) + { + return S_FALSE; + } + + // Convert the start and end to phrase element indices + // as seen from the result object's point of view + ULONG ulPreReplStart; + ULONG ulPreReplEnd; + ULONG cPreReplElts; + HRESULT hr = m_pPhraseReplacement->PostToPreReplacementIndex( + ulStartElement, &ulPreReplStart ); + if (SUCCEEDED(hr)) + { + hr = m_pPhraseReplacement->PostToPreReplacementIndex( + ulStartElement + cElements, &ulPreReplEnd ); + } + + // Call ISpRecoResult::SpeakAudio() + if (SUCCEEDED(hr)) + { + cPreReplElts = ulPreReplEnd - ulPreReplStart; + hr = m_cpRecoResult->SpeakAudio( + ulPreReplStart, cPreReplElts, SPF_ASYNC, NULL ); + } + + return hr; +} /* CResultContainer::SpeakAudio */ + +/********************************************************************** +* CResultContainer::GetAlternatesText * +*-------------------------------------* +* Description: +* Called to get the text of the alternates for +* a specific range of elements in this result. +* ppszCoMemText is expected to point to a buffer +* of size at least sizeof( WCHAR * ) * ulRequestCount, +* and the text in it will be CoTaskMemAlloced. +* Return: +* S_OK +* S_FALSE if there are no alternates +* E_POINTER +* return value of CResultContainer::GetAlternates() +* return value of CResultContainer::GetAltText() +**********************************************************************/ +HRESULT CResultContainer::GetAlternatesText( ULONG ulStartElement, + ULONG cElements, + ULONG ulRequestCount, + WCHAR **ppszCoMemText, + ULONG *pcPhrasesReturned ) +{ + SPDBG_FUNC("CResultContainer::GetAlternatesText"); + if ( !ppszCoMemText || !pcPhrasesReturned ) + { + return E_POINTER; + } + + // Get as many alternates as we can + ULONG cAvailableAlts; + HRESULT hr = GetAlternates( ulStartElement, cElements, ulRequestCount, + &cAvailableAlts ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Sanity check: We didn't get more than we asked for + _ASSERTE( cAvailableAlts <= ulRequestCount ); + + if ( !cAvailableAlts ) + { + // No alternates + *pcPhrasesReturned = 0; + *ppszCoMemText = NULL; + return S_FALSE; + } + + // Null out the pointers to text buffers first + memset(ppszCoMemText, 0, ulRequestCount * sizeof(WCHAR *)); + + // Get the text + for ( ULONG ulAlt = 0; + SUCCEEDED(hr) && (ulAlt < cAvailableAlts); + ulAlt++ ) + { + // ppszCoMemText[ulAlt] is the ulAlt'th (WCHAR *) + // in the array. + // Its address will give us a WCHAR ** which will + // point to a buffer that is to be CoTaskMemAlloced + // by GetAltText() + hr = GetAltText( ulStartElement, cElements, ulAlt, + &(ppszCoMemText[ulAlt]), NULL ); + } + *pcPhrasesReturned = cAvailableAlts; + + return hr; +} /* CResultContainer::GetAlternatesText */ + +/********************************************************************** +* CResultContainer::GetAlternates * +*---------------------------------* +* Description: +* Gets the ISpPhraseAlts for this range of elements +* (indices are given taking replacement into account). +* The phrase alternates are pointed to by +* m_apLastRequestedPhraseAlts. +* It is very likely that GetAlternates() would be called +* numerous times consecutively for the same set of +* alternates. Thus, these are cached between calls. +* Return: +* S_OK +* E_INVALIDARG: Out-of-bounds elements +* Return value of CPhraseReplacement conversion routines +* Return value of ISpRecoResult::GetAlternates +**********************************************************************/ +HRESULT CResultContainer::GetAlternates( ULONG ulStartElement, + ULONG cElements, + ULONG ulRequestCount, + ULONG *pcPhrasesReturned ) +{ + // First check to see if we have these alternates cached. + // We check that there is at least one alternate cached, + // that the alternates are for the same set of phrase elements, + // and that there are enough. + if ( m_apLastRequestedPhraseAlts[0] && + ( m_ulStartOfLastRequestedAlts == ulStartElement ) && + ( m_cElementsInLastRequestedAlts == cElements ) && + ( m_cLastRequestedAltsReturned >= ulRequestCount) ) + { + if ( pcPhrasesReturned ) + { + // We already have these alternates, so don't bother + // getting them again + *pcPhrasesReturned = __min( + ulRequestCount, m_cLastRequestedAltsReturned ); + } + return S_OK; + } + + if ( (ulStartElement + cElements) > + m_pPhraseReplacement->GetNumReplacementElements() ) + { + // Out of bounds + return E_INVALIDARG; + } + + // Convert the start and end to phrase element indices + // as seen from the result object's point of view + ULONG ulPreReplStart; + ULONG ulPreReplLast; + HRESULT hr = m_pPhraseReplacement->PostToPreReplacementIndex( + ulStartElement, &ulPreReplStart ); + if ( SUCCEEDED(hr) ) + { + hr = m_pPhraseReplacement->PostToPreReplacementIndex( + ulStartElement + cElements, &ulPreReplLast ); + } + ULONG cPreReplElements = ulPreReplLast - ulPreReplStart; + + // Release any ISpPhraseAlts that are around from last time + for (int i = 0; i < ALT_REQUEST_COUNT; i++) + { + if ( m_apLastRequestedPhraseAlts[i] ) + { + m_apLastRequestedPhraseAlts[i]->Release(); + m_apLastRequestedPhraseAlts[i] = 0; + } + } + + // Get as many alternates as we can by calling + // ISpRecoResult::GetAlternates() + ULONG cPhrasesReturned; + if (SUCCEEDED(hr)) + { + hr = m_cpRecoResult->GetAlternates( ulPreReplStart, + cPreReplElements, ulRequestCount, m_apLastRequestedPhraseAlts, + &cPhrasesReturned ); + } + if ( pcPhrasesReturned ) + { + *pcPhrasesReturned = cPhrasesReturned; + } + + // Cache information about this alternate request + m_ulStartOfLastRequestedAlts = ulStartElement; + m_cElementsInLastRequestedAlts = cElements; + m_cLastRequestedAltsReturned = cPhrasesReturned; + + return hr; +} /* CResultContainer::GetAlternates */ + +/********************************************************************** +* CResultContainer::GetAltInfo * +*------------------------------* +* Description: +* Given the alternates index, gets the info for the +* alternate (i.e. which elements it replaces in the +* parent and how many elements it has). +* Returns element indices TAKING REPLACEMENTS INTO +* ACCOUNT, unless the fReturnPostReplIndices flag has +* been set to false (it is set to true by default). +* +* If the end of the alternate falls in the middle of +* a replacement, then the result indices are expanded +* to include the entire replacement. +* Return: +* S_OK +* E_FAIL if we couldn't get ulAlternateIndex alternates +* Return value of CResultContainer::GetAlternates() +* Return value of ISpPhraseAlt::GetAltInfo() +* Return value of +* CResultContainer::ExpandToIncludeWholeReplacements() +* Return value of CPhraseReplacement::Initialize() +* Return value of CPhraseReplacement conversion routines +**********************************************************************/ +HRESULT CResultContainer::GetAltInfo( ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + ULONG *pulStartInParent, + ULONG *pcEltsInParent, + ULONG *pcEltsInAlt, + bool fReturnPostReplIndices) +{ + // First make sure we actually have this alternate + ULONG cPhrasesReturned; + HRESULT hr = GetAlternates( + ulStartElement, cElements, ulAlternateIndex + 1, &cPhrasesReturned ); + if ( FAILED( hr ) ) + { + return hr; + } + if ( cPhrasesReturned < (ulAlternateIndex + 1) ) + { + // There aren't enough alternates to accommodate + // this one + return E_FAIL; + } + + // Sanity check: The pointer to the ISpPhraseAlt for this + // alternate is non-NULL + _ASSERTE( m_apLastRequestedPhraseAlts[ ulAlternateIndex ] ); + + // Call to ISpPhraseAlt::GetAltInfo() + ULONG ulStartInParent; + ULONG cEltsInParent; + ULONG cEltsInAlt; + hr = (m_apLastRequestedPhraseAlts[ ulAlternateIndex ])->GetAltInfo( + NULL, &ulStartInParent, &cEltsInParent, &cEltsInAlt ); + +#ifdef _DEBUG + // Debug code for seeing the text of the entire alternate + // (which covers the entire parent phrase) and for seeing + // the text for just the part of the alternate that + // covers the elements in the parent that we are interested in + WCHAR * pwszWhole = 0; + WCHAR * pwszAlt = 0; + BYTE b; + m_apLastRequestedPhraseAlts[ ulAlternateIndex ]->GetText( + SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, true, &pwszWhole, &b ); + m_apLastRequestedPhraseAlts[ ulAlternateIndex ]->GetText( + ulStartInParent, cEltsInAlt, true, &pwszAlt, &b ); + ::CoTaskMemFree( pwszWhole ); + ::CoTaskMemFree( pwszAlt ); +#endif + + // If there is replaced (ITNed) text anywhere in this set of + // elements in the parent, we should be getting alternate + // text for the entire replacement. + // That is, if a replacement covers the word "thirty" in the + // phrase "I have thirty nine dollars", we should also be + // showing alternate text for the elements "nine dollars", + // since it appears to all be one element ("$39.00") to the + // user + if ( SUCCEEDED( hr ) ) + { + const ULONG cEltsInParentBeforeExpansion = cEltsInParent; + + // Expand the endpoints to include entire replacements + hr = m_pPhraseReplacement->ExpandToIncludeWholeReplacements( + &ulStartInParent, &cEltsInParent ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Adjust the number of elements in the alternate accordingly + // (all of the extra elements we have just included are the + // same in the alternate as they are in the parent, so it + // will be the same number of extra elements in the alternate + cEltsInAlt += cEltsInParent - cEltsInParentBeforeExpansion; + } + + if ( !fReturnPostReplIndices ) + { + // We're done; no need to convert, since the caller wants + // output in phrase element indices from the result object's + // point of view + if ( pulStartInParent ) + { + *pulStartInParent = ulStartInParent; + } + if ( pcEltsInParent ) + { + *pcEltsInParent = cEltsInParent; + } + if ( pcEltsInAlt ) + { + *pcEltsInAlt = cEltsInAlt; + } + return hr; + } + + // Convert these element indices to post-replacement indices + if ( SUCCEEDED( hr ) ) + { + // First convert the start element + ULONG ulPostReplStartInParent; + hr = m_pPhraseReplacement->PreToPostReplacementIndex( + ulStartInParent, &ulPostReplStartInParent ); + if (FAILED(hr)) + { + return hr; + } + if ( pulStartInParent ) + { + *pulStartInParent = ulPostReplStartInParent; + } + + // Convert the end element to determine how many post-replacement + // elements this alternate replaces + if ( pcEltsInParent ) + { + ULONG ulEndInParent = ulStartInParent + cEltsInParent; + ULONG ulEndPostReplElement; + hr = m_pPhraseReplacement->PreToPostReplacementIndex( + ulEndInParent, &ulEndPostReplElement ); + if (FAILED(hr)) + { + return hr; + } + *pcEltsInParent = ulEndPostReplElement - ulPostReplStartInParent; + } + } + + // Find the number of elements in the alternate, if that was requested + if ( SUCCEEDED(hr) && pcEltsInAlt ) + { + // Since this ISpPhraseAlt is a completely different ISpPhrase + // from the one associated with m_cpRecoResult, we have to + // construct a new CPhraseReplacement object to deal specifically + // with this phrase. + CPhraseReplacement newPhraseRepl; + hr = newPhraseRepl.Initialize(*(m_apLastRequestedPhraseAlts[ ulAlternateIndex ])); + + // First convert the start element + ULONG ulPostReplStartInAlt; + if ( SUCCEEDED( hr ) ) + { + hr = newPhraseRepl.PreToPostReplacementIndex( + ulStartInParent, &ulPostReplStartInAlt ); + } + + // Convert the end element to determine how many post-replacement + // elements this alternate replaces + ULONG ulEndInAlt = ulStartInParent + cEltsInAlt; + ULONG ulEndPostReplElement; + if ( SUCCEEDED(hr) ) + { + hr = newPhraseRepl.PreToPostReplacementIndex( + ulEndInAlt, &ulEndPostReplElement ); + } + *pcEltsInAlt = ulEndPostReplElement - ulPostReplStartInAlt; + } + return hr; +} /* CResultContainer::GetAltInfo */ + +/********************************************************************** +* CResultContainer::GetAltText * +*------------------------------* +* Description: +* Given the alternates index, gets the text for the +* alternate and display attributes. +* Return: +* S_OK +* Return value of CResultContainer::GetAlternates() +* Return value of CResultContainer::GetAltInfo() +* Return value of ISpPhraseAlt::GetText() +**********************************************************************/ +HRESULT CResultContainer::GetAltText( ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + WCHAR **ppszCoMemText, + BYTE *pbDisplayAttributes ) +{ + // First make sure we actually have this alternate + ULONG cPhrasesReturned; + HRESULT hr = GetAlternates( + ulStartElement, cElements, ulAlternateIndex + 1, &cPhrasesReturned ); + if ( FAILED( hr ) ) + { + return hr; + } + if ( cPhrasesReturned < (ulAlternateIndex + 1) ) + { + // There aren't enough alternates to accommodate + // this one + return E_FAIL; + } + + // Sanity check: The pointer to the ISpPhraseAlt for this + // alternate is non-NULL + _ASSERTE( m_apLastRequestedPhraseAlts[ ulAlternateIndex ] ); + + // Find out what elements in the parent this alternate replaces + // Note that we do NOT want text replacements taken into effect, + // since we are calling ISpPhrase::GetText() directly with + // these phrase element indices, so we need those indices + // from the result object's point of view + ULONG ulStartInParent; + ULONG cEltsInParent; + ULONG cEltsInAlt; + hr = GetAltInfo( ulStartElement, cElements, ulAlternateIndex, + &ulStartInParent, &cEltsInParent, &cEltsInAlt, false ); + if ( FAILED(hr) ) + { + return hr; + } + + // Call to ISpPhraseAlt::GetText() + return m_apLastRequestedPhraseAlts[ ulAlternateIndex ]->GetText( + ulStartInParent, cEltsInAlt, true, ppszCoMemText, pbDisplayAttributes ); +} /* CResultContainer::GetAltText */ + + +/********************************************************************** +* CResultContainer::ChooseAlternate * +*-----------------------------------* +* Description: +* Called when the caller wishes to commit one of the alternates. +* If pbDisplayAttributes is non-NULL, hands back the display +* attributes of the alternate text going in. +* Adjusts the phrase element mapping in CPhraseReplacement +* to the new result object. +* Return: +* S_OK +* Return value of CResultContainer::GetAlternates() +* Return value of CResultContainer::GetAltText() +* Return value of CResultContainer::NotifyOwnersOfCommit() +* Return value of ISpPhraseAlt::Commit() +* Return value of CPhraseReplacement::Initialize() +**********************************************************************/ +HRESULT CResultContainer::ChooseAlternate( ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + BYTE *pbDisplayAttributes ) +{ + // First make sure we actually have this alternate + ULONG cPhrasesReturned; + HRESULT hr = GetAlternates( + ulStartElement, cElements, ulAlternateIndex + 1, &cPhrasesReturned ); + if ( FAILED( hr ) ) + { + return hr; + } + if ( cPhrasesReturned < (ulAlternateIndex + 1) ) + { + // There aren't enough alternates to accommodate + // this one + return E_FAIL; + } + + // Sanity check: The pointer to the ISpPhraseAlt for this + // alternate is non-NULL + _ASSERTE( m_apLastRequestedPhraseAlts[ ulAlternateIndex ] ); + + // If there is interest in the display attributes for the alternate, + // get them + if ( pbDisplayAttributes ) + { + WCHAR *pszCoMemText; + hr = GetAltText( ulStartElement, cElements, ulAlternateIndex, + &pszCoMemText, pbDisplayAttributes ); + if ( FAILED( hr ) ) + { + return hr; + } + ::CoTaskMemFree( pszCoMemText ); + } + + // Notify owners of the alternate committal so that they can adjust + // their element offset maps + hr = NotifyOwnersOfCommit( ulStartElement, cElements, ulAlternateIndex ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Call to ISpPhraseAlt::Commit() + hr = m_apLastRequestedPhraseAlts[ulAlternateIndex]->Commit(); + if ( FAILED( hr ) ) + { + return hr; + } + + // The alternate is now "dead" + + // Re-initialize the phrase replacement info, as the element indices + // and text replacment (ITN) situations are likely to have changed + return m_pPhraseReplacement->Initialize( *m_cpRecoResult ); + +} /* CResultContainer::ChooseAlternate */ + +/********************************************************************** +* CResultContainer::NotifyOwnersOfCommit * +*----------------------------------------* +* Description: +* Called when an alternate is about to be committed BEFORE +* the commit happens. +* Notifies all DictationRuns that hold onto this result +* that their phrase element offset maps will need to change +* Return: +* S_OK +* E_OUTOFMEMORY if the head of the owner list wasn't +* allocated at construction time +* Return value of CResultContainer::GetAlternates() +* Return value of CPhraseReplacement::Initialize() +* Return value of CResultContainer::GetAltInfo() +**********************************************************************/ +HRESULT CResultContainer::NotifyOwnersOfCommit( ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex ) + //ISpPhraseAlt *pChosenAlternate ) +{ + if ( !m_pOwnerListHead ) + { + return E_OUTOFMEMORY; + } + + // First make sure we actually have this alternate + ULONG cPhrasesReturned; + HRESULT hr = GetAlternates( + ulStartElement, cElements, ulAlternateIndex + 1, &cPhrasesReturned ); + if ( FAILED( hr ) ) + { + return hr; + } + if ( cPhrasesReturned < (ulAlternateIndex + 1) ) + { + // There aren't enough alternates to accommodate + // this one + return E_FAIL; + } + + // Sanity check: The pointer to the ISpPhraseAlt for this + // alternate is non-NULL + _ASSERTE( m_apLastRequestedPhraseAlts[ ulAlternateIndex ] ); + + // We need to determine how many post-replacement elements the new + // phrase will have, but the alternate has not yet been committed to + // m_cpRecoResult, so we need to construct a different CPhraseReplacement + // to get that information + CPhraseReplacement newPhraseRepl; + hr = newPhraseRepl.Initialize( *(m_apLastRequestedPhraseAlts[ ulAlternateIndex ]) ); + if ( FAILED( hr ) ) + { + return hr; + } + ULONG cPostReplElementsAfterCommit = newPhraseRepl.GetNumReplacementElements(); + + // Find out which (post-replacement) elements in the parent + // this alternate will replace + ULONG ulStartInParent; + ULONG cEltsInParent; + hr = GetAltInfo( ulStartElement, cElements, ulAlternateIndex, + &ulStartInParent, &cEltsInParent ); + if ( FAILED(hr) ) + { + return hr; + } + + // Loop through the owner list, and let each one adjust its maps + for ( OWNERNODE *pNode = m_pOwnerListHead; pNode; pNode = pNode->pNext ) + { + hr = pNode->pOwner->OnAlternateCommit( ulStartInParent, + cEltsInParent, cPostReplElementsAfterCommit ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + return S_OK; +} /* CResultContainer::NotifyOwnersOfCommit */ + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.h new file mode 100644 index 00000000..c7356ae5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.h @@ -0,0 +1,119 @@ +/****************************************************************************** +* resultcontainer.h +* This module contains the definition of CResultContainer. +* CResultContainer makes all of the recognition-object- +* specific SAPI5 calls +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "DictationRun.h" + +// Forward definition +class CDictationRun; + +// List node for the result container's list of owner DictationRuns +typedef struct OWNERNODE +{ + CDictationRun *pOwner; + OWNERNODE *pNext; +} OWNERNODE; + +// Constant for alternate retrieval +#define ALT_REQUEST_COUNT 15 + +/****************************************************************************** +* CResultContainer * +*------------------* +* Description: +* CResultContainer is the class that handles the recognition result +* object that corresponds to one or more CDictationRun's (see +* DictationRun.h) that hold phrase elements from that result. +* All SAPI5 calls on recognition result objects are made from +* the appropriate instance of CResultContainer +*******************************************************************************/ +class CResultContainer +{ +public: + + CResultContainer( ISpRecoResult &rResult, + CDictationRun &rFirstOwner, + CPhraseReplacement &rPhraseReplacement ); + ~CResultContainer(); + + HRESULT AddOwner( CDictationRun &rNewOwner ); + void DeleteOwner( CDictationRun &rOldOwner ); + + CPhraseReplacement *GetPhraseReplacement() + { return m_pPhraseReplacement; } + + // These methods that behave exactly like the methods of + // the same name in ISpRecoResult, except the arguments + // to these take into account possible ITN replacement + HRESULT SpeakAudio( + ULONG ulStartElement, + ULONG cElements ); + HRESULT Serialize( + SPSERIALIZEDRESULT **ppResultBlock) + { return m_cpRecoResult->Serialize( ppResultBlock );} + + // These methods are closely related to ISpRecoResult + // methods, altered slightly for the purposes of this app + HRESULT GetAlternatesText( + ULONG ulStartElement, + ULONG cElements, + ULONG ulRequestCount, + WCHAR **ppszCoMemText, + ULONG *pcPhrasesReturned ); + HRESULT GetAltInfo( + ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + ULONG *pulStartInParent, + ULONG *pcEltsInParent, + ULONG *pcEltsInAlt = NULL, + bool fReturnPostReplIndices = true); + HRESULT GetAltText( + ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + WCHAR **ppwszCoMemText, + BYTE *pbDisplayAttributes ); + HRESULT ChooseAlternate( + ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + BYTE *pbDisplayAttributes ); + +private: + + HRESULT GetAlternates( + ULONG ulStartElement, + ULONG cElements, + ULONG ulRequestCount, + ULONG *pcPhrasesReturned ); + + // Called whenever the RecoResult has changed as a result of some + // owner committing an alternate + HRESULT NotifyOwnersOfCommit( + ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex ); + +private: + + CComPtr m_cpRecoResult; + CPhraseReplacement *m_pPhraseReplacement; + OWNERNODE *m_pOwnerListHead; + + // Information about the last-requested set of alternates. + // Note that m_ulStartOfLastRequestedAlts and m_cElementsInLastRequestedAlts + // are indices with ITN replacements figured in + ISpPhraseAlt * m_apLastRequestedPhraseAlts[ALT_REQUEST_COUNT]; + ULONG m_cLastRequestedAltsReturned; + ULONG m_ulStartOfLastRequestedAlts; + ULONG m_cElementsInLastRequestedAlts; +}; // class CResultContainer + + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/small.ico b/mp/src/utils/sapi51/Samples/CPP/DictPad/small.ico new file mode 100644 index 00000000..feea2daa Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/DictPad/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.cpp new file mode 100644 index 00000000..2806c8d9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// dictpad.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.h new file mode 100644 index 00000000..975f2d86 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.h @@ -0,0 +1,37 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include +#include +#include +#include "tom.h" + +// Local Header Files + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/textrun.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/textrun.cpp new file mode 100644 index 00000000..f72db669 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/textrun.cpp @@ -0,0 +1,559 @@ +/****************************************************************************** +* textrun.cpp +* Implementation details for the CTextRun object which is our base class +* for tracking all the text (be it dictated or typed) in our product. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "textrun.h" + +/********************************************************************** +* CTextRun::CTextRun * +*--------------------* +* Description: +* CTextRun constructor +**********************************************************************/ +CTextRun::CTextRun() : m_cpTextRange( NULL ), + m_dwRefCount( NULL ) +{ +} /* CTextRun::CTextRun */ + + +/********************************************************************** +* CTextRun::~CTextRun * +*---------------------* +* Description: +* CTextRun destructor +**********************************************************************/ +CTextRun::~CTextRun() +{ +} /* CTextRun::~CTextRun */ + +/********************************************************************** +* CTextRun::IncrementCount * +*--------------------------* +* Description: +* Increments a reference count on this text run. +* +* Return: +* The current count +**********************************************************************/ +DWORD CTextRun::IncrementCount() +{ + m_dwRefCount++; + return m_dwRefCount; +} /* CTextRun::IncrementCount */ + +/********************************************************************** +* CTextRun::DecrementCount * +*--------------------------* +* Description: +* Decrements a reference count on this text run. If the +* count drops to zero, the text run is deleted. +* +* Return: +* The current count +**********************************************************************/ +DWORD CTextRun::DecrementCount() +{ + _ASSERTE( m_dwRefCount ); + + DWORD dwRefCount = --m_dwRefCount; + if( !m_dwRefCount ) + { + delete this; + } + return dwRefCount; +} /* CTextRun::DecrementCount */ + +/****************************************************************************** +* CTextRun::SetTextRange * +*------------------------* +* Description: +* Stores the text range interface pointer for this run +* Return: +* S_OK +* E_POINTER if pTextRange is NULL +******************************************************************************/ +HRESULT CTextRun::SetTextRange( ITextRange *pTextRange ) +{ + if ( !pTextRange ) + { + return E_POINTER; + } + + m_cpTextRange = pTextRange; + + return S_OK; +} /* CTextRun::SetTextRange */ + +/********************************************************************** +* CTextRun::Split * +*-----------------* +* Description: +* Splits up a TextRun so that this text run now ends at lFirstEnd +* and the second text run begins at lSecondBegin. +* "This" will now be a shorter range (it will end sooner), +* and *ppTextRun will point to the new text run +* (space will be allocated here for *ppTextRun) +* to be inserted in the list. +* +* Return: +* S_OK +* E_INVALIDARG +* E_OUTOFMEMORY +* Return value of ITextDocument::Range() +**********************************************************************/ +HRESULT CTextRun::Split( long *plFirstEnd, long *plSecondBegin, + ITextDocument *cpTextDoc, + CTextRun **ppTextRun ) +{ + if ( !plFirstEnd || !plSecondBegin || !cpTextDoc || !ppTextRun ) + { + return E_INVALIDARG; + } + _ASSERTE( m_cpTextRange ); + if ( !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + // These values won't be changing, since this run has no associated + // RecoResult. + // We can chop this block right at these positions. + long lFirstEnd = *plFirstEnd; + long lSecondBegin = *plSecondBegin; + + if ( !WithinRange( lFirstEnd ) || (lFirstEnd > lSecondBegin) ) + { + return E_INVALIDARG; + } + + if ( (GetStart() == lSecondBegin) || (GetEnd() == lFirstEnd) || (lSecondBegin > GetEnd()) ) + { + // Don't need to do anything, since we are asking for both of the + // cuts to be made on already-existing TextRun boundaries + *ppTextRun = NULL; + return S_OK; + } + + *ppTextRun = new CTextRun(); + if ( !(*ppTextRun) ) + { + return E_OUTOFMEMORY; + } + + // The latter range will start at lSecondBegin and end where "this" ended + long lEnd = GetEnd(); + CComPtr pLatterRange; + HRESULT hr = cpTextDoc->Range( lSecondBegin, lEnd, &pLatterRange ); + if ( FAILED( hr ) ) + { + return hr; + } + (*ppTextRun)->SetTextRange( pLatterRange ); + + // Adjust the end of "this"'s range; it will end at lFirstEnd + m_cpTextRange->SetEnd( lFirstEnd ); + + return S_OK; + +} /* CTextRun::Split */ + + +/********************************************************************** +* CTextRun::Concatenate * +*-----------------------* +* Description: +* If possible, concatenates pNext (pPrev if fConcatAfter is false) +* onto the end of this. +* Another CTextRun can always be concatenated on, unless it +* contains dictation. +* +* Return: +* E_NOMERGE if could not be merged (because pTextRun is dictation) +* E_FULLMERGE +**********************************************************************/ +MERGERESULT CTextRun::Concatenate( CTextRun *pTextRun, bool fConcatAfter ) +{ + if ( !pTextRun || !m_cpTextRange ) + { + return E_NOMERGE; + } + + // Check for compatibility: In this case, neither mergee can be + // a dict run + if ( IsDict() || pTextRun->IsDict() ) + { + return E_NOMERGE; + } + + // lNewBound will be the new end (resp. start) of the run, if the + // concatenation is successful + long lNewBound; + + // Concatenation is possible iff one run ends exactly where the other + // begins. + // If concatenation is possible, do it. + if ( fConcatAfter ) + { + // Will be concatenating pTextRun onto the end of this + if ( GetEnd() != pTextRun->GetStart() ) + { + // They are not consecutive runs + return E_NOMERGE; + } + + // lNewBound will be the new end of the run, if the + // concatenation is successful + lNewBound = pTextRun->GetEnd(); + + // Swallow up pTextRun by setting our end to its end + SetEnd( lNewBound ); + + // Make pTextRun degenerate + pTextRun->SetStart( lNewBound ); + + } + else + { + // Will be concatenating pTextRun onto the beginning of this + if ( GetStart() != pTextRun->GetEnd() ) + { + return E_NOMERGE; + } + + // lNewBound will be the new start of the run, if the + // concatenation is successful + lNewBound = pTextRun->GetStart(); + + // Swallow up pTextRun by setting our start to its start + SetStart( lNewBound ); + + // Make pTextRun degenerate + pTextRun->SetEnd( lNewBound ); + } + + return E_FULLMERGE; +} /* CTextRun::Concatenate */ + +/********************************************************************** +* CTextRun::Speak * +*-----------------* +* Description: +* Speaks the text associated with this CTextRun using TTS. +* +* Return: +* S_OK +* Return value of ITextRange::GetText() +* Return value of ISpVoice::Speak() +**********************************************************************/ +HRESULT CTextRun::Speak( ISpVoice &rVoice ) +{ + _ASSERTE( m_cpTextRange ); + if ( !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + // Get the text and speak it. + BSTR bstrText; + HRESULT hr = m_cpTextRange->GetText( &bstrText ); + if( SUCCEEDED( hr ) ) + { + hr = rVoice.Speak( bstrText, SPF_ASYNC, NULL ); + + ::SysFreeString( bstrText ); + } + return hr; +} /* CTextRun::Speak */ + +/********************************************************************** +* CTextRun::Speak() * +*-------------------* +* Description: +* Uses *plStart and *plEnd to find the nearest start and +* endpoints for speaking (to the nearest word). +* Returns these values in plStart and plEnd. +* Speaks the text associated with this CTextRun from *plStart +* to *plEnd. +* +* If *plStart is not within the range, then +* start at the beginning. If lEnd is not within range, then +* end at the end. +* +* Return: +* S_OK +* E_POINTER +* Return value of CTextRun::Speak() +**********************************************************************/ +HRESULT CTextRun::Speak( ISpVoice &rVoice, + long *plStart, + long *plEnd ) +{ + if ( !plStart || !plEnd ) + { + return E_POINTER; + } + _ASSERTE( m_cpTextRange ); + if ( !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + // Save the old range + long lOldStart = GetStart(); + long lOldEnd = GetEnd(); + + // Out of range start or end means we start speaking from the start + // or end (resp.) of the text range. + + if ( WithinRange( *plStart ) ) + { + // The start needs to be moved + SetStart( *plStart ); + } + else + { + *plStart = GetStart(); + } + + if ( WithinRange( *plEnd ) ) + { + // The end needs to be moved + SetEnd( *plEnd ); + } + else + { + *plEnd = GetEnd(); + } + + // Expand to include whole words + m_cpTextRange->Expand( tomWord, NULL ); + + // Get the new start and end so that we can pass them back + m_cpTextRange->GetStart( plStart ); + m_cpTextRange->GetEnd( plEnd ); + + // We should never speak past the end of this run, even if expanding to include + // whole words caused extra text to be included + // (e.g. if you typed "This is a sentence" and dictated some text that + // consumed leading spaces right afterwards) + *plStart = __max( *plStart, lOldStart ); + *plEnd = __min( *plEnd, lOldEnd ); + SetStart( *plStart ); + SetEnd( *plEnd ); + + // Pass to the CTextRun::Speak() that speaks an entire run + HRESULT hr = Speak( rVoice ); + + // Restore the old range limits + SetStart( lOldStart ); + SetEnd( lOldEnd ); + + return hr; +} /* CTextRun::Speak */ + +/********************************************************************** +* CTextRun::Serialize * +*---------------------* +* Description: +* Serializes the text for this run. +* Simply writes a small header that contains the start +* and end indices of this run and indicates that +* no phrase blob follows. +* Return: +* S_OK +* E_INVALIDARG +* E_UNEXPECTED +* Return value of ISequentialStream::Write() +**********************************************************************/ +HRESULT CTextRun::Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ) +{ + if ( !pStream ) + { + return E_INVALIDARG; + } + _ASSERTE( m_cpTextRange ); + if ( !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + RUNHEADER runHdr; + runHdr.lStart = GetStart(); + runHdr.lEnd = GetEnd(); + runHdr.bResultFollows = false; + + // Write the header to the stream + ULONG cbWritten; + HRESULT hr = pStream->Write( &runHdr, sizeof( RUNHEADER ), &cbWritten ); + + return hr; +} /* CTextRun::Serialize */ + +/********************************************************************** +* CTextRun::IsConsumeLeadingSpaces * +*----------------------------------* +* Description: +* Sets *pfConsumeLeadingSpaces to true iff leading spaces before +* lPos would need to be consumed. +* For a text run this value will always be false, since +* typed text has no "display attributes" +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if lPos is out of range +**********************************************************************/ +HRESULT CTextRun::IsConsumeLeadingSpaces( const long lPos, + bool *pfConsumeLeadingSpaces ) +{ + if ( !pfConsumeLeadingSpaces ) + { + return E_POINTER; + } + if ( !WithinRange( lPos ) ) + { + return E_INVALIDARG; + } + + *pfConsumeLeadingSpaces = false; + + return S_OK; +} /* CTextRun::IsConsumeLeadingSpaces */ + +/********************************************************************** +* CTextRun::HowManySpacesAfter * +*------------------------------* +* Description: +* Returns the number of spaces that would need to precede text +* if text were to be inserted at position lPos. +* This number is in the out param puiSpaces. +* For a text run this value will always be zero, since +* typed text has no "display attributes" +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if lPos is out of range +**********************************************************************/ +HRESULT CTextRun::HowManySpacesAfter( const long lPos, UINT *puiSpaces ) +{ + if ( !puiSpaces ) + { + return E_POINTER; + } + if ( !WithinRange( lPos ) ) + { + return E_INVALIDARG; + } + + *puiSpaces = 0; + + return S_OK; +} /* CTextRun::HowManySpacesAfter */ + +/********************************************************************** +* CTextRun::GetStart * +*--------------------* +* Description: +* Returns the start of the associated TextRange, -1 in case +* of error. +**********************************************************************/ +long CTextRun::GetStart() +{ + if ( !m_cpTextRange ) + { + return -1; + } + + long lRet; + HRESULT hr = m_cpTextRange->GetStart( &lRet ); + + return (SUCCEEDED( hr )) ? lRet : -1; +} /* CTextRun::GetStart */ + +/********************************************************************** +* CTextRun::SetStart * +*--------------------* +* Description: +* Sets the start of the associated TextRange. +**********************************************************************/ +void CTextRun::SetStart( long lStart ) +{ + m_cpTextRange->SetStart( lStart ); +} /* CTextRun::SetStart */ + +/********************************************************************** +* CTextRun::GetEnd * +*------------------* +* Description: +* Returns the end of the associated TextRange, -1 in case +* of error. +**********************************************************************/ +long CTextRun::GetEnd() +{ + if ( !m_cpTextRange ) + { + return -1; + } + + long lRet; + HRESULT hr = m_cpTextRange->GetEnd( &lRet ); + + return (SUCCEEDED( hr )) ? lRet : -1; +} /* CTextRun::GetEnd */ + +/********************************************************************** +* CTextRun::SetEnd * +*------------------* +* Description: +* Sets the end of the associated TextRange +**********************************************************************/ +void CTextRun::SetEnd( long lEnd ) +{ + m_cpTextRange->SetEnd( lEnd ); +} /* CTextRun::SetEnd */ + + +/********************************************************************* +* CTextRun::WithinRange * +*-----------------------* +* Description: +* Determines whether lCursorPos falls within the range of +* this CTextRun. +* Return: +* true iff RunStart <= lCursorPos < RunEnd +**********************************************************************/ +bool CTextRun::WithinRange( long lCursorPos ) +{ + if ( !m_cpTextRange ) + { + return false; + } + + long lStart= -1; + long lEnd= -1; + + HRESULT hr = m_cpTextRange->GetStart( &lStart ); + if ( SUCCEEDED( hr ) ) + { + hr = m_cpTextRange->GetEnd( &lEnd ); + } + + return (SUCCEEDED( hr ) && ( lCursorPos >= lStart ) && ( lCursorPos <= lEnd )); +} /* CTextRun::WithinRange */ + +/********************************************************************* +* CTextRun::IsDegenerate * +*------------------------* +* Description: +* Determines whether "this" has a degenerate range associated +* with it. +* Return: +* true iff start == end +**********************************************************************/ +bool CTextRun::IsDegenerate() +{ + return ( GetStart() == GetEnd() ); +} /* CTextRun::IsDegenerate */ \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/textrun.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/textrun.h new file mode 100644 index 00000000..504a9364 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/textrun.h @@ -0,0 +1,90 @@ +/**************************************************************************** +* textrun.h +* This module contains the definition support for CTextRun which is +* our base class for holding onto all the text with DictPad. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#pragma once + +// Enumerated return type for CTextRun merging functions +typedef enum MERGERESULT +{ + E_NOMERGE, // No merging could be done at all + E_PARTIALMERGE, // Part but not all of the range could be merged in + E_LESSTEXT, // Some of the range had to be given up + E_FULLMERGE // All of the range was merged +}; + +// Header for serialized CTextRuns +typedef struct RUNHEADER +{ + bool bResultFollows; // true iff this is a dictation run with the + // associated reco result following in the stream + long lStart; // Start index of the associated text + long lEnd; // End index of the associated text +} RUNHEADER; + +/****************************************************************************** +* CTextRun * +*----------* +* Description: +* This class handles a consecutive run of text in the document. +********************************************************************************/ +class CTextRun +{ + public: + // Constructor / destructor + CTextRun(); + virtual ~CTextRun(); + + // Refcounting methods + DWORD IncrementCount(); + DWORD DecrementCount(); + + // Initialization method + virtual HRESULT SetTextRange( ITextRange *pTextRange ); + + // Phrase element-related methods + virtual HRESULT Split( long *plFirstEnd, long *plSecondBegin, + ITextDocument *cpTextDoc, CTextRun **ppTextRun ); + virtual MERGERESULT Concatenate( CTextRun *pTextRun, bool bConcatAfter ); + virtual HRESULT CorrectPhraseEltsAndRange( bool bForward, bool *pfCorrectionResult = NULL ) + { + if ( pfCorrectionResult ) + { + *pfCorrectionResult = true; + } + return S_OK; + }; + + // Playback methods + virtual HRESULT Speak( ISpVoice &rVoice ); // Speak a whole block + virtual HRESULT Speak( ISpVoice &rVoice, long *plStart, long *plEnd ); + // Speak part of a block + + // Serialization method + virtual HRESULT Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt = NULL ); + // Serialize and write to stream + + // Display attributes methods + virtual HRESULT IsConsumeLeadingSpaces( const long lPos, bool *pfConsumeLeadingSpaces ); + virtual HRESULT HowManySpacesAfter( const long lPos, UINT *puiSpaces ); + + virtual bool IsDict() { return FALSE; }; + + // Endpoints-related methods + long GetStart(); + void SetStart( long lStart ); + long GetEnd(); + void SetEnd( long lEnd ); + bool WithinRange( long lCursorPos ); + bool IsDegenerate(); + + protected: + CComPtr m_cpTextRange; + + private: + DWORD m_dwRefCount; +}; /* class CTextRun */ + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.cpp b/mp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.cpp new file mode 100644 index 00000000..5faaa722 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.cpp @@ -0,0 +1,1596 @@ +/****************************************************************************** +* TextRunList.cpp +* This module contains the implementation details of the CTextRunList +* class which is responsible for maintaining the collection of all the +* text runs in the DictPad program as a doubly linked list. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "TextRunList.h" + +/********************************************************************** +* CTextRunList::CTextRunList * +*----------------------------* +* Description: +* Constructor. +**********************************************************************/ +CTextRunList::CTextRunList( ITextDocument *pTextDoc ) : + m_pHead( NULL ), + m_pTail( NULL ), + m_pCurrent( NULL ), + m_cpTextDoc( pTextDoc ) +{ +} /* CTextRunList::CTextRunList */ + +/********************************************************************** +* CTextRunList::~CTextRunList * +*-----------------------------* +* Description: +* Destructor +* Deletes everything in the list. +**********************************************************************/ +CTextRunList::~CTextRunList() +{ + DeleteAllNodes(); +} /* CTextRunList::~CTextRunList */ + +/********************************************************************** +* CTextRunList::CreateSimpleList * +*--------------------------------* +* Description: +* Creates a simple list consisting of a single TextRun +* made up of the entire text of the document. +* Return: +* S_OK +* E_OUTOFMEMORY +* Return value of ITextDocument::Range() +**********************************************************************/ +HRESULT CTextRunList::CreateSimpleList() +{ + _ASSERTE( !m_pHead && m_cpTextDoc ); + if ( m_pHead || !m_cpTextDoc ) + { + return E_UNEXPECTED; + } + + CComPtr cpDocRange; + HRESULT hr = m_cpTextDoc->Range( 0, 0, &cpDocRange ); + if ( SUCCEEDED( hr ) ) + { + // Keep moving the end of the range until it reaches the end of + // the document in order to get a range with the text of + // the entire document + long lDelta; + do + { + cpDocRange->MoveEnd( tomWord, 100, &lDelta ); + } while ( lDelta ); + + // Create a single CTextRun with this range + CTextRun *pTextRun = new CTextRun(); + if ( !pTextRun ) + { + return E_OUTOFMEMORY; + } + pTextRun->SetTextRange( cpDocRange ); + pTextRun->IncrementCount(); + + // Create a single node with that CTextRun + PTEXTRUNNODE pNode = new TEXTRUNNODE; + if ( !pNode ) + { + return E_OUTOFMEMORY; + } + pNode->pTextRun = pTextRun; + pNode->pNext = pNode->pPrev = NULL; + + // That node is the only node in the list + m_pHead = m_pTail = m_pCurrent = pNode; + } + return hr; +} /* CTextRunList::CreateSimpleList */ + +/********************************************************************** +* CTextRunList::Insert * +*----------------------* +* Description: +* Places pTextRun in the list wherever it should go. +* Tries to use pCurrent as a hint. +* Inserting degenerate runs is OK. +* Return: +* S_OK +* E_POINTER +* E_OUTOFMEMORY +* Return value of CTextRunList::AddHead() +* Return value of CTextRunList::MoveCurrentTo() +* Return value of CTextRunList::InsertAfter() +* Return value of CTextRunList::MergeIn() +***********************************************************************/ +HRESULT CTextRunList::Insert( CTextRun *pTextRun ) +{ + if ( !pTextRun ) + { + return E_POINTER; + } + + // Increment the refcount on the text run + pTextRun->IncrementCount(); + + // Create a new node with this CTextRun + PTEXTRUNNODE pNode = new TEXTRUNNODE; + if ( !pNode ) + { + return E_OUTOFMEMORY; + } + pNode->pTextRun = pTextRun; + + // This is the node that is going to be added + m_pNodeToInsert = pNode; + + // Insert the node into the list + HRESULT hr; + if (( !m_pHead ) || ( pNode->pTextRun->GetStart() == 0 )) + { + // There's nothing in the list already, or this run starts at zero, + // so add it as the head + hr = AddHead( pNode ); + } + else + { + // Move the m_pCurrent pointer to the node that will directly precede this run. + // Nodes will be split here if necessary + hr = MoveCurrentTo( pNode->pTextRun->GetStart() ); + + // Insert the node after where m_pCurrent now is + if ( SUCCEEDED( hr ) ) + { + hr = InsertAfter( m_pCurrent, pNode ); + } + } + if ( FAILED( hr ) ) + { + return hr; + } + + // If we replaced or deleted some entire blocks, + // then we need to delete those nodes here + PTEXTRUNNODE p = pNode->pNext; + PTEXTRUNNODE pNextNode; + PTEXTRUNNODE pPrevNode; + while ( p ) + { + pNextNode = p->pNext; + if ( p->pTextRun->IsDegenerate() || + ( p->pTextRun->GetEnd() <= pNode->pTextRun->GetEnd() )) + { + // This node has a degenerate run or a run that ends earlier than ours: + // remove it and keep going + RemoveNode( p ); + p = pNextNode; + } + else + { + // Stop at the first non-deletable run + p = NULL; + } + } + + // ... And look backwards for the same thing + p = pNode->pPrev; + while ( p ) + { + pPrevNode = p->pPrev; + if (p->pTextRun->IsDegenerate() || + ( p->pTextRun->GetStart() >= pNode->pTextRun->GetStart() )) + { + // This node has a degenerate run or a run that starts later than ours: + // remove it and keep going + RemoveNode( p ); + p = pPrevNode; + } + else + { + // Stop at the first non-deletable run + p = NULL; + } + } + + // Adjust the text ranges of the previous and next nodes + // (This is necessary because the text is actually added before this node + // makes it in, so the TOM has already adjusted the previous and next nodes' ranges to + // cover this new text) + if ( pNode->pNext ) + { + pNode->pNext->pTextRun->SetStart( pNode->pTextRun->GetEnd() ); + } + if ( pNode->pPrev ) + { + pNode->pPrev->pTextRun->SetEnd( pNode->pTextRun->GetStart() ); + } + + // Now merge this new run in with the neighbors, if possible. + // If pNode is degenerate (or becomes degenerate as a result of merging, + // it will get deleted. + bool fMadeItIn = false; + hr = MergeIn( pNode, &fMadeItIn ); + if ( SUCCEEDED( hr ) ) + { + return fMadeItIn ? S_OK : S_FALSE; + } + else + { + return hr; + } +} /* CTextRunList::Insert */ + +/****************************************************************************** +* CTextRunList::Speak * +*---------------------* +* Description: +* Starts speaking at the position *plStartSpeaking and ends at +* *plEndSpeaking, unless *plEndSpeaking is -1, in which case it +* speaks until the end of the document has been reached. +* Adjusts *plStartSpeaking and *plEndSpeaking to reflect the +* start and endpoints at which we actually will be speaking +* since they will have to be expanded if they fall in the middle +* of words or phrase elements. +* +* Return: +* S_OK +* S_FALSE if there was nothing to speak +* E_POINTER +* E_INVALIDARG if the speaking limits are not within range +* Return value of CTextRun::Speak() +******************************************************************************/ +HRESULT CTextRunList::Speak( ISpVoice &rVoice, + long *plStartSpeaking, + long *plEndSpeaking ) +{ + _ASSERTE( GetTailEnd() != 0 ); + + // Check arguments + if ( !plStartSpeaking || !plEndSpeaking ) + { + return E_POINTER; + } + if ((( *plEndSpeaking >= 0 ) && ( *plEndSpeaking < *plStartSpeaking )) || + (*plStartSpeaking < 0) ) + { + return E_INVALIDARG; + } + + if ( *plEndSpeaking == *plStartSpeaking ) + { + // nothing to speak + return S_FALSE; + } + + // Get p to the right spot for starting + PTEXTRUNNODE p; + p = Find( *plStartSpeaking ); + + // If the beginning was not found (i.e. it is at the end), then speak the entire TextRunList. + if ( !p ) + { + *plStartSpeaking = 0; + *plEndSpeaking = GetTailEnd(); + return Speak( rVoice, plStartSpeaking, plEndSpeaking ); + } + + if ( p->pTextRun->WithinRange( *plEndSpeaking ) ) + { + // This block is the only one that needs speaking, since both the start and the end + // limits for speaking are found within this run. + // CTextRun::Speak() will put the appropriate values in *plStartSpeaking and + // *plEndSpeaking. + return p->pTextRun->Speak( rVoice, plStartSpeaking, plEndSpeaking ); + } + + // Speak from *plStartSpeaking to the end of the first block + long lFirstBlockEnd = -1; + HRESULT hr = p->pTextRun->Speak( rVoice, plStartSpeaking, &lFirstBlockEnd ); + + // Spin through the list until the final node is reached or until the end of the + // TextRunList has been reached + for ( p = p->pNext; + SUCCEEDED(hr) && p && + (( *plEndSpeaking < 0 ) || ( p->pTextRun->GetEnd() < *plEndSpeaking )); + p = p->pNext ) + { + hr = p->pTextRun->Speak( rVoice ); + } + + // Stop here if something has gone wrong + if (FAILED(hr)) + { + return hr; + } + + // If we were not supposed to speak to the end of the document, + // speak from the start of the final node until the end limit. + if ( p && (*plEndSpeaking >= 0) ) + { + if ( p->pTextRun->GetStart() < *plEndSpeaking ) + { + // There is something left to speak in the final block, + // so speak from the beginning to *plEndSpeaking + long lFinalBlockStart = -1; + hr = p->pTextRun->Speak( rVoice, &lFinalBlockStart, plEndSpeaking ); + } + else + { + // There is nothing to speak in the final block: + // The end of the speak is the start of the final block + *plEndSpeaking = p->pTextRun->GetStart(); + } + } + else + { + // The end of the speak is the end of the document + *plEndSpeaking = GetTailEnd(); + } + + return hr; +} /* CTextRunList::Speak */ + +/***************************************************************************** +* CTextRunList::Serialize * +*-------------------------* +* Description: +* Serializes the information in the TextRunList and writes +* it to pStream. +* Return: +* S_OK +* E_POINTER: pStream or pRecoCtxt is NULL +* Return value of CTextRun::Serialize() +* Return value of IStream::Write() +******************************************************************************/ +HRESULT CTextRunList::Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ) +{ + if ( !pStream || !pRecoCtxt ) + { + return E_POINTER; + } + + // Walk the list, serializing each CTextRun + PTEXTRUNNODE pNode; + HRESULT hr = S_OK; + for ( pNode = m_pHead; pNode; pNode = pNode->pNext ) + { + // Serialize the node + hr = pNode->pTextRun->Serialize( pStream, pRecoCtxt ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + // Write an "end-of-list" header to the stream + RUNHEADER endHdr; + ULONG cb; + endHdr.lStart = endHdr.lEnd = -1; + hr = pStream->Write( &endHdr, sizeof( RUNHEADER ), &cb ); + + return hr; +} /* CTextRunList::Serialize */ + +/***************************************************************************** +* CTextRunList::Deserialize * +*---------------------------* +* Description: +* Uses an IStream to recreate a previously-serialized TextRunList +* Return: +* S_OK +* E_POINTER: pStream or pRecoCtxt is NULL +* E_FAIL: TextRunList was not empty to begin with or the associated +* ITextDocument is invalid or the TextRunList contains +* invalid offsets +* E_OUTOFMEMORY +* Return value of IStream::Read() +* Return value of ISpRecoContext::DeserializeResult() +* Return value of ITextDocument::Range() +* Return value of CTextRun::SetTextRange() +******************************************************************************/ +HRESULT CTextRunList::Deserialize( IStream *pStream, ISpRecoContext *pRecoCtxt ) +{ + if ( !pStream || !pRecoCtxt ) + { + return E_POINTER; + } + if ( !m_cpTextDoc ) + { + return E_FAIL; + } + + // Since we're going to be creating this CTextRunList from a stream, + // clear out any nodes that are already there + if ( m_pHead ) + { + DeleteAllNodes(); + } + + // Read in the first header; the end will be indicated by a header + // with lStart < 0 + RUNHEADER runHdr; + ULONG cbRead = 0; + HRESULT hr = pStream->Read( &runHdr, sizeof( RUNHEADER ), &cbRead ); + + // Keep reading until the end-of-stream RUNHEADER is encountered + // (that RUNHEADER will have -1 as its lStart) + long lNextPosToRead = 0; // To check consistency of serialized list + while ( SUCCEEDED( hr ) && ( cbRead > 0 ) && ( runHdr.lStart >= 0 ) ) + { + // Consistency check: Make sure this run starts where the + // last run left off + if ( lNextPosToRead == runHdr.lStart ) + { + // Good, update next position + lNextPosToRead = runHdr.lEnd; + } + else + { + hr = E_UNEXPECTED; + } + + CTextRun *pNewRun = NULL; + + if ( runHdr.bResultFollows ) + { + // This run is a serialized CDictationRun + + // Serialized CDictationRuns are preceded by a DICTHEADER + DICTHEADER dictHdr; + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Read( &dictHdr, sizeof( DICTHEADER ), &cbRead ); + } + /* + if ( FAILED( hr ) ) + { + return hr; + } + */ + + // Allocate the appropriate amount of space for the serialized + // result object + void *pv = NULL; + if ( SUCCEEDED( hr ) ) + { + pv = ::CoTaskMemAlloc( dictHdr.cbSize ); + if ( !pv ) + { + hr = E_OUTOFMEMORY; + } + } + + // Read in the serialized result object + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Read( pv, dictHdr.cbSize, &cbRead ); + } + SPSERIALIZEDRESULT *pResultBlob = static_cast (pv); + CComPtr cpResult; + if ( SUCCEEDED( hr ) ) + { + hr = pRecoCtxt->DeserializeResult( pResultBlob, &cpResult ); + } + + if ( pv ) + { + ::CoTaskMemFree( pv ); + } + + /* + if ( FAILED( hr ) ) + { + return hr; + } +*/ + // Create a CDictationRun with which to associate the phrase blob + if ( SUCCEEDED( hr ) ) + { + pNewRun = new CDictationRun; + if ( !pNewRun ) + { + hr = E_OUTOFMEMORY; + } + } + + // Initialize it with the deserialized result object + if ( SUCCEEDED( hr ) ) + { + hr = ((CDictationRun *) pNewRun)->Initialize( + *cpResult, &dictHdr ); + + if ( FAILED( hr ) ) + { + // Punt and make it a TextRun + delete pNewRun; + pNewRun = new CTextRun(); + + if ( pNewRun ) + { + // Proceed with a simple CTextRun + hr = S_OK; + } + } + } + + } + else + { + // The RUNHEADER has indicated that this run is not a CDictationRun, + // so create a CTextRun + pNewRun = new CTextRun(); + } + + if ( !pNewRun ) + { + hr = E_OUTOFMEMORY; + } + else + { + pNewRun->IncrementCount(); + } + + // Create a text range for this run as specified by the RUNHEADER + CComPtr cpRange; + if ( SUCCEEDED( hr ) ) + { + hr = m_cpTextDoc->Range( runHdr.lStart, runHdr.lEnd, &cpRange ); + } + + // Set the run to use that text range + if (SUCCEEDED( hr ) ) + { + hr = pNewRun->SetTextRange( cpRange ); + } + + // Put the node on the list and continue + if ( pNewRun ) + { + // Link in the new node at the tail + PTEXTRUNNODE pNewNode = new TEXTRUNNODE; + pNewNode->pTextRun = pNewRun; + AddTail( pNewNode ); + } + + if ( SUCCEEDED( hr ) ) + { + // Read in the next header + hr = pStream->Read( &runHdr, sizeof( RUNHEADER ), &cbRead ); + } + } + + if ( FAILED( hr ) ) + { + // Roll back: Delete all of the nodes that were created + DeleteAllNodes(); + } + + // Start out with the "hint" pointer pointing to the head + m_pCurrent = m_pHead; + return hr; +} /* CTextRunList::Deserialize */ + +/***************************************************************************** +* CTextRunList::IsConsumeLeadingSpaces * +*--------------------------------------* +* Description: +* Sets *pfConsumeLeadingSpaces to true iff whatever starts at lPos +* has a display attribute to consume leading spaces +* Return: +* E_POINTER +* E_INVALIDARG if lPos is out of range +* Return value of CTextRun::IsConsumeLeadingSpaces() +******************************************************************************/ +HRESULT CTextRunList::IsConsumeLeadingSpaces( long lPos, + bool *pfConsumeLeadingSpaces ) +{ + if ( !pfConsumeLeadingSpaces ) + { + return E_POINTER; + } + + // Find the node containing this position + PTEXTRUNNODE pNode = Find( lPos ); + if ( !pNode ) + { + // we were given an out-of-range position + return E_INVALIDARG; + } + + _ASSERTE( pNode->pTextRun ); + + return pNode->pTextRun->IsConsumeLeadingSpaces( lPos, + pfConsumeLeadingSpaces ); +} /* CTextRunList::ConsumeLeadingSpaces */ + +/***************************************************************************** +* CTextRunList::HowManySpacesAfter * +*----------------------------------* +* Description: +* Returns the number of spaces that would need to precede text +* if text were to be inserted at position lPos. +* This number is in the out param puiSpaces +* Return: +* E_POINTER +* E_INVALIDARG if lPos is out of range +* Return value of CTextRun::HowManySpacesAfter() +******************************************************************************/ +HRESULT CTextRunList::HowManySpacesAfter( long lPos, UINT *puiSpaces ) +{ + if ( !puiSpaces ) + { + return E_POINTER; + } + + // Find the node containing this position + PTEXTRUNNODE pNode = Find( lPos ); + if ( !pNode ) + { + // we were given an out-of-range position + return E_INVALIDARG; + } + + _ASSERTE( pNode->pTextRun ); + + return pNode->pTextRun->HowManySpacesAfter( lPos, puiSpaces ); +} /* CTextRunList::HowManySpacesAfter */ + +/***************************************************************************** +* CTextRunList::GetTailEnd * +*--------------------------* +* Description: +* Returns the end position of the tail. This gives us the length of +* the document +******************************************************************************/ +long CTextRunList::GetTailEnd() +{ + if ( m_pTail ) + { + return m_pTail->pTextRun->GetEnd(); + } + else + { + return 0; + } +} /* CTextRunList::GetTailEnd */ + +/***************************************************************************** +* CTextRunList::Find * +*--------------------* +* Description: Returns a pointer to the node containing position lDest. +* Return: +* NULL if lDest is out of bounds +* Pointer to a node with cpMin <= lDest < cpMax +* OR a pointer to the tail if lDest is the last position in the list +******************************************************************************/ +PTEXTRUNNODE CTextRunList::Find( long lDest ) +{ + if ( !m_pHead || ( lDest < 0 ) || ( lDest > GetTailEnd() )) + { + return NULL; + } + + // Try to use m_pCurrent as a hint + if ( m_pCurrent && + ( m_pCurrent->pTextRun->GetStart() <= lDest ) && + ( lDest < m_pCurrent->pTextRun->GetEnd()) ) + { + return m_pCurrent; + } + + // Check for the start + if ( lDest == 0 ) + { + return m_pHead; + } + + // Check for the end + if ( lDest == GetTailEnd() ) + { + return m_pTail; + } + + // Find whose start is closest to lDest: the head, the tail, or m_pCurrent. + // Note that the distance from the start (head) is just lDest, since the + // start position is always 0. + long lDistFromEnd = labs( lDest - m_pTail->pTextRun->GetStart() ); + long lDistFromCurrent; + if ( m_pCurrent ) + { + lDistFromCurrent = labs( lDest - m_pCurrent->pTextRun->GetStart() ); + } + else + { + // m_pCurrent isn't pointing anywhere. + // "Sabotage" lDistFromCurrent so it will never beat searching from the start + lDistFromCurrent = lDest + 1; + } + bool bSearchForward; + PTEXTRUNNODE pStartSearch; + if (( lDistFromCurrent < lDest ) && + ( lDistFromCurrent < lDistFromEnd )) + { + // m_pCurrent is closer than both the head and the tail + // Search from m_pCurrent + pStartSearch = m_pCurrent; + } + else + { + if ( lDest < lDistFromEnd ) + { + // Head is closer than tail + pStartSearch = m_pHead; + } + else + { + pStartSearch = m_pTail; + } + } + + bSearchForward = (lDest >= pStartSearch->pTextRun->GetStart()); + + // Walk either forwards or backwards from the closest reference node + // looking for a node that meets cpMin <= lDest < cpMax + PTEXTRUNNODE p; + if ( bSearchForward ) + { + // Forward search + for ( p = pStartSearch; + p && (p->pTextRun->GetEnd() <= lDest); + p = p->pNext ) + ; + + _ASSERTE( p ); + if ( p->pTextRun->GetStart() > lDest ) + { + // lDest is in a gap preceding node p + _ASSERTE( false ); + p->pTextRun->SetStart( lDest ); + } + } + else + { + // Backwards search + for ( p = pStartSearch; + p && (p->pTextRun->GetStart() > lDest); + p = p->pPrev ) + ; + + _ASSERTE( p ); + if ( p->pTextRun->GetEnd() <= lDest ) + { + // lDest is in a gap following node p + _ASSERTE( false ); + p->pTextRun->SetEnd( lDest ); + } + } + + return p; +} /* CTextRunList::Find */ + +/***************************************************************************** +* CTextRunList::MoveCurrentTo * +*-----------------------------* +* Description: +* Moves the m_pCurrent to the TextRun node directly preceding +* the specified location (so that the next time we try to +* insert a text run, hopefully we can insert right after +* m_pCurrent. +* If lDest falls in the middle of a text run, splits that text +* run. +* First tries using its old value as a hint. +* Postcondition: The end of m_pCurrent == lDest +* Return: +* S_OK +* E_INVALIDARG if lDest is out of the range of the document +******************************************************************************/ +HRESULT CTextRunList::MoveCurrentTo( LONG lDest ) +{ + if ( m_pCurrent && (lDest == m_pCurrent->pTextRun->GetEnd()) ) + { + // All set, nothing more to do; m_pCurrent was already right + return S_OK; + } + + // If lDest is 0, then set m_pCurrent to NULL (since there is no node preceding the + // head + if ( !lDest ) + { + m_pCurrent = NULL; + return S_OK; + } + + // Find() will return pNode such that cpMin <= lDest < cpMax + PTEXTRUNNODE pNode = Find( lDest ); + + if ( !pNode ) + { + // lDest was too big, so it wasn't found + return E_INVALIDARG; + } + + // Make sure lDest is somewhere in pNode's range + _ASSERTE( pNode->pTextRun->WithinRange( lDest ) || (lDest == pNode->pTextRun->GetEnd()) ); + + HRESULT hr = S_OK; + if ( pNode->pTextRun->GetStart() == lDest ) + { + // The node we found begins exactly at lDest, so no splitting is necessary; + // we just need to have m_pCurrent point to the previous node + m_pCurrent = pNode->pPrev; + } + else + { + // lDest occurs in the middle of pNode's range, so we need to split pNode + hr = SplitNode( pNode ); + + if ( SUCCEEDED( hr ) ) + { + // pNode still starts at the same place, except now it ends at the start + // of m_pNodeToInsert (see CTextRunList::Insert()) + m_pCurrent = pNode; + } + } + return hr; +} /* CTextRunList::MoveCurrentTo */ + +/****************************************************************************** +* CTextRunList::SplitNode * +*-------------------------* +* Description: +* Called BEFORE m_pNodeToInsert is inserted into the list, in +* order to split up pNode to accommodate the new node. +* +* Splits the given node to form a node that ends at the start position +* of m_pNodeToInsert and a node that starts at the end position of +* m_pNodeToInsert. +* +* Creates a new node to bridge the gap if necessary. +* See CTextRun::Split() and CDictationRun::Split() +* Return: +* S_OK +* E_POINTER if pNode is NULL +* E_INVALIDARG if lCursorPos does not fall in the range of pNode +* E_OUTOFMEMORY +* Return value of CTextRun::Split() +* Return value of CTextRunList::InsertAfter() +******************************************************************************/ +HRESULT CTextRunList::SplitNode( PTEXTRUNNODE pNode ) +{ + if ( !pNode ) + { + return E_POINTER; + } + _ASSERTE( m_pNodeToInsert ); + if ( !m_pNodeToInsert ) + { + return E_UNEXPECTED; + } + + if ( m_pNodeToInsert->pTextRun->GetStart() == pNode->pTextRun->GetEnd() ) + { + // No need to split, since the new node is at the end of this node + return S_OK; + } + + if ( !(pNode->pTextRun->WithinRange( m_pNodeToInsert->pTextRun->GetStart() )) ) + { + // Start of m_pNodeToInsert is out of bounds + return E_INVALIDARG; + } + + CTextRun *pLatterRun = NULL; + + // Remember the start and end of m_pNodeToInsert + const long lStart = m_pNodeToInsert->pTextRun->GetStart(); + const long lEnd = m_pNodeToInsert->pTextRun->GetEnd(); + + // Call CTextRun::Split(). This might change the split locations lNewStart and lNewEnd + // and will set pLatterRun to a non-NULL value if the split actually did occur. + long lNewStart = lStart; + long lNewEnd = lEnd; + HRESULT hr = pNode->pTextRun->Split( &lNewStart, + &lNewEnd, m_cpTextDoc, &pLatterRun ); + _ASSERTE( SUCCEEDED( hr ) ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Adjust the range on m_pNodeToInsert if it has changed + if (( lStart != lNewStart ) || ( lEnd != lNewEnd )) + { + m_pNodeToInsert->pTextRun->SetStart( lNewStart ); + m_pNodeToInsert->pTextRun->SetEnd( lNewEnd ); + } + + if ( pLatterRun ) + { + // A split did occur + // Create the new node and insert it right after pNode + PTEXTRUNNODE pNewNode = new TEXTRUNNODE; + if ( !pNewNode ) + { + return E_OUTOFMEMORY; + } + pNewNode->pTextRun = pLatterRun; + pNewNode->pTextRun->IncrementCount(); + pNewNode->pNext = pNewNode->pPrev = NULL; + + hr = InsertAfter( pNode, pNewNode ); + if ( FAILED( hr ) ) + { + return hr; + } + + // InsertAfter() would have moved m_pCurrent to the latter run (the + // one associated with pNewNode). But m_pCurrent should stay at pNode. + m_pCurrent = pNode; + } + + return S_OK; +} /* CTextRunList::SplitNode */ + +/****************************************************************************** +* CTextRunList::MergeIn * +*-----------------------* +* Description: +* For new DictationRuns, passes them along to the separate merging +* method for DictationRuns below. +* handled by a separate merging method below). +* +* First tries to merge with each neighbor if it is a non-dictated +* node. +* +* Next tries to merge with dictation nodes on either side by +* temporarily including the node in the dictation node's range +* and seeing if it is a match for any of the missing phrase elements +* in that run. The neighboring dictation runs are allowed to +* appropriate whatever portion of its range that they can. +* +* Return: +* S_OK +* E_POINTER +* Return value of CTextRunList::MergeInDictRun() +******************************************************************************/ +HRESULT CTextRunList::MergeIn( PTEXTRUNNODE pNode, bool *pfNodeMadeItIn ) +{ + if ( !pfNodeMadeItIn ) + { + return E_POINTER; + } + + *pfNodeMadeItIn = false; + + if ( pNode->pTextRun->IsDict() ) + { + // Dictation runs are handled by a separate merging method. + // Assuming CTextRunList::MergeInDictRun() went off successfully, + // the run will have made it onto the list + HRESULT hr = MergeInDictRun( pNode ); + if ( SUCCEEDED( hr ) ) + { + *pfNodeMadeItIn = true; + } + return hr; + } + + // This run is not a CDictationRun + + // Do the easy merge with the neighbors if they are text nodes + // (that is, two adjacent non-dictated runs can always be merged) + MERGERESULT mr; + HRESULT hr; + if ( pNode->pPrev && !(pNode->pPrev->pTextRun->IsDict()) ) + { + mr = pNode->pTextRun->Concatenate( pNode->pPrev->pTextRun, false ); + + // Both nodes are nondictated text, so this better have worked + _ASSERTE( mr == E_FULLMERGE ); + _ASSERTE( pNode->pPrev->pTextRun->IsDegenerate() ); + if (( mr != E_FULLMERGE ) || !pNode->pPrev->pTextRun->IsDegenerate() ) + { + return E_UNEXPECTED; + } + + // Prev node can now be removed + hr = RemoveNode( pNode->pPrev ); + if ( FAILED( hr ) ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + } + if ( pNode->pNext && !(pNode->pNext->pTextRun->IsDict()) ) + { + mr = pNode->pTextRun->Concatenate( pNode->pNext->pTextRun, true ); + + // Both nodes are nondictated text, so this better have worked + _ASSERTE( mr == E_FULLMERGE ); + _ASSERTE( pNode->pNext->pTextRun->IsDegenerate() ); + if (( mr != E_FULLMERGE ) || !pNode->pNext->pTextRun->IsDegenerate() ) + { + return E_UNEXPECTED; + } + + // Next node can now be removed + hr = RemoveNode( pNode->pNext ); + if ( FAILED( hr ) ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + } + + // pNode should be surrounded by dictation nodes now, since there should never be + // two consecutive text nodes + + // The concatenation for pNext must happen before that for pPrev. + // That is because it is a lot easier to include trailing spaces before the + // next word in a range than it is to include preceding spaces. + // Thus by concatenating onto pPrev LAST we are doing the forward Concatenate second, + // which is more effective in gobbling up pNode's range (our goal is to get + // pNode's range as small as possible. + if ( pNode->pNext ) + { + _ASSERTE( pNode->pNext->pTextRun->IsDict() ); + _ASSERTE( pNode->pNext->pTextRun->GetStart() == pNode->pTextRun->GetEnd() ); + + // This concatenation may change the end of pNode's text range or + // the start of pNext's text range + pNode->pNext->pTextRun->Concatenate( pNode->pTextRun, false ); + } + if ( pNode->pPrev ) + { + _ASSERTE( pNode->pPrev->pTextRun->IsDict() ); + _ASSERTE( pNode->pPrev->pTextRun->GetEnd() == pNode->pTextRun->GetStart() ); + + // This concatenation may change the end of pPrev's text range or + // the start of pNode's text range + pNode->pPrev->pTextRun->Concatenate( pNode->pTextRun, true ); + } + + // If pNode now has nothing left, then remove it and try to concatenate its previous and + // next neighbors together + if ( pNode->pTextRun->IsDegenerate() ) + { + // Hang on to the prev and next nodes + PTEXTRUNNODE pPrev = pNode->pPrev; + PTEXTRUNNODE pNext = pNode->pNext; + + // Remove pNode + HRESULT hr = RemoveNode( pNode ); + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + return E_UNEXPECTED; + } + + // Concatenate pPrev and pNext. If the pNext node is completely consumed, then + // remove it as well + if ( pPrev && pNext ) + { + _ASSERTE( pPrev->pTextRun->GetEnd() == pNext->pTextRun->GetStart() ); + + pPrev->pTextRun->Concatenate( pNext->pTextRun, true ); + + if ( pNext->pTextRun->IsDegenerate() ) + { + // pNext was entirely subsumed by pPrev, so remove it + hr = RemoveNode( pNext ); + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + return E_UNEXPECTED; + } + } + } + + // Do not set *pfNodeMadeItIn to true, since the node did not make it in + return S_OK; + } + else + { + // If we are here, the node made it onto the list successfully + *pfNodeMadeItIn = true; + return S_OK; + } +} /* CTextRunList::MergeIn */ + +/****************************************************************************** +* CTextRunList::MergeInDictRun * +*------------------------------* +* Description: +* Merges in a dictation run. +* Since it is a new dictation run, it is complete and its range +* will not change. If either neighbor is a dictation run, +* we need to check if the phrase elements are correct +* (since, of course, the new dictation run may be splitting up +* already-existing dictation runs). +* If not, we may need to insert text runs on either side. +* Return: +* S_OK +* E_OUTOFMEMORY +* Return value of CTextRun::CorrectPhraseEltsAndRange() +* Return value of ITextDocument::Range() +* Return value of CTextRun::SetTextRange() +* Return value of CTextRunList::InsertAfter() +* Return value of CTextRunList::MergeIn() +*******************************************************************************/ +HRESULT CTextRunList::MergeInDictRun( PTEXTRUNNODE pNode ) +{ + HRESULT hr; + PTEXTRUNNODE pNewTextRunNode = NULL; + CTextRun *pNewTextRun = NULL; + + // Make sure that the previous node still has accurate information + if ( pNode->pPrev ) + { + PTEXTRUNNODE pPrev = pNode->pPrev; + + // Ensure that the previous node's phrase elements reflect reality (it + // may be a newly-broken dictation run.) + // The range of pPrev will be adjusted so that only full phrase elements + // are included in pPrev's range + hr = pPrev->pTextRun->CorrectPhraseEltsAndRange( true ); + if ( FAILED( hr ) ) + { + return hr; + } + + if ( pPrev->pTextRun->GetEnd() < pNode->pTextRun->GetStart() ) + { + // There is a gap between the neighboring run and this run. + // The gap contains a fragment of a phrase element, which will + // now be downgraded to the status of non-dictated text. + + // A new text run must be created to cover that area + pNewTextRun = new CTextRun(); + if ( !pNewTextRun ) + { + return E_OUTOFMEMORY; + } + pNewTextRun->IncrementCount(); + + // That new run will cover the gap + CComPtr pPrevTextRange; + hr = m_cpTextDoc->Range( pPrev->pTextRun->GetEnd(), + pNode->pTextRun->GetStart(), &pPrevTextRange ); + if ( SUCCEEDED( hr ) ) + { + hr = pNewTextRun->SetTextRange( pPrevTextRange ); + } + if ( FAILED( hr ) ) + { + return hr; + } + + // Make a new TEXTRUNNODE for the list + pNewTextRunNode = new TEXTRUNNODE; + if ( !pNewTextRunNode ) + { + return E_OUTOFMEMORY; + } + pNewTextRunNode->pNext = pNewTextRunNode->pPrev = NULL; + pNewTextRunNode->pTextRun = pNewTextRun; + + // Put it right where the gap is + hr = InsertAfter( pPrev, pNewTextRunNode ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + if ( pPrev->pTextRun->IsDegenerate() ) + { + // pPrev now has no complete phrase elements, + // so get rid of it + hr = RemoveNode( pPrev ); + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + if ( pNewTextRunNode ) + { + // We are adding a CTextRun to bridge the gap between pPrev and pNode + + // Merge in the fragment of the phrase element as text + bool fMadeItIn; + hr = MergeIn( pNewTextRunNode, &fMadeItIn ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Reset pNewTextRunNode NULL so this will work for processing pNext + pNewTextRunNode = NULL; + } + } + + // Make sure that the next node still has accurate information + if ( pNode->pNext ) + { + PTEXTRUNNODE pNext = pNode->pNext; + + // Ensure that the next node's phrase elements reflect reality (it + // may be a newly-broken dictation run. + // The range of pPrev will be adjusted so that only full phrase elements + // are included in pNext's range + hr = pNext->pTextRun->CorrectPhraseEltsAndRange( false ); + if ( FAILED( hr ) ) + { + return hr; + } + + if ( pNext->pTextRun->GetStart() > pNode->pTextRun->GetEnd() ) + { + // There is a gap between the neighboring run and this run. + // The gap contains a fragment of a phrase element, which will + // now be downgraded to the status of non-dictated text. + + // A new text run must be created to cover that area + pNewTextRun = new CTextRun(); + if ( !pNewTextRun ) + { + return E_OUTOFMEMORY; + } + pNewTextRun->IncrementCount(); + + // That new run will cover the gap + CComPtr pNextTextRange; + hr = m_cpTextDoc->Range( pNode->pTextRun->GetEnd(), + pNext->pTextRun->GetStart(), &pNextTextRange ); + if ( SUCCEEDED( hr ) ) + { + hr = pNewTextRun->SetTextRange( pNextTextRange ); + } + if ( FAILED( hr ) ) + { + return hr; + } + + // Make a new TEXTRUNNODE for the list + pNewTextRunNode = new TEXTRUNNODE; + if ( !pNewTextRunNode ) + { + return E_OUTOFMEMORY; + } + pNewTextRunNode->pNext = pNewTextRunNode->pPrev = NULL; + pNewTextRunNode->pTextRun = pNewTextRun; + + // Put it right where the gap is + hr = InsertAfter( pNode, pNewTextRunNode ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + if ( pNext->pTextRun->IsDegenerate() ) + { + // pNext now has no complete phrase elements, + // so get rid of it + hr = RemoveNode( pNext ); + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + if ( pNewTextRunNode ) + { + // We are adding a CTextRun to bridge the gap between pNode and pNext + + // Merge in the fragment of the phrase element as text + bool fMadeItIn; + hr = MergeIn( pNewTextRunNode, &fMadeItIn ); + if ( FAILED( hr ) ) + { + return hr; + } + } + } + + // If we got here, then no errors were encountered + return S_OK; +} /*CTextRunList::MergeInDictRun */ + +/********************************************************************** +* CTextRunList::InsertAfter * +*---------------------------* +* Description: +* Inserts pNodeToInsert in the list after pCurrent. +* If pCurrent is NULL, adds it onto the head. +* +* Return: +* E_POINTER if pNodeToInsert is NULL, otherwise S_OK. +**********************************************************************/ +HRESULT CTextRunList::InsertAfter( PTEXTRUNNODE pCurrent, + PTEXTRUNNODE pNodeToInsert ) +{ + HRESULT hr; + if( !pNodeToInsert ) + { + hr = E_POINTER; + } + else if ( !pCurrent ) + { + hr = AddHead( pNodeToInsert ); + } + else + { + // check if pCurrent is the tail of the list + if( pCurrent == m_pTail ) + { + hr = AddTail( pNodeToInsert ); + } + else + { + if( pCurrent->pNext == NULL ) + { + hr = E_UNEXPECTED; // only the tail can have a NULL pNext + } + else + { + // Link in the new node + PTEXTRUNNODE pLast = pCurrent->pNext; + pCurrent->pNext = pNodeToInsert; + pLast->pPrev = pNodeToInsert; + pNodeToInsert->pPrev = pCurrent; + pNodeToInsert->pNext = pLast; + + // Update m_pCurrent + m_pCurrent = pNodeToInsert; + + hr = S_OK; + } + } + } + return hr; +} /* CTextRunList::InsertAfter */ + +/********************************************************************** +* CTextRunList::RemoveNode * +*--------------------------* +* Description: +* Removes a node from the list. +* Decrements the text run reference counts. +* +* Return: +* E_POINTER if pNode is NULL, otherwise S_OK. +**********************************************************************/ +HRESULT CTextRunList::RemoveNode( PTEXTRUNNODE pNode ) +{ + HRESULT hr; + if( !pNode ) + { + hr = E_POINTER; + } + else + { + if( pNode == m_pHead ) + { + RemoveHead(); + } + else if( pNode == m_pTail ) + { + RemoveTail(); + } + else + { + // Link the two neighbors together + PTEXTRUNNODE pLeft = pNode->pPrev; + PTEXTRUNNODE pRight = pNode->pNext; + pLeft->pNext = pRight; + pRight->pPrev = pLeft; + + // Update current node if we're removing it + if( pNode == m_pCurrent ) + { + m_pCurrent = pLeft; + } + + // Decrement the refcount of this pNode's TextRun, then delete it + pNode->pTextRun->DecrementCount(); + delete pNode; + + } + hr = S_OK; + } + return hr; +} /* CTextRunList::RemoveNode */ + +/********************************************************************** +* CTextRunList::AddHead * +*-----------------------* +* Description: +* Adds a node to the head of the list. Sets the current +* pointer to the head. +* +* Return: +* E_POINTER if pHead is NULL, otherwise S_OK. +**********************************************************************/ +HRESULT CTextRunList::AddHead( PTEXTRUNNODE pHead ) +{ + HRESULT hr; + if( !pHead ) + { + hr = E_POINTER; + } + else + { + // Check for the first item in the list + if( !m_pHead ) + { + // This will be the only item on the list + _ASSERTE( m_pTail == NULL ); + pHead->pNext = pHead->pPrev = NULL; + m_pHead = m_pTail = m_pCurrent = pHead; + } + else + { + // Put this node ahead of the existing head + m_pHead->pPrev = pHead; + pHead->pNext = m_pHead; + pHead->pPrev = NULL; + m_pHead = pHead; + m_pCurrent = pHead; + } + hr = S_OK; + } + + return hr; +} /* CTextRunList::AddHead */ + +/********************************************************************** +* CTextRunList::AddTail * +*-----------------------* +* Description: +* Adds a node to the tail of the list. Sets the current +* pointer to the tail. +* +* Return: +* E_POINTER if pTail is NULL, otherwise S_OK. +**********************************************************************/ +HRESULT CTextRunList::AddTail( PTEXTRUNNODE pTail ) +{ + HRESULT hr; + if( !pTail ) + { + hr = E_POINTER; + } + else + { + // Check for the last item in the list + if( !m_pTail ) + { + // This will be the only item on the list + _ASSERTE( m_pHead == NULL ); + pTail->pNext = pTail->pPrev = NULL; + m_pHead = m_pTail = pTail; + } + else + { + // Put this node after of the existing tail + m_pTail->pNext = pTail; + pTail->pPrev = m_pTail; + pTail->pNext = NULL; + m_pTail = pTail; + m_pCurrent = pTail; + } + hr = S_OK; + } + + return hr; +} /* CTextRunList::AddTail */ + +/********************************************************************** +* CTextRunList::RemoveHead * +*--------------------------* +* Description: +* Removes the head node from the list and decrements the +* text run's reference count. +**********************************************************************/ +void CTextRunList::RemoveHead() +{ + _ASSERTE( m_pHead ); + if( m_pHead ) + { + if( m_pCurrent == m_pHead ) + { + // m_pCurrent would usually fall back one, but here + // we are removing the head + m_pCurrent = NULL; + } + m_pHead->pTextRun->DecrementCount(); + + // Update m_pHead + PTEXTRUNNODE pNewHead = m_pHead->pNext; + delete m_pHead; + m_pHead = pNewHead; + + // If we have deleted the only element, then make the tail NULL too + if ( !m_pHead ) + { + m_pTail = NULL; + } + else + { + // Head should have no previous node + m_pHead->pPrev = NULL; + } + } +} /* CTextRunList::RemoveHead */ + +/********************************************************************** +* CTextRunList::RemoveTail * +*--------------------------* +* Description: +* Removes the tail node from the list and decrements the +* text run's reference count. +**********************************************************************/ +void CTextRunList::RemoveTail() +{ + if( m_pTail ) + { + if( m_pCurrent == m_pTail ) + { + m_pCurrent = m_pTail->pPrev; + } + m_pTail->pTextRun->DecrementCount(); + + // Update m_pTail + PTEXTRUNNODE pNewTail = m_pTail->pPrev; + delete m_pTail; + m_pTail = pNewTail; + + // If we have deleted the last element, then make the head NULL too + if ( !m_pTail ) + { + m_pHead = NULL; + } + else + { + // Tail should have no next node + m_pTail->pNext = NULL; + } + } +} /* CTextRunList::RemoveTail */ + +/***************************************************************************** +* CTextRunList::DeleteAllNodes * +*------------------------------* +* Description: +* Deletes a doubly linked list for text run objects +* and decrements the text run reference counts. +******************************************************************************/ +void CTextRunList::DeleteAllNodes() +{ + // Spin through our list, deleting as we go + while( m_pHead ) + { + m_pCurrent = m_pHead; + + m_pHead = m_pHead->pNext; + + // Decrement a count on the TextRun associated with m_pCurrent + // This should delete the TextRun when its refcount hits 0. + m_pCurrent->pTextRun->DecrementCount(); + + delete m_pCurrent; + } + + // The list is now empty + m_pHead = m_pTail = m_pCurrent = NULL; +} /* CTextRunList::DeleteAllNodes */ + + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.h new file mode 100644 index 00000000..8e976a9f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.h @@ -0,0 +1,101 @@ +/****************************************************************************** +* TextRunList.h +* This module contains the definition details of CTextRunList which is +* a container class that keeps track of all of the individual text runs +* in DictPad +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "TextRun.h" +#include "DictationRun.h" + +// Nodes for the CTextRunList +typedef struct TEXTRUNNODE +{ + CTextRun *pTextRun; // Points to the actual test run information + struct TEXTRUNNODE *pPrev; // Points to the previous node in our list + struct TEXTRUNNODE *pNext; // Points to the next node in our list +} TEXTRUNNODE, *PTEXTRUNNODE; + +/****************************************************************************** +* CTextRunList +* This class keeps track of all the CTextRun objects that exist to +* represent the entire document being edited within DictPad +******************************************************************************/ +class CTextRunList +{ + public: + // Constructor/destructor + CTextRunList( ITextDocument *pTextDoc = NULL); + ~CTextRunList(); + + // Initialization methods + void SetTextDoc( ITextDocument *cpTextDoc ) { m_cpTextDoc = cpTextDoc; } + HRESULT CreateSimpleList(); // Create a one-node list consisting of a single TextRun + + // Method for new text + HRESULT Insert( CTextRun *pTextRun ); // Takes care of figuring out where the new node should go + + // Playback method + HRESULT Speak( ISpVoice &rVoice, long *plStartSpeaking, long *plEndSpeaking ); + // Speak starting and ending at specified locations + + // Serialization methods + HRESULT Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ); + // Write the contents of the TextRunList to pStream + HRESULT Deserialize( IStream *pStream, ISpRecoContext *pRecoCtxt ); + // Recreate the TextRunList from the stream + + // Display attributes methods + HRESULT IsConsumeLeadingSpaces( long lPos, bool *pfConsumeLeadingSpaces ); + HRESULT HowManySpacesAfter( long lPos, UINT *puiSpaces ); + // How many spaces would need to precede text + // that would start at lPos + + // Methods that deal with positions in the text + long GetTailEnd(); // length of the document + PTEXTRUNNODE Find( long lDest ); // Pointer to the node that contains this position + + + private: + // Methods for manipulation of adjacent CTextRuns + HRESULT MoveCurrentTo( LONG lDest ); // Move m_pCurrent to a node that ends at + // lDest, splitting nodes if necessary + HRESULT SplitNode( PTEXTRUNNODE pNode ); // Split the given node for m_pNodeToInsert + HRESULT MergeIn( PTEXTRUNNODE pNode, bool *pfNodeMadeItIn ); + // Try to merge a new node in with neighbors + HRESULT MergeInDictRun( PTEXTRUNNODE pNode ); + // Handle newly-dictated text in the list + + // List manipulation methods + HRESULT InsertAfter( PTEXTRUNNODE pCurrent, PTEXTRUNNODE pNodeToInsert ); + HRESULT RemoveNode( PTEXTRUNNODE pNode ); + HRESULT AddHead( PTEXTRUNNODE pHead ); + HRESULT AddTail( PTEXTRUNNODE pTail ); + void RemoveHead(); + void RemoveTail(); + + // Clean-up method + void DeleteAllNodes(); + + private: + // These cached nodes help us to add new nodes to our list + // somewhat optimally. + PTEXTRUNNODE m_pHead; // Starting point (necessary reguardless of strategy) + PTEXTRUNNODE m_pTail; // Last node in our list + PTEXTRUNNODE m_pCurrent; // Most recently added node. We cache this one under the + // assumption that nodes will often be added in groups; + // remembering where the last one went is a good clue + // as to where we should insert the next one. + + PTEXTRUNNODE m_pNodeToInsert; + // Node that we are about to add. This information is necessary for + // calling CTextRun::Split() + + CComPtr m_cpTextDoc; // Pointer to the ITextDocument interface to which + // we will need access for splitting nodes in order + // to retrieve ITextRange pointers. +}; /* class CTextRunList */ + diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/tom.h b/mp/src/utils/sapi51/Samples/CPP/DictPad/tom.h new file mode 100644 index 00000000..bd43fb22 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/tom.h @@ -0,0 +1,6612 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 3.01.75 */ +/* at Thu May 07 14:12:12 1998 + */ +/* Compiler settings for tom.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: none +*/ +//@@MIDL_FILE_HEADING( ) +#include "rpc.h" +#include "rpcndr.h" +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __tomtmp_h__ +#define __tomtmp_h__ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __ITextDocument_FWD_DEFINED__ +#define __ITextDocument_FWD_DEFINED__ +typedef interface ITextDocument ITextDocument; +#endif /* __ITextDocument_FWD_DEFINED__ */ + + +#ifndef __ITextRange_FWD_DEFINED__ +#define __ITextRange_FWD_DEFINED__ +typedef interface ITextRange ITextRange; +#endif /* __ITextRange_FWD_DEFINED__ */ + + +#ifndef __ITextSelection_FWD_DEFINED__ +#define __ITextSelection_FWD_DEFINED__ +typedef interface ITextSelection ITextSelection; +#endif /* __ITextSelection_FWD_DEFINED__ */ + + +#ifndef __ITextFont_FWD_DEFINED__ +#define __ITextFont_FWD_DEFINED__ +typedef interface ITextFont ITextFont; +#endif /* __ITextFont_FWD_DEFINED__ */ + + +#ifndef __ITextPara_FWD_DEFINED__ +#define __ITextPara_FWD_DEFINED__ +typedef interface ITextPara ITextPara; +#endif /* __ITextPara_FWD_DEFINED__ */ + + +#ifndef __ITextStoryRanges_FWD_DEFINED__ +#define __ITextStoryRanges_FWD_DEFINED__ +typedef interface ITextStoryRanges ITextStoryRanges; +#endif /* __ITextStoryRanges_FWD_DEFINED__ */ + + +#ifndef __ITextDocument2_FWD_DEFINED__ +#define __ITextDocument2_FWD_DEFINED__ +typedef interface ITextDocument2 ITextDocument2; +#endif /* __ITextDocument2_FWD_DEFINED__ */ + + +#ifndef __ITextMsgFilter_FWD_DEFINED__ +#define __ITextMsgFilter_FWD_DEFINED__ +typedef interface ITextMsgFilter ITextMsgFilter; +#endif /* __ITextMsgFilter_FWD_DEFINED__ */ + + +#ifndef __ITextDocument_FWD_DEFINED__ +#define __ITextDocument_FWD_DEFINED__ +typedef interface ITextDocument ITextDocument; +#endif /* __ITextDocument_FWD_DEFINED__ */ + + +#ifndef __ITextRange_FWD_DEFINED__ +#define __ITextRange_FWD_DEFINED__ +typedef interface ITextRange ITextRange; +#endif /* __ITextRange_FWD_DEFINED__ */ + + +#ifndef __ITextSelection_FWD_DEFINED__ +#define __ITextSelection_FWD_DEFINED__ +typedef interface ITextSelection ITextSelection; +#endif /* __ITextSelection_FWD_DEFINED__ */ + + +#ifndef __ITextFont_FWD_DEFINED__ +#define __ITextFont_FWD_DEFINED__ +typedef interface ITextFont ITextFont; +#endif /* __ITextFont_FWD_DEFINED__ */ + + +#ifndef __ITextPara_FWD_DEFINED__ +#define __ITextPara_FWD_DEFINED__ +typedef interface ITextPara ITextPara; +#endif /* __ITextPara_FWD_DEFINED__ */ + + +#ifndef __ITextStoryRanges_FWD_DEFINED__ +#define __ITextStoryRanges_FWD_DEFINED__ +typedef interface ITextStoryRanges ITextStoryRanges; +#endif /* __ITextStoryRanges_FWD_DEFINED__ */ + + +#ifndef __ITextDocument2_FWD_DEFINED__ +#define __ITextDocument2_FWD_DEFINED__ +typedef interface ITextDocument2 ITextDocument2; +#endif /* __ITextDocument2_FWD_DEFINED__ */ + + +#ifndef __ITextMsgFilter_FWD_DEFINED__ +#define __ITextMsgFilter_FWD_DEFINED__ +typedef interface ITextMsgFilter ITextMsgFilter; +#endif /* __ITextMsgFilter_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +/**************************************** + * Generated header for interface: __MIDL_itf_tom_0000 + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [local] */ + + + + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_tom_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_tom_0000_v0_0_s_ifspec; + + +#ifndef __tom_LIBRARY_DEFINED__ +#define __tom_LIBRARY_DEFINED__ + +/**************************************** + * Generated header for library: tom + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [version][uuid] */ + + +typedef /* [public] */ +enum __MIDL___MIDL_itf_tom_0000_0001 + { tomFalse = 0, + tomTrue = -1, + tomUndefined = -9999999, + tomToggle = -9999998, + tomAutoColor = -9999997, + tomDefault = -9999996, + tomSuspend = -9999995, + tomResume = -9999994, + tomApplyNow = 0, + tomApplyLater = 1, + tomTrackParms = 2, + tomCacheParms = 3, + tomBackward = 0xc0000001, + tomForward = 0x3fffffff, + tomMove = 0, + tomExtend = 1, + tomNoSelection = 0, + tomSelectionIP = 1, + tomSelectionNormal = 2, + tomSelectionFrame = 3, + tomSelectionColumn = 4, + tomSelectionRow = 5, + tomSelectionBlock = 6, + tomSelectionInlineShape = 7, + tomSelectionShape = 8, + tomSelStartActive = 1, + tomSelAtEOL = 2, + tomSelOvertype = 4, + tomSelActive = 8, + tomSelReplace = 16, + tomEnd = 0, + tomStart = 32, + tomCollapseEnd = 0, + tomCollapseStart = 1, + tomClientCoord = 256, + tomNone = 0, + tomSingle = 1, + tomWords = 2, + tomDouble = 3, + tomDotted = 4, + tomDash = 5, + tomDashDot = 6, + tomDashDotDot = 7, + tomWave = 8, + tomThick = 9, + tomHair = 10, + tomLineSpaceSingle = 0, + tomLineSpace1pt5 = 1, + tomLineSpaceDouble = 2, + tomLineSpaceAtLeast = 3, + tomLineSpaceExactly = 4, + tomLineSpaceMultiple = 5, + tomAlignLeft = 0, + tomAlignCenter = 1, + tomAlignRight = 2, + tomAlignJustify = 3, + tomAlignDecimal = 3, + tomAlignBar = 4, + tomAlignInterWord = 3, + tomAlignInterLetter = 4, + tomAlignScaled = 5, + tomAlignGlyphs = 6, + tomAlignSnapGrid = 7, + tomSpaces = 0, + tomDots = 1, + tomDashes = 2, + tomLines = 3, + tomThickLines = 4, + tomEquals = 5, + tomTabBack = -3, + tomTabNext = -2, + tomTabHere = -1, + tomListNone = 0, + tomListBullet = 1, + tomListNumberAsArabic = 2, + tomListNumberAsLCLetter = 3, + tomListNumberAsUCLetter = 4, + tomListNumberAsLCRoman = 5, + tomListNumberAsUCRoman = 6, + tomListNumberAsSequence = 7, + tomListParentheses = 0x10000, + tomListPeriod = 0x20000, + tomListPlain = 0x30000, + tomCharacter = 1, + tomWord = 2, + tomSentence = 3, + tomParagraph = 4, + tomLine = 5, + tomStory = 6, + tomScreen = 7, + tomSection = 8, + tomColumn = 9, + tomRow = 10, + tomWindow = 11, + tomCell = 12, + tomCharFormat = 13, + tomParaFormat = 14, + tomTable = 15, + tomObject = 16, + tomMatchWord = 2, + tomMatchCase = 4, + tomMatchPattern = 8, + tomUnknownStory = 0, + tomMainTextStory = 1, + tomFootnotesStory = 2, + tomEndnotesStory = 3, + tomCommentsStory = 4, + tomTextFrameStory = 5, + tomEvenPagesHeaderStory = 6, + tomPrimaryHeaderStory = 7, + tomEvenPagesFooterStory = 8, + tomPrimaryFooterStory = 9, + tomFirstPageHeaderStory = 10, + tomFirstPageFooterStory = 11, + tomNoAnimation = 0, + tomLasVegasLights = 1, + tomBlinkingBackground = 2, + tomSparkleText = 3, + tomMarchingBlackAnts = 4, + tomMarchingRedAnts = 5, + tomShimmer = 6, + tomWipeDown = 7, + tomWipeRight = 8, + tomAnimationMax = 8, + tomLowerCase = 0, + tomUpperCase = 1, + tomTitleCase = 2, + tomSentenceCase = 4, + tomToggleCase = 5, + tomReadOnly = 0x100, + tomShareDenyRead = 0x200, + tomShareDenyWrite = 0x400, + tomPasteFile = 0x1000, + tomCreateNew = 0x10, + tomCreateAlways = 0x20, + tomOpenExisting = 0x30, + tomOpenAlways = 0x40, + tomTruncateExisting = 0x50, + tomRTF = 0x1, + tomText = 0x2, + tomHTML = 0x3, + tomWordDocument = 0x4, + tomBold = 0x80000001, + tomItalic = 0x80000002, + tomUnderline = 0x80000004, + tomStrikeout = 0x80000008, + tomProtected = 0x80000010, + tomLink = 0x80000020, + tomSmallCaps = 0x80000040, + tomAllCaps = 0x80000080, + tomHidden = 0x80000100, + tomOutline = 0x80000200, + tomShadow = 0x80000400, + tomEmboss = 0x80000800, + tomImprint = 0x80001000, + tomDisabled = 0x80002000, + tomRevised = 0x80004000, + tomNormalCaret = 0, + tomKoreanBlockCaret = 0x1, + tomIncludeInset = 0x1, + tomIgnoreCurrentFont = 0, + tomMatchFontCharset = 0x1, + tomMatchFontSignature = 0x2, + tomCharset = 0x80000000 + } tomConstants; + + + + + + + + + + +EXTERN_C const IID LIBID_tom; + +#ifndef __ITextDocument_INTERFACE_DEFINED__ +#define __ITextDocument_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextDocument + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextDocument; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C0-A1DF-11ce-8098-00AA0047BE5D") + ITextDocument : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetName( + /* [retval][out] */ BSTR __RPC_FAR *pName) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSelection( + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryRanges( + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSaved( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSaved( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDefaultTabStop( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDefaultTabStop( + /* [in] */ float Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE New( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Open( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Save( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Freeze( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Unfreeze( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE BeginEditCollection( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndEditCollection( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Undo( + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Redo( + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Range( + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE RangeFromPoint( + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextDocumentVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextDocument __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextDocument __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextDocument __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextDocument __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextDocument __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextDocument __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextDocument __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelection )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryCount )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryRanges )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSaved )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSaved )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDefaultTabStop )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultTabStop )( + ITextDocument __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *New )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Unfreeze )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEditCollection )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndEditCollection )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Undo )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Redo )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Range )( + ITextDocument __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RangeFromPoint )( + ITextDocument __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + END_INTERFACE + } ITextDocumentVtbl; + + interface ITextDocument + { + CONST_VTBL struct ITextDocumentVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextDocument_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextDocument_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextDocument_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextDocument_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextDocument_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextDocument_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextDocument_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextDocument_GetName(This,pName) \ + (This)->lpVtbl -> GetName(This,pName) + +#define ITextDocument_GetSelection(This,ppSel) \ + (This)->lpVtbl -> GetSelection(This,ppSel) + +#define ITextDocument_GetStoryCount(This,pCount) \ + (This)->lpVtbl -> GetStoryCount(This,pCount) + +#define ITextDocument_GetStoryRanges(This,ppStories) \ + (This)->lpVtbl -> GetStoryRanges(This,ppStories) + +#define ITextDocument_GetSaved(This,pValue) \ + (This)->lpVtbl -> GetSaved(This,pValue) + +#define ITextDocument_SetSaved(This,Value) \ + (This)->lpVtbl -> SetSaved(This,Value) + +#define ITextDocument_GetDefaultTabStop(This,pValue) \ + (This)->lpVtbl -> GetDefaultTabStop(This,pValue) + +#define ITextDocument_SetDefaultTabStop(This,Value) \ + (This)->lpVtbl -> SetDefaultTabStop(This,Value) + +#define ITextDocument_New(This) \ + (This)->lpVtbl -> New(This) + +#define ITextDocument_Open(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Open(This,pVar,Flags,CodePage) + +#define ITextDocument_Save(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Save(This,pVar,Flags,CodePage) + +#define ITextDocument_Freeze(This,pCount) \ + (This)->lpVtbl -> Freeze(This,pCount) + +#define ITextDocument_Unfreeze(This,pCount) \ + (This)->lpVtbl -> Unfreeze(This,pCount) + +#define ITextDocument_BeginEditCollection(This) \ + (This)->lpVtbl -> BeginEditCollection(This) + +#define ITextDocument_EndEditCollection(This) \ + (This)->lpVtbl -> EndEditCollection(This) + +#define ITextDocument_Undo(This,Count,prop) \ + (This)->lpVtbl -> Undo(This,Count,prop) + +#define ITextDocument_Redo(This,Count,prop) \ + (This)->lpVtbl -> Redo(This,Count,prop) + +#define ITextDocument_Range(This,cp1,cp2,ppRange) \ + (This)->lpVtbl -> Range(This,cp1,cp2,ppRange) + +#define ITextDocument_RangeFromPoint(This,x,y,ppRange) \ + (This)->lpVtbl -> RangeFromPoint(This,x,y,ppRange) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetName_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + +void __RPC_STUB ITextDocument_GetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetSelection_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + +void __RPC_STUB ITextDocument_GetSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetStoryCount_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_GetStoryCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetStoryRanges_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + +void __RPC_STUB ITextDocument_GetStoryRanges_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetSaved_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextDocument_GetSaved_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_SetSaved_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextDocument_SetSaved_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetDefaultTabStop_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextDocument_GetDefaultTabStop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_SetDefaultTabStop_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextDocument_SetDefaultTabStop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_New_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_New_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Open_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + +void __RPC_STUB ITextDocument_Open_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Save_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + +void __RPC_STUB ITextDocument_Save_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Freeze_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_Freeze_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Unfreeze_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_Unfreeze_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_BeginEditCollection_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_BeginEditCollection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_EndEditCollection_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_EndEditCollection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Undo_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + +void __RPC_STUB ITextDocument_Undo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Redo_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + +void __RPC_STUB ITextDocument_Redo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Range_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextDocument_Range_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_RangeFromPoint_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextDocument_RangeFromPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextDocument_INTERFACE_DEFINED__ */ + + +#ifndef __ITextRange_INTERFACE_DEFINED__ +#define __ITextRange_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextRange + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextRange; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C2-A1DF-11ce-8098-00AA0047BE5D") + ITextRange : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetText( + /* [retval][out] */ BSTR __RPC_FAR *pbstr) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetText( + /* [in] */ BSTR bstr) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetChar( + /* [retval][out] */ long __RPC_FAR *pch) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetChar( + /* [in] */ long ch) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFormattedText( + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFormattedText( + /* [in] */ ITextRange __RPC_FAR *pRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStart( + /* [retval][out] */ long __RPC_FAR *pcpFirst) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStart( + /* [in] */ long cpFirst) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEnd( + /* [retval][out] */ long __RPC_FAR *pcpLim) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEnd( + /* [in] */ long cpLim) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFont( + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFont( + /* [in] */ ITextFont __RPC_FAR *pFont) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPara( + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPara( + /* [in] */ ITextPara __RPC_FAR *pPara) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryLength( + /* [retval][out] */ long __RPC_FAR *pcch) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryType( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Collapse( + /* [in] */ long bStart) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Expand( + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetIndex( + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetIndex( + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetRange( + /* [in] */ long cpActive, + /* [in] */ long cpOther) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE InRange( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE InStory( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Select( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE StartOf( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndOf( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Move( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStart( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEnd( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStartWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEndWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStartUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEndUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindText( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindTextStart( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindTextEnd( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Delete( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Cut( + /* [out] */ VARIANT __RPC_FAR *pVar) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Copy( + /* [out] */ VARIANT __RPC_FAR *pVar) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Paste( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanPaste( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanEdit( + /* [retval][out] */ long __RPC_FAR *pbCanEdit) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ChangeCase( + /* [in] */ long Type) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetPoint( + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetPoint( + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ScrollIntoView( + /* [in] */ long Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEmbeddedObject( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextRangeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextRange __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextRange __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextRange __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextRange __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextRange __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextRange __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextRange __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetText )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetText )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetChar )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetChar )( + ITextRange __RPC_FAR * This, + /* [in] */ long ch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFormattedText )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFormattedText )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStart )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStart )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpFirst); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnd )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpLim); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFont )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFont )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPara )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPara )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryLength )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryType )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Collapse )( + ITextRange __RPC_FAR * This, + /* [in] */ long bStart); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Expand )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIndex )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndex )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRange )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InRange )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InStory )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Select )( + ITextRange __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartOf )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndOf )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStart )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindText )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextStart )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Cut )( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Copy )( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Paste )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanPaste )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanEdit )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChangeCase )( + ITextRange __RPC_FAR * This, + /* [in] */ long Type); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPoint )( + ITextRange __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPoint )( + ITextRange __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ScrollIntoView )( + ITextRange __RPC_FAR * This, + /* [in] */ long Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmbeddedObject )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + END_INTERFACE + } ITextRangeVtbl; + + interface ITextRange + { + CONST_VTBL struct ITextRangeVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextRange_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextRange_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextRange_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextRange_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextRange_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextRange_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextRange_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextRange_GetText(This,pbstr) \ + (This)->lpVtbl -> GetText(This,pbstr) + +#define ITextRange_SetText(This,bstr) \ + (This)->lpVtbl -> SetText(This,bstr) + +#define ITextRange_GetChar(This,pch) \ + (This)->lpVtbl -> GetChar(This,pch) + +#define ITextRange_SetChar(This,ch) \ + (This)->lpVtbl -> SetChar(This,ch) + +#define ITextRange_GetDuplicate(This,ppRange) \ + (This)->lpVtbl -> GetDuplicate(This,ppRange) + +#define ITextRange_GetFormattedText(This,ppRange) \ + (This)->lpVtbl -> GetFormattedText(This,ppRange) + +#define ITextRange_SetFormattedText(This,pRange) \ + (This)->lpVtbl -> SetFormattedText(This,pRange) + +#define ITextRange_GetStart(This,pcpFirst) \ + (This)->lpVtbl -> GetStart(This,pcpFirst) + +#define ITextRange_SetStart(This,cpFirst) \ + (This)->lpVtbl -> SetStart(This,cpFirst) + +#define ITextRange_GetEnd(This,pcpLim) \ + (This)->lpVtbl -> GetEnd(This,pcpLim) + +#define ITextRange_SetEnd(This,cpLim) \ + (This)->lpVtbl -> SetEnd(This,cpLim) + +#define ITextRange_GetFont(This,pFont) \ + (This)->lpVtbl -> GetFont(This,pFont) + +#define ITextRange_SetFont(This,pFont) \ + (This)->lpVtbl -> SetFont(This,pFont) + +#define ITextRange_GetPara(This,pPara) \ + (This)->lpVtbl -> GetPara(This,pPara) + +#define ITextRange_SetPara(This,pPara) \ + (This)->lpVtbl -> SetPara(This,pPara) + +#define ITextRange_GetStoryLength(This,pcch) \ + (This)->lpVtbl -> GetStoryLength(This,pcch) + +#define ITextRange_GetStoryType(This,pValue) \ + (This)->lpVtbl -> GetStoryType(This,pValue) + +#define ITextRange_Collapse(This,bStart) \ + (This)->lpVtbl -> Collapse(This,bStart) + +#define ITextRange_Expand(This,Unit,pDelta) \ + (This)->lpVtbl -> Expand(This,Unit,pDelta) + +#define ITextRange_GetIndex(This,Unit,pIndex) \ + (This)->lpVtbl -> GetIndex(This,Unit,pIndex) + +#define ITextRange_SetIndex(This,Unit,Index,Extend) \ + (This)->lpVtbl -> SetIndex(This,Unit,Index,Extend) + +#define ITextRange_SetRange(This,cpActive,cpOther) \ + (This)->lpVtbl -> SetRange(This,cpActive,cpOther) + +#define ITextRange_InRange(This,pRange,pb) \ + (This)->lpVtbl -> InRange(This,pRange,pb) + +#define ITextRange_InStory(This,pRange,pb) \ + (This)->lpVtbl -> InStory(This,pRange,pb) + +#define ITextRange_IsEqual(This,pRange,pb) \ + (This)->lpVtbl -> IsEqual(This,pRange,pb) + +#define ITextRange_Select(This) \ + (This)->lpVtbl -> Select(This) + +#define ITextRange_StartOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> StartOf(This,Unit,Extend,pDelta) + +#define ITextRange_EndOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndOf(This,Unit,Extend,pDelta) + +#define ITextRange_Move(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Move(This,Unit,Count,pDelta) + +#define ITextRange_MoveStart(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveStart(This,Unit,Count,pDelta) + +#define ITextRange_MoveEnd(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveEnd(This,Unit,Count,pDelta) + +#define ITextRange_MoveWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveStartWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveEndWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveUntil(This,Cset,Count,pDelta) + +#define ITextRange_MoveStartUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartUntil(This,Cset,Count,pDelta) + +#define ITextRange_MoveEndUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndUntil(This,Cset,Count,pDelta) + +#define ITextRange_FindText(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindText(This,bstr,cch,Flags,pLength) + +#define ITextRange_FindTextStart(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextStart(This,bstr,cch,Flags,pLength) + +#define ITextRange_FindTextEnd(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextEnd(This,bstr,cch,Flags,pLength) + +#define ITextRange_Delete(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Delete(This,Unit,Count,pDelta) + +#define ITextRange_Cut(This,pVar) \ + (This)->lpVtbl -> Cut(This,pVar) + +#define ITextRange_Copy(This,pVar) \ + (This)->lpVtbl -> Copy(This,pVar) + +#define ITextRange_Paste(This,pVar,Format) \ + (This)->lpVtbl -> Paste(This,pVar,Format) + +#define ITextRange_CanPaste(This,pVar,Format,pb) \ + (This)->lpVtbl -> CanPaste(This,pVar,Format,pb) + +#define ITextRange_CanEdit(This,pbCanEdit) \ + (This)->lpVtbl -> CanEdit(This,pbCanEdit) + +#define ITextRange_ChangeCase(This,Type) \ + (This)->lpVtbl -> ChangeCase(This,Type) + +#define ITextRange_GetPoint(This,Type,px,py) \ + (This)->lpVtbl -> GetPoint(This,Type,px,py) + +#define ITextRange_SetPoint(This,x,y,Type,Extend) \ + (This)->lpVtbl -> SetPoint(This,x,y,Type,Extend) + +#define ITextRange_ScrollIntoView(This,Value) \ + (This)->lpVtbl -> ScrollIntoView(This,Value) + +#define ITextRange_GetEmbeddedObject(This,ppv) \ + (This)->lpVtbl -> GetEmbeddedObject(This,ppv) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetText_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + +void __RPC_STUB ITextRange_GetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextRange_SetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetChar_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + +void __RPC_STUB ITextRange_GetChar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetChar_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long ch); + + +void __RPC_STUB ITextRange_SetChar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetDuplicate_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextRange_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetFormattedText_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextRange_GetFormattedText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetFormattedText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + +void __RPC_STUB ITextRange_SetFormattedText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStart_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + +void __RPC_STUB ITextRange_GetStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpFirst); + + +void __RPC_STUB ITextRange_SetStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + +void __RPC_STUB ITextRange_GetEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpLim); + + +void __RPC_STUB ITextRange_SetEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetFont_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + +void __RPC_STUB ITextRange_GetFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetFont_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + +void __RPC_STUB ITextRange_SetFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetPara_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + +void __RPC_STUB ITextRange_GetPara_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetPara_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + +void __RPC_STUB ITextRange_SetPara_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStoryLength_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + +void __RPC_STUB ITextRange_GetStoryLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStoryType_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextRange_GetStoryType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Collapse_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long bStart); + + +void __RPC_STUB ITextRange_Collapse_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Expand_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Expand_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetIndex_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + +void __RPC_STUB ITextRange_GetIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetIndex_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + +void __RPC_STUB ITextRange_SetIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetRange_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + +void __RPC_STUB ITextRange_SetRange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_InRange_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_InRange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_InStory_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_InStory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_IsEqual_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Select_Proxy( + ITextRange __RPC_FAR * This); + + +void __RPC_STUB ITextRange_Select_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_StartOf_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_StartOf_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_EndOf_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_EndOf_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Move_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Move_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStartWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStartWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEndWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEndWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStartUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStartUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEndUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEndUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindTextStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindTextStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindTextEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindTextEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Delete_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Delete_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Cut_Proxy( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + +void __RPC_STUB ITextRange_Cut_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Copy_Proxy( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + +void __RPC_STUB ITextRange_Copy_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Paste_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + +void __RPC_STUB ITextRange_Paste_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_CanPaste_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_CanPaste_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_CanEdit_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + +void __RPC_STUB ITextRange_CanEdit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_ChangeCase_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Type); + + +void __RPC_STUB ITextRange_ChangeCase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetPoint_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + +void __RPC_STUB ITextRange_GetPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetPoint_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + +void __RPC_STUB ITextRange_SetPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_ScrollIntoView_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextRange_ScrollIntoView_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetEmbeddedObject_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + +void __RPC_STUB ITextRange_GetEmbeddedObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextRange_INTERFACE_DEFINED__ */ + + +#ifndef __ITextSelection_INTERFACE_DEFINED__ +#define __ITextSelection_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextSelection + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextSelection; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C1-A1DF-11ce-8098-00AA0047BE5D") + ITextSelection : public ITextRange + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFlags( + /* [retval][out] */ long __RPC_FAR *pFlags) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFlags( + /* [in] */ LONG Flags) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetType( + /* [retval][out] */ long __RPC_FAR *pType) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveLeft( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveRight( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveUp( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveDown( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE HomeKey( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndKey( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE TypeText( + /* [in] */ BSTR bstr) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextSelectionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextSelection __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextSelection __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextSelection __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextSelection __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextSelection __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextSelection __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextSelection __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetText )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetChar )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetChar )( + ITextSelection __RPC_FAR * This, + /* [in] */ long ch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFormattedText )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFormattedText )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStart )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpFirst); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnd )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpLim); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFont )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFont )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPara )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPara )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryLength )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryType )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Collapse )( + ITextSelection __RPC_FAR * This, + /* [in] */ long bStart); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Expand )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIndex )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndex )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRange )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InRange )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InStory )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Select )( + ITextSelection __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartOf )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndOf )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Cut )( + ITextSelection __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Copy )( + ITextSelection __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Paste )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanPaste )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanEdit )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChangeCase )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Type); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPoint )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPoint )( + ITextSelection __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ScrollIntoView )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmbeddedObject )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFlags )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pFlags); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFlags )( + ITextSelection __RPC_FAR * This, + /* [in] */ LONG Flags); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetType )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pType); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveLeft )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveRight )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUp )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveDown )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HomeKey )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndKey )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *TypeText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + END_INTERFACE + } ITextSelectionVtbl; + + interface ITextSelection + { + CONST_VTBL struct ITextSelectionVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextSelection_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextSelection_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextSelection_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextSelection_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextSelection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextSelection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextSelection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextSelection_GetText(This,pbstr) \ + (This)->lpVtbl -> GetText(This,pbstr) + +#define ITextSelection_SetText(This,bstr) \ + (This)->lpVtbl -> SetText(This,bstr) + +#define ITextSelection_GetChar(This,pch) \ + (This)->lpVtbl -> GetChar(This,pch) + +#define ITextSelection_SetChar(This,ch) \ + (This)->lpVtbl -> SetChar(This,ch) + +#define ITextSelection_GetDuplicate(This,ppRange) \ + (This)->lpVtbl -> GetDuplicate(This,ppRange) + +#define ITextSelection_GetFormattedText(This,ppRange) \ + (This)->lpVtbl -> GetFormattedText(This,ppRange) + +#define ITextSelection_SetFormattedText(This,pRange) \ + (This)->lpVtbl -> SetFormattedText(This,pRange) + +#define ITextSelection_GetStart(This,pcpFirst) \ + (This)->lpVtbl -> GetStart(This,pcpFirst) + +#define ITextSelection_SetStart(This,cpFirst) \ + (This)->lpVtbl -> SetStart(This,cpFirst) + +#define ITextSelection_GetEnd(This,pcpLim) \ + (This)->lpVtbl -> GetEnd(This,pcpLim) + +#define ITextSelection_SetEnd(This,cpLim) \ + (This)->lpVtbl -> SetEnd(This,cpLim) + +#define ITextSelection_GetFont(This,pFont) \ + (This)->lpVtbl -> GetFont(This,pFont) + +#define ITextSelection_SetFont(This,pFont) \ + (This)->lpVtbl -> SetFont(This,pFont) + +#define ITextSelection_GetPara(This,pPara) \ + (This)->lpVtbl -> GetPara(This,pPara) + +#define ITextSelection_SetPara(This,pPara) \ + (This)->lpVtbl -> SetPara(This,pPara) + +#define ITextSelection_GetStoryLength(This,pcch) \ + (This)->lpVtbl -> GetStoryLength(This,pcch) + +#define ITextSelection_GetStoryType(This,pValue) \ + (This)->lpVtbl -> GetStoryType(This,pValue) + +#define ITextSelection_Collapse(This,bStart) \ + (This)->lpVtbl -> Collapse(This,bStart) + +#define ITextSelection_Expand(This,Unit,pDelta) \ + (This)->lpVtbl -> Expand(This,Unit,pDelta) + +#define ITextSelection_GetIndex(This,Unit,pIndex) \ + (This)->lpVtbl -> GetIndex(This,Unit,pIndex) + +#define ITextSelection_SetIndex(This,Unit,Index,Extend) \ + (This)->lpVtbl -> SetIndex(This,Unit,Index,Extend) + +#define ITextSelection_SetRange(This,cpActive,cpOther) \ + (This)->lpVtbl -> SetRange(This,cpActive,cpOther) + +#define ITextSelection_InRange(This,pRange,pb) \ + (This)->lpVtbl -> InRange(This,pRange,pb) + +#define ITextSelection_InStory(This,pRange,pb) \ + (This)->lpVtbl -> InStory(This,pRange,pb) + +#define ITextSelection_IsEqual(This,pRange,pb) \ + (This)->lpVtbl -> IsEqual(This,pRange,pb) + +#define ITextSelection_Select(This) \ + (This)->lpVtbl -> Select(This) + +#define ITextSelection_StartOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> StartOf(This,Unit,Extend,pDelta) + +#define ITextSelection_EndOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndOf(This,Unit,Extend,pDelta) + +#define ITextSelection_Move(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Move(This,Unit,Count,pDelta) + +#define ITextSelection_MoveStart(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveStart(This,Unit,Count,pDelta) + +#define ITextSelection_MoveEnd(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveEnd(This,Unit,Count,pDelta) + +#define ITextSelection_MoveWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveStartWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveEndWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveUntil(This,Cset,Count,pDelta) + +#define ITextSelection_MoveStartUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartUntil(This,Cset,Count,pDelta) + +#define ITextSelection_MoveEndUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndUntil(This,Cset,Count,pDelta) + +#define ITextSelection_FindText(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindText(This,bstr,cch,Flags,pLength) + +#define ITextSelection_FindTextStart(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextStart(This,bstr,cch,Flags,pLength) + +#define ITextSelection_FindTextEnd(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextEnd(This,bstr,cch,Flags,pLength) + +#define ITextSelection_Delete(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Delete(This,Unit,Count,pDelta) + +#define ITextSelection_Cut(This,pVar) \ + (This)->lpVtbl -> Cut(This,pVar) + +#define ITextSelection_Copy(This,pVar) \ + (This)->lpVtbl -> Copy(This,pVar) + +#define ITextSelection_Paste(This,pVar,Format) \ + (This)->lpVtbl -> Paste(This,pVar,Format) + +#define ITextSelection_CanPaste(This,pVar,Format,pb) \ + (This)->lpVtbl -> CanPaste(This,pVar,Format,pb) + +#define ITextSelection_CanEdit(This,pbCanEdit) \ + (This)->lpVtbl -> CanEdit(This,pbCanEdit) + +#define ITextSelection_ChangeCase(This,Type) \ + (This)->lpVtbl -> ChangeCase(This,Type) + +#define ITextSelection_GetPoint(This,Type,px,py) \ + (This)->lpVtbl -> GetPoint(This,Type,px,py) + +#define ITextSelection_SetPoint(This,x,y,Type,Extend) \ + (This)->lpVtbl -> SetPoint(This,x,y,Type,Extend) + +#define ITextSelection_ScrollIntoView(This,Value) \ + (This)->lpVtbl -> ScrollIntoView(This,Value) + +#define ITextSelection_GetEmbeddedObject(This,ppv) \ + (This)->lpVtbl -> GetEmbeddedObject(This,ppv) + + +#define ITextSelection_GetFlags(This,pFlags) \ + (This)->lpVtbl -> GetFlags(This,pFlags) + +#define ITextSelection_SetFlags(This,Flags) \ + (This)->lpVtbl -> SetFlags(This,Flags) + +#define ITextSelection_GetType(This,pType) \ + (This)->lpVtbl -> GetType(This,pType) + +#define ITextSelection_MoveLeft(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveLeft(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveRight(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveRight(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveUp(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveUp(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveDown(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveDown(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_HomeKey(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> HomeKey(This,Unit,Extend,pDelta) + +#define ITextSelection_EndKey(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndKey(This,Unit,Extend,pDelta) + +#define ITextSelection_TypeText(This,bstr) \ + (This)->lpVtbl -> TypeText(This,bstr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_GetFlags_Proxy( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pFlags); + + +void __RPC_STUB ITextSelection_GetFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_SetFlags_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ LONG Flags); + + +void __RPC_STUB ITextSelection_SetFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_GetType_Proxy( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pType); + + +void __RPC_STUB ITextSelection_GetType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveLeft_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveLeft_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveRight_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveRight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveUp_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveUp_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveDown_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveDown_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_HomeKey_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_HomeKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_EndKey_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_EndKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_TypeText_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextSelection_TypeText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextSelection_INTERFACE_DEFINED__ */ + + +#ifndef __ITextFont_INTERFACE_DEFINED__ +#define __ITextFont_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextFont + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextFont; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C3-A1DF-11ce-8098-00AA0047BE5D") + ITextFont : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDuplicate( + /* [in] */ ITextFont __RPC_FAR *pFont) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanChange( + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStyle( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStyle( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAllCaps( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAllCaps( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAnimation( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAnimation( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetBackColor( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetBackColor( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetBold( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetBold( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEmboss( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEmboss( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetForeColor( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetForeColor( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetHidden( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetHidden( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEngrave( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEngrave( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetItalic( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetItalic( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKerning( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKerning( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLanguageID( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetLanguageID( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetName( + /* [retval][out] */ BSTR __RPC_FAR *pbstr) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetName( + /* [in] */ BSTR bstr) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetOutline( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetOutline( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPosition( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPosition( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetProtected( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetProtected( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetShadow( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetShadow( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSize( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSize( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSmallCaps( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSmallCaps( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpacing( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpacing( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStrikeThrough( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStrikeThrough( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSubscript( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSubscript( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSuperscript( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSuperscript( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetUnderline( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetUnderline( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetWeight( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetWeight( + /* [in] */ long Value) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextFontVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextFont __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextFont __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextFont __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextFont __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextFont __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextFont __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextFont __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDuplicate )( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanChange )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStyle )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStyle )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAllCaps )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAllCaps )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAnimation )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAnimation )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBackColor )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetBackColor )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBold )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetBold )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmboss )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEmboss )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetForeColor )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetForeColor )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHidden )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetHidden )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEngrave )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEngrave )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetItalic )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetItalic )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKerning )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKerning )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLanguageID )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetLanguageID )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetName )( + ITextFont __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetOutline )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetOutline )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPosition )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPosition )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProtected )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetProtected )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetShadow )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetShadow )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSize )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSize )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSmallCaps )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSmallCaps )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpacing )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpacing )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStrikeThrough )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStrikeThrough )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSubscript )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSubscript )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSuperscript )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSuperscript )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetUnderline )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetUnderline )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWeight )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWeight )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + END_INTERFACE + } ITextFontVtbl; + + interface ITextFont + { + CONST_VTBL struct ITextFontVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextFont_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextFont_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextFont_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextFont_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextFont_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextFont_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextFont_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextFont_GetDuplicate(This,ppFont) \ + (This)->lpVtbl -> GetDuplicate(This,ppFont) + +#define ITextFont_SetDuplicate(This,pFont) \ + (This)->lpVtbl -> SetDuplicate(This,pFont) + +#define ITextFont_CanChange(This,pB) \ + (This)->lpVtbl -> CanChange(This,pB) + +#define ITextFont_IsEqual(This,pFont,pB) \ + (This)->lpVtbl -> IsEqual(This,pFont,pB) + +#define ITextFont_Reset(This,Value) \ + (This)->lpVtbl -> Reset(This,Value) + +#define ITextFont_GetStyle(This,pValue) \ + (This)->lpVtbl -> GetStyle(This,pValue) + +#define ITextFont_SetStyle(This,Value) \ + (This)->lpVtbl -> SetStyle(This,Value) + +#define ITextFont_GetAllCaps(This,pValue) \ + (This)->lpVtbl -> GetAllCaps(This,pValue) + +#define ITextFont_SetAllCaps(This,Value) \ + (This)->lpVtbl -> SetAllCaps(This,Value) + +#define ITextFont_GetAnimation(This,pValue) \ + (This)->lpVtbl -> GetAnimation(This,pValue) + +#define ITextFont_SetAnimation(This,Value) \ + (This)->lpVtbl -> SetAnimation(This,Value) + +#define ITextFont_GetBackColor(This,pValue) \ + (This)->lpVtbl -> GetBackColor(This,pValue) + +#define ITextFont_SetBackColor(This,Value) \ + (This)->lpVtbl -> SetBackColor(This,Value) + +#define ITextFont_GetBold(This,pValue) \ + (This)->lpVtbl -> GetBold(This,pValue) + +#define ITextFont_SetBold(This,Value) \ + (This)->lpVtbl -> SetBold(This,Value) + +#define ITextFont_GetEmboss(This,pValue) \ + (This)->lpVtbl -> GetEmboss(This,pValue) + +#define ITextFont_SetEmboss(This,Value) \ + (This)->lpVtbl -> SetEmboss(This,Value) + +#define ITextFont_GetForeColor(This,pValue) \ + (This)->lpVtbl -> GetForeColor(This,pValue) + +#define ITextFont_SetForeColor(This,Value) \ + (This)->lpVtbl -> SetForeColor(This,Value) + +#define ITextFont_GetHidden(This,pValue) \ + (This)->lpVtbl -> GetHidden(This,pValue) + +#define ITextFont_SetHidden(This,Value) \ + (This)->lpVtbl -> SetHidden(This,Value) + +#define ITextFont_GetEngrave(This,pValue) \ + (This)->lpVtbl -> GetEngrave(This,pValue) + +#define ITextFont_SetEngrave(This,Value) \ + (This)->lpVtbl -> SetEngrave(This,Value) + +#define ITextFont_GetItalic(This,pValue) \ + (This)->lpVtbl -> GetItalic(This,pValue) + +#define ITextFont_SetItalic(This,Value) \ + (This)->lpVtbl -> SetItalic(This,Value) + +#define ITextFont_GetKerning(This,pValue) \ + (This)->lpVtbl -> GetKerning(This,pValue) + +#define ITextFont_SetKerning(This,Value) \ + (This)->lpVtbl -> SetKerning(This,Value) + +#define ITextFont_GetLanguageID(This,pValue) \ + (This)->lpVtbl -> GetLanguageID(This,pValue) + +#define ITextFont_SetLanguageID(This,Value) \ + (This)->lpVtbl -> SetLanguageID(This,Value) + +#define ITextFont_GetName(This,pbstr) \ + (This)->lpVtbl -> GetName(This,pbstr) + +#define ITextFont_SetName(This,bstr) \ + (This)->lpVtbl -> SetName(This,bstr) + +#define ITextFont_GetOutline(This,pValue) \ + (This)->lpVtbl -> GetOutline(This,pValue) + +#define ITextFont_SetOutline(This,Value) \ + (This)->lpVtbl -> SetOutline(This,Value) + +#define ITextFont_GetPosition(This,pValue) \ + (This)->lpVtbl -> GetPosition(This,pValue) + +#define ITextFont_SetPosition(This,Value) \ + (This)->lpVtbl -> SetPosition(This,Value) + +#define ITextFont_GetProtected(This,pValue) \ + (This)->lpVtbl -> GetProtected(This,pValue) + +#define ITextFont_SetProtected(This,Value) \ + (This)->lpVtbl -> SetProtected(This,Value) + +#define ITextFont_GetShadow(This,pValue) \ + (This)->lpVtbl -> GetShadow(This,pValue) + +#define ITextFont_SetShadow(This,Value) \ + (This)->lpVtbl -> SetShadow(This,Value) + +#define ITextFont_GetSize(This,pValue) \ + (This)->lpVtbl -> GetSize(This,pValue) + +#define ITextFont_SetSize(This,Value) \ + (This)->lpVtbl -> SetSize(This,Value) + +#define ITextFont_GetSmallCaps(This,pValue) \ + (This)->lpVtbl -> GetSmallCaps(This,pValue) + +#define ITextFont_SetSmallCaps(This,Value) \ + (This)->lpVtbl -> SetSmallCaps(This,Value) + +#define ITextFont_GetSpacing(This,pValue) \ + (This)->lpVtbl -> GetSpacing(This,pValue) + +#define ITextFont_SetSpacing(This,Value) \ + (This)->lpVtbl -> SetSpacing(This,Value) + +#define ITextFont_GetStrikeThrough(This,pValue) \ + (This)->lpVtbl -> GetStrikeThrough(This,pValue) + +#define ITextFont_SetStrikeThrough(This,Value) \ + (This)->lpVtbl -> SetStrikeThrough(This,Value) + +#define ITextFont_GetSubscript(This,pValue) \ + (This)->lpVtbl -> GetSubscript(This,pValue) + +#define ITextFont_SetSubscript(This,Value) \ + (This)->lpVtbl -> SetSubscript(This,Value) + +#define ITextFont_GetSuperscript(This,pValue) \ + (This)->lpVtbl -> GetSuperscript(This,pValue) + +#define ITextFont_SetSuperscript(This,Value) \ + (This)->lpVtbl -> SetSuperscript(This,Value) + +#define ITextFont_GetUnderline(This,pValue) \ + (This)->lpVtbl -> GetUnderline(This,pValue) + +#define ITextFont_SetUnderline(This,Value) \ + (This)->lpVtbl -> SetUnderline(This,Value) + +#define ITextFont_GetWeight(This,pValue) \ + (This)->lpVtbl -> GetWeight(This,pValue) + +#define ITextFont_SetWeight(This,Value) \ + (This)->lpVtbl -> SetWeight(This,Value) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetDuplicate_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont); + + +void __RPC_STUB ITextFont_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetDuplicate_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + +void __RPC_STUB ITextFont_SetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_CanChange_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextFont_CanChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_IsEqual_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextFont_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_Reset_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetStyle_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetStyle_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetAllCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetAllCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetAllCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetAllCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetAnimation_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetAnimation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetAnimation_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetAnimation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetBackColor_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetBackColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetBackColor_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetBackColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetBold_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetBold_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetBold_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetBold_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetEmboss_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetEmboss_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetEmboss_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetEmboss_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetForeColor_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetForeColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetForeColor_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetForeColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetHidden_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetHidden_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetHidden_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetHidden_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetEngrave_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetEngrave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetEngrave_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetEngrave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetItalic_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetItalic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetItalic_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetItalic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetKerning_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetKerning_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetKerning_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetKerning_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetLanguageID_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetLanguageID_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetLanguageID_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetLanguageID_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetName_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + +void __RPC_STUB ITextFont_GetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetName_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextFont_SetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetOutline_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetOutline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetOutline_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetOutline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetPosition_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetPosition_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetProtected_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetProtected_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetProtected_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetProtected_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetShadow_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetShadow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetShadow_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetShadow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSize_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSize_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSmallCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSmallCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSmallCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSmallCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSpacing_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSpacing_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetStrikeThrough_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetStrikeThrough_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetStrikeThrough_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetStrikeThrough_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSubscript_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSubscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSubscript_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSubscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSuperscript_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSuperscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSuperscript_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSuperscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetUnderline_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetUnderline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetUnderline_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetUnderline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetWeight_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetWeight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetWeight_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetWeight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextFont_INTERFACE_DEFINED__ */ + + +#ifndef __ITextPara_INTERFACE_DEFINED__ +#define __ITextPara_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextPara + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextPara; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C4-A1DF-11ce-8098-00AA0047BE5D") + ITextPara : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDuplicate( + /* [in] */ ITextPara __RPC_FAR *pPara) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanChange( + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStyle( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStyle( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAlignment( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAlignment( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetHyphenation( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetHyphenation( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFirstLineIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKeepTogether( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKeepTogether( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKeepWithNext( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKeepWithNext( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLeftIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLineSpacing( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLineSpacingRule( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListAlignment( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListAlignment( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListLevelIndex( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListLevelIndex( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListStart( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListStart( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListTab( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListTab( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListType( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListType( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetNoLineNumber( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetNoLineNumber( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPageBreakBefore( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPageBreakBefore( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetRightIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetRightIndent( + /* [in] */ float Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetIndents( + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetLineSpacing( + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpaceAfter( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpaceAfter( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpaceBefore( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpaceBefore( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetWidowControl( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetWidowControl( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetTabCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddTab( + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ClearAllTabs( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE DeleteTab( + /* [in] */ float tbPos) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetTab( + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextParaVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextPara __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextPara __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextPara __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextPara __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextPara __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextPara __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextPara __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDuplicate )( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanChange )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStyle )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStyle )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAlignment )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAlignment )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHyphenation )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetHyphenation )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFirstLineIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKeepTogether )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKeepTogether )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKeepWithNext )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKeepWithNext )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLeftIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineSpacing )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineSpacingRule )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListAlignment )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListAlignment )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListLevelIndex )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListLevelIndex )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListStart )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListStart )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListTab )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListType )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListType )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNoLineNumber )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNoLineNumber )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPageBreakBefore )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPageBreakBefore )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRightIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRightIndent )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndents )( + ITextPara __RPC_FAR * This, + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetLineSpacing )( + ITextPara __RPC_FAR * This, + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpaceAfter )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpaceAfter )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpaceBefore )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpaceBefore )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWidowControl )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWidowControl )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTabCount )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ClearAllTabs )( + ITextPara __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DeleteTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTab )( + ITextPara __RPC_FAR * This, + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader); + + END_INTERFACE + } ITextParaVtbl; + + interface ITextPara + { + CONST_VTBL struct ITextParaVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextPara_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextPara_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextPara_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextPara_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextPara_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextPara_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextPara_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextPara_GetDuplicate(This,ppPara) \ + (This)->lpVtbl -> GetDuplicate(This,ppPara) + +#define ITextPara_SetDuplicate(This,pPara) \ + (This)->lpVtbl -> SetDuplicate(This,pPara) + +#define ITextPara_CanChange(This,pB) \ + (This)->lpVtbl -> CanChange(This,pB) + +#define ITextPara_IsEqual(This,pPara,pB) \ + (This)->lpVtbl -> IsEqual(This,pPara,pB) + +#define ITextPara_Reset(This,Value) \ + (This)->lpVtbl -> Reset(This,Value) + +#define ITextPara_GetStyle(This,pValue) \ + (This)->lpVtbl -> GetStyle(This,pValue) + +#define ITextPara_SetStyle(This,Value) \ + (This)->lpVtbl -> SetStyle(This,Value) + +#define ITextPara_GetAlignment(This,pValue) \ + (This)->lpVtbl -> GetAlignment(This,pValue) + +#define ITextPara_SetAlignment(This,Value) \ + (This)->lpVtbl -> SetAlignment(This,Value) + +#define ITextPara_GetHyphenation(This,pValue) \ + (This)->lpVtbl -> GetHyphenation(This,pValue) + +#define ITextPara_SetHyphenation(This,Value) \ + (This)->lpVtbl -> SetHyphenation(This,Value) + +#define ITextPara_GetFirstLineIndent(This,pValue) \ + (This)->lpVtbl -> GetFirstLineIndent(This,pValue) + +#define ITextPara_GetKeepTogether(This,pValue) \ + (This)->lpVtbl -> GetKeepTogether(This,pValue) + +#define ITextPara_SetKeepTogether(This,Value) \ + (This)->lpVtbl -> SetKeepTogether(This,Value) + +#define ITextPara_GetKeepWithNext(This,pValue) \ + (This)->lpVtbl -> GetKeepWithNext(This,pValue) + +#define ITextPara_SetKeepWithNext(This,Value) \ + (This)->lpVtbl -> SetKeepWithNext(This,Value) + +#define ITextPara_GetLeftIndent(This,pValue) \ + (This)->lpVtbl -> GetLeftIndent(This,pValue) + +#define ITextPara_GetLineSpacing(This,pValue) \ + (This)->lpVtbl -> GetLineSpacing(This,pValue) + +#define ITextPara_GetLineSpacingRule(This,pValue) \ + (This)->lpVtbl -> GetLineSpacingRule(This,pValue) + +#define ITextPara_GetListAlignment(This,pValue) \ + (This)->lpVtbl -> GetListAlignment(This,pValue) + +#define ITextPara_SetListAlignment(This,Value) \ + (This)->lpVtbl -> SetListAlignment(This,Value) + +#define ITextPara_GetListLevelIndex(This,pValue) \ + (This)->lpVtbl -> GetListLevelIndex(This,pValue) + +#define ITextPara_SetListLevelIndex(This,Value) \ + (This)->lpVtbl -> SetListLevelIndex(This,Value) + +#define ITextPara_GetListStart(This,pValue) \ + (This)->lpVtbl -> GetListStart(This,pValue) + +#define ITextPara_SetListStart(This,Value) \ + (This)->lpVtbl -> SetListStart(This,Value) + +#define ITextPara_GetListTab(This,pValue) \ + (This)->lpVtbl -> GetListTab(This,pValue) + +#define ITextPara_SetListTab(This,Value) \ + (This)->lpVtbl -> SetListTab(This,Value) + +#define ITextPara_GetListType(This,pValue) \ + (This)->lpVtbl -> GetListType(This,pValue) + +#define ITextPara_SetListType(This,Value) \ + (This)->lpVtbl -> SetListType(This,Value) + +#define ITextPara_GetNoLineNumber(This,pValue) \ + (This)->lpVtbl -> GetNoLineNumber(This,pValue) + +#define ITextPara_SetNoLineNumber(This,Value) \ + (This)->lpVtbl -> SetNoLineNumber(This,Value) + +#define ITextPara_GetPageBreakBefore(This,pValue) \ + (This)->lpVtbl -> GetPageBreakBefore(This,pValue) + +#define ITextPara_SetPageBreakBefore(This,Value) \ + (This)->lpVtbl -> SetPageBreakBefore(This,Value) + +#define ITextPara_GetRightIndent(This,pValue) \ + (This)->lpVtbl -> GetRightIndent(This,pValue) + +#define ITextPara_SetRightIndent(This,Value) \ + (This)->lpVtbl -> SetRightIndent(This,Value) + +#define ITextPara_SetIndents(This,StartIndent,LeftIndent,RightIndent) \ + (This)->lpVtbl -> SetIndents(This,StartIndent,LeftIndent,RightIndent) + +#define ITextPara_SetLineSpacing(This,LineSpacingRule,LineSpacing) \ + (This)->lpVtbl -> SetLineSpacing(This,LineSpacingRule,LineSpacing) + +#define ITextPara_GetSpaceAfter(This,pValue) \ + (This)->lpVtbl -> GetSpaceAfter(This,pValue) + +#define ITextPara_SetSpaceAfter(This,Value) \ + (This)->lpVtbl -> SetSpaceAfter(This,Value) + +#define ITextPara_GetSpaceBefore(This,pValue) \ + (This)->lpVtbl -> GetSpaceBefore(This,pValue) + +#define ITextPara_SetSpaceBefore(This,Value) \ + (This)->lpVtbl -> SetSpaceBefore(This,Value) + +#define ITextPara_GetWidowControl(This,pValue) \ + (This)->lpVtbl -> GetWidowControl(This,pValue) + +#define ITextPara_SetWidowControl(This,Value) \ + (This)->lpVtbl -> SetWidowControl(This,Value) + +#define ITextPara_GetTabCount(This,pCount) \ + (This)->lpVtbl -> GetTabCount(This,pCount) + +#define ITextPara_AddTab(This,tbPos,tbAlign,tbLeader) \ + (This)->lpVtbl -> AddTab(This,tbPos,tbAlign,tbLeader) + +#define ITextPara_ClearAllTabs(This) \ + (This)->lpVtbl -> ClearAllTabs(This) + +#define ITextPara_DeleteTab(This,tbPos) \ + (This)->lpVtbl -> DeleteTab(This,tbPos) + +#define ITextPara_GetTab(This,iTab,ptbPos,ptbAlign,ptbLeader) \ + (This)->lpVtbl -> GetTab(This,iTab,ptbPos,ptbAlign,ptbLeader) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetDuplicate_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara); + + +void __RPC_STUB ITextPara_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetDuplicate_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + +void __RPC_STUB ITextPara_SetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_CanChange_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextPara_CanChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_IsEqual_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextPara_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_Reset_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetStyle_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetStyle_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetHyphenation_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetHyphenation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetHyphenation_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetHyphenation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetFirstLineIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetFirstLineIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetKeepTogether_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetKeepTogether_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetKeepTogether_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetKeepTogether_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetKeepWithNext_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetKeepWithNext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetKeepWithNext_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetKeepWithNext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLeftIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLeftIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLineSpacing_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLineSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLineSpacingRule_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLineSpacingRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListLevelIndex_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListLevelIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListLevelIndex_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListLevelIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListStart_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListStart_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListTab_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetListTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListType_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListType_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetNoLineNumber_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetNoLineNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetNoLineNumber_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetNoLineNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetPageBreakBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetPageBreakBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetPageBreakBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetPageBreakBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetRightIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetRightIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetRightIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetRightIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetIndents_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent); + + +void __RPC_STUB ITextPara_SetIndents_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetLineSpacing_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing); + + +void __RPC_STUB ITextPara_SetLineSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetSpaceAfter_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetSpaceAfter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetSpaceAfter_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetSpaceAfter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetSpaceBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetSpaceBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetSpaceBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetSpaceBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetWidowControl_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetWidowControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetWidowControl_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetWidowControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetTabCount_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextPara_GetTabCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_AddTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader); + + +void __RPC_STUB ITextPara_AddTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_ClearAllTabs_Proxy( + ITextPara __RPC_FAR * This); + + +void __RPC_STUB ITextPara_ClearAllTabs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_DeleteTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos); + + +void __RPC_STUB ITextPara_DeleteTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader); + + +void __RPC_STUB ITextPara_GetTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextPara_INTERFACE_DEFINED__ */ + + +#ifndef __ITextStoryRanges_INTERFACE_DEFINED__ +#define __ITextStoryRanges_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextStoryRanges + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextStoryRanges; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C5-A1DF-11ce-8098-00AA0047BE5D") + ITextStoryRanges : public IDispatch + { + public: + virtual /* [restricted][id] */ HRESULT STDMETHODCALLTYPE _NewEnum( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextStoryRangesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextStoryRanges __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextStoryRanges __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextStoryRanges __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [restricted][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *_NewEnum )( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Item )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCount )( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + END_INTERFACE + } ITextStoryRangesVtbl; + + interface ITextStoryRanges + { + CONST_VTBL struct ITextStoryRangesVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextStoryRanges_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextStoryRanges_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextStoryRanges_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextStoryRanges_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextStoryRanges_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextStoryRanges_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextStoryRanges_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextStoryRanges__NewEnum(This,ppunkEnum) \ + (This)->lpVtbl -> _NewEnum(This,ppunkEnum) + +#define ITextStoryRanges_Item(This,Index,ppRange) \ + (This)->lpVtbl -> Item(This,Index,ppRange) + +#define ITextStoryRanges_GetCount(This,pCount) \ + (This)->lpVtbl -> GetCount(This,pCount) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [restricted][id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges__NewEnum_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum); + + +void __RPC_STUB ITextStoryRanges__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges_Item_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextStoryRanges_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges_GetCount_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextStoryRanges_GetCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextStoryRanges_INTERFACE_DEFINED__ */ + + +#ifndef __ITextDocument2_INTERFACE_DEFINED__ +#define __ITextDocument2_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextDocument2 + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextDocument2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("01c25500-4268-11d1-883a-3c8b00c10000") + ITextDocument2 : public ITextDocument + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachMsgFilter( + /* [in] */ IUnknown __RPC_FAR *pFilter) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetEffectColor( + /* [in] */ long Index, + /* [in] */ COLORREF cr) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetEffectColor( + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetCaretType( + /* [retval][out] */ long __RPC_FAR *pCaretType) = 0; + + virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE SetCaretType( + /* [in] */ long CaretType) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetImmContext( + /* [retval][out] */ long __RPC_FAR *pContext) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ReleaseImmContext( + /* [in] */ long Context) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPreferredFont( + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetNotificationMode( + /* [retval][out] */ long __RPC_FAR *pMode) = 0; + + virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE SetNotificationMode( + /* [in] */ long Mode) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetClientRect( + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetSelectionEx( + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetWindow( + /* [out] */ long __RPC_FAR *phWnd) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetFEFlags( + /* [out] */ long __RPC_FAR *pFlags) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UpdateWindow( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CheckTextLimit( + long cch, + long __RPC_FAR *pcch) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IMEInProgress( + long Mode) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextDocument2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextDocument2 __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextDocument2 __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelection )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryCount )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryRanges )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSaved )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSaved )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDefaultTabStop )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultTabStop )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *New )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Unfreeze )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEditCollection )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndEditCollection )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Undo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Redo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Range )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RangeFromPoint )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachMsgFilter )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pFilter); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEffectColor )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [in] */ COLORREF cr); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEffectColor )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCaretType )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCaretType); + + /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetCaretType )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long CaretType); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetImmContext )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pContext); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ReleaseImmContext )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Context); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPreferredFont )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNotificationMode )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pMode); + + /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNotificationMode )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Mode); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetClientRect )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelectionEx )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWindow )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *phWnd); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFEFlags )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *pFlags); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UpdateWindow )( + ITextDocument2 __RPC_FAR * This); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CheckTextLimit )( + ITextDocument2 __RPC_FAR * This, + long cch, + long __RPC_FAR *pcch); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IMEInProgress )( + ITextDocument2 __RPC_FAR * This, + long Mode); + + END_INTERFACE + } ITextDocument2Vtbl; + + interface ITextDocument2 + { + CONST_VTBL struct ITextDocument2Vtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextDocument2_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextDocument2_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextDocument2_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextDocument2_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextDocument2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextDocument2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextDocument2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextDocument2_GetName(This,pName) \ + (This)->lpVtbl -> GetName(This,pName) + +#define ITextDocument2_GetSelection(This,ppSel) \ + (This)->lpVtbl -> GetSelection(This,ppSel) + +#define ITextDocument2_GetStoryCount(This,pCount) \ + (This)->lpVtbl -> GetStoryCount(This,pCount) + +#define ITextDocument2_GetStoryRanges(This,ppStories) \ + (This)->lpVtbl -> GetStoryRanges(This,ppStories) + +#define ITextDocument2_GetSaved(This,pValue) \ + (This)->lpVtbl -> GetSaved(This,pValue) + +#define ITextDocument2_SetSaved(This,Value) \ + (This)->lpVtbl -> SetSaved(This,Value) + +#define ITextDocument2_GetDefaultTabStop(This,pValue) \ + (This)->lpVtbl -> GetDefaultTabStop(This,pValue) + +#define ITextDocument2_SetDefaultTabStop(This,Value) \ + (This)->lpVtbl -> SetDefaultTabStop(This,Value) + +#define ITextDocument2_New(This) \ + (This)->lpVtbl -> New(This) + +#define ITextDocument2_Open(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Open(This,pVar,Flags,CodePage) + +#define ITextDocument2_Save(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Save(This,pVar,Flags,CodePage) + +#define ITextDocument2_Freeze(This,pCount) \ + (This)->lpVtbl -> Freeze(This,pCount) + +#define ITextDocument2_Unfreeze(This,pCount) \ + (This)->lpVtbl -> Unfreeze(This,pCount) + +#define ITextDocument2_BeginEditCollection(This) \ + (This)->lpVtbl -> BeginEditCollection(This) + +#define ITextDocument2_EndEditCollection(This) \ + (This)->lpVtbl -> EndEditCollection(This) + +#define ITextDocument2_Undo(This,Count,prop) \ + (This)->lpVtbl -> Undo(This,Count,prop) + +#define ITextDocument2_Redo(This,Count,prop) \ + (This)->lpVtbl -> Redo(This,Count,prop) + +#define ITextDocument2_Range(This,cp1,cp2,ppRange) \ + (This)->lpVtbl -> Range(This,cp1,cp2,ppRange) + +#define ITextDocument2_RangeFromPoint(This,x,y,ppRange) \ + (This)->lpVtbl -> RangeFromPoint(This,x,y,ppRange) + + +#define ITextDocument2_AttachMsgFilter(This,pFilter) \ + (This)->lpVtbl -> AttachMsgFilter(This,pFilter) + +#define ITextDocument2_SetEffectColor(This,Index,cr) \ + (This)->lpVtbl -> SetEffectColor(This,Index,cr) + +#define ITextDocument2_GetEffectColor(This,Index,pcr) \ + (This)->lpVtbl -> GetEffectColor(This,Index,pcr) + +#define ITextDocument2_GetCaretType(This,pCaretType) \ + (This)->lpVtbl -> GetCaretType(This,pCaretType) + +#define ITextDocument2_SetCaretType(This,CaretType) \ + (This)->lpVtbl -> SetCaretType(This,CaretType) + +#define ITextDocument2_GetImmContext(This,pContext) \ + (This)->lpVtbl -> GetImmContext(This,pContext) + +#define ITextDocument2_ReleaseImmContext(This,Context) \ + (This)->lpVtbl -> ReleaseImmContext(This,Context) + +#define ITextDocument2_GetPreferredFont(This,cp,CodePage,Option,pbstr,pPitchAndFamily) \ + (This)->lpVtbl -> GetPreferredFont(This,cp,CodePage,Option,pbstr,pPitchAndFamily) + +#define ITextDocument2_GetNotificationMode(This,pMode) \ + (This)->lpVtbl -> GetNotificationMode(This,pMode) + +#define ITextDocument2_SetNotificationMode(This,Mode) \ + (This)->lpVtbl -> SetNotificationMode(This,Mode) + +#define ITextDocument2_GetClientRect(This,Type,pLeft,pTop,pRight,pBottom) \ + (This)->lpVtbl -> GetClientRect(This,Type,pLeft,pTop,pRight,pBottom) + +#define ITextDocument2_GetSelectionEx(This,ppSel) \ + (This)->lpVtbl -> GetSelectionEx(This,ppSel) + +#define ITextDocument2_GetWindow(This,phWnd) \ + (This)->lpVtbl -> GetWindow(This,phWnd) + +#define ITextDocument2_GetFEFlags(This,pFlags) \ + (This)->lpVtbl -> GetFEFlags(This,pFlags) + +#define ITextDocument2_UpdateWindow(This) \ + (This)->lpVtbl -> UpdateWindow(This) + +#define ITextDocument2_CheckTextLimit(This,cch,pcch) \ + (This)->lpVtbl -> CheckTextLimit(This,cch,pcch) + +#define ITextDocument2_IMEInProgress(This,Mode) \ + (This)->lpVtbl -> IMEInProgress(This,Mode) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_AttachMsgFilter_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pFilter); + + +void __RPC_STUB ITextDocument2_AttachMsgFilter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetEffectColor_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [in] */ COLORREF cr); + + +void __RPC_STUB ITextDocument2_SetEffectColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetEffectColor_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr); + + +void __RPC_STUB ITextDocument2_GetEffectColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetCaretType_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCaretType); + + +void __RPC_STUB ITextDocument2_GetCaretType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetCaretType_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long CaretType); + + +void __RPC_STUB ITextDocument2_SetCaretType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetImmContext_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pContext); + + +void __RPC_STUB ITextDocument2_GetImmContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_ReleaseImmContext_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Context); + + +void __RPC_STUB ITextDocument2_ReleaseImmContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetPreferredFont_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily); + + +void __RPC_STUB ITextDocument2_GetPreferredFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetNotificationMode_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pMode); + + +void __RPC_STUB ITextDocument2_GetNotificationMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetNotificationMode_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Mode); + + +void __RPC_STUB ITextDocument2_SetNotificationMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetClientRect_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom); + + +void __RPC_STUB ITextDocument2_GetClientRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetSelectionEx_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + +void __RPC_STUB ITextDocument2_GetSelectionEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetWindow_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *phWnd); + + +void __RPC_STUB ITextDocument2_GetWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetFEFlags_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *pFlags); + + +void __RPC_STUB ITextDocument2_GetFEFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_UpdateWindow_Proxy( + ITextDocument2 __RPC_FAR * This); + + +void __RPC_STUB ITextDocument2_UpdateWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_CheckTextLimit_Proxy( + ITextDocument2 __RPC_FAR * This, + long cch, + long __RPC_FAR *pcch); + + +void __RPC_STUB ITextDocument2_CheckTextLimit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_IMEInProgress_Proxy( + ITextDocument2 __RPC_FAR * This, + long Mode); + + +void __RPC_STUB ITextDocument2_IMEInProgress_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextDocument2_INTERFACE_DEFINED__ */ + + +#ifndef __ITextMsgFilter_INTERFACE_DEFINED__ +#define __ITextMsgFilter_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextMsgFilter + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][version][uuid] */ + + + +EXTERN_C const IID IID_ITextMsgFilter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("a3787420-4267-11d1-883a-3c8b00c10000") + ITextMsgFilter : public IUnknown + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachDocument( + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE HandleMessage( + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachMsgFilter( + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextMsgFilterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextMsgFilter __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextMsgFilter __RPC_FAR * This); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachDocument )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HandleMessage )( + ITextMsgFilter __RPC_FAR * This, + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachMsgFilter )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter); + + END_INTERFACE + } ITextMsgFilterVtbl; + + interface ITextMsgFilter + { + CONST_VTBL struct ITextMsgFilterVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextMsgFilter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextMsgFilter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextMsgFilter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextMsgFilter_AttachDocument(This,hwnd,pTextDoc) \ + (This)->lpVtbl -> AttachDocument(This,hwnd,pTextDoc) + +#define ITextMsgFilter_HandleMessage(This,pmsg,pwparam,plparam,plres) \ + (This)->lpVtbl -> HandleMessage(This,pmsg,pwparam,plparam,plres) + +#define ITextMsgFilter_AttachMsgFilter(This,pMsgFilter) \ + (This)->lpVtbl -> AttachMsgFilter(This,pMsgFilter) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_AttachDocument_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc); + + +void __RPC_STUB ITextMsgFilter_AttachDocument_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_HandleMessage_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres); + + +void __RPC_STUB ITextMsgFilter_HandleMessage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_AttachMsgFilter_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter); + + +void __RPC_STUB ITextMsgFilter_AttachMsgFilter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextMsgFilter_INTERFACE_DEFINED__ */ + +#endif /* __tom_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * ); + +unsigned long __RPC_USER HWND_UserSize( unsigned long __RPC_FAR *, unsigned long , HWND __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER HWND_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, HWND __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER HWND_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, HWND __RPC_FAR * ); +void __RPC_USER HWND_UserFree( unsigned long __RPC_FAR *, HWND __RPC_FAR * ); + +unsigned long __RPC_USER VARIANT_UserSize( unsigned long __RPC_FAR *, unsigned long , VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +void __RPC_USER VARIANT_UserFree( unsigned long __RPC_FAR *, VARIANT __RPC_FAR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/toolbar1.bmp b/mp/src/utils/sapi51/Samples/CPP/DictPad/toolbar1.bmp new file mode 100644 index 00000000..e0c9f2fa Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/DictPad/toolbar1.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/DictPad/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/DictPad/version.rc2 new file mode 100644 index 00000000..616e5b8b --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/DictPad/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Dictation Pad Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "DICTPAD\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "dictpad.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/resource.h b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/resource.h new file mode 100644 index 00000000..65cbe51a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/resource.h @@ -0,0 +1,20 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by sreng.rc +// +#define IDS_PROJNAME 100 +#define IDR_SRENG 101 +#define IDR_SRENGUI 102 +#define IDR_SRENGEXT 103 +#define IDR_SRENGALT 104 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.cpp new file mode 100644 index 00000000..f15ba6f2 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.cpp @@ -0,0 +1,90 @@ +// srengdll.cpp : Implementation of DLL Exports. +//Copyright (c) Microsoft Corporation. All rights reserved. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, + +#include "stdafx.h" +#include "resource.h" +#include +#include "sreng.h" + +#include "sreng_i.c" +#include "sreng.h" +#include "srengobj.h" +#include "srengui.h" +#include "srengext.h" +#include "srengalt.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_SampleSREngine, CSrEngine) +OBJECT_ENTRY(CLSID_SampleSREngineUI, CSrEngineUI) +OBJECT_ENTRY(CLSID_SampleSRExtension, CSampleSRExtension) +OBJECT_ENTRY(CLSID_SampleSREngineAlternates, CSrEngineAlternates) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point +#ifdef _WIN32_WCE +extern "C" +BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_SRENGLib); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} +#else +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_SRENGLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} +#endif +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.def b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.def new file mode 100644 index 00000000..62a027fd --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.def @@ -0,0 +1,9 @@ +; sreng.def : Declares the module parameters. + +LIBRARY "sreng.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.dsp b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.dsp new file mode 100644 index 00000000..803baaab --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.dsp @@ -0,0 +1,207 @@ +# Microsoft Developer Studio Project File - Name="sreng" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=sreng - Win32 Release x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sreng.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sreng.mak" CFG="sreng - Win32 Release x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sreng - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "sreng - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "sreng - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sreng___Win32_Debug_x86" +# PROP BASE Intermediate_Dir "sreng___Win32_Debug_x86" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\sdk\include" /I "..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\sdk\include" /I "..\..\ddk\include" /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\sdk\lib\i386" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Debug_x86 +TargetPath=.\Debug_x86\sreng.dll +InputPath=.\Debug_x86\sreng.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "sreng - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sreng___Win32_Release_x86" +# PROP BASE Intermediate_Dir "sreng___Win32_Release_x86" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\sdk\include" /I "..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\sdk\lib\i386" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Release_x86 +TargetPath=.\Release_x86\sreng.dll +InputPath=.\Release_x86\sreng.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "sreng - Win32 Debug x86" +# Name "sreng - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\sreng.cpp +# End Source File +# Begin Source File + +SOURCE=.\sreng.def +# End Source File +# Begin Source File + +SOURCE=.\sreng.idl +# ADD BASE MTL /I "..\..\sdk\idl" /tlb ".\sreng.tlb" /h "sreng.h" /iid "sreng_i.c" /Oicf +# ADD MTL /I "..\..\..\..\idl" /I "..\..\..\..\..\ddk\idl" /tlb ".\sreng.tlb" /h "sreng.h" /iid "sreng_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\sreng.rc +# End Source File +# Begin Source File + +SOURCE=.\srengalt.cpp +# End Source File +# Begin Source File + +SOURCE=.\srengext.cpp +# End Source File +# Begin Source File + +SOURCE=.\srengobj.cpp +# End Source File +# Begin Source File + +SOURCE=.\srengui.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\sreng.h +# End Source File +# Begin Source File + +SOURCE=.\srengalt.h +# End Source File +# Begin Source File + +SOURCE=.\srengext.h +# End Source File +# Begin Source File + +SOURCE=.\srengobj.h +# End Source File +# Begin Source File + +SOURCE=.\srengui.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\sreng.rgs +# End Source File +# Begin Source File + +SOURCE=.\srengalt.rgs +# End Source File +# Begin Source File + +SOURCE=.\srengext.rgs +# End Source File +# Begin Source File + +SOURCE=.\srengui.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.idl b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.idl new file mode 100644 index 00000000..38c872e1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.idl @@ -0,0 +1,64 @@ +// srengdll.idl : IDL source for sreng.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (sreng.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; +import "sapiddk.idl"; + +[ + object, + uuid(BBC18F3B-CF35-4f7c-99E8-D1F803AB4851), + helpstring("ISampleSRExtension Interface"), + pointer_default(unique) +] +interface ISampleSRExtension : IUnknown +{ + HRESULT ExamplePrivateEngineCall(void); +}; + +[ + uuid(41B89B6C-9399-11D2-9623-00C04F8EE628), + version(1.0), + helpstring("sreng 1.0 Type Library") +] +library SRENGLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(41B89B79-9399-11D2-9623-00C04F8EE628), + helpstring("Sample SR Engine Class") + ] + coclass SampleSREngine + { + [default] interface ISpSREngine; + }; + [ + uuid(B84714C0-3BFD-405D-83C5-E9C486826AD5), + helpstring("Sample SR Engine UI Class") + ] + coclass SampleSREngineUI + { + [default] interface ISpTokenUI; + }; + [ + uuid(78771A48-CE55-46a5-B78C-B813E3403F82), + helpstring("Sample SR Engine Extension Class") + ] + coclass SampleSRExtension + { + [default] interface ISampleSRExtension; + }; + [ + uuid(882CAE4A-99BA-490b-BF80-CF69A60454A7), + helpstring("Sample SR Engine Alternates Class") + ] + coclass SampleSREngineAlternates + { + [default] interface ISpSRAlternates; + }; +}; diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rc b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rc new file mode 100644 index 00000000..64c7c6de --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rc @@ -0,0 +1,90 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""sreng.tlb""\r\n" + "#include ""version.rc2""\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_SRENG REGISTRY DISCARDABLE "sreng.rgs" +IDR_SRENGUI REGISTRY DISCARDABLE "srengui.rgs" +IDR_SRENGEXT REGISTRY DISCARDABLE "srengext.rgs" +IDR_SRENGALT REGISTRY DISCARDABLE "srengalt.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "sreng" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "sreng.tlb" +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rgs b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rgs new file mode 100644 index 00000000..31a9c20f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rgs @@ -0,0 +1,101 @@ +HKCR +{ + SampleSREngine.SampleSREngine.1 = s 'Sample SR Engine Class' + { + CLSID = s '{41B89B79-9399-11D2-9623-00C04F8EE628}' + } + SampleSREngine.SampleSREngine = s 'Sample SR Engine Class' + { + CLSID = s '{41B89B79-9399-11D2-9623-00C04F8EE628}' + CurVer = s 'SampleSREngine.SampleSREngine.1' + } + NoRemove CLSID + { + ForceRemove {41B89B79-9399-11D2-9623-00C04F8EE628} = s 'Sample SR Engine Class' + { + ProgID = s 'SampleSREngine.SampleSREngine.1' + VersionIndependentProgID = s 'SampleSREngine.SampleSREngine' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{41B89B6C-9399-11D2-9623-00C04F8EE628}' + } + } +} + +HKLM +{ + NoRemove SOFTWARE + { + NoRemove Microsoft + { + NoRemove Speech + { + NoRemove Recognizers + { + NoRemove Tokens + { + ForceRemove SAPI5SampleEngine = s 'SAPI Developer Sample Engine' + { + val CLSID = s '{41B89B79-9399-11D2-9623-00C04F8EE628}' + val RecoExtension = s '{78771A48-CE55-46A5-B78C-B813E3403F82}' + val AlternatesCLSID = s '{882CAE4A-99BA-490B-BF80-CF69A60454A7}' + val 409 = s 'SAPI Developer Sample Engine' + + ForceRemove {41B89B79-9399-11D2-9623-00C04F8EE628} + { + ForceRemove Files + { + val SampleEngDataFile = s 'C:\An_example_file_path' + } + } + ForceRemove Attributes + { + val Vendor = s 'Microsoft' + val Language = s '409;9' + val CommandAndControl = s '' + val Dictation = s '' + val Desktop = s '' + val Hypotheses = s '' + val Alternates = s 'CC;Dictation' + val DictationInCFG = s 'Anywhere;Trailing' + val WildcardInCFG = s 'Anywhere;Trailing' + val WordSequences = s '' + val SpeakingStyle = s 'Discrete;Continuous' + } + ForceRemove UI = s '' + { + ForceRemove EngineProperties = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + + ForceRemove UserTraining = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + + ForceRemove MicTraining = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + + ForceRemove AddRemoveWord = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + + ForceRemove RecoProfileProperties = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.cpp new file mode 100644 index 00000000..83ea4a4b --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.cpp @@ -0,0 +1,137 @@ +/****************************************************************************** +* srengalt.h +* This file contains the implementation of the CSrEngineAlternates class. +* This implements the interface ISpSRAlternates. +* When an app calls GetAlternates or Commit on a result, SAPI will +* look for the AlternatesCLSID field in the engine object token, and +* create this object. +* It will then call the methods here, passing the relevant results information. +* This includes any serialized data the main engine has returned with +* the results to allow alternates to be generated off-line. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "srengalt.h" + +/**************************************************************************** +* CSrEngineAlternates::GetAlternates * +*---------------------------* +* Description: +* This method generates alternate phrases when SAPI requests them. +* The method reads the extra information returned from the SR engine +* inside the results object. This gets returned +* as alternates phrases to SAPI. In addition this method can find a private interface to engine +* from the context and query the engine for additional result information. +* +* The engine must have returned info serialised within the results object +* allowing us to produce alternatives. This is the case in the sample engine. +* +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngineAlternates::GetAlternates(SPPHRASEALTREQUEST *pAltRequest, + SPPHRASEALT **ppAlts, ULONG *pcAlts) +{ + HRESULT hr = S_OK; + + // We will just produce one alternate + // This will replace the words in the original phrase on a one-to-one basis + // Real alternates may have different numbers of words to original, + // and replace only parts of the original. + *pcAlts = 1; + *ppAlts = (SPPHRASEALT *)::CoTaskMemAlloc(sizeof(SPPHRASEALT)); + (*ppAlts)[0].ulStartElementInParent = pAltRequest->ulStartElement; + (*ppAlts)[0].cElementsInParent = pAltRequest->cElements; + (*ppAlts)[0].cElementsInAlternate = pAltRequest->cElements; + (*ppAlts)[0].pvAltExtra = NULL; + (*ppAlts)[0].cbAltExtra = 0; + + // Create and fill an SPPHRASE structure + SPPHRASE phrase; + memset(&phrase, 0, sizeof(phrase)); + phrase.cbSize = sizeof(phrase); + // An alternates analyzer should really query its SR engine to find it's lang id. + // For the sample engine we will just hard-code this + phrase.LangID = 1033; + + WCHAR *pAlts = (WCHAR *) pAltRequest->pvResultExtra; + ULONG nAltChars = pAltRequest->cbResultExtra / sizeof(WCHAR); + ULONG nWord = 0; + + // Count words in alternate data + for(ULONG i = 0; i < nAltChars; i++) + { + if(iswspace(pAlts[i]) || pAlts[i] == '\0') + { + nWord++; + } + } + + // Allocate elements + SPPHRASEELEMENT* pElements = (SPPHRASEELEMENT*)_alloca(sizeof(SPPHRASEELEMENT) * nWord); + memset(pElements, 0, sizeof(SPPHRASEELEMENT)*nWord); + + // Add words in alternate to elements + ULONG cW = 0; + nWord = 0; + for(i = 0; i < nAltChars; i++) + { + if(iswspace(pAlts[i]) || pAlts[i] == '\0') + { + pElements[nWord].bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + WCHAR *pszWord = (WCHAR *)_alloca(sizeof(WCHAR) * (i- cW)); + wcsncpy(pszWord, &pAlts[cW], i - cW); + pszWord[i - cW] = '\0'; + pElements[nWord].pszDisplayText = pszWord; + + cW = i + 1; + nWord++; + } + } + + // Add elements to phrase + phrase.Rule.ulCountOfElements = nWord; + phrase.pElements = pElements; + + // Make phrase builder and add phrase info + CComPtr cpBuilder; + hr = cpBuilder.CoCreateInstance(CLSID_SpPhraseBuilder); + if(SUCCEEDED(hr)) + { + hr = cpBuilder->InitFromPhrase(&phrase); + } + if(SUCCEEDED(hr)) + { + (*ppAlts)[0].pPhrase = cpBuilder; + (*ppAlts)[0].pPhrase->AddRef(); + } + + // Alternates class can also query enginethrough private interface + CComPtr m_cpExt; + hr = pAltRequest->pRecoContext->QueryInterface(&m_cpExt); + if(SUCCEEDED(hr)) + { + hr = m_cpExt->ExamplePrivateEngineCall(); + } + return hr; +} + +/**************************************************************************** +* CSrEngineAlternates::Commit * +*---------------------------* +* Description: +* Here the engine could use the information from the application +* about which was the correct alternate in order to do supervised +* adaptation. +* In this sample we do nothing here. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngineAlternates::Commit(SPPHRASEALTREQUEST *pAltRequest, + SPPHRASEALT *pAlt, void **ppvResultExtra, ULONG *pcbResultExtra) +{ + return S_OK; +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.h b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.h new file mode 100644 index 00000000..fde94385 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.h @@ -0,0 +1,48 @@ +/****************************************************************************** +* srengalt.h +* This file contains the declaration of the CSrEngineAlternates class. +* This implements the interface ISpSRAlternates. +* When an app calls GetAlternates or Commit on a result, SAPI will +* look for the AlternatesCLSID field in the engine object token, and +* create this object. +* It will then call the methods here, passing the relevant results information. +* This includes any serialized data the main engine has returned with +* the results to allow alternates to be generated off-line. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#pragma once + +#include "stdafx.h" +#include "sreng.h" +#include "resource.h" + +class ATL_NO_VTABLE CSrEngineAlternates : + public CComObjectRootEx, + public CComCoClass, + public ISpSRAlternates +{ +public: + + DECLARE_REGISTRY_RESOURCEID(IDR_SRENGALT) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CSrEngineAlternates) + COM_INTERFACE_ENTRY(ISpSRAlternates) + END_COM_MAP() + +public: + + STDMETHODIMP GetAlternates( + SPPHRASEALTREQUEST *pAltRequest, + SPPHRASEALT **ppAlts, + ULONG *pcAlts); + + STDMETHODIMP Commit( + SPPHRASEALTREQUEST *pAltRequest, + SPPHRASEALT *pAlt, + void **ppvResultExtra, + ULONG *pcbResultExtra); +}; diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.rgs b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.rgs new file mode 100644 index 00000000..1ba6165a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SampleSREngineAlternates.SampleSREngineAlternates.1 = s 'Sample SR Engine Alternates Class' + { + CLSID = s '{882CAE4A-99BA-490b-BF80-CF69A60454A7}' + } + SampleSREngineAlternates.SampleSREngineAlternates = s 'Sample SR Engine Alternates Class' + { + CLSID = s '{882CAE4A-99BA-490B-BF80-CF69A60454A7}' + CurVer = s 'SampleSREngineAlternates.SampleSREngineAlternates.1' + } + NoRemove CLSID + { + ForceRemove {882CAE4A-99BA-490B-BF80-CF69A60454A7} = s 'SampleSrEngineAlternates Class' + { + ProgID = s 'SampleSREngineAlternates.SampleSREngineAlternates.1' + VersionIndependentProgID = s 'SampleSREngineAlternates.SampleSREngineAlternates' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{41B89B6C-9399-11D2-9623-00C04F8EE628}' + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.cpp new file mode 100644 index 00000000..cc00bdd1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.cpp @@ -0,0 +1,31 @@ +/****************************************************************************** +* srengext.cpp +* This file contains the implementation of the CSampleSRExtension class. +* This implements the custom interface ISampleSRExtension. +* When an app QI's for this from the reco context, SAPI will +* look for the ExtensionCLSID field in the engine object token, and +* create this object and then QI for the requested interface. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "srengext.h" + +/**************************************************************************** +* CSampleSRExtension::ExamplePrivateEngineCall * +*----------------------------------------------* +* Description: +* This method shows an example of calling back to the main engine object. +* When CallEngine is called, the data supplied will get passed by SAPI +* to the ISpSREngine::PrivateCall method in CSrEngine. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSampleSRExtension::ExamplePrivateEngineCall(void) +{ + // We can use this method to pass data to and from the actual engine class, via the context + static BYTE Data[4] = { 1, 2, 3, 4 }; + return m_pEngineCall->CallEngine( (void*)Data, sp_countof(Data) ); +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.h b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.h new file mode 100644 index 00000000..1e0d4e61 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.h @@ -0,0 +1,56 @@ +/****************************************************************************** +* srengext.h +* This file contains the declaration of the CSampleSRExtension class. +* This implements the custom interface ISampleSRExtension. +* When an app QI's for this from the reco context, SAPI will +* look for the ExtensionCLSID field in the engine object token, and +* create this object and then QI for the requested interface. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#pragma once + +#include "stdafx.h" +#include "sreng.h" +#include "resource.h" + +class ATL_NO_VTABLE CSampleSRExtension : +public CComObjectRootEx, +public CComCoClass, +public ISampleSRExtension +{ +public: + +DECLARE_REGISTRY_RESOURCEID(IDR_SRENGEXT) +DECLARE_GET_CONTROLLING_UNKNOWN() +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CSampleSRExtension) + COM_INTERFACE_ENTRY(ISampleSRExtension) +END_COM_MAP() + + HRESULT FinalConstruct() + { + // We can query back to SAPI to find both the reco context, and, + // an IID__ISpPrivateEngineCall interface which can be used to call + // back to the main engine object. + HRESULT hr; + hr = OuterQueryInterface(IID__ISpPrivateEngineCall, (void **)&m_pEngineCall); + if(SUCCEEDED(hr)) + { + hr = OuterQueryInterface(IID_ISpRecoContext, (void **)&m_pRecoCtxt); + if (SUCCEEDED(hr)) + { + GetControllingUnknown()->Release(); + } + } + return hr; + } + + STDMETHODIMP ExamplePrivateEngineCall(void); // Just a test method + +private: + _ISpPrivateEngineCall *m_pEngineCall; + ISpRecoContext *m_pRecoCtxt; +}; diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.rgs b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.rgs new file mode 100644 index 00000000..cdc84c66 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SampleSrEngineExt.SampleSrEngineExt.1 = s 'Sample SR Engine Extension Class' + { + CLSID = s '{78771A48-CE55-46A5-B78C-B813E3403F82}' + } + SampleSrEngineExt.SampleSrEngineExt = s 'Sample SR Engine Extension Class' + { + CLSID = s '{78771A48-CE55-46A5-B78C-B813E3403F82}' + CurVer = s 'SampleSrEngineExt.SampleSrEngineExt.1' + } + NoRemove CLSID + { + ForceRemove {78771A48-CE55-46A5-B78C-B813E3403F82} = s 'SampleSrEngineExt Class' + { + ProgID = s 'SampleSrEngineExt.SampleSrEngineExt.1' + VersionIndependentProgID = s 'SampleSrEngineExt.SampleSrEngineExt' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{41B89B6C-9399-11D2-9623-00C04F8EE628}' + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.cpp new file mode 100644 index 00000000..2e2c374d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.cpp @@ -0,0 +1,1944 @@ +/****************************************************************************** +* srengobj.cpp +* This file contains the implementation of the CSrEngine class. +* This implements ISpSREngine and ISpObjectWithToken. +* This is the main recognition object +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sreng.h" +#include "srengobj.h" +#include "SpHelper.h" +#ifndef _WIN32_WCE +#include "shfolder.h" +#endif + +static const WCHAR DICT_WORD[] = L"Blah"; // This is the default word the sample engine uses for dictation +static const WCHAR ALT_WORD[] = L"Alt"; // This is the default word used for alternates + +/**************************************************************************** +* CSrEngine::FinalConstruct * +*---------------------------* +* Description: +* The ATL FinalConstruct method. Called after the standard C++ constructor +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::FinalConstruct() +{ + SPDBG_FUNC("Sample Engine - FINALCONSTRUCT"); + HRESULT hr = S_OK; + + // This event is used to indicate when space is available for data to be given to the recognition thread + m_hQueueHasRoom = ::CreateEvent(NULL, TRUE, TRUE, NULL); + m_FrameQueue.SetSpaceAvailEvent(m_hQueueHasRoom); + + // Create a thread control which will be used for the recognition thread + CComPtr cpTaskMgr; + hr = cpTaskMgr.CoCreateInstance(CLSID_SpResourceManager); + if (SUCCEEDED(hr)) + { + hr = cpTaskMgr->CreateThreadControl(this, this, THREAD_PRIORITY_NORMAL, &m_cpDecoderThread); + } + + if(SUCCEEDED(hr)) + { + // Create the SAPI lexicon which holds user and app pronounciations + hr = m_cpLexicon.CoCreateInstance(CLSID_SpLexicon); + } + return hr; +} + + +/**************************************************************************** +* CSrEngine::FinalRelease * +*---------------------------* +* Description: +* The ATL FinalRelease method. Clean up any resources not automatically destructed. +* Return: +* S_OK +*****************************************************************************/ +HRESULT CSrEngine::FinalRelease() +{ + SPDBG_FUNC("Sample Engine - FINALRELEASE"); + ::CloseHandle(m_hQueueHasRoom); + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetObjectToken * +*---------------------------* +* Description: +* This method is called by SAPI immediately after the engine is created. +* It can be used to get registry information specific to this engine. +* The engine can recover from the token file paths stored there during installation. +* The engine also can recover user set defaults for accuracy, rejection etc. +* Also could have different engines sharing the same code base (CLSID) but having different registry info +* e.g. if engine supports different languages +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetObjectToken(ISpObjectToken * pToken) +{ + SPDBG_FUNC("Sample Engine - SETOBJECTTOKEN"); + HRESULT hr = S_OK; + + // Helper function that copies the token reference. + hr = SpGenericSetObjectToken(pToken, m_cpEngineObjectToken); + if(FAILED(hr)) + { + return hr; + } + + // Read attribute information from the token in the registry + CComPtr cpAttribKey; + hr = pToken->OpenKey(L"Attributes", &cpAttribKey); + + if(SUCCEEDED(hr)) + { + WCHAR *psz = NULL; + hr = cpAttribKey->GetStringValue(L"Desktop", &psz); + ::CoTaskMemFree(psz); + if(SUCCEEDED(hr)) + { + // This instance of the engine is for doing desktop recognition + } + else if(hr == SPERR_NOT_FOUND) + { + hr = cpAttribKey->GetStringValue(L"Telephony", &psz); + ::CoTaskMemFree(psz); + if(SUCCEEDED(hr)) + { + // This instance of the engine is for doing telephony recognition + } + } + } + + // Read what language is set in the registry + if(SUCCEEDED(hr)) + { + WCHAR *pszLangID = NULL; + hr = cpAttribKey->GetStringValue(L"Language", &pszLangID); + if(SUCCEEDED(hr)) + { + // We could use this language id in recognition. + } + else if(hr == SPERR_NOT_FOUND) + { + pszLangID = L"409"; // Default language (US English) + hr = S_OK; + } + m_LangID = (unsigned short)wcstol(pszLangID, NULL, 16); + ::CoTaskMemFree(pszLangID); + } + + // Read data-file location + WCHAR *pszPath = NULL; + + // Looks for the file path stored in the registry + hr = pToken->GetStorageFileName(CLSID_SampleSREngine, L"SampleEngDataFile", NULL, 0, &pszPath); + // Could now load engine data-files from this given path + + ::CoTaskMemFree(pszPath); + + return hr; +} + +/**************************************************************************** +* CSrEngine::GetObjectToken * +*---------------------------* +* Description: +* This method is called if SAPI wants to find which object token this engine is using +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::GetObjectToken(ISpObjectToken ** ppToken) +{ + SPDBG_FUNC("Sample Engine - GETOBJECTTOKEN"); + // Generic helper function + return SpGenericGetObjectToken(ppToken, m_cpEngineObjectToken); +} + + +/**************************************************************************** +* CSrEngine::SetSite * +*---------------------------* +* Description: +* This is called to give the engine a reference to the ISpSREngineSite. +* The engine uses this to call back to SAPI. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetSite(ISpSREngineSite *pSite) +{ + m_cpSite = pSite; + return S_OK; +} + + +/**************************************************************************** +* CSrEngine::SetRecoProfile * +*---------------------------* +* Description: +* The RecoProfile is an object token holding information on the current +* user and enrollment session. The engine can store whatever information here +* it likes. It should store this in a key under the RecoProfile key named with the engine class id. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetRecoProfile(ISpObjectToken *pProfile) +{ + SPDBG_FUNC("Sample Engine - SETRECOPROFILE"); + + // First find if our engine already has info in this profile + HRESULT hr = S_OK; + WCHAR *pszCLSID, *pszPath = NULL; + CComPtr dataKey; + + m_cpUserObjectToken = pProfile; + + hr = ::StringFromCLSID(CLSID_SampleSREngine, &pszCLSID); + if(FAILED(hr)) + { + return hr; + } + + hr = pProfile->OpenKey(pszCLSID, &dataKey); + if(hr == SPERR_NOT_FOUND) + { + // We haven't seen this user profile before, so create a new registry key to hold info for it + hr = pProfile->CreateKey(pszCLSID, &dataKey); + + // Now we can set some default values + if(SUCCEEDED(hr)) + { + hr = dataKey->SetStringValue(L"GENDER", L"UNKNOWN"); + } + if(SUCCEEDED(hr)) + { + hr = dataKey->SetStringValue(L"AGE", L"UNKNOWN"); + } + + // Now we can create some temporary file storage (e.g. for trained models) + if(SUCCEEDED(hr)) + { + hr = pProfile->GetStorageFileName(CLSID_SampleSREngine, L"SampleEngTrainingFile", NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, &pszPath); + } + + // Now we request a UI for user training (or properties - SPDUI_RecoProfileProperties) + // The engine cannot directly create UI it must request it. + hr = AddEventString(SPEI_REQUEST_UI, 0, SPDUI_UserTraining); + + } + else if(SUCCEEDED(hr)) + { + // We've already seen this profile so read values + WCHAR *pszGender = NULL, *pszAge = NULL; + hr = dataKey->GetStringValue(L"GENDER", &pszGender); + if(SUCCEEDED(hr)) + { + hr = dataKey->GetStringValue(L"AGE", &pszAge); + } + + // Now we could read training file + if(SUCCEEDED(hr)) + { + hr = pProfile->GetStorageFileName(CLSID_SampleSREngine, L"SampleEngTrainingFile", NULL, 0, &pszPath); + } + + ::CoTaskMemFree(pszGender); + ::CoTaskMemFree(pszAge); + } + + ::CoTaskMemFree(pszPath); + ::CoTaskMemFree(pszCLSID); + return hr; +} + + +/**************************************************************************** +* CSrEngine::OnCreateRecoContext * +*---------------------------* +* Description: +* This method is called each time a new reco context is created in +* an application using this engine. +* This sample engine does not strictly need info about reco contexts +* but for reference we will a keep list of them. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::OnCreateRecoContext(SPRECOCONTEXTHANDLE hSapiContext, void ** ppvDrvCtxt) +{ + SPDBG_FUNC("Sample Engine - CREATERECOCONTEXT"); + + CContext * pContext = new CContext(hSapiContext); + + // Store a reference to the CContext structure + *ppvDrvCtxt = pContext; + m_ContextList.InsertHead(pContext); + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::OnDeleteRecoContext * +*---------------------------* +* Description: +* This method is called each time a reco context is deleted. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::OnDeleteRecoContext(void * pvDrvCtxt) +{ + SPDBG_FUNC("Sample Engine - DELETERECOCONTEXT"); + + CContext * pContext = (CContext *) pvDrvCtxt; + m_ContextList.Remove(pContext); + delete pContext; + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::OnCreateGrammar * +*---------------------------* +* Description: +* This method is called each time a new reco grammar is created in +* an application using this engine. +* We keep a list of grammars - storing a pointer to the list entry in ppvEngineGrammar. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::OnCreateGrammar(void * pvEngineRecoContext, SPGRAMMARHANDLE hSapiGrammar, void ** ppvEngineGrammar) +{ + SPDBG_FUNC("Sample Engine - ONCREATEGRAMMAR"); + + // Each grammar will be associated with a context + CContext * pContext = (CContext *) pvEngineRecoContext; + SPDBG_ASSERT(m_ContextList.Find(pContext->m_hSapiContext)); + + // Keep a list of grammars + CDrvGrammar * pGrammar = new CDrvGrammar(hSapiGrammar); + // Store a reference to the CDrvGrammar structure + *ppvEngineGrammar = pGrammar; + m_GrammarList.InsertHead(pGrammar); + + return S_OK; +} + + +/**************************************************************************** +* CSrEngine::OnDeleteGrammar * +*---------------------------* +* Description: +* This method is called each time a reco grammar is deleted. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::OnDeleteGrammar(void * pvDrvGrammar) +{ + SPDBG_FUNC("Sample Engine - ONDELETEGRAMMAR"); + + CDrvGrammar * pGrammar = (CDrvGrammar *)pvDrvGrammar; + m_GrammarList.Remove(pGrammar); + delete pGrammar; + + return S_OK; +} + + +/**************************************************************************** +* CSrEngine::WordNotify * +*---------------------------* +* Description: +* This method is called by SAPI to inform the engine of the words in +* command & control (C&C) grammars. When words are added or removed (e.g. by +* the application loading or unloading grammars) this method is called. +* Here we examine the word text, see if it has an associated pronunciation, +* and see if there is a pronunciation in the lexicon. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::WordNotify(SPCFGNOTIFY Action, ULONG cWords, const SPWORDENTRY * pWords) +{ + SPDBG_FUNC("Sample Engine - WORDNOTIFY"); + HRESULT hr = S_OK; + ULONG i; + WCHAR *wordPron; + + switch(Action){ + case SPCFGN_ADD: + SPWORDENTRY WordEntry; + for(i = 0; SUCCEEDED(hr) && i < cWords; i++) + { + WordEntry = pWords[i]; + hr = m_cpSite->GetWordInfo(&WordEntry, SPWIO_WANT_TEXT); + if(SUCCEEDED(hr) && WordEntry.aPhoneId) + { + // Word entry contains a specific pronounciation from CFG + // Engine should use this in recognition + wordPron = new WCHAR[wcslen(WordEntry.aPhoneId)]; + wcscpy(wordPron, WordEntry.aPhoneId); + ::CoTaskMemFree((void*)WordEntry.aPhoneId); + } + else + { + // See if word is in lexicon + SPWORDPRONUNCIATIONLIST PronList; + PronList.pFirstWordPronunciation = 0; + PronList.pvBuffer = 0; + PronList.ulSize = 0; + hr = m_cpLexicon->GetPronunciations(WordEntry.pszLexicalForm, eLEXTYPE_APP | eLEXTYPE_USER, pWords[i].LangID, &PronList); + if(SUCCEEDED(hr)) + { + // Pronounciation(s) found in SAPI lexicon + // Engines should use these prons in recognition and also language and POS info + // For sample just copy first pron + wordPron = new WCHAR[wcslen(PronList.pFirstWordPronunciation->szPronunciation)]; + wcscpy(wordPron, PronList.pFirstWordPronunciation->szPronunciation); + ::CoTaskMemFree(PronList.pvBuffer); + } + else if(hr == SPERR_NOT_IN_LEX) + { + // No pronunciation present in SAPI lexicon. + // Engine should generate its own pronounciation or fail + // Here we generate a default NULL pronunciation + wordPron = NULL; + hr = S_OK; + } + else + { + break; // Unexpected error - break; + } + + // Associate the pronunciation information with the SAPI word handle so it can be recovered later + // An engine can store any arbitrary pointer with each word. + hr = m_cpSite->SetWordClientContext(WordEntry.hWord, wordPron); + } + + if (SUCCEEDED(hr)) + { + // When calling GetWordInfo SAPI allocates the strings which we must free + ::CoTaskMemFree((void*)WordEntry.pszDisplayText); + ::CoTaskMemFree((void*)WordEntry.pszLexicalForm); + } + } + break; + case SPCFGN_REMOVE: + for(i = 0; i < cWords; i++) + { + WordEntry = pWords[i]; + // Client context already on word entry + wordPron = (WCHAR *) WordEntry.pvClientContext; + if(wordPron) + { + delete wordPron; + } + } + break; + } + + return hr; +} + +/**************************************************************************** +* CSrEngine::RuleNotify * +*---------------------------* +* Description: +* This method is called by SAPI to inform the engine of the rules in +* command & control grammars. The order or actions of CFG grammars is of this form: +* WordNotify(SPCFGN_ADD) - add words +* RuleNotify(SPCFGN_ADD) - add rules +* RuleNotify(SPCFGN_ACTIVATE) - activate rules to indicate they are to be used for recognition +* RuleNotify(SPCFGN_INVALIDATE) - if a rule gets edited by the app then this is called +* RuleNotify(SPCFGN_DEACTIVE) - deactivate rules +* RuleNotify(SPCFGN_REMOVE) - remove rules +* WordNotify(SPCFGN_REMOVE) - remove words +* +* The engine can call GetRuleInfo to find the initial state in the rule, and +* then GetStateInfo to find the information about subsequent states and transitions in the rule. +* If a rule is edited then SPCFGN_INVALIDATE is called to indicate rule has changed so the engine +* must reparse the rule information. +* +* The engine can obtain all the information about the rule either before or during recognition. +* In this sample engine we just keep a list of rules initially and then wait +* until we want to generate a result and then find a random path through the rule. +* +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::RuleNotify(SPCFGNOTIFY Action, ULONG cRules, const SPRULEENTRY * pRules) +{ + SPDBG_FUNC("Sample Engine - RULENOTIFY"); + ULONG i; + CRuleEntry *pRuleEntry; + + switch (Action) + { + case SPCFGN_ADD: + for (i = 0; i < cRules; i++) + { + // Obtain information on the rule and store in a CRuleEntry structure + pRuleEntry = new CRuleEntry; + pRuleEntry->m_hRule = pRules[i].hRule; + pRuleEntry->m_fTopLevel = (pRules[i].Attributes & SPRAF_TopLevel); + pRuleEntry->m_fActive = (pRules[i].Attributes & SPRAF_Active); + + // Keep a list of rules + m_RuleList.InsertHead(pRuleEntry); + + // Engine can store information associated with rule handle if desired + m_cpSite->SetRuleClientContext(pRules[i].hRule, (void *)pRuleEntry); + } + break; + case SPCFGN_REMOVE: + for (i = 0; i < cRules; i++) + { + pRuleEntry = m_RuleList.Find(pRules[i].hRule); + SPDBG_ASSERT(pRuleEntry); // The rule must have been added before being removed + m_RuleList.Remove(pRuleEntry); + delete pRuleEntry; + } + break; + case SPCFGN_ACTIVATE: + for (i = 0; i < cRules; i++) + { + pRuleEntry = m_RuleList.Find(pRules[i].hRule); + // Only top-level rules can be activated + SPDBG_ASSERT(pRuleEntry && !pRuleEntry->m_fActive && pRuleEntry->m_fTopLevel); + pRuleEntry->m_fActive = TRUE; + } + break; + case SPCFGN_DEACTIVATE: + for (i = 0; i < cRules; i++) + { + pRuleEntry = m_RuleList.Find(pRules[i].hRule); + SPDBG_ASSERT(pRuleEntry && pRuleEntry->m_fActive && pRuleEntry->m_fTopLevel); + pRuleEntry->m_fActive = FALSE; + } + break; + case SPCFGN_INVALIDATE: + for (i = 0; i < cRules; i++) + { + pRuleEntry = m_RuleList.Find(pRules[i].hRule); + SPDBG_ASSERT(pRuleEntry); + pRuleEntry->m_fTopLevel = (pRules[i].Attributes & SPRAF_TopLevel); + pRuleEntry->m_fActive = (pRules[i].Attributes & SPRAF_Active); + // Don't need to do anything here as we don't start parsing the rule until recognition time + } + break; + } + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::LoadSLM * +*---------------------------* +* Description: +* Called when SAPI wants the engine to load a dictaion language model (SLM). +* For each reco gramar one dictation as well as C&C rules can be loaded. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::LoadSLM(void * pvEngineGrammar, const WCHAR * pszTopicName) +{ + SPDBG_FUNC("Sample Engine - LOADSLM"); + + if (pszTopicName) + { + // Engines should load the named language model - e.g. Spelling using + // this parameter. If NULL load the default dictation model. + // Since just a sample ignore this parameter. + } + + // pvEngineGrammar is the pointer ppvEngineGrammar we set in OnCreateGrammar + // Use this to find out on which grammar the SLM is being asked for. + CDrvGrammar * pGrammar = (CDrvGrammar *)pvEngineGrammar; + pGrammar->m_SLMLoaded = TRUE; + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::UnloadSLM * +*---------------------------* +* Description: +* Called when SAPI wants the engine to delete an SLM. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::UnloadSLM(void *pvEngineGrammar) +{ + SPDBG_FUNC("Sample Engine - UNLOADSLM"); + + CDrvGrammar * pGrammar = (CDrvGrammar *)pvEngineGrammar; + pGrammar->m_SLMLoaded = FALSE; + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetSLMState * +*---------------------------* +* Description: +* Called to activate or deactivate an SLM for recognition. +* NewState is either SPRS_ACTIVE or SPRS_INACTIVE. +* Return: +* S_OK +*****************************************************************************/ +HRESULT CSrEngine::SetSLMState(void * pvDrvGrammar, SPRULESTATE NewState) +{ + SPDBG_FUNC("Sample Engine - SETSLMSTATE"); + + // pvDrvGrammar is the pointer ppvEngineGrammar we set in OnCreateGrammar + CDrvGrammar * pGrammar = (CDrvGrammar *)pvDrvGrammar; + if (NewState != SPRS_INACTIVE) + { + pGrammar->m_SLMActive = TRUE; + } + else + { + pGrammar->m_SLMActive = FALSE; + } + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetWordSequenceData * +*---------------------------* +* Description: +* If the app submits a text buffer to SAPI this method is called. +* The text buffer supplied here can either be used in CFGs with the text buffer transition, +* or in dictation to supply information to the engine about the prior text visible on screen. +* This sample engine is just using the text buffer with the text buffer transition. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetWordSequenceData(void *pvEngineGrammar, const WCHAR *pText, ULONG cchText, const SPTEXTSELECTIONINFO *pInfo) +{ + SPDBG_FUNC("Sample Engine - SETWORDSEQUENCE"); + + //For each grammar object going to be released, SAPI would call SetWordSequenceData(NULL, 0, NULL). + + // Recover the data we have associated with this grammar. + CDrvGrammar * pGrammar = (CDrvGrammar*)pvEngineGrammar; + + // Delete previous grammar text buffer + if(pGrammar->m_pWordSequenceText) + { + delete pGrammar->m_pWordSequenceText; + } + + // Make a copy of the text data + if(cchText) + { + pGrammar->m_pWordSequenceText = new WCHAR[cchText]; + memcpy((void *)pGrammar->m_pWordSequenceText, pText, sizeof(WCHAR) * cchText); + pGrammar->m_cchText = cchText; + } + else + { + pGrammar->m_pWordSequenceText = NULL; + pGrammar->m_cchText = NULL; + } + + // Engines can use the SPTEXTSELECTIONINFO to determine which + // parts of the text buffer are visible on screen and / or selected. + // This sample engine is using the active text selection only. + SetTextSelection(pvEngineGrammar, pInfo); + + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetTextSelection * +*---------------------------* +* Description: +* This method tells engines if the SPTEXTSELECTIONINFO structure +* has been updated. This sample engine is using only fields ulStartActiveOffset and cchActiveChars of SPTEXTSELECTIONINFO. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetTextSelection(void * pvEngineGrammar, const SPTEXTSELECTIONINFO * pInfo) +{ + SPDBG_FUNC("Sample Engine - SETTEXTSELECTION"); + + // Recover the data we have associated with this grammar. + CDrvGrammar * pGrammar = (CDrvGrammar*)pvEngineGrammar; + + if (pGrammar->m_pInfo) + { + delete pGrammar->m_pInfo; + } + + if (pInfo) + { + pGrammar->m_pInfo = new SPTEXTSELECTIONINFO(*pInfo); + } + else + { + pGrammar->m_pInfo = NULL; + } + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::IsPronounceable * +*---------------------------* +* Description: +* Engines should return whether it has or will be able to +* generate a pronounciation for this word. +* In this sample engine, this is always true. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::IsPronounceable(void * pDrvGrammar, const WCHAR * pszWord, SPWORDPRONOUNCEABLE * pWordPronounceable) +{ + SPDBG_FUNC("Sample Engine - ISPRONOUNCEABLE"); + *pWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE; + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetAdaptationData * +*---------------------------* +* Description: +* This method can be used by the app to give text data to the engine +* for language model adaptation etc. This method can only be called +* by the app after if has received an SPEI_ADAPTATION event. Since +* we never fire that event this method should never be called. + +* Return: +* E_UNEXPECTED +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetAdaptationData(void * pvEngineCtxtCookie, const WCHAR *pAdaptationData, const ULONG cch) +{ + SPDBG_FUNC("Sample Engine - SETADAPTATIONDATA"); + + SPDBG_ASSERT(0); // This method should never be called + return E_UNEXPECTED; +} + +/**************************************************************************** +* CSrEngine::AddEvent * +*---------------------------* +* Description: +* Internal helper method to send an event to SAPI. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::AddEvent(SPEVENTENUM eEventId, ULONGLONG ullStreamPos, WPARAM wParam, LPARAM lParam) +{ + SPDBG_FUNC("Sample Engine - AddEvent"); + HRESULT hr = S_OK; + + SPEVENT Event; + Event.eEventId = eEventId; + Event.elParamType = SPET_LPARAM_IS_UNDEFINED; + Event.ulStreamNum = 0; // Always set this to zero - SAPI fills this in + Event.ullAudioStreamOffset = ullStreamPos; + Event.wParam = wParam; + Event.lParam = lParam; + + hr = m_cpSite->AddEvent(&Event, NULL); + + return hr; +} + +/**************************************************************************** +* CSrEngine::AddEventString * +*---------------------------* +* Description: +* Internal helper method to send an event with a string LParam to SAPI. +* Request UI is the only event in the sample to need this. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::AddEventString(SPEVENTENUM eEventId, ULONGLONG ullStreamPos, const WCHAR * psz, WPARAM wParam) +{ + SPDBG_FUNC("Sample Engine - AddEventString"); + HRESULT hr = S_OK; + + SPEVENT Event; + Event.eEventId = eEventId; + Event.elParamType = SPET_LPARAM_IS_STRING; + Event.ulStreamNum = 0; // Always set this to zero - SAPI fills this in + Event.ullAudioStreamOffset = ullStreamPos; + Event.wParam = wParam; + Event.lParam = (LPARAM)psz; + + hr = m_cpSite->AddEvent(&Event, NULL); + + return hr; +} + + +#define BLOCKSIZE 220 // 1/100 of a second + +/**************************************************************************** +* CSrEngine::RecognizeStream * +*---------------------------* +* Description: +* This is the method that SAPI calls for recognition to take place. +* Engines must only return from this method after they have read all the data +* and completed all the recognition they are going to do on this stream. +* Thus this method is giving a thread to the engine to do recognition on, +* and engines may create additional threads. +* +* In this sample we constantly read data using this thread, and then perform +* very basic speech detection and pass data to a recognizer thread, which +* generates hypotheses and results. +* +* Parameters: +* +* - REFGUID rguidFormatId - this is the GUID of the input audio format +* - const WAVEFORMATEX * pWaveFormatEx - this is the extended wav format information of the audio format +* - HANDLE hRequestSync - this Win32 event is used to indicate that there are pending tasks +* and the engine should call Synchronize() for SAPI to process these. +* - HANDLE hDataAvailable - this Win32 event is used to tell the engine that data is available to be read. +* The frequency this is set can be controlled by the SetBufferNotifySize method. +* - HANDLE hExit - this Win32 event indicates the engine is being closed down and should exit immediately. +* - BOOL fNewAudioStream - this indicates this is a new input stream +* e.g. the app has done a new SetInput call rather than just restarting the previous stream. +* - BOOL fRealTimeAudio - this indicates the input is from a real-time ISpAudio stream, rather than, say, a file +* - ISpObjectToken * pAudioObjectToken - this is the object token representing the audio input device +* the engine may want to query this. +* +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::RecognizeStream(REFGUID rguidFormatId, + const WAVEFORMATEX * pWaveFormatEx, + HANDLE hRequestSync, + HANDLE hDataAvailable, + HANDLE hExit, + BOOL fNewAudioStream, + BOOL fRealTimeAudio, + ISpObjectToken * pAudioObjectToken) +{ + SPDBG_FUNC("Sample Engine - RECOGNIZESTREAM"); + HRESULT hr = S_OK; + + m_hRequestSync = hRequestSync; + + // Start the recognition thread + hr = m_cpDecoderThread->StartThread(0, NULL); + + if (SUCCEEDED(hr)) + { + const HANDLE aWait[] = { hExit, m_hQueueHasRoom }; + + while (TRUE) // sit in this loop until there is no more data + { + // The Read method is used to read data. This will block until the required + // amount of data is available. If the stream has ended either a fail code + // will be returned or the amount read will be less than the amount asked for. + // To see how much data is available to be read without blocking the DataAvailable + // method can be used or hDataAvailable event. + BYTE aData[BLOCKSIZE]; + ULONG cbRead; + hr = m_cpSite->Read(aData, sizeof(aData), &cbRead); + if (hr != S_OK || cbRead < sizeof(aData)) + { + break; + } + + // Decide if the frame of data is noise or silence with a simple level detector + BOOL bNoiseDetected = FALSE; + SHORT * pBuffer = (SHORT *)aData; + for (ULONG i = 0; i < cbRead; i += 2, pBuffer++) + { + if (*pBuffer < (SHORT)-3000 || *pBuffer > (SHORT)3000) + { + bNoiseDetected = TRUE; + break; + } + } + + // If there no space on the frame queue then wait + BOOL bBlock = m_FrameQueue.IsFull(); + if(bBlock) + { + // Wait for space to appear on the queue to be passed to the recognizer. + // Real engines should not wait - the data reading should be as real-time as possible + // Also detect if the hExit event is set to indicate we should stop processing. + if (::WaitForMultipleObjects(sp_countof(aWait), aWait, FALSE, INFINITE) == WAIT_OBJECT_0) + { + break; + } + } + + // Add the frame to the queue and notify the decoder thread + m_FrameQueue.InsertTail(bNoiseDetected); + m_cpDecoderThread->Notify(); + + } + + // Once we've stopped reading data we must wait for the recognizer thread to finish + // All processing must be done before returning from the RecognizeStream method. + m_cpDecoderThread->WaitForThreadDone(TRUE, &hr, 30 * 1000); + } + + m_hRequestSync = NULL; + + SPDBG_REPORT_ON_FAIL( hr ); + return hr; +} + + +/**************************************************************************** +* CSrEngine::ThreadProc * +*-----------------------* +* Description: +* This is the main thread for the recognition process. +* This hExitThreadEvent indicates this thread should complete, +* and the hNotifyEvent indicates the RecognizeStream thread is notifying +* that data is available for processing. The m_hRequestSync indicates +* SAPI is requesting the engine should call Synchronize. +* +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::ThreadProc(void *, HANDLE hExitThreadEvent, HANDLE hNotifyEvent, HWND hwndWorker, volatile const BOOL * pfContinueProcessing) +{ + SPDBG_FUNC("Sample Engine - Recognition ThreadProc"); + HRESULT hr = S_OK; + const HANDLE aWait[] = { hExitThreadEvent, hNotifyEvent, m_hRequestSync }; + ULONG block = 0; + ULONG silenceafternoise = 0; + DWORD waitres; + + m_bSoundStarted = FALSE; + m_bPhraseStarted = FALSE; + m_cBlahBlah = 0; + + m_ullStart = 0; + m_ullEnd = 0; + while (*pfContinueProcessing) // sit in this loop until exit + { + ULONG cEvents = sp_countof(aWait); + // Respond to the request sync event only if speech not detected, + // as we don't want to allow grammar changes during recognition. + // However always respond after several seconds. + if(m_bPhraseStarted && (block - m_ullStart / BLOCKSIZE) < 5 * 100) + { + --cEvents; + } + waitres = ::WaitForMultipleObjects(cEvents, aWait, FALSE, INFINITE); + switch (waitres) + { + + case WAIT_OBJECT_0: // Exit thread + break; + + case WAIT_OBJECT_0 + 1: // Notify (data is available) + + // Engines should regularly call UpdateRecoPos to indicate how far through the + // stream they have recognized. + m_cpSite->UpdateRecoPos((ULONGLONG)block * BLOCKSIZE); + + if (m_ullStart == 0 && !m_bPhraseStarted) + { + // Engines should also call Synchronize to indicate they are ready + // to be notified about grammar changes and other tasks. Within Synchronize + // if grammars have changed WordNotify, RuleNotify etc. will be called before Synchronize returns. + // Here Synchronize is called only if processing silence, not speech + // to avoid having to deal with grammar changes during recognition. + + m_cpSite->Synchronize((ULONGLONG)block * BLOCKSIZE); + // A return code of S_FALSE from synchronize means the engine can stop recognizing + // This engine ignores this. + } + while (m_FrameQueue.HasData()) + { + BOOL bNoise = m_FrameQueue.RemoveHead(); + block++; // Update the position in stream + if (bNoise) + { + // Found some speech - update start and end positions + silenceafternoise = 0; + if (m_ullStart == 0) + { + m_ullStart = (ULONGLONG)block * BLOCKSIZE; + } + m_ullEnd = (ULONGLONG)block * BLOCKSIZE; + _CheckRecognition(); // this will generate hypotheses and events + } + else + { + // Found some silence + silenceafternoise++; + if (silenceafternoise > 50) + { + if (m_bSoundStarted) + { + // We've heard 1/2 sec of silence since the last noise, so send the + // final recognition if we had previously started a phrase + if (m_bPhraseStarted) + { + _NotifyRecognition(FALSE, m_cBlahBlah); + } + AddEvent(SPEI_SOUND_END, m_ullEnd); // send the sound end event + m_bSoundStarted = FALSE; + m_bPhraseStarted = FALSE; + } + m_ullStart = 0; + m_ullEnd = 0; + } + } + + //--- Generate random interference start at 20 seconds into the stream + // and saying it's gone at 22 seconds + if (block % (100 * 30) == 20 * 100) + { + const SPINTERFERENCE rgspi[] = + { SPINTERFERENCE_NOISE, SPINTERFERENCE_NOSIGNAL, SPINTERFERENCE_TOOLOUD, SPINTERFERENCE_TOOQUIET }; + + AddEvent(SPEI_INTERFERENCE, block*BLOCKSIZE, 0, rgspi[rand() % 4]); + } + else if (block % (100 * 30) == 22 * 100) + { + AddEvent(SPEI_INTERFERENCE, block*BLOCKSIZE, 0, SPINTERFERENCE_NONE); + } + // Ask for UI at 10 seconds into the stream + // and cancel request one second later + else if (block == 10 * 100) + { + AddEventString(SPEI_REQUEST_UI, block * BLOCKSIZE, SPDUI_UserTraining); + } + else if (block == 11 * 100) // Cancle the UI request at 11 seconds into the stream + { + AddEventString(SPEI_REQUEST_UI, block * BLOCKSIZE, NULL); + } + } + break; + + case WAIT_OBJECT_0 + 2: + // SAPI has explicitly requested we call Synchronize + hr = m_cpSite->Synchronize((ULONGLONG)block * BLOCKSIZE); + // Once synchronize is called the engine cannot fire events prior to that stream position + // so update the stored stream start position + m_ullStart = block * BLOCKSIZE; + if(m_ullEnd < m_ullStart) + { + m_ullEnd = m_ullStart; + } + break; + + default: + SPDBG_ASSERT(FALSE); + // Something strange! + break; + } + } + + // Before exiting we must make sure every phrase start has been paired with a recognition, + // and that every sound start event has a corresponding sound end. + if (m_bPhraseStarted) + { + _NotifyRecognition(FALSE, m_cBlahBlah); + } + if (m_bSoundStarted) + { + AddEvent(SPEI_SOUND_END, m_ullEnd); + } + + return S_OK; +} + + +/**************************************************************************** +* CSrEngine::_CheckRecognition * +*---------------------------* +* Description: +* This internal method decides when to fire sound start events, +* phrase start events and hypotheses. +*****************************************************************************/ +void CSrEngine::_CheckRecognition() +{ + SPDBG_FUNC("Sample Engine - _NotifyRecognition"); + ULONG duration, blahs; + + if (m_ullEnd > m_ullStart) + { + duration = (ULONG)(m_ullEnd - m_ullStart); + if (duration >= BLOCKSIZE * 100 * 1 / 8) + { + if (!m_bSoundStarted) + { + // Heard something that was longer than 1/8th second, so do sound start + AddEvent(SPEI_SOUND_START, m_ullStart); + m_bSoundStarted = TRUE; + m_cBlahBlah = 0; + } + if (duration >= BLOCKSIZE * 100 * 1 / 4) + { + // Heard something that was longer than 1/4 second, so do phrase start + // and then generate a hypothesis every 1/4 second after that. + blahs = duration / (BLOCKSIZE * 100 * 1 / 4); + if (blahs != m_cBlahBlah) + { + m_cBlahBlah = blahs; + if (!m_bPhraseStarted) + { + m_bPhraseStarted = TRUE; + AddEvent(SPEI_PHRASE_START, m_ullStart); + } + _NotifyRecognition(TRUE, blahs); + } + } + } + } +} + + +/**************************************************************************** +* CSrEngine::_NotifyRecognition * +*-------------------------------* +* Description: +* This internal method is used to generate a recognition result. The contents +* are random since we don't actually know how to recognize anything.* +****************************************************************************/ +void CSrEngine::_NotifyRecognition( BOOL fHypothesis, ULONG nWords ) +{ + SPDBG_FUNC("Sample Engine - _NotifyRecognition"); + HRESULT hr = S_OK; + + // First count the active CFG rules + ULONG cActiveCFGRules = 0; + CRuleEntry * pRule = m_RuleList.GetHead(); + for(; pRule; pRule = m_RuleList.GetNext(pRule)) + { + if( pRule->m_fActive ) + { + cActiveCFGRules++; + } + } + + // Then count all the grammars with active dictation + ULONG cActiveSLM = 0; + CDrvGrammar * pGram = m_GrammarList.GetHead(); + for(; pGram; pGram = m_GrammarList.GetNext(pGram)) + { + if(pGram->m_SLMActive) + { + cActiveSLM++; + } + } + + // If both CFG and dictation are active, randomly do one or the other + if(cActiveCFGRules && cActiveSLM) + { + if(rand() % 2) + { + cActiveSLM = 0; + } + else + { + cActiveCFGRules = 0; + } + } + + //--- Compose reco result info + SPRECORESULTINFO Result; + memset(&Result, 0, sizeof(SPRECORESULTINFO)); + Result.cbSize = sizeof(SPRECORESULTINFO); + Result.fHypothesis = fHypothesis; + Result.ullStreamPosStart = m_ullStart; + Result.ullStreamPosEnd = m_ullEnd; + + if( cActiveCFGRules ) + { + // Generate a CFG result phrase + hr = WalkCFGRule(&Result, cActiveCFGRules, fHypothesis, nWords, m_ullStart, (ULONG)(m_ullEnd - m_ullStart)); + if( SUCCEEDED(hr) ) + { + // Pass the results info to SAPI + hr = m_cpSite->Recognition(&Result); + // Cleanup any memory allocated for alternates and release phrases + for(ULONG i = 0; i < Result.ulNumAlts; i++) + { + Result.aPhraseAlts[i].pPhrase->Release(); + } + Result.pPhrase->Release(); + delete[] Result.aPhraseAlts; + } + } + else if(cActiveSLM) + { + // Generate a dictation result phrase + hr = WalkSLM(&Result, cActiveSLM, nWords, m_ullStart, (ULONG)(m_ullEnd - m_ullStart)); + if( SUCCEEDED(hr) ) + { + // Pass the results info to SAPI + hr = m_cpSite->Recognition(&Result); + // Release the result phrase + Result.pPhrase->Release(); + delete[] Result.pvEngineData; + } + } + else if(!fHypothesis) + { + // No rules were active - return a false recognition + // RecognizeStream can still be called if no rules are active + // - the engine is free to do anything it wants with the speech data. + Result.eResultType = SPRT_FALSE_RECOGNITION; + hr = m_cpSite->Recognition(&Result); + } + +} + +/**************************************************************************** +* CSrEngine::CreatePhraseFromRule * +*---------------------------------* +* Description: +* This method is used to produce the result phrase for a CFG result. +* It selects a random path through an active rule, and +* then calls ParseFromTransition to generate an ISpPhraseBuilder object. +* +* Return: +* S_OK +* FAIL(hr) +****************************************************************************/ +HRESULT CSrEngine::CreatePhraseFromRule( CRuleEntry * pRule, BOOL fHypothesis, + ULONGLONG ullAudioPos, ULONG ulAudioSize, + ISpPhraseBuilder** ppPhrase ) +{ + HRESULT hr = S_OK; + SPRULEENTRY RuleInfo; + RuleInfo.hRule = pRule->m_hRule; + hr = m_cpSite->GetRuleInfo(&RuleInfo, SPRIO_NONE); + if( SUCCEEDED(hr) ) + { + SPPATHENTRY Path[200]; // Note: Limit of 200 transitions in grammar! + ULONG cTrans; + // Recursively generate random path + hr = RecurseWalk(RuleInfo.hInitialState, Path, &cTrans); + + //Fill in the audio offset and audio size for each element in the path, while each element has equal size and silence in between + if (cTrans) + { + ULONG ulInterval = ulAudioSize/cTrans; + for (ULONG ul = 0; ul < cTrans; ul++) + { + Path[ul].elem.ulAudioStreamOffset = ul * ulInterval; + Path[ul].elem.ulAudioSizeBytes = ulInterval/2; + } + } + + if (SUCCEEDED(hr)) + { + // generate a SPPARSEINFO structure + SPPARSEINFO ParseInfo; + memset(&ParseInfo, 0, sizeof(ParseInfo)); + ParseInfo.cbSize = sizeof(SPPARSEINFO); + ParseInfo.hRule = pRule->m_hRule; + ParseInfo.ullAudioStreamPosition = ullAudioPos; + ParseInfo.ulAudioSize = ulAudioSize; + ParseInfo.cTransitions = cTrans; + ParseInfo.pPath = Path; + ParseInfo.fHypothesis = fHypothesis; + ParseInfo.SREngineID = CLSID_SampleSREngine; + ParseInfo.ulSREnginePrivateDataSize = 0; + ParseInfo.pSREnginePrivateData = NULL; + + // Generate a phrase object from the parse info. + hr = m_cpSite->ParseFromTransitions(&ParseInfo, ppPhrase ); + if(SUCCEEDED(hr)) + { + // delete any allocated memory + for(ULONG i = 0; i < cTrans; i++) + { + if(Path[i].elem.pszDisplayText) + { + delete const_cast(Path[i].elem.pszDisplayText); + } + } + } + } + } + return hr; +} + +/**************************************************************************** +* CSrEngine::FindRule * +*---------------------* +* Description: +* This method is used to locate an active rule in the rule list by index +* +****************************************************************************/ +CRuleEntry* CSrEngine::FindRule( ULONG ulRuleIndex ) +{ + CRuleEntry * pRule = m_RuleList.GetHead(); + ULONG ulRule = 0; + while( pRule ) + { + if( pRule->m_fActive && ( ulRule++ == ulRuleIndex ) ) + { + break; + } + pRule = m_RuleList.GetNext( pRule ); + } + SPDBG_ASSERT(pRule && pRule->m_fActive); + return pRule; +} + +/**************************************************************************** +* CSrEngine::NextRuleAlt * +*------------------------* +* Description: +* This method is used to locate a rule alternate in the rule list +* +****************************************************************************/ +CRuleEntry* CSrEngine::NextRuleAlt( CRuleEntry * pPriRule, CRuleEntry * pLastRule ) +{ + CRuleEntry * pRule = (pLastRule)?(pLastRule):(m_RuleList.GetHead()); + for(; pRule; pRule = m_RuleList.GetNext(pRule)) + { + if( pRule->m_fActive && + ( m_cpSite->IsAlternate( pPriRule->m_hRule, pRule->m_hRule ) == S_OK ) ) + { + break; + } + } + return pRule; +} + +/**************************************************************************** +* CSrEngine::WalkCFGRule * +*------------------------* +* Description: +* This method is used to produce the results information for a CFG result. +* It creates a result phrase and then some alternates phrases. +* Return: +* S_OK +* FAILED(hr) +****************************************************************************/ +HRESULT CSrEngine::WalkCFGRule( SPRECORESULTINFO * pResult, ULONG cRulesActive, BOOL fHypothesis, + ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize) +{ + HRESULT hr = E_FAIL; + CRuleEntry * pPriRule = NULL; + pResult->ulSizeEngineData = 0; + pResult->pvEngineData = NULL; + pResult->eResultType = SPRT_CFG; + pResult->hGrammar = NULL; + + while (hr == E_FAIL) + { + // Randomly pick a rule and locate it in the list + pPriRule = FindRule( rand() % cRulesActive ); + + // Create a phrase from the rule + hr = CreatePhraseFromRule( pPriRule, fHypothesis, ullAudioPos, + ulAudioSize, &pResult->pPhrase ); + // E_FAIL means the random path generated came to a dead end. Most likely an empty + // dynamic rule. We are not allowed to recognize through empty rules. + // Hence we choose another random toplevel rule and try again until we succeed. + } + + if (hr != S_OK) + { + SPDBG_ASSERT(FALSE); + } + + // Get the phrase info + SPPHRASE* pPriPhraseInfo = NULL; + if( SUCCEEDED( hr ) ) + { + hr = pResult->pPhrase->GetPhrase( &pPriPhraseInfo ); + } + + // Ask the site how many alternates to generate + ULONG ulNumAlts = 0; + if( SUCCEEDED( hr ) ) + { + hr = m_cpSite->GetMaxAlternates( pPriRule->m_hRule, &ulNumAlts ); + } + + // Randomly create some alternates + if( SUCCEEDED( hr ) && ulNumAlts ) + { + pResult->aPhraseAlts = new SPPHRASEALT[ulNumAlts]; + if( pResult->aPhraseAlts ) + { + memset( pResult->aPhraseAlts, 0, ulNumAlts * sizeof(SPPHRASEALT) ); + CRuleEntry * pAltRule = NULL; + + for( ULONG i = 0; SUCCEEDED( hr ) && (i < ulNumAlts); ++i ) + { + // Try to find an alternate rule + pAltRule = NextRuleAlt( pPriRule, pAltRule ); + if( !pAltRule ) + { + ulNumAlts = i; + break; + } + + // Create an alternate phrase from the rule + hr = CreatePhraseFromRule( pAltRule, fHypothesis, ullAudioPos, + ulAudioSize, &pResult->aPhraseAlts[i].pPhrase ); + + // Get the alternate phrase info + SPPHRASE* pAltPhraseInfo = NULL; + if( SUCCEEDED( hr ) ) + { + hr = pResult->aPhraseAlts[i].pPhrase->GetPhrase( &pAltPhraseInfo ); + } + + if( SUCCEEDED( hr ) ) + { + ++pResult->ulNumAlts; + + // Fill out relationship info + pResult->aPhraseAlts[i].cElementsInParent = pPriPhraseInfo->Rule.ulCountOfElements; + pResult->aPhraseAlts[i].cElementsInAlternate = pAltPhraseInfo->Rule.ulCountOfElements; + + // Point to some extra data for testing + static BYTE AltData[] = { 0xED, 0xED, 0xED, 0xED }; + pResult->aPhraseAlts[i].pvAltExtra = &AltData; + pResult->aPhraseAlts[i].cbAltExtra = sp_countof( AltData ); + } + + if( pAltPhraseInfo ) + { + ::CoTaskMemFree( pAltPhraseInfo ); + } + } + } + else + { + E_OUTOFMEMORY; + } + } + + // Cleanup main phrase information + if( pPriPhraseInfo ) + { + ::CoTaskMemFree( pPriPhraseInfo ); + } + + // Cleanup on failure + if( FAILED( hr ) ) + { + if( pResult->pPhrase ) + { + pResult->pPhrase->Release(); + pResult->pPhrase = NULL; + } + + for( ULONG i = 0; i < pResult->ulNumAlts; ++i ) + { + pResult->aPhraseAlts[i].pPhrase->Release(); + pResult->aPhraseAlts[i].pPhrase = NULL; + } + pResult->ulNumAlts = 0; + delete[] pResult->aPhraseAlts; + pResult->aPhraseAlts = NULL; + } + + return hr; +} + +/**************************************************************************** +* CSrEngine::WalkSLM * +*---------------------------* +* Description: +* This method is used to produce the results information for a dictation result. +* It creates a result phrase, and then serializes some alternates information +* that the CSrEngineAlternates object uses to generate alternates. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::WalkSLM(SPRECORESULTINFO * pResult, ULONG cSLMActive, + ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize) +{ + HRESULT hr = S_OK; + + // If several dictation grammars are active pick one at random + ULONG ulGramIndex = rand() % cSLMActive; + CDrvGrammar * pGram = m_GrammarList.GetHead(); + ULONG nGram = 0; + for(; pGram; pGram = m_GrammarList.GetNext(pGram)) + { + if(pGram->m_SLMActive) + { + if(nGram == ulGramIndex) + { + break; + } + nGram++; + } + } + SPDBG_ASSERT(pGram && pGram->m_SLMActive); + + // create and fill SPPHRASE structure + SPPHRASE phrase; + memset(&phrase, 0, sizeof(SPPHRASE)); + phrase.cbSize = sizeof(SPPHRASE); + phrase.LangID = m_LangID; + phrase.ullAudioStreamPosition = ullAudioPos; + phrase.ulAudioSizeBytes = ulAudioSize; + phrase.SREngineID = CLSID_SampleSREngine; + + // allocate elements + ULONG cb = nWords * sizeof(SPPHRASEELEMENT); + SPPHRASEELEMENT* pElements = (SPPHRASEELEMENT *)_alloca(cb); + memset(pElements, 0, cb); + + // fill in word info into elements + for (ULONG n = 0; n < nWords; n++) + { + ULONG ulInterval = ulAudioSize/nWords; + + pElements[n].bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + pElements[n].pszDisplayText = DICT_WORD; + pElements[n].ulAudioStreamOffset = n * ulInterval; + pElements[n].ulAudioSizeBytes = ulInterval/2; + + } + + // add elements to phrase + phrase.Rule.ulCountOfElements = nWords; + phrase.pElements = pElements; + + // make phrase builder and add phrase info + CComPtr cpBuilder; + hr = cpBuilder.CoCreateInstance(CLSID_SpPhraseBuilder); + if (SUCCEEDED(hr)) + { + hr = cpBuilder->InitFromPhrase(&phrase); + } + + if (SUCCEEDED(hr)) + { + // Store alternates string in extra engine data + // We just serialize an equal number of copies of ALT_WORD as DICT_WORD. + // Engines can store any information (e.g. serialized lattice) here. + pResult->ulSizeEngineData = sizeof(ALT_WORD) * nWords; + pResult->pvEngineData = new WCHAR[(sizeof(ALT_WORD) / sizeof(WCHAR )) * nWords]; + if (pResult->pvEngineData == NULL) + { + hr = E_OUTOFMEMORY; + } + } + + if (SUCCEEDED(hr)) + { + WCHAR *pC = (WCHAR *)pResult->pvEngineData; + for(ULONG i = 0; i < nWords; i++) + { + wcscpy(pC,ALT_WORD); + pC += wcslen(ALT_WORD); + *pC = L' '; + pC++; + } + *(--pC) = '\0'; + + pResult->eResultType = SPRT_SLM; + pResult->hGrammar = pGram->m_hSapiGrammar; + } + + if (SUCCEEDED(hr)) + { + pResult->pPhrase = cpBuilder.Detach(); + } + else + { + delete[] pResult->pvEngineData; + pResult->pvEngineData = NULL; + pResult->ulSizeEngineData = 0; + } + + return hr; +} + +/**************************************************************************** +* CSrEngine::WalkTextBuffer * +*---------------------------* +* Description: +* This is called when RecurseWalk hits a text-buffer transition. +* At such a transition the engine should try to recognize any sequence +* of words from the active text selection the app has supplied. +* Any word can be the start word and then recognition can continue to +* the next \0 end of sentence marker or at the end of the active text selection. +* In this sample we pick a random string of words from the buffer. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::WalkTextBuffer(void* pvGrammarCookie, SPPATHENTRY * pPath, SPTRANSITIONID hId, ULONG * pcTrans) +{ + HRESULT hr = S_OK; + // Check if text buffer present + CDrvGrammar * pGrammar = (CDrvGrammar *) pvGrammarCookie; + SPDBG_ASSERT(pGrammar->m_pWordSequenceText && pGrammar->m_cchText >= 2); //m_cchText counts the trailing "/0/0" + + *pcTrans = 0; + + // Count sentences + ULONG nPhrase = 0; + const WCHAR *cPhrase; + + ULONG ulStartActiveOffset = 0; //The default value with text selection + ULONG cchActiveChars = pGrammar->m_cchText - 2; //The default value with text selection + ULONG ccChars = 0; + + if (pGrammar->m_pInfo) + { + ulStartActiveOffset = pGrammar->m_pInfo->ulStartActiveOffset; + cchActiveChars = pGrammar->m_pInfo->cchActiveChars; + } + + for (cPhrase = pGrammar->m_pWordSequenceText + ulStartActiveOffset; + ccChars < cchActiveChars && (*cPhrase != L'\0' || *(cPhrase + 1) != '\0'); + ccChars++, cPhrase++) + { + if(*cPhrase != L'\0' && *(cPhrase + 1) == L'\0') + { + nPhrase++; + } + } + + + SPDBG_ASSERT(nPhrase); + + // Randomly pick a sentence between the first active sentence and the last active sentence + nPhrase = rand() % nPhrase; //nPhrase would be 0 index + ULONG nP = 0; + for(cPhrase = pGrammar->m_pWordSequenceText + ulStartActiveOffset; nP != nPhrase; cPhrase++) + { + if(*cPhrase == L'\0') + { + nP++; + } + } + + // Count words in sentence + ULONG nWord = 1; + const WCHAR *cWord; + for(cWord = cPhrase; *cWord != L'\0' && ULONG(cWord - pGrammar->m_pWordSequenceText) < ulStartActiveOffset + cchActiveChars; cWord++) + { + if(iswspace(*cWord)) + { + while(*(cWord+1) && iswspace(*(cWord+1)) && ULONG(cWord - pGrammar->m_pWordSequenceText) < ulStartActiveOffset + cchActiveChars - 1) {cWord++;} + nWord++; + } + } + + // Pick entry and exit word + ULONG startWord = rand() % nWord; + ULONG countWord = rand() % (nWord - startWord) + 1; + + // Find the entry word + for(nWord = 0, cWord = cPhrase; nWord != startWord; cWord++) + { + if(iswspace(*cWord)) + { + while(*(cWord+1) && iswspace(*(cWord+1)) && ULONG(cWord - pGrammar->m_pWordSequenceText) < ulStartActiveOffset + cchActiveChars - 1) {cWord++;} + nWord++; + } + } + + // Build paths to end word + const WCHAR *cW = cWord; + for(nWord = 0; nWord != countWord; cWord++) + { + if(*cWord == L'\0' || iswspace(*cWord) || ULONG(cWord - pGrammar->m_pWordSequenceText) == ulStartActiveOffset + cchActiveChars) + { + // Build a path entry + pPath->hTransition = hId; + memset(&pPath->elem, 0, sizeof(pPath->elem)); + pPath->elem.bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + WCHAR *pszWord = new WCHAR[cWord - cW + 1]; + wcsncpy(pszWord, cW, cWord - cW); + pszWord[cWord - cW] = '\0'; + pPath->elem.pszDisplayText = pszWord; + + pPath++; + (*pcTrans)++; + + while(*(cWord+1) && iswspace(*(cWord+1)) && ULONG(cWord - pGrammar->m_pWordSequenceText) < ulStartActiveOffset + cchActiveChars - 1) {cWord++;} + cW = cWord + 1; // first char of next word + nWord++; + } + } + + return hr; +} + +/**************************************************************************** +* CSrEngine::RecurseWalk * +*----------------------* +* Description: +* This method produces a random path through an active CFG. If the path contains +* a rule reference transition RecurseWalk is recursively called to produce a path though +* sub-rules. The result is an array of SPPATHENTRY elements containing the transitions. +* +* The initial state in each rule is obtained by calling GetRuleInfo. Then for each +* state GetStateInfo can be called. This gives an array of SPTRANSITION entries +* the contain information on the type of transition, the transition id and +* the next state the transition goes to. The transition id is the main information +* included in the SPPATHENTRY. Only for word transitions are SPPATHENTRY created, +* as this is all that is required by ParseFromTransitions. +* +* Return: +* S_OK +* FAILED(hr) +****************************************************************************/ +HRESULT CSrEngine::RecurseWalk(SPSTATEHANDLE hState, SPPATHENTRY * pPath, ULONG * pcTrans) +{ + HRESULT hr = S_OK; + + CSpStateInfo StateInfo; + *pcTrans = 0; + while (SUCCEEDED(hr) && hState) + { + ULONG cTrans; + hr = m_cpSite->GetStateInfo(hState, &StateInfo); + if (SUCCEEDED(hr)) + { + // Now randomly decide which transition to take. + ULONG cTransInState = StateInfo.cEpsilons + StateInfo.cWords + StateInfo.cRules + StateInfo.cSpecialTransitions; + if (cTransInState == 0) + { + // This path is a dead-end. Most likely this is due to an empty dynamic rule. + hr = E_FAIL; + break; + } + SPTRANSITIONENTRY * pTransEntry = StateInfo.pTransitions + (rand() % cTransInState); + + switch(pTransEntry->Type) + { + case SPTRANSEPSILON: + // Epsilon transition - don't need to create a path entry + // Advance to the next state. + break; + case SPTRANSRULE: + // Rule transition - we recursively descend into the rule and add onto the path array + hr = RecurseWalk(pTransEntry->hRuleInitialState, pPath, &cTrans); + *pcTrans += cTrans; + pPath += cTrans; + break; + case SPTRANSWORD: + case SPTRANSWILDCARD: + // For a word transition we complete an SPPATHENTRY structure with the transition id. + // A wildcard transition indicates the engine should match against any speech, so we do the same thing. + pPath->hTransition = pTransEntry->ID; + memset(&pPath->elem, 0, sizeof(pPath->elem)); + pPath->elem.bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + pPath++; + (*pcTrans)++; + break; + case SPTRANSTEXTBUF: + // Text Buffer transition - produce a path from WalkTextBuffer + hr = WalkTextBuffer(pTransEntry->pvGrammarCookie, pPath, pTransEntry->ID, &cTrans); + *pcTrans += cTrans; + pPath += cTrans; + break; + case SPTRANSDICTATION: + // Dictation transition - indicating the recognizer should do dictation at + // this point in the grammar. We generate the DICT_WORD as a path entry. + // The word text is indicated by setting pszDisplayText, which otherwise can be left NULL. + pPath->hTransition = pTransEntry->ID; + memset(&pPath->elem, 0, sizeof(pPath->elem)); + pPath->elem.bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + WCHAR *pszWord = new WCHAR[wcslen(DICT_WORD) + 1]; + wcscpy(pszWord, DICT_WORD); + pPath->elem.pszDisplayText = pszWord; + pPath++; + (*pcTrans)++; + break; + } + + // Move to the next state - a transition to NULL indicates the end of the rule. + hState = pTransEntry->hNextState; + } + } + return hr; +} + + + +/**************************************************************************** +* CSrEngine::GetInputAudioFormat * +*---------------------------* +* Description: +* This method is called for SAPI to find what audio formats the engine +* can support for recognition. +* Audio formats a represented by a GUID and an optional WAVEFORMATEX +* structure for wav file formats. This method may be called +* either with pSourceFormatId and pSourceWaveFormatEx NULL, in which +* case the engine should return its most preferred format. It may also +* be called with these set, in which case the engine should return +* that format if it can support or the closest it can. +* +* If the engines returned format is incompatible with the input audio +* object format SAPI will try and create a format convertor to convert the audio +* +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::GetInputAudioFormat(const GUID * pSourceFormatId, const WAVEFORMATEX * pSourceWaveFormatEx, + GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWFEX) +{ + SPDBG_FUNC( "Sample Engine - GETINPUTAUDIOFORMAT" ); + + // Helper function which fills in the sample engine desired format (PCM 11kHz Mono). + return SpConvertStreamFormatEnum(SPSF_11kHz16BitMono, pDesiredFormatId, ppCoMemDesiredWFEX); +} + + +/***************************************************************************** +* CSrEngine::SetPropertyNum * +*---------------------* +* Description: +* The following methods are used for the app to send and receive +* real-time attribute information to the engine. This differs from the +* ISpObjectWithToken mechanism which is used to query static registry information. +* If the app tries to set or query an attribute the engine should return +* okay if it supports that attribute and S_FALSE if it does not. +* In this method the app is trying to set a numeric property value. +* Return: +* S_FALSE +*****************************************************************************/ +STDMETHODIMP CSrEngine:: + SetPropertyNum( SPPROPSRC eSrc, PVOID pvSrcObj, const WCHAR* pName, LONG lValue ) +{ + SPDBG_FUNC( "Sample Engine - SETPROPERTYNUM" ); + HRESULT hr = S_OK; + + hr = S_FALSE; // We don't support any properties + + return hr; +} + +/***************************************************************************** +* CSrEngine::GetPropertyNum * +*---------------------* +* Description: +* In this method the app is trying to get a numeric property value. +*****************************************************************************/ +STDMETHODIMP CSrEngine:: + GetPropertyNum( SPPROPSRC eSrc, PVOID pvSrcObj, const WCHAR* pName, LONG * plValue ) +{ + SPDBG_FUNC( "Sample Engine - GETPROPERTYNUM" ); + HRESULT hr = S_OK; + + hr = S_FALSE; + *plValue = 0; + + return hr; +} + +/***************************************************************************** +* CSrEngine::SetPropertyString * +*----------------------* +* Description: +* In this method the app is trying to set a string property value. +*****************************************************************************/ +STDMETHODIMP CSrEngine:: + SetPropertyString( SPPROPSRC eSrc, PVOID pvSrcObj, const WCHAR* pName, const WCHAR* pValue ) +{ + SPDBG_FUNC( "Sample Engine - SETPROPERTYSTRING" ); + HRESULT hr = S_OK; + + hr = S_FALSE; + + return hr; +} + +/***************************************************************************** +* CSrEngine::GetPropertyString * +*----------------------* +* Description: +* In this method the app is trying to get a string property value. +*****************************************************************************/ +STDMETHODIMP CSrEngine:: + GetPropertyString( SPPROPSRC eSrc, PVOID pvSrcObj, const WCHAR* pName, WCHAR** ppCoMemValue ) +{ + SPDBG_FUNC( "Sample Engine - GETPROPERTYSTRING" ); + HRESULT hr = S_OK; + + hr = S_FALSE; + *ppCoMemValue = NULL; + + return hr; +} + + +/**************************************************************************** +* CSrEngine::PrivateCall * +*---------------------------* +* Description: +* This method is used for a reco extension to send private, engine-specific information +* to an engine it knows about. The app QI's off the reco context for a private +* interface, and SAPI creates the engine' extension object (in this case CSampleSRExtension). +* The app can then call methods on this interface. If the extension object wants to +* communicate with the engine it calls CallEngine. The data from that call is then +* passed to this method on the engine. +* +* Similarly the alternates class and UI class can also use this mechanism to +* communicate with their main engine class. +* +* The single buffer is in/out. This call can update the buffer, and the updated buffer +* will be returned to the caller of _ISpPrivateEngineCall::CallEngine(). To return +* variable size buffers, use _ISpPrivateEngineCall::CallEngineEx() and +* ISpSREngine::PrivateCallEx(). +* +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::PrivateCall(void * pvEngineContext, void * pCallFrame, ULONG ulCallFrameSize) +{ + SPDBG_FUNC( "Sample Engine - PRIVATECALL" ); + // Just an example - do nothing here + return S_OK; +} + +/**************************************************************************** +* CSrEngine::PrivateCallEx * +*--------------------------* +* Description: +* This method is similar to PrivateCall except that the call frame is an +* input only parameter. This function should CoTaskMemAlloc a response block +* and return it in *ppvCoMemResponse. You must also return the size of the +* allocated block (in bytes) in *pcbResponse. +* +* While this is slightly more work than CallEngine/PrivateCall, it allows for +* variable size responses, which could be more efficent in some cases. +* +* Returns: +* S_OK +* +*****************************************************************************/ + +STDMETHODIMP CSrEngine::PrivateCallEx(void * pvEngineContext, const void * pInCallFrame, ULONG ulCallFrameSize, + void ** ppvCoMemResponse, ULONG * pcbResponse) +{ + SPDBG_FUNC("SampleEngine - PrivateCallEx"); + HRESULT hr = S_OK; + + *ppvCoMemResponse = NULL; + *pcbResponse = 0; + + return hr; +} + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.h b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.h new file mode 100644 index 00000000..e77c9756 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.h @@ -0,0 +1,347 @@ +/****************************************************************************** +* srengobj.h +* This file contains the declaration of the CSrEngine class. +* This implements ISpSREngine and ISpObjectWithToken. +* This is the main recognition object +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#pragma once + +#include "stdafx.h" +#include "sreng.h" +#include "resource.h" + +// A list of reco contexts is stored. Each entry in the list is an instance of this class. +class CContext +{ +public: + CContext * m_pNext; + BOOL operator==(SPRECOCONTEXTHANDLE hContext) + { + return (m_hSapiContext == hContext); + } + + CContext(SPRECOCONTEXTHANDLE hSapiContext) : + m_hSapiContext(hSapiContext) + {} + + SPRECOCONTEXTHANDLE m_hSapiContext; // The reco context handle given by SAPI +}; + +// A list of reco grammars is stored. Each entry in the list is an instance of this class. +class CDrvGrammar +{ +public: + CDrvGrammar * m_pNext; + SPGRAMMARHANDLE m_hSapiGrammar; // The grammar handle given by SAPI + BOOL m_SLMLoaded; // Does the grammar have an associated SLM for dictation + BOOL m_SLMActive; // Is the dictation active + WCHAR* m_pWordSequenceText; // The text of the word sequence buffer if one is set + ULONG m_cchText; // The size of the word sequence buffer + SPTEXTSELECTIONINFO* m_pInfo; // The text selection of the word sequence buffer + + CDrvGrammar(SPGRAMMARHANDLE hSapiGrammar) : + m_hSapiGrammar(hSapiGrammar), + m_SLMLoaded(FALSE), + m_SLMActive(FALSE), + m_pWordSequenceText(NULL), + m_cchText(0), + m_pInfo(NULL) + { + } + + ~CDrvGrammar() + { + // Free up resources + //For each grammar object going to be released, SAPI would call SetWordSequenceData(NULL, 0, NULL). + //SetWordSequenceData and SetTextSelection would release the memories. + //There is no need to release memories referred by m_pWordSequenceText and m_pInfo here. + } + +#ifdef _WIN32_WCE + CDrvGrammar() + { + } + + static LONG Compare(const CDrvGrammar *, const CDrvGrammar *) + { + return 0; + } +#endif +}; + +// The RecognizeStream thread read audio data in blocks. For each block +// it decides if the data is speech or silence and adds that value to this queue. +// The decoder thread reads these and processes them. +// A critical section is used to make the queue thread-safe, and an event is used to +// show if the buffer has space or not. +// This very roughtly simulates the idea of doing features extraction on +// one thread and passes the feature stream to the decoder. +class CFrameQueue +{ +public: + BOOL m_aFrames[100]; // The queue of speech/silence values + ULONG m_cFrames; + ULONG m_ulHeadIndex; + HANDLE m_hSpaceAvailEvent; + CRITICAL_SECTION m_cs; + + CFrameQueue() + { + m_cFrames = 0; + m_ulHeadIndex = 0; + m_hSpaceAvailEvent = NULL; + InitializeCriticalSection(&m_cs); + } + ~CFrameQueue() + { + DeleteCriticalSection(&m_cs); + } + void SetSpaceAvailEvent(HANDLE h) + { + m_hSpaceAvailEvent = h; + } + void InsertTail(BOOL b) + { + EnterCriticalSection(&m_cs); + ULONG ulTailIndex = (m_ulHeadIndex + m_cFrames) % sp_countof(m_aFrames); + m_aFrames[ulTailIndex] = b; + m_cFrames++; + if (m_cFrames == sp_countof(m_aFrames)) + { + ResetEvent(m_hSpaceAvailEvent); + } + LeaveCriticalSection(&m_cs); + } + BOOL IsFull() + { + EnterCriticalSection(&m_cs); + BOOL b = (m_cFrames == sp_countof(m_aFrames)); + LeaveCriticalSection(&m_cs); + return b; + } + BOOL RemoveHead() + { + EnterCriticalSection(&m_cs); + BOOL b = m_aFrames[m_ulHeadIndex]; + m_ulHeadIndex = (m_ulHeadIndex + 1) % sp_countof(m_aFrames); + m_cFrames--; + SetEvent(m_hSpaceAvailEvent); + LeaveCriticalSection(&m_cs); + return b; + } + BOOL HasData() + { + EnterCriticalSection(&m_cs); + ULONG cFrames = m_cFrames; + LeaveCriticalSection(&m_cs); + return cFrames; + } +}; + + +// Class so we can use CSpBasicQueue to store rule information +class CRuleEntry +{ +public: + BOOL operator==(SPRULEHANDLE rh) + { + return (m_hRule == rh); + } + CRuleEntry * m_pNext; + SPRULEHANDLE m_hRule; // SAPI rule handle + BOOL m_fTopLevel; // Shows if rule can be activated + BOOL m_fActive; // Shows if rule is currectly active +}; + + + +// The main CSrEngine class + +class ATL_NO_VTABLE CSrEngine : + public CComObjectRootEx, + public CComCoClass, + public ISpSREngine, + public ISpObjectWithToken, + public ISpThreadTask +{ +public: + CSrEngine() : + m_ulNextGrammarIndex(0), + m_cActive(0), + m_bPhraseStarted(FALSE), + m_bSoundStarted(FALSE), + m_hQueueHasRoom(NULL), + m_hRequestSync(NULL), + m_LangID(0) + {} + +DECLARE_REGISTRY_RESOURCEID(IDR_SRENG) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CSrEngine) + COM_INTERFACE_ENTRY(ISpSREngine) + COM_INTERFACE_ENTRY(ISpObjectWithToken) +END_COM_MAP() + +private: + HANDLE m_hRequestSync; + CFrameQueue m_FrameQueue; + ULONG m_cBlahBlah; + CSpBasicQueue m_GrammarList; + CSpBasicQueue m_ContextList; + ULONG m_ulNextGrammarIndex; + ULONG m_cActive; + ULONGLONG m_ullStart; + ULONGLONG m_ullEnd; + BOOL m_bSoundStarted:1; + BOOL m_bPhraseStarted:1; + CComPtr m_cpSite; + CComPtr m_cpDecoderThread; + HANDLE m_hQueueHasRoom; + CSpBasicQueue m_RuleList; + CComPtr m_cpLexicon; + CComPtr m_cpEngineObjectToken; + CComPtr m_cpUserObjectToken; + LANGID m_LangID; + +public: + + HRESULT RandomlyWalkRule(SPRECORESULTINFO * pResult, ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize); + HRESULT RecurseWalk(SPSTATEHANDLE hState, SPPATHENTRY * pPath, ULONG * pcTrans); + HRESULT WalkCFGRule(SPRECORESULTINFO * pResult, ULONG cRulesActive, BOOL fHypothesis, + ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize); + HRESULT WalkSLM(SPRECORESULTINFO * pResult, ULONG cSLMActive, + ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize); + HRESULT WalkTextBuffer(void* pvGrammarCookie, SPPATHENTRY * pPath, SPTRANSITIONID hId, ULONG * pcTrans); + + HRESULT AddEvent(SPEVENTENUM eEvent, ULONGLONG ullStreamPos, WPARAM wParam = 0, LPARAM lParam = 0); + HRESULT AddEventString(SPEVENTENUM eEvent, ULONGLONG ulLStreamPos, const WCHAR * psz, WPARAM = 0); + + HRESULT CreatePhraseFromRule( CRuleEntry * pRule, BOOL fHypothesis, + ULONGLONG ullAudioPos, ULONG ulAudioSize, + ISpPhraseBuilder** ppPhrase ); + + CRuleEntry* FindRule( ULONG ulRuleIndex ); + CRuleEntry* NextRuleAlt( CRuleEntry * pPriRule, CRuleEntry * pLastRule ); + + void _CheckRecognition(); + void _NotifyRecognition(BOOL fHypothesis, ULONG nWords); + + // ATL contstructor / destructor + HRESULT FinalConstruct(); + HRESULT FinalRelease(); + + // Initialization methods + STDMETHODIMP SetObjectToken(ISpObjectToken * pToken); + STDMETHODIMP GetObjectToken(ISpObjectToken ** ppToken); + + STDMETHODIMP SetRecoProfile(ISpObjectToken * pProfileToken); + STDMETHODIMP SetSite(ISpSREngineSite *pSite); + STDMETHODIMP GetInputAudioFormat(const GUID * pSrcFormatId, const WAVEFORMATEX * pSrcWFEX, + GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWFEX); + + STDMETHODIMP OnCreateRecoContext(SPRECOCONTEXTHANDLE hSAPIRecoContext, void ** ppvDrvCtxt); + STDMETHODIMP OnDeleteRecoContext(void * pvDrvCtxt); + + STDMETHODIMP OnCreateGrammar(void * pvEngineRecoContext, + SPGRAMMARHANDLE hSAPIGrammar, + void ** ppvEngineGrammar); + + STDMETHODIMP OnDeleteGrammar(void * pvEngineGrammar); + + // CFG methods + STDMETHODIMP WordNotify(SPCFGNOTIFY Action, ULONG cWords, const SPWORDENTRY * pWords); + STDMETHODIMP RuleNotify(SPCFGNOTIFY Action, ULONG cRules, const SPRULEENTRY * pRules); + + // Proprietary grammar methods + // - used to implement an engine-specific grammar format + // - this sample does not implement these + STDMETHODIMP LoadProprietaryGrammar(void * pvEngineGrammar, + REFGUID rguidParam, + const WCHAR * pszStringParam, + const void * pvDataParam, + ULONG ulDataSize, + SPLOADOPTIONS Options) + { + return E_NOTIMPL; + } + + STDMETHODIMP UnloadProprietaryGrammar(void * pvEngineGrammar) + { + return E_NOTIMPL; + } + + STDMETHODIMP SetProprietaryRuleState(void * pvEngineGrammar, + const WCHAR * pszName, + void * pvReserved, + SPRULESTATE NewState, + ULONG * pcRulesChanged) + { + return E_NOTIMPL; + } + STDMETHODIMP SetProprietaryRuleIdState(void * pvEngineGrammar, + DWORD dwRuleId, + SPRULESTATE NewState) + { + return E_NOTIMPL; + } + + // Since this engine does not support proprietary grammars, we do not need to implement + // this method other than just returning S_OK. Note to implementors: Do NOT return + // E_NOTIMPL. Just return S_OK and ignore this data if you do not need it to implement + // proprietary grammars. + STDMETHODIMP SetGrammarState(void * pvEngineGrammar, SPGRAMMARSTATE eGrammarState) + { + return S_OK; + } + STDMETHODIMP SetContextState(void * pvEngineContxt, SPCONTEXTSTATE eCtxtState) + { + return S_OK; + } + + + // Dictation methods + STDMETHODIMP LoadSLM(void * pvEngineGrammar, const WCHAR * pszTopicName); + STDMETHODIMP UnloadSLM(void * pvEngineGrammar); + STDMETHODIMP SetSLMState(void * pvEngineGrammar, SPRULESTATE NewState); + + STDMETHODIMP IsPronounceable(void *pDrvGrammar, const WCHAR *pszWord, SPWORDPRONOUNCEABLE * pWordPronounceable); + STDMETHODIMP SetWordSequenceData(void * pvEngineGrammar, const WCHAR * pText, ULONG cchText, const SPTEXTSELECTIONINFO * pInfo); + STDMETHODIMP SetTextSelection(void * pvEngineGrammar, const SPTEXTSELECTIONINFO * pInfo); + STDMETHODIMP SetAdaptationData(void * pvEngineCtxtCookie, const WCHAR * pText, const ULONG cch); + + // Property methods + STDMETHODIMP SetPropertyNum( SPPROPSRC eSrc, void* pvSrcObj, const WCHAR* pName, LONG lValue ); + STDMETHODIMP GetPropertyNum( SPPROPSRC eSrc, void* pvSrcObj, const WCHAR* pName, LONG * plValue ); + STDMETHODIMP SetPropertyString( SPPROPSRC eSrc, void* pvSrcObj, const WCHAR* pName, const WCHAR* pValue ); + STDMETHODIMP GetPropertyString( SPPROPSRC eSrc, void* pvSrcObj, const WCHAR* pName, WCHAR** ppCoMemValue ); + + + // The main recognition method + STDMETHODIMP RecognizeStream(REFGUID rguidFmtId, const WAVEFORMATEX * pWaveFormatEx, + HANDLE hRequestSync, HANDLE hDataAvailable, + HANDLE hExit, BOOL fNewAudioStream, BOOL fRealTimeAudio, + ISpObjectToken * pAudioObjectToken); + + STDMETHODIMP PrivateCall(void * pvEngineContext, void * pCallFrame, ULONG ulCallFrameSize); + STDMETHODIMP PrivateCallEx(void * pvEngineContext, const void * pInCallFrame, ULONG ulCallFrameSize, + void ** ppvCoMemResponse, ULONG * pcbResponse); + + + // ISpThreadTask methods + STDMETHODIMP InitThread( void * pvTaskData, HWND hwnd ) + { + return S_OK; + } + LRESULT STDMETHODCALLTYPE WindowMessage( void *pvTaskData, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ) + { + return E_UNEXPECTED; + } + + STDMETHODIMP ThreadProc( void *pvTaskData, HANDLE hExitThreadEvent, HANDLE hNotifyEvent, HWND hwndWorker, volatile const BOOL * pfContinueProcessing ); +}; + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.cpp new file mode 100644 index 00000000..e5a8ea86 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.cpp @@ -0,0 +1,79 @@ +/****************************************************************************** +* srengui.cpp +* This file contains the implementation of the CSrEngineUI class. +* This implements ISpTokenUI. This is used by the app to display UI. +* The methods here can either be called by the app directly from ISpObjectToken, +* or they can be called from the reco instance, in which case the methods +* are able to make a private call back to the main engine object. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sreng.h" +#include "srengui.h" + +/**************************************************************************** +* CSrEngineUI::IsUISupported * +*----------------------------* +* Description: +* Determine if the UI is supported. A reference to the main SR engine +* object (if it has been created), can be obtained from punkObject. +* If none-NULL this may be an ISpRecoContext, from which an engine +* extension interface can be obtained. +* +* Return: +* S_OK on success +* E_INVALIDARG on invalid arguments +*****************************************************************************/ +STDMETHODIMP CSrEngineUI::IsUISupported(const WCHAR * pszTypeOfUI, void * pvExtraData, ULONG cbExtraData, IUnknown * punkObject, BOOL *pfSupported) +{ + *pfSupported = FALSE; + + // We can do both engine specific properties as well as default settings (defaults when punkObject == NULL) + if (wcscmp(pszTypeOfUI, SPDUI_EngineProperties) == 0) + *pfSupported = TRUE; + + // We can only do user training if we get passed an engine + if (wcscmp(pszTypeOfUI, SPDUI_UserTraining) == 0 && punkObject != NULL) + *pfSupported = TRUE; + + // We can only do mic training if we get passed an engine + if (wcscmp(pszTypeOfUI, SPDUI_MicTraining) == 0 && punkObject != NULL) + *pfSupported = TRUE; + + return S_OK; +} + +/**************************************************************************** +* CSrEngineUI::DisplayUI * +*------------------------* +* Description: +* Display the UI requested +* +* Return: +* S_OK on success +*****************************************************************************/ +STDMETHODIMP CSrEngineUI::DisplayUI(HWND hwndParent, const WCHAR * pszTitle, const WCHAR * pszTypeOfUI, void * pvExtraData, ULONG cbExtraData, ISpObjectToken * pToken, IUnknown * punkObject) +{ + + if (wcscmp(pszTypeOfUI, SPDUI_EngineProperties) == 0) + { + if (punkObject) + { + MessageBoxW(hwndParent, L"Developer Sample Engine: Replace this with real engine properties dialog.", pszTitle, MB_OK); + } + } + + if (wcscmp(pszTypeOfUI, SPDUI_UserTraining) == 0) + { + MessageBoxW(hwndParent, L"Developer Sample Engine: Replace this with real user training wizard / dialog.", pszTitle, MB_OK); + } + + if (wcscmp(pszTypeOfUI, SPDUI_MicTraining) == 0) + { + MessageBoxW(hwndParent, L"Developer Sample Engine: Replace this with real microphone training wizard / dialog.", pszTitle, MB_OK); + } + + return S_OK; +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.h b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.h new file mode 100644 index 00000000..af2f0ea1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.h @@ -0,0 +1,47 @@ +/****************************************************************************** +* srengui.cpp +* This file contains the declaration of the CSrEngineUI class. +* This implements ISpTokenUI. This is used by the app to display UI. +* The methods here can either be called by the app directly from ISpObjectToken, +* or they can be called from the reco instance, in which case the methods +* are able to make a private call back to the main engine object. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#pragma once + +#include "resource.h" + +class ATL_NO_VTABLE CSrEngineUI : + public CComObjectRootEx, + public CComCoClass, + public ISpTokenUI +{ +public: + + DECLARE_REGISTRY_RESOURCEID(IDR_SRENGUI) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CSrEngineUI) + COM_INTERFACE_ENTRY(ISpTokenUI) + END_COM_MAP() + +public: + + STDMETHODIMP IsUISupported( + const WCHAR * pszTypeOfUI, + void * pvExtraData, + ULONG cbExtraData, + IUnknown * punkObject, + BOOL *pfSupported); + STDMETHODIMP DisplayUI( + HWND hwndParent, + const WCHAR * pszTitle, + const WCHAR * pszTypeOfUI, + void * pvExtraData, + ULONG cbExtraData, + ISpObjectToken * pToken, + IUnknown * punkObject); +}; diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.rgs b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.rgs new file mode 100644 index 00000000..5710dc07 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SampleSrEngineUI.SampleSrEngineUI.1 = s 'Sample SR Engine Class' + { + CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + SampleSrEngineUI.SampleSrEngineUI = s 'Sample SR Engine Class' + { + CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + CurVer = s 'SampleSrEngineUI.SampleSrEngineUI.1' + } + NoRemove CLSID + { + ForceRemove {B84714C0-3BFD-405D-83C5-E9C486826AD5} = s 'SampleSrEngineUI Class' + { + ProgID = s 'SampleSrEngineUI.SampleSrEngineUI.1' + VersionIndependentProgID = s 'SampleSrEngineUI.SampleSrEngineUI' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{41B89B6C-9399-11D2-9623-00C04F8EE628}' + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengver.h b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengver.h new file mode 100644 index 00000000..9b1cabcf --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/srengver.h @@ -0,0 +1,78 @@ +/**************************************************************************** + * * + * VERSION.H -- Version information for internal builds * + * * + * This file is only modified by the official builder to update the * + * VERSION, VER_PRODUCTVERSION and VER_PRODUCTVERSION_STR values * + * * + * version.h is created on the fly from verhead.bat and vertail.h, * + * with the current version numbers inserted in between * + * * + ****************************************************************************/ + +#ifndef VER_H +/* ver.h defines constants needed by the VS_VERSION_INFO structure */ +//#include +#endif +#include +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "SR SAMPLE ENGINE 5" +#define VER_INTERNALNAME_STR "SRSAMPLEENG5" + +/*--------------------------------------------------------------*/ +/* the following entry should be phased out in favor of */ +/* VER_PRODUCTVERSION_STR, but is used in the shell today. */ +/*--------------------------------------------------------------*/ + + +/*--------------------------------------------------------------*/ +/* the following values should be modified by the official */ +/* builder for each build */ +/*--------------------------------------------------------------*/ + +#define VERSION "5.0" +#define VER_FILEVERSION_STR "5.0" +#define VER_FILEVERSION 5,0 +#define VER_PRODUCTVERSION_STR "5.0" +#define VER_PRODUCTVERSION 5,0 + +#define OFFICIAL 1 +#define FINAL 1 + +/*--------------------------------------------------------------*/ +/* the following section defines values used in the version */ +/* data structure for all files, and which do not change. */ +/*--------------------------------------------------------------*/ + +/* default is nodebug */ +#if _DEBUG +#define VER_DEBUG VS_FF_DEBUG +#else +#define VER_DEBUG 0 +#endif + +/* default is privatebuild */ +#ifndef OFFICIAL +#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD +#else +#define VER_PRIVATEBUILD 0 +#endif + +/* default is prerelease */ +#ifndef FINAL +#define VER_PRERELEASE VS_FF_PRERELEASE +#else +#define VER_PRERELEASE 0 +#endif + +#define VER_FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#define VER_FILEOS VOS_DOS_WINDOWS32 +#define VER_FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) + +#define VER_COMPANYNAME_STR "Microsoft Corporation\0" +#define VER_PRODUCTNAME_STR "Microsoft\256 Windows(TM) Operating System\0" +#define VER_LEGALTRADEMARKS_STR \ +"Microsoft\256 is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0" + +//#include "\sapi5\build\common.ver" diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.cpp new file mode 100644 index 00000000..5064c7ee --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.cpp @@ -0,0 +1,13 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.h new file mode 100644 index 00000000..9899f57a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.h @@ -0,0 +1,38 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__41B89B6F_9399_11D2_9623_00C04F8EE628__INCLUDED_) +#define AFX_STDAFX_H__41B89B6F_9399_11D2_9623_00C04F8EE628__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef STRICT +#define STRICT +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module + +extern CComModule _Module; +#include + +#include + +// Platform SDK needs to be installed for this sample because it #includes shfolder.h +#ifndef MAXULONG_PTR +#error This sample application requires a newer version of the Platform SDK than you have installed. +#endif // MAXULONG_PTR + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__41B89B6F_9399_11D2_9623_00C04F8EE628__INCLUDED) diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/SR/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/version.rc2 new file mode 100644 index 00000000..f1daef78 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/SR/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "TTS SAMPLE ENGINE 5\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TTSSAMPLEENG5\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "ttseng.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/anglais.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/anglais.wav new file mode 100644 index 00000000..4d251f75 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/anglais.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/as.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/as.wav new file mode 100644 index 00000000..52c44b6e Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/as.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/blah.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/blah.wav new file mode 100644 index 00000000..038ebad5 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/blah.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/computer_s.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/computer_s.wav new file mode 100644 index 00000000..22bbfeff Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/computer_s.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/default.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/default.wav new file mode 100644 index 00000000..460affdb Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/default.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/enter.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/enter.wav new file mode 100644 index 00000000..8dd947ae Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/enter.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/have.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/have.wav new file mode 100644 index 00000000..d63ad1ec Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/have.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/he.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/he.wav new file mode 100644 index 00000000..8928c1e7 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/he.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/here.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/here.wav new file mode 100644 index 00000000..1eb1ff05 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/here.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/je.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/je.wav new file mode 100644 index 00000000..7e061478 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/je.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.cpp new file mode 100644 index 00000000..29424b73 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.cpp @@ -0,0 +1,187 @@ +/****************************************************************************** +* mkvoice.cpp * +*-------------* +* This application assembles a simple voice font for the sample TTS engine. +*Copyright (c) Microsoft Corporation. All rights reserved. +* +******************************************************************************/ +#include "stdafx.h" +#include +#include + +int wmain(int argc, WCHAR* argv[]) +{ + USES_CONVERSION; + static const DWORD dwVersion = { 1 }; + ULONG ulNumWords = 0; + HRESULT hr = S_OK; + + //--- Check args + if( argc != 4 ) + { + printf( "%s", "Usage: > mkvoice [[in]word list file] [[out]voice file] [voice name]\n" ); + hr = E_INVALIDARG; + } + else + { + ::CoInitialize( NULL ); + + //--- Open word list file and create output voice file + //--- _wfopen is not supported on Win9x, so use fopen. + FILE* hWordList = fopen( W2A(argv[1]), "r" ); + FILE* hVoiceFile = fopen( W2A(argv[2]), "wb" ); + + if( hWordList && hVoiceFile ) + { + //--- Write file version and leave space for word count + if( !fwrite( &dwVersion, sizeof(dwVersion), 1, hVoiceFile ) || + fseek( hVoiceFile, 4, SEEK_CUR ) ) + { + hr = E_FAIL; + } + + //--- Get each entry + WCHAR WordFileName[MAX_PATH]; + while( SUCCEEDED( hr ) && fgetws( WordFileName, MAX_PATH, hWordList ) ) + { + ULONG ulTextLen = wcslen( WordFileName ); + if( WordFileName[ulTextLen-1] == '\n' ) + { + WordFileName[--ulTextLen] = NULL; + } + //--- Include NULL character when writing to the file + ulTextLen = (ulTextLen+1) * sizeof(WCHAR); + + if( fwrite( &ulTextLen, sizeof(ulTextLen), 1, hVoiceFile ) && + fwrite( WordFileName, ulTextLen, 1, hVoiceFile ) ) + { + ++ulNumWords; + //--- Open the wav data + ISpStream* pStream; + wcscat( WordFileName, L".wav" ); + hr = SPBindToFile( WordFileName, SPFM_OPEN_READONLY, &pStream ); + if( SUCCEEDED( hr ) ) + { + CSpStreamFormat Fmt; + Fmt.AssignFormat(pStream); + if( Fmt.ComputeFormatEnum() == SPSF_11kHz16BitMono ) + { + STATSTG Stat; + hr = pStream->Stat( &Stat, STATFLAG_NONAME ); + ULONG ulNumBytes = Stat.cbSize.LowPart; + + //--- Write the number of audio bytes + if( SUCCEEDED( hr ) && + fwrite( &ulNumBytes, sizeof(ulNumBytes), 1, hVoiceFile ) ) + { + BYTE* Buff = (BYTE*)alloca( ulNumBytes ); + if( SUCCEEDED( hr = pStream->Read( Buff, ulNumBytes, NULL ) ) ) + { + //--- Write the audio samples + if( !fwrite( Buff, 1, ulNumBytes, hVoiceFile ) ) + { + hr = E_FAIL; + } + } + } + else + { + hr = E_FAIL; + } + } + else + { + printf( "Input file: %s has wrong wav format.", WordFileName ); + } + pStream->Release(); + } + } + else + { + hr = E_FAIL; + } + } + } + else + { + hr = E_FAIL; + } + + //--- Write word count + if( SUCCEEDED( hr ) ) + { + if( fseek( hVoiceFile, sizeof(dwVersion), SEEK_SET ) || + !fwrite( &ulNumWords, sizeof(ulNumWords), 1, hVoiceFile ) ) + { + hr = E_FAIL; + } + } + + //--- Register the new voice file + // The section below shows how to programatically create a token for + // the new voice and set its attributes. + if( SUCCEEDED( hr ) ) + { + CComPtr cpToken; + CComPtr cpDataKeyAttribs; + hr = SpCreateNewTokenEx( + SPCAT_VOICES, + argv[3], + &CLSID_SampleTTSEngine, + L"Sample TTS Voice", + 0x409, + L"Sample TTS Voice", + &cpToken, + &cpDataKeyAttribs); + + //--- Set additional attributes for searching and the path to the + // voice data file we just created. + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Gender", L"Male"); + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Name", L"SampleTTSVoice"); + } + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Language", L"409"); + } + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Age", L"Adult"); + } + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Vendor", L"Microsoft"); + } + + //--- _wfullpath is not supported on Win9x, so use _fullpath. + CHAR szFullPath[MAX_PATH * 2]; + if (SUCCEEDED(hr) && _fullpath(szFullPath, W2A(argv[2]), sizeof(szFullPath)/sizeof(szFullPath[0])) == NULL) + { + hr = SPERR_NOT_FOUND; + } + + if (SUCCEEDED(hr)) + { + USES_CONVERSION; + hr = cpToken->SetStringValue(L"VoiceData", A2W(szFullPath)); + } + } + } + + //--- Cleanup + if( hWordList ) + { + fclose( hWordList ); + } + if( hVoiceFile ) + { + fclose( hVoiceFile ); + } + ::CoUninitialize(); + } + return FAILED( hr ); +} + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.dsp b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.dsp new file mode 100644 index 00000000..dad01263 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.dsp @@ -0,0 +1,125 @@ +# Microsoft Developer Studio Project File - Name="mkvoice" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=mkvoice - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "mkvoice.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "mkvoice.mak" CFG="mkvoice - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "mkvoice - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "mkvoice - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "mkvoice - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\ddk\include" /I "..\..\..\..\..\include" /I "..\..\..\..\..\..\ddk\include" /I "..\..\..\include" /I "..\\" /I "..\engines\tts" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib advapi32.lib ole32.lib uuid.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\..\lib\i386" +# Begin Special Build Tool +TargetDir=.\Release +SOURCE="$(InputPath)" +PostBuild_Desc=Build and register voice file +PostBuild_Cmds=$(TargetDir)\mkvoice.exe wordlist.txt SampleVoice.vce SampleTTSVoice +# End Special Build Tool + +!ELSEIF "$(CFG)" == "mkvoice - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\..\ddk\include" /I "..\..\..\..\..\include" /I "..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib advapi32.lib ole32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\..\lib\i386" +# Begin Special Build Tool +TargetDir=.\Debug +SOURCE="$(InputPath)" +PostBuild_Desc=Build and register voice file +PostBuild_Cmds=$(TargetDir)\mkvoice.exe wordlist.txt SampleVoice.vce SampleTTSVoice +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "mkvoice - Win32 Release" +# Name "mkvoice - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\mkvoice.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.rc b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.rc new file mode 100644 index 00000000..a9b4f346 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.rc @@ -0,0 +1 @@ +#include "version.rc2" \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/parler.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/parler.wav new file mode 100644 index 00000000..527c166f Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/parler.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/peut.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/peut.wav new file mode 100644 index 00000000..02635040 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/peut.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/said.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/said.wav new file mode 100644 index 00000000..9ac5ee40 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/said.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/sample.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/sample.wav new file mode 100644 index 00000000..34fb207f Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/sample.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/selected.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/selected.wav new file mode 100644 index 00000000..b7d76cae Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/selected.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/she.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/she.wav new file mode 100644 index 00000000..bef09513 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/she.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/speak.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/speak.wav new file mode 100644 index 00000000..45076ec8 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/speak.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/spoken.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/spoken.wav new file mode 100644 index 00000000..b48a9576 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/spoken.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.cpp new file mode 100644 index 00000000..7548ef01 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// mkvoice.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.h new file mode 100644 index 00000000..19b7e8cf --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.h @@ -0,0 +1,27 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__152AD93A_F366_47F7_B0EF_5E609435ECBB__INCLUDED_) +#define AFX_STDAFX_H__152AD93A_F366_47F7_B0EF_5E609435ECBB__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif // WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__152AD93A_F366_47F7_B0EF_5E609435ECBB__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/text.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/text.wav new file mode 100644 index 00000000..8ca94c51 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/text.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/the.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/the.wav new file mode 100644 index 00000000..92f36130 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/the.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/to.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/to.wav new file mode 100644 index 00000000..60d7c84e Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/to.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/tts.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/tts.wav new file mode 100644 index 00000000..f5aee2fc Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/tts.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/type.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/type.wav new file mode 100644 index 00000000..9f2b4ead Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/type.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/version.rc2 new file mode 100644 index 00000000..6bdb30f6 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Mkvoice Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "Mkvoice\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "Mkvoice.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/voice.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/voice.wav new file mode 100644 index 00000000..d05ae055 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/voice.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wish.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wish.wav new file mode 100644 index 00000000..c5080733 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wish.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wordlist.txt b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wordlist.txt new file mode 100644 index 00000000..43d12567 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wordlist.txt @@ -0,0 +1,19 @@ +blah +enter +spoken +type +the +text +you +wish +to +speak +here +as +computer_s +default +have +sample +selected +TTS +voice diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/you.wav b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/you.wav new file mode 100644 index 00000000..63992467 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/you.wav differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/SampleVoice.vce b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/SampleVoice.vce new file mode 100644 index 00000000..c1f4b960 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/SampleVoice.vce differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/resource.h b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/resource.h new file mode 100644 index 00000000..5a2aa4c6 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by TtsEng.rc +// +#define IDS_PROJNAME 100 +#define IDR_SAMPLETTSENGINE 101 +#define IDR_SAMPLEVOICEDATAOBJ 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.cpp new file mode 100644 index 00000000..68edaff4 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.cpp @@ -0,0 +1,14 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.h new file mode 100644 index 00000000..d52a3138 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.h @@ -0,0 +1,29 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED_) +#define AFX_STDAFX_H__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef STRICT +#define STRICT +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED) diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.cpp new file mode 100644 index 00000000..e59a0972 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.cpp @@ -0,0 +1,77 @@ +// TtsEng.cpp : Implementation of DLL Exports. +//Copyright (c) Microsoft Corporation. All rights reserved. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f msttsdrvps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "TtsEng.h" +#include "TtsEng_i.c" +#include "TtsEngObj.h" + + + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) + OBJECT_ENTRY( CLSID_SampleTTSEngine , CTTSEngObj ) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +#ifdef _WIN32_WCE +extern "C" BOOL WINAPI DllMain(HANDLE hInstance, ULONG dwReason, LPVOID) +#else +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +#endif +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_SAMPLETTSENGLib); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + + + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.def b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.def new file mode 100644 index 00000000..f15e16f5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.def @@ -0,0 +1,5 @@ +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.dsp b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.dsp new file mode 100644 index 00000000..69c01a98 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.dsp @@ -0,0 +1,168 @@ +# Microsoft Developer Studio Project File - Name="TtsEng" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=TtsEng - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ttseng.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ttseng.mak" CFG="TtsEng - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TtsEng - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TtsEng - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TtsEng - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "TtsEng___Win32_Debug_x86" +# PROP BASE Intermediate_Dir "TtsEng___Win32_Debug_x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\sdk\include" /I "..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\..\..\ddk\include" /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD MTL /I "..\..\..\..\..\ddk\idl" /I "..\..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Debug_x86 +TargetPath=.\Debug_x86\ttseng.dll +InputPath=.\Debug_x86\ttseng.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "TtsEng - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "TtsEng___Win32_Release_x86" +# PROP BASE Intermediate_Dir "TtsEng___Win32_Release_x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\..\..\ddk\include" /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\..\..\ddk\idl" /I "..\..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /dll /map /machine:I386 /libpath:"..\..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Release_x86 +TargetPath=.\Release_x86\ttseng.dll +InputPath=.\Release_x86\ttseng.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "TtsEng - Win32 Debug x86" +# Name "TtsEng - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TtsEng.cpp +# End Source File +# Begin Source File + +SOURCE=.\TtsEng.def +# End Source File +# Begin Source File + +SOURCE=.\TtsEng.idl +# ADD BASE MTL /I "..\..\..\sdk\idl" /tlb ".\TtsEng.tlb" /h "TtsEng.h" /iid "" /Oicf +# ADD MTL /I "..\..\..\sdk\idl" /tlb ".\TtsEng.tlb" /h "TtsEng.h" /iid "TtsEng_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\TtsEng.rc +# End Source File +# Begin Source File + +SOURCE=.\TtsEngObj.cpp +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TtsEngObj.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\TtsEngObj.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.idl b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.idl new file mode 100644 index 00000000..96de3a94 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.idl @@ -0,0 +1,49 @@ +/***************************************************************************** +* TtsEng.idl * +*------------* +* Description: +* This idl file is for the sample SAPI5 Text To Speech Engine. +*----------------------------------------------------------------------------- +* Creation: 09/17/99 +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +//--- Import base idl +import "oaidl.idl"; +import "ocidl.idl"; +import "sapiddk.idl"; + +//=== Forward References ====================================================== + +//=== Constants =============================================================== + +//=== Interface definitions =================================================== +typedef struct VOICEITEM +{ + LPCWSTR pText; + ULONG ulTextLen; + ULONG ulNumAudioBytes; + BYTE* pAudio; +} VOICEITEM; + + +//=== CoClass definitions ===================================================== +[ + uuid(7192AA2F-F759-43e9-91E7-226371EF6B2F), + version(1.0), + helpstring("Sample TTS Engine 1.0 Type Library") +] +library SAMPLETTSENGLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(A832755E-9C2A-40b4-89B2-3A92EE705852), + helpstring("SampleTTSEngine Class") + ] + coclass SampleTTSEngine + { + [default] interface ISpTTSEngine; + interface ISpObjectWithToken; + }; +}; diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.rc b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.rc new file mode 100644 index 00000000..b9173dc3 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.rc @@ -0,0 +1,91 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""TtsEng.tlb""\r\n" + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_SAMPLETTSENGINE REGISTRY DISCARDABLE "TtsEngObj.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "TtsEng" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "TtsEng.tlb" +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.cpp b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.cpp new file mode 100644 index 00000000..dc4e9cef --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.cpp @@ -0,0 +1,744 @@ +/******************************************************************************* +* TtsEngObj.cpp * +*---------------* +* Description: +* This module is the main implementation file for the CTTSEngObj class. +*------------------------------------------------------------------------------- +* Creation Date: 03/24/99 +* Copyright (c) Microsoft Corporation. All rights reserved. +* All Rights Reserved +* +*******************************************************************************/ + +//--- Additional includes +#include "stdafx.h" +#include "TtsEngObj.h" + +//--- Local + +/***************************************************************************** +* CTTSEngObj::FinalConstruct * +*----------------------------* +* Description: +* Constructor +*****************************************************************************/ +HRESULT CTTSEngObj::FinalConstruct() +{ + SPDBG_FUNC( "CTTSEngObj::FinalConstruct" ); + HRESULT hr = S_OK; + + //--- Init vars + m_hVoiceData = NULL; + m_pVoiceData = NULL; + m_pWordList = NULL; + m_ulNumWords = 0; + + return hr; +} /* CTTSEngObj::FinalConstruct */ + +/***************************************************************************** +* CTTSEngObj::FinalRelease * +*--------------------------* +* Description: +* destructor +*****************************************************************************/ +void CTTSEngObj::FinalRelease() +{ + SPDBG_FUNC( "CTTSEngObj::FinalRelease" ); + + delete m_pWordList; + + if( m_pVoiceData ) + { + ::UnmapViewOfFile( (void*)m_pVoiceData ); + } + + if( m_hVoiceData ) + { + ::CloseHandle( m_hVoiceData ); + } + +} /* CTTSEngObj::FinalRelease */ + +/***************************************************************************** +* CTTSEngObj::MapFile * +*---------------------* +* Description: +* Helper function used by SetObjectToken to map file. This function +* assumes that m_cpToken has been initialized. +*****************************************************************************/ +HRESULT CTTSEngObj::MapFile( const WCHAR * pszTokenVal, // Value that contains file path + HANDLE * phMapping, // Pointer to file mapping handle + void ** ppvData ) // Pointer to the data +{ + USES_CONVERSION; + HRESULT hr = S_OK; + CSpDynamicString dstrFilePath; + hr = m_cpToken->GetStringValue( pszTokenVal, &dstrFilePath ); + if ( SUCCEEDED( hr ) ) + { + bool fWorked = false; + *phMapping = NULL; + *ppvData = NULL; + HANDLE hFile; +#ifdef _WIN32_WCE + hFile = CreateFileForMapping( dstrFilePath, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL ); +#else + hFile = CreateFile( W2T(dstrFilePath), GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL ); +#endif + if (hFile != INVALID_HANDLE_VALUE) + { + *phMapping = ::CreateFileMapping( hFile, NULL, PAGE_READONLY, 0, 0, NULL ); + if (*phMapping) + { + *ppvData = ::MapViewOfFile( *phMapping, FILE_MAP_READ, 0, 0, 0 ); + if (*ppvData) + { + fWorked = true; + } + } + ::CloseHandle( hFile ); + } + if (!fWorked) + { + hr = HRESULT_FROM_WIN32(::GetLastError()); + if (*phMapping) + { + ::CloseHandle(*phMapping); + *phMapping = NULL; + } + } + } + return hr; +} /* CTTSEngObj::MapFile */ + +// +//=== ISpObjectWithToken Implementation ====================================== +// + +/***************************************************************************** +* CTTSEngObj::SetObjectToken * +*----------------------------* +* Description: +* This function performs the majority of the initialization of the voice. +* Once the object token has been provided, the filenames are read from the +* token key and the files are mapped. +*****************************************************************************/ +STDMETHODIMP CTTSEngObj::SetObjectToken(ISpObjectToken * pToken) +{ + SPDBG_FUNC( "CTTSEngObj::SetObjectToken" ); + HRESULT hr = SpGenericSetObjectToken(pToken, m_cpToken); + + //--- Map the voice data so it will be shared among all instances + // Note: This is a good example of how to memory map and share + // your voice data across instances. + if( SUCCEEDED( hr ) ) + { + hr = MapFile( L"VoiceData", &m_hVoiceData, &m_pVoiceData ); + } + + //--- Setup word list + // Note: This is specific to our example, you probably + // don't care much about this logic. + if( SUCCEEDED( hr ) ) + { + delete m_pWordList; + + //--- Check version + UNALIGNED DWORD* pdwPtr = (UNALIGNED DWORD*)m_pVoiceData; + if( *pdwPtr++ != 1 ) + { + //--- Bad voice file version + hr = E_INVALIDARG; + SPDBG_ASSERT(0); + } + + //--- Get number of words + if( SUCCEEDED( hr ) ) + { + m_ulNumWords = *pdwPtr++; + } + + //--- Build word list + m_pWordList = new VOICEITEM[m_ulNumWords]; + if( !m_pWordList ) + { + hr = E_OUTOFMEMORY; + } + else + { + for( ULONG i = 0; i < m_ulNumWords; ++i ) + { + ULONG ulTextByteLen = *pdwPtr++; + m_pWordList[i].pText = (UNALIGNED WCHAR*)pdwPtr; + m_pWordList[i].ulTextLen = (ulTextByteLen / sizeof(WCHAR)) - 1; + pdwPtr = (UNALIGNED DWORD*)(((BYTE*)pdwPtr) + ulTextByteLen); + m_pWordList[i].ulNumAudioBytes = *pdwPtr++; + m_pWordList[i].pAudio = (BYTE*)pdwPtr; + pdwPtr = (UNALIGNED DWORD*)(((BYTE*)pdwPtr) + m_pWordList[i].ulNumAudioBytes); + } + } + } + + return hr; +} /* CTTSEngObj::SetObjectToken */ + +// +//=== ISpTTSEngine Implementation ============================================ +// + +/***************************************************************************** +* CTTSEngObj::Speak * +*-------------------* +* Description: +* This is the primary method that SAPI calls to render text. +*----------------------------------------------------------------------------- +* Input Parameters +* +* pUser +* Pointer to the current user profile object. This object contains +* information like what languages are being used and this object +* also gives access to resources like the SAPI master lexicon object. +* +* dwSpeakFlags +* This is a set of flags used to control the behavior of the +* SAPI voice object and the associated engine. +* +* VoiceFmtIndex +* Zero based index specifying the output format that should +* be used during rendering. +* +* pTextFragList +* A linked list of text fragments to be rendered. There is +* one fragement per XML state change. If the input text does +* not contain any XML markup, there will only be a single fragment. +* +* pOutputSite +* The interface back to SAPI where all output audio samples and events are written. +* +* Return Values +* S_OK - This should be returned after successful rendering or if +* rendering was interrupted because *pfContinue changed to FALSE. +* E_INVALIDARG +* E_OUTOFMEMORY +* +*****************************************************************************/ +STDMETHODIMP CTTSEngObj::Speak( DWORD dwSpeakFlags, + REFGUID rguidFormatId, + const WAVEFORMATEX * pWaveFormatEx, + const SPVTEXTFRAG* pTextFragList, + ISpTTSEngineSite* pOutputSite ) +{ + SPDBG_FUNC( "CTTSEngObj::Speak" ); + HRESULT hr = S_OK; + + //--- Check args + if( SP_IS_BAD_INTERFACE_PTR( pOutputSite ) || + SP_IS_BAD_READ_PTR( pTextFragList ) ) + { + hr = E_INVALIDARG; + } + else + { + //--- Init some vars + m_pCurrFrag = pTextFragList; + m_pNextChar = m_pCurrFrag->pTextStart; + m_pEndChar = m_pNextChar + m_pCurrFrag->ulTextLen; + m_ullAudioOff = 0; + + //--- Parse + // We've supplied a simple word/sentence breaker just to show one + // way of walking the fragment list. It obviously doesn't deal with + // things like abreviations and expansion of numbers and dates. + CItemList ItemList; + + while( SUCCEEDED( hr ) && !(pOutputSite->GetActions() & SPVES_ABORT) ) + { + //--- Do skip? + if( pOutputSite->GetActions() & SPVES_SKIP ) + { + long lSkipCnt; + SPVSKIPTYPE eType; + hr = pOutputSite->GetSkipInfo( &eType, &lSkipCnt ); + if( SUCCEEDED( hr ) ) + { + //--- Notify SAPI how many items we skipped. We're returning zero + // because this feature isn't implemented. + hr = pOutputSite->CompleteSkip( 0 ); + } + } + + //--- Build the text item list + if( SUCCEEDED( hr ) && (hr = GetNextSentence( ItemList )) != S_OK ) + { + break; + } + + //--- We aren't going to do any part of speech determination, + // prosody, or pronunciation determination. If you were, one thing + // you will need is access to the SAPI lexicon. You can get that with + // the following call. + // CComPtr cpLexicon; + // hr = pUser->GetLexicon( &cpLexicon ); + + if( !(pOutputSite->GetActions() & SPVES_ABORT) ) + { + //--- Fire begin sentence event + CSentItem& FirstItem = ItemList.GetHead(); + CSentItem& LastItem = ItemList.GetTail(); + CSpEvent Event; + Event.eEventId = SPEI_SENTENCE_BOUNDARY; + Event.elParamType = SPET_LPARAM_IS_UNDEFINED; + Event.ullAudioStreamOffset = m_ullAudioOff; + Event.lParam = (LPARAM)FirstItem.ulItemSrcOffset; + Event.wParam = (WPARAM)LastItem.ulItemSrcOffset + + LastItem.ulItemSrcLen - + FirstItem.ulItemSrcOffset; + hr = pOutputSite->AddEvents( &Event, 1 ); + + //--- Output + if( SUCCEEDED( hr ) ) + { + hr = OutputSentence( ItemList, pOutputSite ); + } + } + } + + //--- S_FALSE just says that we hit the end, return okay + if( hr == S_FALSE ) + { + hr = S_OK; + } + } + + return hr; +} /* CTTSEngObj::Speak */ + +/***************************************************************************** +* CTTSEngObj::OutputSentence * +*----------------------------* +* This method is used to output an item list. +****************************************************************************/ +HRESULT CTTSEngObj::OutputSentence( CItemList& ItemList, ISpTTSEngineSite* pOutputSite ) +{ + HRESULT hr = S_OK; + ULONG WordIndex; + + //--- Lookup words in our voice + SPLISTPOS ListPos = ItemList.GetHeadPosition(); + while( ListPos && !(pOutputSite->GetActions() & SPVES_ABORT) ) + { + CSentItem& Item = ItemList.GetNext( ListPos ); + + //--- Process sentence items + switch( Item.pXmlState->eAction ) + { + //--- Speak some text --------------------------------------- + case SPVA_Speak: + { + //--- We don't say anything for punctuation or control characters + // in this sample. + if( iswalpha( Item.pItem[0] ) || iswdigit( Item.pItem[0] ) ) + { + //--- Lookup the word, if we can't find it just use the first one + for( WordIndex = 0; WordIndex < m_ulNumWords; ++WordIndex ) + { + if( ( m_pWordList[WordIndex].ulTextLen == Item.ulItemLen ) && + ( !wcsnicmp( m_pWordList[WordIndex].pText, Item.pItem, Item.ulItemLen )) ) + { + break; + } + } + if( WordIndex == m_ulNumWords ) + { + WordIndex = 0; + } + + //--- Queue the event + CSpEvent Event; + Event.eEventId = SPEI_WORD_BOUNDARY; + Event.elParamType = SPET_LPARAM_IS_UNDEFINED; + Event.ullAudioStreamOffset = m_ullAudioOff; + Event.lParam = Item.ulItemSrcOffset; + Event.wParam = Item.ulItemSrcLen; + hr = pOutputSite->AddEvents( &Event, 1 ); + + //--- Queue the audio data + hr = pOutputSite->Write( m_pWordList[WordIndex].pAudio, + m_pWordList[WordIndex].ulNumAudioBytes, + NULL ); + + //--- Update the audio offset + m_ullAudioOff += m_pWordList[WordIndex].ulNumAudioBytes; + } + } + break; + + //--- Output some silence for a pause ----------------------- + case SPVA_Silence: + { + BYTE Buff[1000]; + memset( Buff, 0, 1000 ); + ULONG NumSilenceBytes = Item.pXmlState->SilenceMSecs * 22; + + //--- Queue the audio data in chunks so that we can get + // interrupted if necessary. + while( !(pOutputSite->GetActions() & SPVES_ABORT) ) + { + if( NumSilenceBytes > 1000 ) + { + hr = pOutputSite->Write( Buff, 1000, NULL ); + NumSilenceBytes -= 1000; + } + else + { + hr = pOutputSite->Write( Buff, NumSilenceBytes, NULL ); + break; + } + } + + //--- Update the audio offset + m_ullAudioOff += NumSilenceBytes; + } + break; + + //--- Fire a bookmark event --------------------------------- + case SPVA_Bookmark: + { + //--- The bookmark is NOT a null terminated string in the Item, but we need + //--- to convert it to one. Allocate enough space for the string. + WCHAR * pszBookmark = (WCHAR *)_alloca((Item.ulItemLen + 1) * sizeof(WCHAR)); + memcpy(pszBookmark, Item.pItem, Item.ulItemLen * sizeof(WCHAR)); + pszBookmark[Item.ulItemLen] = 0; + //--- Queue the event + SPEVENT Event; + Event.eEventId = SPEI_TTS_BOOKMARK; + Event.elParamType = SPET_LPARAM_IS_STRING; + Event.ullAudioStreamOffset = m_ullAudioOff; + Event.lParam = (LPARAM)pszBookmark; + Event.wParam = _wtol(pszBookmark); + hr = pOutputSite->AddEvents( &Event, 1 ); + } + break; + + case SPVA_Pronounce: + //--- Our sample engine doesn't handle this. If it + // did, you would use the associated pronunciation in + // the XmlState structure instead of the lexicon. + break; + + case SPVA_ParseUnknownTag: + //--- This will reference an XML tag that is unknown to SAPI + // if your engine has private tags to control state, you + // would examine these tags and see if you recognize it. This + // would also be the point that you would make the rendering + // state change. + break; + } + } + + return hr; +} /* CTTSEngObj::OutputSentence */ + +/***************************************************************************** +* CTTSEngObj::GetVoiceFormat * +*----------------------------* +* Description: +* This method returns the output data format associated with the +* specified format Index. Formats are in order of quality with the best +* starting at 0. +*****************************************************************************/ +STDMETHODIMP CTTSEngObj::GetOutputFormat( const GUID * pTargetFormatId, const WAVEFORMATEX * pTargetWaveFormatEx, + GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx ) +{ + SPDBG_FUNC( "CTTSEngObj::GetVoiceFormat" ); + HRESULT hr = S_OK; + + hr = SpConvertStreamFormatEnum(SPSF_11kHz16BitMono, pDesiredFormatId, ppCoMemDesiredWaveFormatEx); + + return hr; +} /* CTTSEngObj::GetVoiceFormat */ + +// +//=== This code is just a simplified parser ================================== +// +/***************************************************************************** +* CTTSEngObj::GetNextSentence * +*-----------------------------* +* This method is used to create a list of items to be spoken. +****************************************************************************/ +HRESULT CTTSEngObj::GetNextSentence( CItemList& ItemList ) +{ + HRESULT hr = S_OK; + + //--- Clear the destination + ItemList.RemoveAll(); + + //--- Is there any work to do + if( m_pCurrFrag == NULL ) + { + hr = S_FALSE; + } + else + { + BOOL fSentDone = false; + BOOL fGoToNextFrag = false; + + while( m_pCurrFrag && !fSentDone ) + { + if( m_pCurrFrag->State.eAction == SPVA_Speak ) + { + fSentDone = AddNextSentItem( ItemList ); + + //--- Advance fragment? + if( m_pNextChar >= m_pEndChar ) + { + fGoToNextFrag = true; + } + } + else + { + //--- Add non spoken fragments + CSentItem Item; + Item.pItem = m_pCurrFrag->pTextStart; + Item.ulItemLen = m_pCurrFrag->ulTextLen; + Item.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset; + Item.ulItemSrcLen = Item.ulItemLen; + Item.pXmlState = &m_pCurrFrag->State; + ItemList.AddTail( Item ); + fGoToNextFrag = true; + } + + if( fGoToNextFrag ) + { + fGoToNextFrag = false; + m_pCurrFrag = m_pCurrFrag->pNext; + if( m_pCurrFrag ) + { + m_pNextChar = m_pCurrFrag->pTextStart; + m_pEndChar = m_pNextChar + m_pCurrFrag->ulTextLen; + } + else + { + m_pNextChar = NULL; + m_pEndChar = NULL; + } + } + } // end while + + if( ItemList.IsEmpty() ) + { + hr = S_FALSE; + } + } + return hr; +} /* CTTSEngObj::GetNextSentence */ + +/***************************************************************************** +* IsSpace * +*---------* +* Returns true if the character is a space, tab, carriage return, or line feed. +****************************************************************************/ +static BOOL IsSpace( WCHAR wc ) +{ + return ( ( wc == 0x20 ) || ( wc == 0x9 ) || ( wc == 0xD ) || ( wc == 0xA ) ); +} + +/***************************************************************************** +* SkipWhiteSpace * +*----------------* +* Returns the position of the next non-whitespace character. +****************************************************************************/ +static const WCHAR* SkipWhiteSpace( const WCHAR* pPos ) +{ + while( IsSpace( *pPos ) ) ++pPos; + return pPos; +} + +/***************************************************************************** +* FindNextToken * +*---------------* +* Locates the next space delimited token in the stream +****************************************************************************/ +static const WCHAR* + FindNextToken( const WCHAR* pStart, const WCHAR* pEnd, const WCHAR*& pNext ) +{ + const WCHAR* pPos = SkipWhiteSpace( pStart ); + pNext = pPos; + if( pNext == pEnd ) + { + pPos = NULL; + } + else + { + while( *pNext && !IsSpace( *pNext ) ) + { + if( ++pNext == pEnd ) + { + //--- This can happen when a text fragment is + // tight up against a following xml tag. + break; + } + } + } + return pPos; +} /* FindNextToken */ + +/***************************************************************************** +* SearchSet * +*-----------* +* Finds the character in the specified array. +****************************************************************************/ +BOOL SearchSet( WCHAR wc, const WCHAR* Set, ULONG Count, ULONG* pIndex ) +{ + for( ULONG i = 0; i < Count; ++i ) + { + if( wc == Set[i] ) + { + *pIndex = i; + return true; + } + } + return false; +} + +/***************************************************************************** +* CTTSEngObj::AddNextSentItem * +*-----------------------------* +* Locates the next sentence item in the stream and adds it to the list. +* Returns true if the last item added is the end of the sentence. +****************************************************************************/ +BOOL CTTSEngObj::AddNextSentItem( CItemList& ItemList ) +{ + //--- Get the token + ULONG ulIndex; + CSentItem Item; + Item.pItem = FindNextToken( m_pNextChar, m_pEndChar, m_pNextChar ); + + //--- This case can occur when we hit the end of a text fragment. + // Returning at this point will cause advancement to the next fragment. + if( Item.pItem == NULL ) + { + return false; + } + + const WCHAR* pTrailChar = m_pNextChar-1; + ULONG TokenLen = m_pNextChar - Item.pItem; + + //--- Split off leading punction if any + static const WCHAR LeadItems[] = { L'(', L'\"', L'{', L'\'', L'[' }; + while( TokenLen > 1 ) + { + if( SearchSet( Item.pItem[0], LeadItems, sp_countof(LeadItems), &ulIndex ) ) + { + CSentItem LItem; + LItem.pItem = Item.pItem; + LItem.ulItemLen = 1; + LItem.pXmlState = &m_pCurrFrag->State; + LItem.ulItemSrcLen = LItem.ulItemLen; + LItem.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset + + ( LItem.pItem - m_pCurrFrag->pTextStart ); + ItemList.AddTail( LItem ); + ++Item.pItem; + --TokenLen; + } + else + { + break; + } + } + + //--- Get primary item insert position + SPLISTPOS ItemPos = ItemList.AddTail( Item ); + + //--- Split off trailing punction if any. + static const WCHAR EOSItems[] = { L'.', L'!', L'?' }; + static const WCHAR TrailItems[] = { L',', L'\"', L';', L':', L')', L'}', L'\'', L']' }; + SPLISTPOS NextPos = NULL; + BOOL fIsEOS = false; + while( TokenLen > 1 ) + { + BOOL fAddTrailItem = false; + if( SearchSet( *pTrailChar, EOSItems, sp_countof(EOSItems), &ulIndex ) ) + { + fIsEOS = true; + fAddTrailItem = true; + } + else if( SearchSet( *pTrailChar, TrailItems, sp_countof(TrailItems), &ulIndex ) ) + { + fAddTrailItem = true; + } + + if( fAddTrailItem ) + { + CSentItem TItem; + TItem.pItem = pTrailChar; + TItem.ulItemLen = 1; + TItem.pXmlState = &m_pCurrFrag->State; + TItem.ulItemSrcLen = TItem.ulItemLen; + TItem.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset + + ( TItem.pItem - m_pCurrFrag->pTextStart ); + NextPos = ItemList.InsertAfter( ItemPos, TItem ); + --TokenLen; + --pTrailChar; + } + else + { + break; + } + } + + //--- Abreviation or sentence end? + // If we are at the end of the buffer then EOS is implied. + if( *m_pNextChar == NULL ) + { + fIsEOS = true; + if( !SearchSet( *(m_pNextChar-1), EOSItems, sp_countof(EOSItems), &ulIndex ) ) + { + //--- Terminate with a period if we are at the end of a buffer + // and no end of sentence punction has been added. + static const WCHAR* pPeriod = L"."; + CSentItem EOSItem; + EOSItem.pItem = pPeriod; + EOSItem.ulItemLen = 1; + EOSItem.pXmlState = &m_pCurrFrag->State; + EOSItem.ulItemSrcLen = EOSItem.ulItemLen; + EOSItem.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset + + ( (m_pNextChar-1) - m_pCurrFrag->pTextStart ); + ItemList.AddTail( EOSItem ); + } + } + else if( pTrailChar[1] == L'.' ) + { + //--- Here is where you would try to prove that it's not EOS + // It might be an abreviation. That's a hard problem that + // we are not going to attempt here. + } + + //--- Substitute underscore for apostrophe + for( ULONG i = 0; i < TokenLen; ++i ) + { + if( Item.pItem[i] == L'\'' ) + { + ((WCHAR)Item.pItem[i]) = L'_'; + } + } + + //--- Add the main item + if( TokenLen > 0 ) + { + Item.ulItemLen = TokenLen; + Item.pXmlState = &m_pCurrFrag->State; + Item.ulItemSrcLen = Item.ulItemLen; + Item.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset + + ( Item.pItem - m_pCurrFrag->pTextStart ); + ItemList.SetAt( ItemPos, Item ); + } + + return fIsEOS; +} /* CTTSEngObj::AddNextSentItem */ + diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.h b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.h new file mode 100644 index 00000000..6b28143f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.h @@ -0,0 +1,121 @@ +/****************************************************************************** +* 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 +#endif + +#ifndef SPCollec_h +#include +#endif + +#include "resource.h" + +//=== 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 CItemList; + +/*** CTTSEngObj COM object ******************************** +*/ +class ATL_NO_VTABLE CTTSEngObj : + public CComObjectRootEx, + public CComCoClass, + 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 ); + + + private: + /*--- Non interface methods ---*/ + HRESULT MapFile(const WCHAR * pszTokenValName, HANDLE * phMapping, void ** ppvData ); + HRESULT GetNextSentence( CItemList& ItemList ); + BOOL AddNextSentItem( CItemList& ItemList ); + HRESULT OutputSentence( CItemList& ItemList, ISpTTSEngineSite* pOutputSite ); + + /*=== Member Data ===*/ + private: + CComPtr 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 diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.rgs b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.rgs new file mode 100644 index 00000000..1cbef620 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.rgs @@ -0,0 +1,25 @@ +HKCR +{ + TtsEng.SampleTTSEngine.1 = s 'SampleTTSEngine Class' + { + CLSID = s '{A832755E-9C2A-40B4-89B2-3A92EE705852}' + } + TtsEng.SampleTTSEngine = s 'SampleTTSEngine Class' + { + CLSID = s '{A832755E-9C2A-40B4-89B2-3A92EE705852}' + CurVer = s 'TtsEng.SampleTTSEngine.1' + } + NoRemove CLSID + { + ForceRemove {A832755E-9C2A-40B4-89B2-3A92EE705852} = s 'SampleTTSEngine Class' + { + ProgID = s 'TtsEng.SampleTTSEngine.1' + VersionIndependentProgID = s 'TtsEng.SampleTTSEngine' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{7192AA2F-F759-43E9-91E7-226371EF6B2F}' + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengver.h b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengver.h new file mode 100644 index 00000000..8868ab9c --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengver.h @@ -0,0 +1,78 @@ +/**************************************************************************** + * * + * VERSION.H -- Version information for internal builds * + * * + * This file is only modified by the official builder to update the * + * VERSION, VER_PRODUCTVERSION and VER_PRODUCTVERSION_STR values * + * * + * version.h is created on the fly from verhead.bat and vertail.h, * + * with the current version numbers inserted in between * + * * + ****************************************************************************/ + +#ifndef VER_H +/* ver.h defines constants needed by the VS_VERSION_INFO structure */ +//#include +#endif +#include +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "TTS SAMPLE ENGINE 5" +#define VER_INTERNALNAME_STR "TTSSAMPLEENG5" + +/*--------------------------------------------------------------*/ +/* the following entry should be phased out in favor of */ +/* VER_PRODUCTVERSION_STR, but is used in the shell today. */ +/*--------------------------------------------------------------*/ + + +/*--------------------------------------------------------------*/ +/* the following values should be modified by the official */ +/* builder for each build */ +/*--------------------------------------------------------------*/ + +#define VERSION "5.0" +#define VER_FILEVERSION_STR "5.0" +#define VER_FILEVERSION 5,0 +#define VER_PRODUCTVERSION_STR "5.0" +#define VER_PRODUCTVERSION 5,0 + +#define OFFICIAL 1 +#define FINAL 1 + +/*--------------------------------------------------------------*/ +/* the following section defines values used in the version */ +/* data structure for all files, and which do not change. */ +/*--------------------------------------------------------------*/ + +/* default is nodebug */ +#if _DEBUG +#define VER_DEBUG VS_FF_DEBUG +#else +#define VER_DEBUG 0 +#endif + +/* default is privatebuild */ +#ifndef OFFICIAL +#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD +#else +#define VER_PRIVATEBUILD 0 +#endif + +/* default is prerelease */ +#ifndef FINAL +#define VER_PRERELEASE VS_FF_PRERELEASE +#else +#define VER_PRERELEASE 0 +#endif + +#define VER_FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#define VER_FILEOS VOS_DOS_WINDOWS32 +#define VER_FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) + +#define VER_COMPANYNAME_STR "Microsoft Corporation\0" +#define VER_PRODUCTNAME_STR "Microsoft\256 Windows(TM) Operating System\0" +#define VER_LEGALTRADEMARKS_STR \ +"Microsoft\256 is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0" + +//#include "\sapi5\build\common.ver" diff --git a/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/version.rc2 new file mode 100644 index 00000000..bf912a5a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Engines/TTS/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 0 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees0\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees0.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/chs_reco.rc b/mp/src/utils/sapi51/Samples/CPP/Reco/chs_reco.rc new file mode 100644 index 00000000..fd89ed43 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/chs_reco.rc @@ -0,0 +1,3 @@ +LANGUAGE 0x4, SUBLANG_NEUTRAL + +IDR_SOL_CFG SRGRAMMAR DISCARDABLE "chs_sol.cfg" diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/chs_sol.xml b/mp/src/utils/sapi51/Samples/CPP/Reco/chs_sol.xml new file mode 100644 index 00000000..a002e507 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Reco/chs_sol.xml differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/itn_j.xml b/mp/src/utils/sapi51/Samples/CPP/Reco/itn_j.xml new file mode 100644 index 00000000..db4dd994 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Reco/itn_j.xml differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/jpn_reco.rc b/mp/src/utils/sapi51/Samples/CPP/Reco/jpn_reco.rc new file mode 100644 index 00000000..ae1b47ac --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/jpn_reco.rc @@ -0,0 +1,8 @@ +LANGUAGE 0x11, SUBLANG_NEUTRAL + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_SOL_CFG SRGRAMMAR DISCARDABLE "jpn_sol.cfg" diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/jpn_sol.xml b/mp/src/utils/sapi51/Samples/CPP/Reco/jpn_sol.xml new file mode 100644 index 00000000..c43fb8d6 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Reco/jpn_sol.xml differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/lmadapt.cpp b/mp/src/utils/sapi51/Samples/CPP/Reco/lmadapt.cpp new file mode 100644 index 00000000..c3abf67b --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/lmadapt.cpp @@ -0,0 +1,361 @@ +/****************************************************************************** +* LMAdapt.cpp +* Language Model adaptation routines +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include + +/**************************************************************************** +* CRecoDlgClass::GetTextFile * +*----------------------------* +* +* Description: Load the content of a text file into a buffer. The +* buffer is converted into Unicode using the default +* engine codepage if it isn't already in Unicode. +* +* Return: Buffer and character count +* HRESULT hr; +* +****************************************************************************/ + +HRESULT CRecoDlgClass::GetTextFile( + WCHAR ** ppwszCoMem, + ULONG * pcch) +{ + TCHAR pszFileName[_MAX_PATH]; + OPENFILENAME ofn; + HRESULT hr = S_OK; + HANDLE hf = INVALID_HANDLE_VALUE; + DWORD cBytes; + BOOL fUnicodeFile = FALSE; + USHORT uTemp; + WCHAR * pwszCoMem = 0; + ULONG cch = 0; + DWORD dwRead; + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + + if (SUCCEEDED(hr)) + { + pszFileName[0] = 0; + + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hDlg; + ofn.hInstance = m_hInstance; + ofn.lpstrFilter = _T("Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0"); + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = pszFileName; + ofn.nMaxFile = _MAX_PATH; + ofn.nMaxFileTitle = _MAX_PATH; + ofn.lpstrFileTitle = NULL; + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = NULL; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; + ofn.lpstrDefExt = _T("txt"); + + hr = GetOpenFileName(&ofn) ? S_OK : E_FAIL; + } + + if (SUCCEEDED(hr)) + { + hf = CreateFile(pszFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + hr = (hf != INVALID_HANDLE_VALUE) ? S_OK : HRESULT_FROM_WIN32(CommDlgExtendedError()); + } + + if (SUCCEEDED(hr)) + { + cBytes = GetFileSize(hf, NULL); // 64K limit + + hr = (cBytes != -1) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + hr = ReadFile(hf, &uTemp, 2, &dwRead, NULL) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + fUnicodeFile = uTemp == 0xfeff; + + if (fUnicodeFile) + { + cBytes -= 2; + + pwszCoMem = (WCHAR *)CoTaskMemAlloc(cBytes); + + if (pwszCoMem) + { + hr = ReadFile(hf, pwszCoMem, cBytes, &dwRead, NULL) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + + cch = cBytes / sizeof(WCHAR); + } + else + { + hr = E_OUTOFMEMORY; + } + } + else + { + UINT uiCodePage = SpCodePageFromLcid(MAKELCID(m_langid, SORT_DEFAULT)); + + char * pszBuffer = (char *)malloc(cBytes); + + hr = pszBuffer ? S_OK : E_OUTOFMEMORY; + + if (SUCCEEDED(hr)) + { + SetFilePointer(hf, 0, NULL, FILE_BEGIN); // rewind + + hr = ReadFile(hf, pszBuffer, cBytes, &dwRead, NULL) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + cch = MultiByteToWideChar(uiCodePage, 0, pszBuffer, cBytes, NULL, NULL); + + if (cch) + { + pwszCoMem = (WCHAR *)CoTaskMemAlloc(sizeof(WCHAR) * cch); + } + else + { + hr = E_FAIL; + } + } + + if (SUCCEEDED(hr)) + { + MultiByteToWideChar(uiCodePage, 0, pszBuffer, cBytes, pwszCoMem, cch); + } + + if (pszBuffer) + { + free(pszBuffer); + } + } + } + + if (INVALID_HANDLE_VALUE != hf) + { + CloseHandle(hf); + } + + *ppwszCoMem = pwszCoMem; + *pcch = cch; + + return hr; +} + +/*************************************************************************************** +* CRecoDlgClass::FeedDocumentFromFile * +*-------------------------------------* +* Description: Open a text file and feed its content to the SR engine. +* Return: +* S_OK +* E_FAIL if no client window or if unsuccessful at obtaining the file name +****************************************************************************************/ + +HRESULT CRecoDlgClass::FeedDocumentFromFile() +{ + WCHAR * pwszCoMem = 0; + ULONG cch = 0; + + HRESULT hr = GetTextFile(&pwszCoMem, &cch); + + if (SUCCEEDED(hr)) + { + hr = FeedDocument(pwszCoMem, cch); + } + + return hr; +} + +/*************************************************************************************** +* CRecoDlgClass::FeedDocumentFromClipboard * +*------------------------------------------* +* Description: Take text from the clipboard and feed its content to the SR engine. +* Return: +* S_OK +* E_FAIL if neither CF_TEXT or CF_UNICODETEXT was available on the clipboard +****************************************************************************************/ + +HRESULT CRecoDlgClass::FeedDocumentFromClipboard() +{ + HRESULT hr; + UINT uFormat; + HANDLE hData; + BOOL fClipboardOpened = FALSE; + WCHAR * pwszCoMem; + ULONG cch; + + if (IsClipboardFormatAvailable(CF_UNICODETEXT)) + { + uFormat = CF_UNICODETEXT; + } + else if (IsClipboardFormatAvailable(CF_TEXT)) + { + uFormat = CF_TEXT; + } + else + { + uFormat = 0; + } + + if (uFormat) + { + hr = OpenClipboard(m_hDlg) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + else + { + hr = E_FAIL; + } + + if (SUCCEEDED(hr)) + { + fClipboardOpened = TRUE; + + hData = GetClipboardData(uFormat); + + hr = hData ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + VOID * pData = 0; + DWORD cBytes; + + if (CF_UNICODETEXT == uFormat) + { + cBytes = GlobalSize(hData); + + pwszCoMem = (WCHAR *)CoTaskMemAlloc(cBytes); + + if (pwszCoMem) + { + pData = GlobalLock(hData); + + hr = pData ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + else + { + hr = E_OUTOFMEMORY; + } + + if (SUCCEEDED(hr)) + { + memcpy(pwszCoMem, pData, cBytes); + + cch = cBytes / sizeof(WCHAR); + } + } + else + { + UINT uiCodePage = SpCodePageFromLcid(MAKELCID(m_langid, SORT_DEFAULT)); + + cBytes = GlobalSize(hData); + pData = GlobalLock(hData); + hr = pData ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + + if (SUCCEEDED(hr)) + { + cch = MultiByteToWideChar(uiCodePage, 0, (char *)pData, cBytes, NULL, NULL); + + hr = cch ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + pwszCoMem = (WCHAR *)CoTaskMemAlloc(cch * sizeof(WCHAR)); + + hr = pwszCoMem ? S_OK : E_OUTOFMEMORY; + } + + if (SUCCEEDED(hr)) + { + MultiByteToWideChar(uiCodePage, 0, (char *)pData, cBytes, pwszCoMem, cch); + } + } + + if (pData) + { + GlobalUnlock(hData); + } + } + + if (SUCCEEDED(hr)) + { + hr = FeedDocument(pwszCoMem, cch); + } + + if (fClipboardOpened) + { + CloseClipboard(); + } + + return hr; +} + +/*************************************************************************************** +* CRecoDlgClass::FeedDocument * +*-----------------------------* +* Description: Common code for FeedDocumentFromFile and FeedDocumentFromClipboard. +* Feed the text buffer to the SR engine. +* Return: +* S_OK +* E_* if error in SR engine +****************************************************************************************/ + +HRESULT CRecoDlgClass::FeedDocument(const WCHAR * pszCoMem, const ULONG cch) +{ + HRESULT hr = S_OK; + // + // NOTE: This function limits the size of the adaptation data to a maximum of 16K + // characters (32K bytes). This sample does NOT demonstrate the proper use + // of this method. Applcations that use SetAdaptationData should break the + // data into small (1K or less) blocks, call SetAdaptationData, and then wait + // for a SPEI_ADAPTATION event before sending the next small block of data. + // Note that calling SetAdapataionData with buffers larger than 32K can result + // in unpredictable results. Do NOT call this method with large buffers. + // + if (cch <= 16000) + { + hr = m_cpRecoCtxt->SetAdaptationData(pszCoMem, cch); + } + + CoTaskMemFree((void *)pszCoMem); + + return hr; +} + +/*************************************************************************************** +* CRecoDlgClass::TrainFromFile * +*------------------------------* +* Description: Load a text file, and launch the User Training wizard using this text. +* +* Return: +* S_OK +* E_* if error in SR engine +****************************************************************************************/ + +HRESULT CRecoDlgClass::TrainFromFile() +{ + WCHAR * pwszCoMem = 0; + ULONG cch = 0; + + HRESULT hr = GetTextFile(&pwszCoMem, &cch); + + if (SUCCEEDED(hr)) + { + hr = m_cpRecognizer->DisplayUI(m_hDlg, NULL, SPDUI_UserTraining, (void *)pwszCoMem, cch * sizeof(WCHAR)); + + CoTaskMemFree(pwszCoMem); + } + + return hr; +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/reco.cpp b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.cpp new file mode 100644 index 00000000..61926943 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.cpp @@ -0,0 +1,1957 @@ +/**************************************************************************** +* Reco.Cpp * +*----------* +* Description: +* This sample program is a basic speech recognition test tool. It is a +* dialog based Win32 application that uses ATL to help manage COM interface +* pointers. A basic understanding of the ATL CComPtr object will be useful +* when looking at this code. +* +* This tool allows the user to load and activate command and control +* grammars, activate a dictation grammar, turn the microphone and audio +* retention on and off, and examine the results of recognitions. +*Copyright (c) Microsoft Corporation. All rights reserved. +* +****************************************************************************/ + +#include "stdafx.h" +#define FT64(filetime) (*((LONGLONG*)&(filetime))) + +/**************************************************************************** +* WinMain * +*---------* +* Description: +* Main entry point for a Win32 application. This program simply initializes +* COM, constructs a CRecoDlg class object on the stack, and displays the dialog +* by calling DialogBoxParam. +* +* Returns: +* Always returns 0 +* +****************************************************************************/ + +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ +#ifdef _WIN32_WCE + if (SUCCEEDED(::CoInitializeEx(NULL,COINIT_MULTITHREADED))) +#else + if (SUCCEEDED(::CoInitialize(NULL))) +#endif + { + // NOTE: Extra scope provided so DlgClass is destroyed before CoUninitialize is called. + { + CRecoDlgClass DlgClass(hInstance); + ::DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_RECODLG), NULL, (DLGPROC)CRecoDlgClass::DlgProc, (LPARAM)&DlgClass); + } + ::CoUninitialize(); + } + return 0; +} + + +/**************************************************************************** +* Implementation of CRecoDlgClass +****************************************************************************/ + + +/**************************************************************************** +* CRecoDlgClass::DlgProc * +*------------------------* +* Description: +* This static member function is the message handler for the main appliation +* dialog. When the dialog is initialized via WM_INITDIALOG, the pointer to the +* CRecoDlgClass object is passed to this function in the lParam. This is stored +* in the USERDATA window long and used for subsequent message processing. +* +* Returns: +* Appropriate LRESULT for give window message +* +****************************************************************************/ + +LRESULT CALLBACK CRecoDlgClass::DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + CRecoDlgClass * pThis = (CRecoDlgClass *)::GetWindowLong(hDlg, GWL_USERDATA); + LRESULT lr = FALSE; + + switch (message) + { + case WM_INITDIALOG: + ::SetWindowLong(hDlg, GWL_USERDATA, lParam); + pThis = (CRecoDlgClass *)lParam; + lr = pThis->InitDialog(hDlg); + break; + + case WM_RECOEVENT: + pThis->RecoEvent(); + lr = TRUE; + break; + + case WM_HELP: + ::DialogBoxParam(pThis->m_hInstance, (LPCTSTR)IDD_DIALOG_BETAHELP, hDlg, (DLGPROC)BetaHelpDlgProc, NULL); + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDC_CHECK_CREATE) + { + pThis->UpdateRecoCtxtState(); + } + else if (LOWORD(wParam) == IDC_CHECK_MIC) + { + BOOL bIsChecked = (::SendDlgItemMessage( hDlg, IDC_CHECK_MIC, BM_GETCHECK, 0, 0 ) == BST_CHECKED); + if (bIsChecked) + { + pThis->m_cpRecognizer->SetRecoState( SPRST_ACTIVE ); + } + else + { + pThis->m_cpRecognizer->SetRecoState( SPRST_INACTIVE ); + } + } + else if (LOWORD(wParam) == IDM_FILE_EXIT || LOWORD(wParam) == IDCANCEL) + { + pThis->Cleanup(); + EndDialog(hDlg, 0); + lr = TRUE; + } + else if (LOWORD(wParam) == IDM_HELP) + { + ::DialogBoxParam(pThis->m_hInstance, (LPCTSTR)IDD_DIALOG_BETAHELP, hDlg, (DLGPROC)BetaHelpDlgProc, NULL); + } + else if (LOWORD(wParam) == IDM_CFG_LOAD_GRAMMAR) + { + pThis->SpecifyCAndCGrammar(); + } + else if (LOWORD(wParam) == IDM_CFG_SET_WORD_SEQUENCE_DATA) + { + pThis->SetWordSequenceData(); + } + else if (LOWORD(wParam) == IDC_EDIT_PARSETEXT) + { + BOOL bEnableSubmit = ::SendDlgItemMessage(hDlg, IDC_EDIT_PARSETEXT, WM_GETTEXTLENGTH, 0, 0); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_SUBMIT), bEnableSubmit); + } + else if (LOWORD(wParam) == IDC_BUTTON_SUBMIT) + { + TCHAR tszText[MAX_PATH]; + ::SendDlgItemMessage(hDlg, IDC_EDIT_PARSETEXT, WM_GETTEXT, sp_countof(tszText), (LPARAM)tszText); + if (tszText[0] != 0) + { + USES_CONVERSION; + pThis->EmulateRecognition(T2W(tszText)); + } + } + else if( LOWORD(wParam) == IDC_BUTTON_ALTERNATES ) + { + LONG item = ::SendDlgItemMessage(hDlg, IDC_LIST_PHRASES, LB_GETCURSEL, 0, 0); + CRecoDlgListItem * pli = NULL; + if (item != LB_ERR) + { + pli = (CRecoDlgListItem*)::SendDlgItemMessage(hDlg, IDC_LIST_PHRASES, LB_GETITEMDATA, item, 0); + } + if( pli ) + { + CAlternatesDlgClass AltDlg; + AltDlg.m_pResult = pli->GetRecoResult(); + if (AltDlg.m_pResult) + { + int RetVal = ::DialogBoxParam( pThis->m_hInstance, (LPCTSTR)IDD_ALTS_DIALOG, hDlg, + (DLGPROC)CAlternatesDlgClass::AlternatesDlgProc, + (LPARAM)&AltDlg ); + + //--- Draw the new item + if( RetVal == IDOK ) + { + CSpDynamicString dstrText; + AltDlg.m_pResult->GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, + TRUE, &dstrText, NULL ); + CRecoDlgListItem * pNewItem = + new CRecoDlgListItem( AltDlg.m_pResult, dstrText, pli->IsHypothesis() ); + int iNewPhrase = ::SendDlgItemMessage( hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pNewItem); + ::SendDlgItemMessage( hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + ::SendDlgItemMessage( hDlg, IDC_LIST_PHRASES, LB_DELETESTRING, iNewPhrase-1, 0); + pThis->UpdatePropWindow( pNewItem ); + } + } + } + lr = TRUE; + } + else if (LOWORD(wParam) == IDM_CFG_ADD_DYNAMIC_RULE && pThis->m_cpCFGGrammar) + { + CDynGrammarDlgClass DlgClass(pThis, &pThis->m_ItemList); + ::DialogBoxParam(pThis->m_hInstance, (LPCTSTR)IDD_DYNGRAMMARDLG, hDlg, (DLGPROC)CDynGrammarDlgClass::DlgProc, (LPARAM)&DlgClass); + lr = TRUE; + } + else if (LOWORD(wParam) == IDM_SLM_ADAPT_FROM_FILE) + { + lr = pThis->FeedDocumentFromFile(); + } + else if (LOWORD(wParam) == IDM_SLM_ADAPT_FROM_CLIPBOARD) + { + lr = pThis->FeedDocumentFromClipboard(); + } + else if (LOWORD(wParam) == IDM_SLM_TRAIN_FROM_FILE) + { + lr = pThis->TrainFromFile(); + } + else if (LOWORD(wParam) == IDC_RADIO_SHARED || + LOWORD(wParam) == IDC_RADIO_INPROC) + { + pThis->UpdateRecoCtxtState(); + } + else if (pThis->m_cpRecoCtxt) + { + HRESULT hr; + + if (HIWORD(wParam) == BN_CLICKED && + (LOWORD(wParam) == IDC_CHECK_CFG || + LOWORD(wParam) == IDC_CHECK_DICTATION || + LOWORD(wParam) == IDC_CHECK_DICTATION_ACTIVE || + LOWORD(wParam) == IDC_CHECK_CFG_ACTIVE || + LOWORD(wParam) == IDC_CHECK_SPELLING || + LOWORD(wParam) == IDC_CHECK_SPELLING_ACTIVE)) + { + hr = pThis->UpdateGrammarState(LOWORD(wParam)); + } + else if (LOWORD(wParam) == IDC_CHECK_RETAIN_AUDIO) + { + SPAUDIOOPTIONS Opts = SPAO_NONE; + if (::SendDlgItemMessage( hDlg, IDC_CHECK_RETAIN_AUDIO, BM_GETCHECK, 0, 0 ) == BST_CHECKED) + { + Opts = SPAO_RETAIN_AUDIO; + } + pThis->m_cpRecoCtxt->SetAudioOptions(Opts, NULL, NULL); + } + else if (LOWORD(wParam) == IDC_LIST_PHRASES) + { + WORD wNotify = HIWORD(wParam); + LONG item = ::SendDlgItemMessage(hDlg, IDC_LIST_PHRASES, LB_GETCURSEL, 0, 0); + CRecoDlgListItem * pli = NULL; + if (item != LB_ERR) + { + pli = (CRecoDlgListItem*)::SendDlgItemMessage(hDlg, IDC_LIST_PHRASES, LB_GETITEMDATA, item, 0); + } + if (wNotify == LBN_SELCHANGE) + { + pThis->UpdatePropWindow(pli); + } + else if (wNotify == LBN_DBLCLK && pli) + { + ISpRecoResult * pResult = pli->GetRecoResult(); + if (pResult) + { + if (FAILED(pli->GetRecoResult()->SpeakAudio(NULL, 0, SPF_ASYNC, NULL))) + { + CComPtr cpVoice; + pThis->m_cpRecoCtxt->GetVoice(&cpVoice); + if (cpVoice) + { + cpVoice->Speak(pli->GetText(), SPF_ASYNC, NULL); + } + } + } + } + } + } + break; + + case WM_DRAWITEM: + if (wParam == IDC_LIST_PHRASES) + { + LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam; + + const CRecoDlgListItem * pli = (const CRecoDlgListItem *)pdis->itemData; + + if (pli && pli->GetText()) + { + HGDIOBJ hfontOld = pThis->m_hfont ? SelectObject( pdis->hDC, pThis->m_hfont ) : NULL; + + CComPtr cpResult; + SPRECORESULTTIMES times; + UINT oldTextAlign = GetTextAlign(pdis->hDC); + UINT options = ETO_OPAQUE | ETO_CLIPPED; + + cpResult = pli->GetRecoResult(); + if (cpResult && cpResult->GetResultTimes(×) == S_OK) + { + FILETIME localtime; + SYSTEMTIME systime; + + if (FileTimeToLocalFileTime(×.ftStreamTime, &localtime) && + FileTimeToSystemTime(&localtime, &systime)) + { + TCHAR sztime[18]; + wsprintf(sztime, _T("[%2d:%02d:%02d.%03d] -"), + systime.wHour, systime.wMinute, systime.wSecond, systime.wMilliseconds); + SetTextAlign(pdis->hDC, TA_UPDATECP); + MoveToEx(pdis->hDC, pdis->rcItem.left, pdis->rcItem.top, NULL); + ExtTextOut(pdis->hDC, + pdis->rcItem.left, pdis->rcItem.top, + options, + &pdis->rcItem, + sztime, 16, + NULL); + options = ETO_CLIPPED; + } + } + + ExtTextOutW(pdis->hDC, + pdis->rcItem.left, pdis->rcItem.top, + options, + &pdis->rcItem, + pli->GetText(), pli->GetTextLength(), + NULL); + + if (pli->IsHypothesis()) + { + const WCHAR *pszHypothesis = L" [Hypothesis]"; + ExtTextOutW(pdis->hDC, + pdis->rcItem.left, pdis->rcItem.top, + options, + &pdis->rcItem, + pszHypothesis, wcslen(pszHypothesis), + NULL); + } + + SetTextAlign(pdis->hDC, oldTextAlign); + + if (hfontOld) + { + SelectObject(pdis->hDC, hfontOld); + } + } + } + break; + + case WM_DELETEITEM: + if (wParam == IDC_LIST_PHRASES) + { + CRecoDlgListItem * pli = (CRecoDlgListItem *)((DELETEITEMSTRUCT *)lParam)->itemData; + delete pli; + lr = TRUE; + } + break; + + } + + return lr; +} + +/**************************************************************************** +* CRecoDlgClass::ConstructRuleDisplay * +*-------------------------------------* +* Description: +* Given the SPPHRASERULE obtained from the parsed result object, +* writes the tree for the rules into dstr. +* Calls itself recursively for sub-rules. +* Returns: +* S_OK +****************************************************************************/ + +HRESULT CRecoDlgClass::ConstructRuleDisplay(const SPPHRASERULE *pRule, CSpDynamicString &dstr, ULONG ulLevel) +{ + SPDBG_FUNC("CRecoDlgClass::ConstructRuleDisplay"); + HRESULT hr = S_OK; + + USES_CONVERSION; + TCHAR szText[256]; + + // construct indent + while(SUCCEEDED(hr) && pRule) + { + wsprintf(szText, _T(" [%2d, %2d] "), pRule->ulFirstElement, pRule->ulFirstElement + pRule->ulCountOfElements); + for (ULONG i = 0; i < ulLevel; i++) + { + dstr.Append(L"\t"); + } + if (pRule->pszName) + { + if (wcslen(pRule->pszName) > 240) + { + dstr.Append(L"\"(Rule name too long)\" = \""); + } + else + { + WCHAR *pwszRuleName = wcsdup( pRule->pszName ); + if ( pwszRuleName ) + { + wsprintf(szText, _T("%s \"%s\" (%d)"), szText, W2T(pwszRuleName), pRule->ulId); + dstr.Append(T2W(szText)); + + free( pwszRuleName ); + } + else + { + hr = E_OUTOFMEMORY; + } + } + } + else + { + dstr.Append(L"\"(UNK)\" = \""); + } + dstr.Append(L"\r\n"); + if (pRule->pFirstChild && SUCCEEDED(hr)) + { + hr = ConstructRuleDisplay(pRule->pFirstChild, dstr, ulLevel + 1); + } + pRule = pRule->pNextSibling; + } + return hr; +} + +/**************************************************************************** +* CRecoDlgClass::ConstructPropertyDisplay * +*-----------------------------------------* +* Description: +* Given the SPPHRASEPROPERTY obtained from the parsed result object, +* writes the property tree into dstr. +* Calls itself recursively for sub-properties. +* Returns: +* S_OK +****************************************************************************/ + +HRESULT CRecoDlgClass::ConstructPropertyDisplay(const SPPHRASEELEMENT *pElem, const SPPHRASEPROPERTY *pProp, + CSpDynamicString & dstr, ULONG ulLevel) +{ + SPDBG_FUNC("CRecoDlgClass::ConstructPropertyDisplay"); + HRESULT hr = S_OK; + USES_CONVERSION; + TCHAR szText[256]; + + // construct indent + while(SUCCEEDED(hr) && pProp) + { + wsprintf(szText, _T(" [%2d, %2d] "), pProp->ulFirstElement, pProp->ulCountOfElements ? pProp->ulFirstElement + pProp->ulCountOfElements-1 : 0); + dstr.Append(T2W(szText)); + for (ULONG i = 0; i < ulLevel; i++) + { + dstr.Append(L"\t"); + } + if (pProp->pszName) + { + if (wcslen(pProp->pszName) > 240) + { + dstr.Append(L"\"(Rule name too long)\" = \""); + } + else + { + WCHAR *pwszPropName = wcsdup( pProp->pszName ); + if ( pwszPropName ) + { + wsprintf(szText, _T("\"%s\" = \""), W2T(pwszPropName)); + dstr.Append(T2W(szText)); + + free( pwszPropName ); + } + else + { + dstr.Append(L"Out of memory" ); + } + } + } + else + { + dstr.Append(L"\"(UNK)\" = \""); + } + if (!pProp->pszValue) + { + // construct the value from the elements! + ULONG ulEndElement = pProp->ulFirstElement + pProp->ulCountOfElements; + for (ULONG j = pProp->ulFirstElement; j < ulEndElement; j++) + { + if (j+1 < ulEndElement) + { + dstr.Append2(pElem[j].pszDisplayText, L" "); + } + else + { + dstr.Append(pElem[j].pszDisplayText); + } + } + } + else + { + dstr.Append(pProp->pszValue); + } + + if (pProp->vValue.vt != VT_EMPTY) + { + CComVariant cv = pProp->vValue; + cv.ChangeType(VT_BSTR); + wsprintf(szText, _T("\" (%d = %s)"), pProp->ulId, W2T(cv.bstrVal)); + } + else + { + wsprintf(szText, _T("\" (%d)"), pProp->ulId); + } + dstr.Append2(T2W(szText), L"\r\n"); + if (pProp->pFirstChild) + { + hr = ConstructPropertyDisplay(pElem, pProp->pFirstChild, dstr, ulLevel + 1); + } + pProp = pProp->pNextSibling; + } + return hr; +} + + +/**************************************************************************** +* CRecoDlgClass::UpdatePropWindow * +*---------------------------------* +* Description: +* Updates the contents of the property status window to contain a full +* text dump of the result list item pointed to by pli. If a NULL is passed +* to this method, the property window will be cleared. +* +* Returns: +* TRUE if property window was updated +* FALSE if it was not +* +****************************************************************************/ + +BOOL CRecoDlgClass::UpdatePropWindow(const CRecoDlgListItem * pli) +{ + BOOL fOK = FALSE; + + HWND hwndStatus = ::GetDlgItem(m_hDlg, IDC_STATUS); + ISpPhrase * pPhrase = pli ? pli->GetRecoResult() : NULL; + SPPHRASE *pElements; + + if (pli && pPhrase && SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + USES_CONVERSION; + TCHAR szText[256]; + + CSpDynamicString dstr; + + if (pElements->Rule.pszName || pElements->Rule.ulId) + { + WCHAR *pwszRuleName = NULL; + if ( pElements->Rule.pszName ) + { + pwszRuleName = wcsdup( pElements->Rule.pszName ); + } + else + { + pwszRuleName = wcsdup( L"" ); + } + + if ( pwszRuleName ) + { + wsprintf(szText, _T("RULE=\"%s\" (%05d)\r\n\r\n"), W2T(pwszRuleName), pElements->Rule.ulId); + dstr.Append(T2W(szText)); + dstr.Append(pli->GetText()); + + free( pwszRuleName ); + } + else + { + dstr.Append( L"Out of memory" ); + } + } + else + { + dstr = L"DICTATION\r\n\r\n"; + CSpDynamicString dstrText; + pPhrase->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dstrText, NULL); + dstr.Append(dstrText); + } + dstr.Append(L"\r\n"); + // Display the overall confidence. This is specified on a per-rule basis. + // However, the top rule contains everything and hence is the phrase confidence. + wsprintf(szText, _T("\r\nOverall confidence = %i.\r\n"), pElements->Rule.Confidence); + dstr.Append(T2W(szText)); + if (pElements->pProperties) + { + dstr.Append(L"\r\nPROPERTIES:\r\n"); + ConstructPropertyDisplay(pElements->pElements, pElements->pProperties, dstr, 0); + dstr.Append(L"\r\n"); + } + + dstr.Append(L"\r\nPARSE TREE:\r\n"); + ConstructRuleDisplay(&pElements->Rule, dstr, 0); + + dstr.Append(L"\r\nELEMENTS:\r\n"); + for (ULONG i = 0; i < pElements->Rule.ulCountOfElements; i++) + { + WCHAR wszIntPhone[SP_MAX_PRON_LENGTH]; + wszIntPhone[0] = L'\0'; + if ( pElements->pElements[i].pszPronunciation ) + { + m_cpPhoneConv->IdToPhone(pElements->pElements[i].pszPronunciation, wszIntPhone); + } + + WCHAR *pwszDisplayText = wcsdup( pElements->pElements[i].pszDisplayText ); + wsprintf(szText, _T(" <%u - %u> \"%s\" %c(%c) {%S}\r\n"), + pElements->pElements[i].ulAudioStreamOffset, + pElements->pElements[i].ulAudioStreamOffset + pElements->pElements[i].ulAudioSizeBytes, + pwszDisplayText ? W2T(pwszDisplayText) : _T("(out of memory)"), + ConfidenceGroupChar(pElements->pElements[i].ActualConfidence), + ConfidenceGroupChar(pElements->pElements[i].RequiredConfidence), + wszIntPhone); + if ( pwszDisplayText ) + { + free( pwszDisplayText ); + } + dstr.Append(T2W(szText)); + } + + ::CoTaskMemFree(pElements); + + SPRECORESULTTIMES times; + pli->GetRecoResult()->GetResultTimes(×); + + DWORD dwTickEnd = times.dwTickCount + (DWORD)(times.ullLength / 10000); + DWORD dwTickNow = GetTickCount(); + + wsprintf(szText, _T("GetTickCount latency = (%u - %u) = %dms\r\n"), dwTickNow, dwTickEnd, dwTickNow - dwTickEnd); + ATLTRACE(szText); + dstr.Append(T2W(szText)); + + ATLTRACE(L"\r\n"); + + ::SendMessage(hwndStatus, WM_SETTEXT, 0, (LPARAM)W2T(dstr)); + + fOK = TRUE; + } + else + { + ::SendMessage(hwndStatus, WM_SETTEXT, 0, (LPARAM)TEXT("")); + } + + return fOK; +} + + +/**************************************************************************** +* CRecoDlgClass::UpdateGrammarState * +*-----------------------------------* +* Description: +* This method is called whenever a check box state has changed to update +* the state of grammars. It will create or release m_cpCFGGrammar and +* m_cpDictationGrammar and activate or deactivate either of them. +* +* If at any point during this function, a SAPI call fails, the state of +* the application will be reset. +* +* Returns: +* S_OK, or failed HRESULT from SAPI calls made below +* +****************************************************************************/ + +HRESULT CRecoDlgClass::UpdateGrammarState(WORD wIdChanged) +{ + #ifdef _DEBUG + static BOOL fInUpdate = FALSE; + _ASSERTE(!fInUpdate); + fInUpdate = TRUE; + #endif // _DEBUG + + HRESULT hr = S_OK; + + if (m_cpRecoCtxt) // only if there is a recognition context + { + BOOL fActivateCFG = ::SendDlgItemMessage(m_hDlg, IDC_CHECK_CFG_ACTIVE, BM_GETCHECK, 0, 0); + BOOL fActivateDictation = ::SendDlgItemMessage(m_hDlg, IDC_CHECK_DICTATION_ACTIVE, BM_GETCHECK, 0, 0); + BOOL fLoadDictation = ::SendDlgItemMessage( m_hDlg, IDC_CHECK_DICTATION, BM_GETCHECK, 0, 0 ); + BOOL fLoadCFG = ::SendDlgItemMessage( m_hDlg, IDC_CHECK_CFG, BM_GETCHECK, 0, 0 ); + BOOL fActivateSpelling = ::SendDlgItemMessage(m_hDlg, IDC_CHECK_SPELLING_ACTIVE, BM_GETCHECK, 0, 0); + BOOL fLoadSpelling = ::SendDlgItemMessage( m_hDlg, IDC_CHECK_SPELLING, BM_GETCHECK, 0, 0 ); + SPSTATEHANDLE hDynRule = NULL; + + // Force the pair of checks to be in sync. If the ID is 0 then no checkbox + // has changed state, so we don't have to do anything. + WORD wIdToUpdate = 0; + WPARAM NewState; + switch (wIdChanged) + { + case IDC_CHECK_CFG: + if ((!fLoadCFG) && fActivateCFG) + { + fActivateCFG = FALSE; + wIdToUpdate = IDC_CHECK_CFG_ACTIVE; + NewState = BST_UNCHECKED; + } + break; + case IDC_CHECK_DICTATION: + if ((!fLoadDictation) && fActivateDictation) + { + fActivateDictation = FALSE; + wIdToUpdate = IDC_CHECK_DICTATION_ACTIVE; + NewState = BST_UNCHECKED; + } + break; + case IDC_CHECK_SPELLING: + if ((!fLoadSpelling) && fActivateSpelling) + { + fActivateSpelling = FALSE; + wIdToUpdate = IDC_CHECK_SPELLING_ACTIVE; + NewState = BST_UNCHECKED; + } + break; + case IDC_CHECK_CFG_ACTIVE: + if (fActivateCFG && (!fLoadCFG)) + { + fLoadCFG = TRUE; + wIdToUpdate = IDC_CHECK_CFG; + NewState = BST_CHECKED; + } + break; + case IDC_CHECK_DICTATION_ACTIVE: + if (fActivateDictation && (!fLoadDictation)) + { + fLoadDictation = TRUE; + wIdToUpdate = IDC_CHECK_DICTATION; + NewState = BST_CHECKED; + } + break; + case IDC_CHECK_SPELLING_ACTIVE: + if (fActivateSpelling && (!fLoadSpelling)) + { + fLoadSpelling = TRUE; + wIdToUpdate = IDC_CHECK_SPELLING; + NewState = BST_CHECKED; + } + break; + } + if (wIdToUpdate) + { + ::SendDlgItemMessage(m_hDlg, wIdToUpdate, BM_SETCHECK, NewState, 0); + } + + // + // Now load the appropriate grammar(s)... + // + UINT uiErrorMessageID = 0; + if (fLoadCFG) + { + if (!m_cpCFGGrammar) + { + // + // If the first char of m_szGrammarFile is 0 then load the solitaire grammar + // from our resource. Otherwise, load the grammar from the file. + // + hr = m_cpRecoCtxt->CreateGrammar(MYGRAMMARID, &m_cpCFGGrammar); + + if (*m_szGrammarFile) + { + USES_CONVERSION; + if (SUCCEEDED(hr)) + { + hr = m_cpCFGGrammar->LoadCmdFromFile(T2W(m_szGrammarFile), SPLO_DYNAMIC); + } + } + else + { + // Need a method of determining the language id of the grammar resource we + // want to load. This is dependent solely on the primary language of the engine the + // user has selected. Hence, the resources are labelled 'Primary', SUBLANG_NEUTRAL + // and we use the primary language id of the engine to do the LoadCmdFromResource. + hr = m_cpCFGGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_SOL_CFG), + L"SRGRAMMAR", MAKELANGID(PRIMARYLANGID(m_langid), SUBLANG_NEUTRAL), SPLO_DYNAMIC); + } + + // Load dynamic rules, if any. + if (SUCCEEDED(hr) && m_ItemList.GetHead()) + { + hr = m_cpCFGGrammar->GetRule(g_szDynRuleName, NULL, SPRAF_TopLevel | SPRAF_Dynamic, TRUE, &hDynRule); + if (SUCCEEDED(hr)) + { + CDynItem *pItem = m_ItemList.GetHead(); + while (pItem && SUCCEEDED(hr)) + { + hr = m_cpCFGGrammar->AddWordTransition(hDynRule, NULL, pItem->m_dstr, L" ", SPWT_LEXICAL, 1.0, NULL); + pItem = m_ItemList.GetNext(pItem); + } + + if (SUCCEEDED(hr)) + hr = m_cpCFGGrammar->Commit(0); + } + } + } + } + else + { + ::SendDlgItemMessage(m_hDlg, IDC_CHECK_CFG_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0); + m_cpCFGGrammar.Release(); + m_cpCFGVoice.Release(); + } + + if (SUCCEEDED(hr)) + { + if (fLoadDictation) + { + if (!m_cpDictationGrammar) + { + hr = m_cpRecoCtxt->CreateGrammar(MYGRAMMARID, &m_cpDictationGrammar); + + if (SUCCEEDED(hr)) + { + hr = m_cpDictationGrammar->LoadDictation(NULL, SPLO_STATIC); + } + } + } + else + { + ::SendDlgItemMessage(m_hDlg, IDC_CHECK_DICTATION_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0); + m_cpDictationGrammar.Release(); + } + } + + if (SUCCEEDED(hr)) + { + if (fLoadSpelling) + { + if (!m_cpSpellingGrammar) + { + hr = m_cpRecoCtxt->CreateGrammar(MYGRAMMARID, &m_cpSpellingGrammar); + if (SUCCEEDED(hr)) + { + hr = m_cpSpellingGrammar->LoadDictation(SPTOPIC_SPELLING, SPLO_STATIC); + if (FAILED(hr)) + { + m_cpSpellingGrammar.Release(); + } + } + } + } + else + { + ::SendDlgItemMessage(m_hDlg, IDC_CHECK_SPELLING_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0); + m_cpSpellingGrammar.Release(); + } + } + + // If we've failed by now, it's a grammar load failure + if ( FAILED( hr ) ) + { + uiErrorMessageID = IDS_GRAMMAR_LOAD_FAIL; + } + + if (SUCCEEDED(hr) && m_cpCFGGrammar) + { + hr = m_cpCFGGrammar->SetRuleState(NULL, NULL, fActivateCFG ? SPRS_ACTIVE : SPRS_INACTIVE); + + if (SUCCEEDED(hr) && hDynRule) + { + hr = m_cpCFGGrammar->SetRuleState(g_szDynRuleName, NULL, fActivateCFG ? SPRS_ACTIVE : SPRS_INACTIVE); + } + } + + if (SUCCEEDED(hr) && m_cpDictationGrammar) + { + hr = m_cpDictationGrammar->SetDictationState(fActivateDictation ? SPRS_ACTIVE : SPRS_INACTIVE); + } + + if (SUCCEEDED(hr) && m_cpSpellingGrammar) + { + hr = m_cpSpellingGrammar->SetDictationState(fActivateSpelling ? SPRS_ACTIVE : SPRS_INACTIVE); + } + + // If we have failed here, but the grammar load succeeded, then it's a + // SetRuleState/SetDictationState failure + if ( FAILED( hr ) && (0 == uiErrorMessageID) ) + { + if ( SPERR_DEVICE_BUSY == hr ) + { + uiErrorMessageID = IDS_DEVICE_BUSY; + } + else + { + uiErrorMessageID = IDS_RULESTATE_FAIL; + } + } + + if (SUCCEEDED(hr)) + { + HMENU hMenu = ::GetMenu(m_hDlg); + ::EnableMenuItem(hMenu, IDM_CFG_LOAD_GRAMMAR, fLoadCFG ? MF_GRAYED : MF_ENABLED); + ::EnableMenuItem(hMenu, IDM_CFG_ADD_DYNAMIC_RULE, fLoadCFG ? MF_ENABLED : MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_CFG_SET_WORD_SEQUENCE_DATA, fLoadCFG ? MF_ENABLED : MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_TRAIN_FROM_FILE, m_cpRecognizer ? MF_ENABLED : MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_ADAPT_FROM_FILE, m_cpDictationGrammar ? MF_ENABLED : MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_ADAPT_FROM_CLIPBOARD, m_cpDictationGrammar ? MF_ENABLED : MF_GRAYED); + } + else + { + MessageBoxFromResource( uiErrorMessageID ); + Reset(); + } + } + + #ifdef _DEBUG + fInUpdate = FALSE; + #endif // _DEBUG + + return hr; +} + + +/**************************************************************************** +* CRecoDlgClass::UpdateRecoCtxtState * +*------------------------------------* +* Description: +* Creates or releases the m_cpRecoContext member based on the state of the +* ICD_CHECK_CREATE checkbox. This method also enables or disables various controls +* based on weather or not there is a m_cpRecoContext object. If for any reason +* one of the SAPI calls fails, the application state will be reset. +* +* Returns: +* S_OK +* Return value of CRecoDlgClass::CreateRecoCtxt() +* Return value of CRecoDlgClass::UpdateGrammarState() +* +****************************************************************************/ + +HRESULT CRecoDlgClass::UpdateRecoCtxtState() +{ + HRESULT hr = S_OK; + BOOL bCreateChecked = (::SendDlgItemMessage(m_hDlg, IDC_CHECK_CREATE, BM_GETCHECK, 0, 0 ) == BST_CHECKED); + if (bCreateChecked) + { + if (!m_cpRecoCtxt) + { + BOOL bShared = (::SendDlgItemMessage(m_hDlg, IDC_RADIO_SHARED, BM_GETCHECK, 0, 0) == BST_CHECKED); + if (bShared) + { + hr = CreateRecoCtxt(0); + } + else + { + HWND hwndList = ::GetDlgItem(m_hDlg, IDC_COMBO_ENGINES); + LONG i = ::SendMessage(hwndList, CB_GETCURSEL, 0, 0); + hr = CreateRecoCtxt(::SendMessage(hwndList, CB_GETITEMDATA, i, 0)); + } + } + + if( SUCCEEDED(hr) ) + { + hr = UpdateGrammarState(0); + if (FAILED(hr)) + { + Reset(); + } + } + } + else + { + Reset(); + } + BOOL bEnable = (m_cpRecoCtxt != NULL); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_LIST_PHRASES), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_CFG), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_CFG_ACTIVE), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_MIC), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_DICTATION), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_DICTATION_ACTIVE), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_SPELLING), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_SPELLING_ACTIVE), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_RETAIN_AUDIO), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_RADIO_SHARED), m_cpRecoCtxt == NULL); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_RADIO_INPROC), m_cpRecoCtxt == NULL); + BOOL bEnableCombo = (m_cpRecoCtxt == NULL); + if (bEnableCombo) + { + bEnableCombo = (::SendDlgItemMessage(m_hDlg, IDC_RADIO_INPROC, BM_GETCHECK, 0, 0) == BST_CHECKED); + } + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_COMBO_ENGINES), bEnableCombo); + if (!bEnable) + { + UpdatePropWindow(NULL); + } + return hr; +} + +/**************************************************************************** +* CRecoDlgClass::InitDialog * +*---------------------------* +* Description: +* Enumerates the available SR engines and populates the combo box. +* Initializes the application to the default starting state. +* +* Returns: +* TRUE if successful, else FALSE +* +****************************************************************************/ + +BOOL CRecoDlgClass::InitDialog(HWND hDlg) +{ + HRESULT hr = S_OK; + m_hDlg = hDlg; + + // + // Initialize the list of engines. The shared context will be indicated by a NULL + // GUID pointer (a 0 item data). The default inproc engine will be GUID_NULL, and all + // other engines will have a GUID allocated for them. + // + CComPtr cpEnum; + if (SUCCEEDED(hr)) + { + hr = SpEnumTokens(SPCAT_RECOGNIZERS, NULL, NULL, &cpEnum); + } + if (FAILED(hr)) + { + return FALSE; + } + + CComPtr cpDefaultRecoToken; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOGNIZERS, &cpDefaultRecoToken); + + if (SUCCEEDED(hr)) + { + CSpDynamicString dstrDefaultName; + if (SUCCEEDED(SpGetDescription(cpDefaultRecoToken, &dstrDefaultName))) + { + CSpDynamicString dstrDesc(L"Shar&ed: "); + dstrDesc.Append(dstrDefaultName); + USES_CONVERSION; + ::SendDlgItemMessage(hDlg, IDC_RADIO_SHARED, WM_SETTEXT, 0, (LPARAM)W2T(dstrDesc)); + } + } + + // + // Now set up the list. + // + HWND hwndList = ::GetDlgItem(hDlg, IDC_COMBO_ENGINES); + + ISpObjectToken * pEngineToken; + + while (cpEnum->Next(1, &pEngineToken, NULL) == S_OK) + { + CSpDynamicString dstrName; + if (SUCCEEDED(SpGetDescription(pEngineToken, &dstrName))) + { + USES_CONVERSION; + LRESULT NewItem = ::SendMessage(hwndList, CB_ADDSTRING, 0, (LPARAM)W2T(dstrName)); + ::SendMessage(hwndList, CB_SETITEMDATA, NewItem, (LPARAM)pEngineToken); + } + else + { + pEngineToken->Release(); + } + } + + ::SendMessage(hwndList, CB_SETCURSEL, 0, 0); + ::SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)::LoadIconA(m_hInstance, MAKEINTRESOURCEA(IDI_RECO))); + + ::SendDlgItemMessage( m_hDlg, IDC_CHECK_MIC, BM_SETCHECK, BST_CHECKED, 0 ); + ::SendDlgItemMessage( m_hDlg, IDC_RADIO_SHARED, BM_SETCHECK, BST_CHECKED, 0 ); + + UpdateRecoCtxtState(); + UpdateGrammarStatusWindow(); + + // + // Phrase window is owner draw, in order to prevent dataloss in thunking + // We keep the Unicode string in the CRecoDlgListItem and call ExtTextOutW. + // + + HWND hwndPhrase = GetDlgItem(hDlg, IDC_LIST_PHRASES); + LONG l = GetWindowLong(hwndPhrase, GWL_STYLE); + SetWindowLong(hwndPhrase, GWL_STYLE, l & ~LBS_HASSTRINGS); + + return TRUE; +} + + +/**************************************************************************** +* CRecoDlgClass::Cleanup * +*------------------------* +* Description: +* Called when the application is shutting down. +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::Cleanup() +{ + // + // Release all the engine tokens in the combo box + // + HWND hwndList = ::GetDlgItem(m_hDlg, IDC_COMBO_ENGINES); + LONG NumEntries = ::SendMessage(hwndList, CB_GETCOUNT, 0, 0); + for (LONG i = 0; i < NumEntries; i++) + { + LRESULT ItemData = ::SendMessage(hwndList, CB_GETITEMDATA, i, 0); + if (ItemData) + { + ((IUnknown *)ItemData)->Release(); + } + } + + Reset(); + + if (m_hfont) + { + ::DeleteObject(m_hfont); + } +} + + +/**************************************************************************** +* CRecoDlgClass::CreateRecoCtxt * +*-------------------------------* +* Description: +* This method is only called from UpdateRecoCtxtState. It is passed the +* item data from selected item in the IDC_COMBO_ENGINES combo box. If the item +* data is NULL then the "Shared default engine" is selected. If it is non-NULL +* then the item data points to an SpObjectToken for the selected engine to +* load inproc. +* +* Returns: +* S_OK, or failed HRESULT of SAPI initialization calls made below +* +****************************************************************************/ + +HRESULT CRecoDlgClass::CreateRecoCtxt(LRESULT ItemData) +{ + HRESULT hr = S_OK; + + // + // ItemData is NULL, for shared case. In the inproc case, we are REQUIRED to set the + // input so we create the default audio object. + // + if (ItemData) + { + hr = m_cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + if (SUCCEEDED(hr)) + { + hr = m_cpRecognizer->SetRecognizer((ISpObjectToken *)ItemData); + } + if (SUCCEEDED(hr)) + { + CComPtr cpAudioToken; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_AUDIOIN, &cpAudioToken); + if (SUCCEEDED(hr)) + { + hr = m_cpRecognizer->SetInput(cpAudioToken, TRUE); + } + } + } + else + { + hr = m_cpRecognizer.CoCreateInstance(CLSID_SpSharedRecognizer); + } + if (SUCCEEDED(hr)) + { + hr = m_cpRecognizer->CreateRecoContext(&m_cpRecoCtxt); + } + if (SUCCEEDED(hr)) + { + hr = m_cpRecoCtxt->SetNotifyWindowMessage(m_hDlg, WM_RECOEVENT, 0, 0); + } + if (SUCCEEDED(hr)) + { + const ULONGLONG ullInterest = SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | + SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | + SPFEI(SPEI_FALSE_RECOGNITION) | SPFEI(SPEI_HYPOTHESIS) | + SPFEI(SPEI_INTERFERENCE) | SPFEI(SPEI_RECO_OTHER_CONTEXT) | + SPFEI(SPEI_REQUEST_UI) | SPFEI(SPEI_RECO_STATE_CHANGE) | + SPFEI(SPEI_PROPERTY_NUM_CHANGE) | SPFEI(SPEI_PROPERTY_STRING_CHANGE); + hr = m_cpRecoCtxt->SetInterest(ullInterest, ullInterest); + } + + if( SUCCEEDED(hr) ) + { + //--- Set the max number of desired alternates + hr = m_cpRecoCtxt->SetMaxAlternates( 3 ); + } + + SPRECOGNIZERSTATUS stat; + + // Get locale/font settings + if (SUCCEEDED(hr)) + { + ZeroMemory(&stat, sizeof(stat)); + hr = m_cpRecognizer->GetStatus(&stat); + } + + if (SUCCEEDED(hr)) + { + m_langid = stat.aLangID[0]; + + // Pick an appropriate font. On Windows 2000, let the system fontlink. + + DWORD dwVersion = GetVersion(); + + if ( dwVersion >= 0x80000000 + || LOBYTE(LOWORD(dwVersion)) < 5 + || m_langid != MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)) + { + TCHAR achCodePage[6]; + UINT uiCodePage; + + if (0 != GetLocaleInfo(MAKELCID(m_langid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, achCodePage, 6)) + { + uiCodePage = _ttoi(achCodePage); + } + else + { + uiCodePage = GetACP(); + } + + CComPtr cpMultiLanguage; + MIMECPINFO MimeCpInfo; + + if ( SUCCEEDED(cpMultiLanguage.CoCreateInstance(CLSID_CMultiLanguage)) + && SUCCEEDED(cpMultiLanguage->GetCodePageInfo(uiCodePage, &MimeCpInfo))) + { + USES_CONVERSION; + + if (m_hfont) + { + DeleteObject(m_hfont); + } + + m_hfont = CreateFont(0, 0, 0, 0, FW_NORMAL, 0, 0, 0, + MimeCpInfo.bGDICharset, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + W2T(MimeCpInfo.wszProportionalFont)); + + } + } + } + + if (SUCCEEDED(hr)) + { + m_cpPhoneConv.Release(); + hr = SpCreatePhoneConverter(m_langid, NULL, NULL, &m_cpPhoneConv); + } + + if (FAILED(hr)) + { + MessageBoxFromResource( IDS_RECOCONTEXT_FAIL ); + Reset(); + } + return hr; +} + +/**************************************************************************** +* CRecoDlgClass::UpdateGrammarStatusWindow * +*------------------------------------------* +* Description: +* Called whenever the grammar file has changed to set the text of the +* grammar status control (a line in the dialog box below the property window). +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::UpdateGrammarStatusWindow() +{ + const static TCHAR szPrefixText[] = _T("Current C&&C Grammar: "); + TCHAR szDesc[sp_countof(m_szGrammarFileTitle) + sp_countof(szPrefixText)]; + _tcscpy(szDesc, szPrefixText); + _tcscat(szDesc, *m_szGrammarFile ? m_szGrammarFileTitle : _T("Solitaire (built-in demo grammar)")); + ::SendDlgItemMessage(m_hDlg, IDC_GRAMMAR_STATUS, WM_SETTEXT, 0, (LPARAM)szDesc); +} + + +/**************************************************************************** +* CRecoDlgClass::Reset * +*----------------------* +* Description: +* Shutdown and release all of the objects associated with an active +* recognition context and reset UI elements to their initial state. +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::Reset() +{ + UpdatePropWindow(NULL); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_CFG_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_CFG, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_DICTATION_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_DICTATION, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_SPELLING_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_SPELLING, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_CREATE, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_RETAIN_AUDIO, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_MIC, BM_SETCHECK, BST_CHECKED, 0 ); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_MIC), 0); + + HMENU hMenu = ::GetMenu(m_hDlg); + ::EnableMenuItem(hMenu, IDM_CFG_LOAD_GRAMMAR, MF_ENABLED); + ::EnableMenuItem(hMenu, IDM_CFG_ADD_DYNAMIC_RULE, MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_CFG_SET_WORD_SEQUENCE_DATA, MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_TRAIN_FROM_FILE, MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_ADAPT_FROM_FILE, MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_ADAPT_FROM_CLIPBOARD, MF_GRAYED); + + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_RESETCONTENT, 0, 0); + + m_cpCFGGrammar.Release(); + m_cpCFGVoice.Release(); + m_cpRecoCtxt.Release(); + m_cpDictationGrammar.Release(); + m_cpSpellingGrammar.Release(); + m_cpRecognizer.Release(); + + m_bInSound = FALSE; + m_bGotReco = FALSE; +} + +/**************************************************************************** +* CRecoDlgClass::RecoEvent * +*--------------------------* +* Description: +* Whenever a notification is sent from the m_cpRecoCtxt object, this +* method is called. When a recognition event occurs, it adds an item to +* the listbox. If a sound start / sound end occurs without a recogntion +* then it inserts a "" string in the listbox. +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::RecoEvent() +{ + USES_CONVERSION; + CSpEvent event; + long iNewPhrase; + + if (m_cpRecoCtxt) + { + while (event.GetFrom(m_cpRecoCtxt) == S_OK) + { + switch (event.eEventId) + { + case SPEI_REQUEST_UI: + if (event.RequestTypeOfUI() != NULL) + { + #ifdef _DEBUG + SPRECOCONTEXTSTATUS recostatus; + m_cpRecoCtxt->GetStatus(&recostatus); + _ASSERTE(wcscmp(recostatus.szRequestTypeOfUI, event.RequestTypeOfUI()) == 0); + #endif // _DEBUG + + m_cpRecognizer->DisplayUI(m_hDlg, L"Basic Speech Recognition", event.RequestTypeOfUI() , NULL, 0); + } + else + { + #ifdef _DEBUG + SPRECOCONTEXTSTATUS recostatus; + m_cpRecoCtxt->GetStatus(&recostatus); + _ASSERTE(recostatus.szRequestTypeOfUI[0] == '\0'); + #endif // _DEBUG + } + break; + + case SPEI_INTERFERENCE: + { + USES_CONVERSION; + CSpDynamicString dstr; + switch(event.Interference()) + { + case SPINTERFERENCE_NONE: + dstr = L"Interference - None"; + break; + case SPINTERFERENCE_NOISE: + dstr = L"Interference - Noise"; + break; + case SPINTERFERENCE_NOSIGNAL: + dstr = L"Interference - No signal"; + break; + case SPINTERFERENCE_TOOLOUD: + dstr = L"Interference - Too loud"; + break; + case SPINTERFERENCE_TOOQUIET: + dstr = L"Interference - Too quiet"; + break; + case SPINTERFERENCE_TOOFAST: + dstr = L"Dictation mode: Interference - Too fast"; + break; + case SPINTERFERENCE_TOOSLOW: + dstr = L"Dictation mode: Interference - Too slow"; + break; + default: + dstr = L"Unrecognized Interference Event"; + } + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, dstr, FALSE); + if (pli) + { + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + } + break; + + case SPEI_PROPERTY_NUM_CHANGE: + { + USES_CONVERSION; + TCHAR sz[MAX_PATH * 2]; + WCHAR *pwszPropertyName = NULL; + if ( event.PropertyName() ) + { + pwszPropertyName = wcsdup( event.PropertyName() ); + } + else + { + pwszPropertyName = wcsdup( L"" ); + } + wsprintf(sz, _T("Attrib change: %s=%d"), + pwszPropertyName ? W2T(pwszPropertyName) : _T("(out of memory)"), + event.PropertyNumValue()); + if ( pwszPropertyName ) + { + free( pwszPropertyName ); + } + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, T2W(sz), FALSE); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + break; + + case SPEI_PROPERTY_STRING_CHANGE: + { + USES_CONVERSION; + TCHAR sz[MAX_PATH * 2]; + WCHAR *pwszPropertyName = NULL; + if ( event.PropertyName() ) + { + pwszPropertyName = wcsdup( event.PropertyName() ); + } + else + { + pwszPropertyName = wcsdup( L"" ); + } + + WCHAR *pwszPropertyStringValue = NULL; + if ( event.PropertyStringValue() ) + { + pwszPropertyStringValue = wcsdup( event.PropertyStringValue() ); + } + else + { + pwszPropertyStringValue = wcsdup( L"" ); + } + wsprintf(sz, _T("Attrib change: %s=%s"), + pwszPropertyName ? W2T(pwszPropertyName) : _T("(out of memory)"), + pwszPropertyStringValue ? W2T(pwszPropertyStringValue): _T("(out of memory)") ); + if ( pwszPropertyName ) + { + free( pwszPropertyName ); + } + if ( pwszPropertyStringValue ) + { + free( pwszPropertyStringValue ); + } + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, T2W(sz), FALSE); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + break; + + case SPEI_RECO_STATE_CHANGE: + ::SendDlgItemMessage( m_hDlg, IDC_CHECK_MIC, BM_SETCHECK, + (event.RecoState() == SPRST_INACTIVE) ? BST_UNCHECKED : BST_CHECKED, 0 ); + break; + + + + case SPEI_SOUND_START: + m_bInSound = TRUE; + break; + + case SPEI_SOUND_END: + if (m_bInSound) + { + m_bInSound = FALSE; + if (!m_bGotReco) + { + const WCHAR wszNoise[] = L"(Noise without speech)"; + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, wszNoise, FALSE); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + m_bGotReco = FALSE; + } + break; + + case SPEI_RECO_OTHER_CONTEXT: + { + m_bGotReco = TRUE; + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, L"(Recognition for other client)", FALSE); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + break; + + + case SPEI_FALSE_RECOGNITION: + case SPEI_HYPOTHESIS: + case SPEI_RECOGNITION: + { + CComPtr cpResult; + cpResult = event.RecoResult(); + + m_bGotReco = TRUE; + + CRecoDlgListItem * pli; + + CSpDynamicString dstrText; + if (event.eEventId == SPEI_FALSE_RECOGNITION) + { + dstrText = L"(Unrecognized)"; + } + else + { + cpResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dstrText, NULL); + } + + pli = new CRecoDlgListItem(cpResult, dstrText, event.eEventId == SPEI_HYPOTHESIS); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + UpdatePropWindow(pli); + + cpResult.Release(); + } + break; + } + } + } +} + +/**************************************************************************** +* CRecoDlgClass::EmulateRecognition * +*-----------------------------------* +* Description: +* Calls ISpRecognizer::EmulateRecognition to parse the phrase +* built out of the text in pszText +* Returns: +* void +****************************************************************************/ + +void CRecoDlgClass::EmulateRecognition(WCHAR *pszText) +{ + SPDBG_FUNC("CRecoDlgClass::EmulateRecognition"); + HRESULT hr = S_OK; + + CComPtr cpPhrase; + if (SUCCEEDED(CreatePhraseFromText(pszText, &cpPhrase, m_langid, m_cpPhoneConv)) && m_cpRecognizer) + { + hr = m_cpRecognizer->EmulateRecognition(cpPhrase); + } +} + + + +/**************************************************************************** +* CRecoDlgClass::SpecifyCAndCGrammar * +*------------------------------------* +* Description: +* This method is called when the "C&C Grammar" button is pressed on the +* main application dialog. It opens the standard file dialog so that the user +* can specify a command and control grammar to be used by the application. If +* the user cancels out of the dialog, then this method resets the m_szGrammarFile +* member so that the built-in grammar will be used. +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::SpecifyCAndCGrammar() +{ + OPENFILENAME OpenFileName; + const static TCHAR szFilter[] = _T("Grammar files\0*.cfg;*.xml\0All files\0*.*\0"); + size_t ofnsize = (BYTE*)&OpenFileName.lpTemplateName + sizeof(OpenFileName.lpTemplateName) - (BYTE*)&OpenFileName; + + // Fill in the OPENFILENAME structure to support a template and hook. + OpenFileName.lStructSize = ofnsize; + OpenFileName.hwndOwner = m_hDlg; + OpenFileName.hInstance = m_hInstance; + OpenFileName.lpstrFilter = szFilter; + OpenFileName.lpstrCustomFilter = NULL; + OpenFileName.nMaxCustFilter = 0; + OpenFileName.nFilterIndex = 0; + OpenFileName.lpstrFile = m_szGrammarFile; + OpenFileName.nMaxFile = sp_countof(m_szGrammarFile); + OpenFileName.lpstrFileTitle = m_szGrammarFileTitle; + OpenFileName.nMaxFileTitle = sp_countof(m_szGrammarFileTitle); + OpenFileName.lpstrInitialDir = NULL; + OpenFileName.lpstrTitle = _T("Select a grammar file"); + OpenFileName.nFileOffset = 0; + OpenFileName.nFileExtension = 0; + OpenFileName.lpstrDefExt = _T("cfg"); + OpenFileName.lCustData = 0; + OpenFileName.lpfnHook = NULL; + OpenFileName.lpTemplateName = NULL; + OpenFileName.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + + // Call the common dialog function. + if (!GetOpenFileName(&OpenFileName)) + { + // If for any reason, GetOpenFileName returns false, revert to our internal grammar + m_szGrammarFile[0] = 0; + } + UpdateGrammarStatusWindow(); +} + +/**************************************************************************** +* CRecoDlgClass::MessageBoxFromResource * +*---------------------------------------* +* Description: +* Display a MessageBox whose text is the requested string resource ID +* +* Returns: +* void +* +****************************************************************************/ +int CRecoDlgClass::MessageBoxFromResource( UINT uiResource ) +{ + TCHAR szMessage[ MAX_LOADSTRING ]; + ::LoadString( m_hInstance, uiResource, szMessage, sizeof( szMessage ) ); + return ::MessageBox( m_hDlg, szMessage, NULL, MB_ICONEXCLAMATION ); +} + +/**************************************************************************** +* CRecoDlgClass::SetWordSequenceData * +*------------------------------------* +* Description: +* This method is called when the "Set Word Sequence Data" menu item is selected from the +* C&C menu. It opens the standard file dialog so that the user +* can specify a document to be used by the application. +* +****************************************************************************/ + +void CRecoDlgClass::SetWordSequenceData() +{ + WCHAR * pwszCoMem = 0; + WCHAR * pwszCoMem2 = 0; + ULONG cch = 0; + + HRESULT hr = GetTextFile(&pwszCoMem, &cch); + + if (SUCCEEDED(hr)) + { + SPTEXTSELECTIONINFO tsi; + + tsi.ulStartActiveOffset = 0; + tsi.cchActiveChars = cch; + tsi.ulStartSelection = 0; + tsi.cchSelection = cch; + + pwszCoMem2 = (WCHAR *)CoTaskMemAlloc(sizeof(WCHAR) * (cch + 2)); + + if (SUCCEEDED(hr)) + { + // SetWordSequenceData requires double NULL terminator. + memcpy(pwszCoMem2, pwszCoMem, sizeof(WCHAR) * cch); + pwszCoMem2[cch] = L'\0'; + pwszCoMem2[cch+1] = L'\0'; + + hr = m_cpCFGGrammar->SetWordSequenceData(pwszCoMem2, cch + 2, &tsi); + + CoTaskMemFree(pwszCoMem2); + } + CoTaskMemFree(pwszCoMem); + } +} + + +/**************************************************************************** +* Implementation of CDynGrammarDlgClass +****************************************************************************/ + +/**************************************************************************** +* CDynGrammarDlgClass::DlgProc * +*------------------------------* +* Description: +* This static member function is the message handler for the dynamic rule +* dialog. When the dialog is initialized via WM_INITDIALOG, the pointer to the +* CDynGrammarDlgClass object is passed to this function in the lParam. This is stored +* in the USERDATA window long and used for subsequent message processing. +* +* Returns: +* Appropriate LRESULT for give window message +* +****************************************************************************/ + +LRESULT CALLBACK CDynGrammarDlgClass::DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + CDynGrammarDlgClass * pThis = (CDynGrammarDlgClass *)::GetWindowLong(hDlg, GWL_USERDATA); + switch (message) + { + case WM_INITDIALOG: + ::SetWindowLong(hDlg, GWL_USERDATA, lParam); + pThis = (CDynGrammarDlgClass *)lParam; + return pThis->InitDialog(hDlg, pThis->m_pItemList); + + case WM_HELP: + ::DialogBoxParam(pThis->m_pParent->m_hInstance, (LPCTSTR)IDD_DIALOG_BETAHELP, hDlg, (DLGPROC)BetaHelpDlgProc, NULL); + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + pThis->Cleanup(); + EndDialog(hDlg, 0); + return TRUE; + } + else if (LOWORD(wParam) == IDC_BUTTON_ADDITEM) + { + pThis->AddItem(); + } + else if (LOWORD(wParam) == IDC_BUTTON_CLEARALL) + { + pThis->ClearAll(); + } + else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_EDIT_NEWITEM) + { + // + // Only enable the "Add" button if there is some text in the edit control + // + BOOL fEnable = ::SendMessage((HWND)lParam, WM_GETTEXTLENGTH, 0, 0); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_ADDITEM), fEnable); + } + + break; + + } + return FALSE; +} + + +/**************************************************************************** +* CDynGrammarDlgClass::InitDialog * +*---------------------------------* +* Description: +* This method is called from the WM_INITDIALOG message. It initialzes +* the m_hDlg member and populates the listbox with any items that have already +* been added to the "DynRule". +* +* Returns: +* TRUE if successful, else FALSE +* +****************************************************************************/ + +BOOL CDynGrammarDlgClass::InitDialog(HWND hDlg, CSpBasicQueue *pItemList) +{ + USES_CONVERSION; + HRESULT hr = S_OK; + m_hDlg = hDlg; + + m_pItemList = pItemList; + ISpRecoGrammar * pGram = m_pParent->m_cpCFGGrammar; + + hr = pGram->GetRule(g_szDynRuleName, NULL, SPRAF_TopLevel | SPRAF_Dynamic | SPRAF_Active, TRUE, &m_hDynRule); + if (SUCCEEDED(hr)) + { + HWND hwndList = ::GetDlgItem(hDlg, IDC_LIST_ITEMS); + CDynItem *pItem = m_pItemList->GetHead(); + while (pItem) + { + LRESULT Index = ::SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)W2T(pItem->m_dstr)); + ::SendMessage(hwndList, LB_SETITEMDATA, Index, (LPARAM)W2T(pItem->m_dstr)); + pItem = m_pItemList->GetNext(pItem); + } + } + return TRUE; +} + +/**************************************************************************** +* CDynGrammarDlgClass::AddItem * +*------------------------------* +* Description: +* Called when the "Add" button is pressed. It calls AddItem to add the +* text in the edit control to the "DynRule" in the CFG grammar. +* +* Returns: +* void +* +****************************************************************************/ + +void CDynGrammarDlgClass::AddItem() +{ + HRESULT hr = S_OK; + WCHAR wszItem[MAX_PATH]; + GETTEXTEX gtex = { sp_countof(wszItem), GT_DEFAULT, 1200, NULL, NULL }; + + ::SendDlgItemMessage(m_hDlg, IDC_EDIT_NEWITEM, EM_GETTEXTEX, (WPARAM)>ex, (LPARAM)wszItem); + + hr = m_pParent->m_cpCFGGrammar->AddWordTransition(m_hDynRule, NULL, wszItem, L" ", SPWT_LEXICAL, 1.0, NULL); + if (SUCCEEDED(hr)) + { + CDynItem *pItem = new CDynItem(wszItem); + if (pItem) + { + m_pItemList->InsertTail(pItem); + USES_CONVERSION; + LRESULT Index = ::SendDlgItemMessage(m_hDlg, IDC_LIST_ITEMS, LB_ADDSTRING, 0, (LPARAM)W2T(wszItem)); + } + ::SendDlgItemMessage(m_hDlg, IDC_EDIT_NEWITEM, WM_SETTEXT, 0, (LPARAM)_T("")); + ::SetFocus(::GetDlgItem(m_hDlg, IDC_EDIT_NEWITEM)); + } +} + + +/**************************************************************************** +* CDynGrammarDlgClass::ClearAll * +*-------------------------------* +* Description: +* Called when the "Clear" button is pressed. Clears the contents of the +* listbox and clears the "DynRule" in the CFG grammar. +* +* Returns: +* void +* +****************************************************************************/ + +void CDynGrammarDlgClass::ClearAll() +{ + ::SendDlgItemMessage(m_hDlg, IDC_LIST_ITEMS, LB_RESETCONTENT, 0, 0); + m_pParent->m_cpCFGGrammar->ClearRule(m_hDynRule); + m_pItemList->Purge(); +} + + +/**************************************************************************** +* CDynGrammarDlgClass::Cleanup * +*------------------------------* +* Description: +* Called when the dialog is being closed. Commits the changes to the +* "DynRule" and sets the activation state of the DynRule to the same state +* as the current setting of the checkbox in the main dialog. +* +* Returns: +* void +* +****************************************************************************/ + +void CDynGrammarDlgClass::Cleanup() +{ + m_pParent->m_cpCFGGrammar->Commit(0); + BOOL fActive = ::SendDlgItemMessage(m_pParent->m_hDlg, IDC_CHECK_CFG_ACTIVE, BM_GETCHECK, 0, 0); + m_pParent->m_cpCFGGrammar->SetRuleState(g_szDynRuleName, NULL, fActive ? SPRS_ACTIVE : SPRS_INACTIVE); +} + +/**************************************************************************** +* Implemenation of temporary help dialog for pre-release tool +****************************************************************************/ + +const TCHAR g_szBetaHelpText[] = +_T("INTRODUCTION:\r\n") +_T("This tool can be used by engine vendors and CFG grammar developers to perform basic functionality ") +_T("testing for recognition. The tool can select a specific engine, load a specified command and control grammar, add items to ") +_T("a dynamic rule, enable a dictation grammar, and turn the microphone state on and off.\r\n\r\n") +_T("BASIC USE:\r\n") +_T("Select the speech recognition engine you want to use and then check Create Recognition Context. ") +_T("Once the engine has loaded, you can enable a dictation grammar by checking Activate Dictation. ") +_T("For debugging purposes, the operations of loading and then activating a specific grammar have been separated so that ") +_T("engine developers can debug the process of loading a grammar prior to the grammar activation.\r\n\r\n") +_T("COMMAND AND CONTROL GRAMMARS\r\n") +_T("Recognition has a built-in grammar containing the basic commands for solitaire. Try saying \"Play the King of Diamonds\" or ") +_T("\"Put the Jack of Clubs on the Queen please.\" If you want to load your own grammar, click Load C&&C. Use GramComp.Exe ") +_T("to compile the grammar for use with this program. If you wish to test dynamic lists, author a grammar with a rule named \"DynRule\" ") +_T("and then reference that rule from a top-level rule in your grammar. When you add items to the grammar, click Dynamic Rules. ") +_T("The items will be added to the dynamic rule in your grammar. If the grammar does not contain a rule named \"DynRule\", then the ") +_T("items added in the Dynamic Rules dialog will become top-level rules.\r\n\r\n") +_T("OTHER FEATURES:\r\n") +_T("When a command is recognized, the text is displayed in the list box at the top of the dialog box, and a dump of the full result is displayed ") +_T("in the status window towards the bottom of the dialog. To examine the result of a particular utterance, simply click it in the list box, and ") +_T("the result status window will be updated. To play back the audio from an utterance, double click the item. Note that if you have not ") +_T("checked Retain Reco Audio, the text will be played back using synthesized speech. If you have enabled audio retention, the ") +_T("original utterance will be played back. To emulate recognition, you can type a phrase you want parsed into the edit box ") +_T("at the bottom of the dialog and click \"Submit\""); + +LRESULT CALLBACK BetaHelpDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + ::SendDlgItemMessage(hDlg, IDC_BETA_HELP, WM_SETTEXT, 0, (LPARAM)g_szBetaHelpText); + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, 0); + return TRUE; + } + + } + return FALSE; +} + +/**************************************************************************** +* AlternatesDlgProc * +*-------------------* +* Description: +* Dlgproc for the alternates dialog, which displays the +* alternates for the current phrase and allows the user to +* choose (commit) one of them. +****************************************************************************/ +LRESULT CALLBACK CAlternatesDlgClass:: + AlternatesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + USES_CONVERSION; + HRESULT hr = S_OK; + CAlternatesDlgClass* pThis = (CAlternatesDlgClass *)::GetWindowLong(hDlg, GWL_USERDATA); + + switch( message ) + { + case WM_INITDIALOG: + { + ::SetWindowLong(hDlg, GWL_USERDATA, lParam); + pThis = (CAlternatesDlgClass *)lParam; + + //--- Ask for up to 5 alts + hr = pThis->m_pResult->GetAlternates( 0, SPRR_ALL_ELEMENTS, NUM_ALTS, + pThis->m_Alts, &pThis->m_ulNumAltsReturned ); + //--- Show user choices + if( SUCCEEDED( hr ) && pThis->m_ulNumAltsReturned ) + { + for( ULONG i = 0; i < pThis->m_ulNumAltsReturned; ++i ) + { + WCHAR* pComemText = NULL; + BYTE Attrs; + hr = pThis->m_Alts[i]->GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, true, + &pComemText, &Attrs ); + if( SUCCEEDED( hr ) ) + { + int Err = ::SendDlgItemMessage( hDlg, IDC_ALTS_LIST, LB_ADDSTRING, 0, (LPARAM)W2T(pComemText) ); + ::CoTaskMemFree( pComemText ); + } + } + + //--- Pick the first alternate by default + ::SendDlgItemMessage( hDlg, IDC_ALTS_LIST, LB_SETCURSEL, 0, 0 ); + } + break; + } + + case WM_COMMAND: + { + if( LOWORD(wParam) == IDOK ) + { + ULONG Index = ::SendDlgItemMessage( hDlg, IDC_ALTS_LIST, LB_GETCURSEL, 0, 0 ); + if( Index <= pThis->m_ulNumAltsReturned ) + { + pThis->m_Alts[Index]->Commit(); + } + } + + if( ( LOWORD(wParam) == IDOK ) || LOWORD(wParam) == IDCANCEL ) + { + EndDialog(hDlg, LOWORD(wParam) ); + return TRUE; + } + break; + } + } + return FALSE; +} + diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/reco.dsp b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.dsp new file mode 100644 index 00000000..847d9efa --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.dsp @@ -0,0 +1,255 @@ +# Microsoft Developer Studio Project File - Name="Reco" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=Reco - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "reco.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "reco.mak" CFG="Reco - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Reco - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "Reco - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "reco" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Reco - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Reco___Win32_Debug_x86" +# PROP BASE Intermediate_Dir "Reco___Win32_Debug_x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\ddk\include" /I "..\..\..\..\test\engext" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "Reco - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Reco___Win32_Release_x86" +# PROP BASE Intermediate_Dir "Reco___Win32_Release_x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\ddk\include" /I "..\..\..\..\test\engext" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "Reco - Win32 Debug x86" +# Name "Reco - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\lmadapt.cpp +# End Source File +# Begin Source File + +SOURCE=.\Reco.cpp +# End Source File +# Begin Source File + +SOURCE=.\Reco.rc +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Reco.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\Reco.ico +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# Begin Source File + +SOURCE=.\tv.cfg +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "*.xml" +# Begin Source File + +SOURCE=.\chs_sol.xml + +!IF "$(CFG)" == "Reco - Win32 Debug x86" + +USERDEP__CHS_S="..\..\..\idl\sapi.idl" +# Begin Custom Build +ProjDir=. +InputPath=.\chs_sol.xml + +"$(ProjDir)\chs_sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Reco - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\chs_sol.xml + +"$(ProjDir)\chs_sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\jpn_sol.xml + +!IF "$(CFG)" == "Reco - Win32 Debug x86" + +USERDEP__JPN_S="..\..\..\idl\sapi.idl" +# Begin Custom Build +ProjDir=. +InputPath=.\jpn_sol.xml + +"$(ProjDir)\jpn_sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Reco - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\jpn_sol.xml + +"$(ProjDir)\jpn_sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\sol.xml + +!IF "$(CFG)" == "Reco - Win32 Debug x86" + +USERDEP__SOL_X="..\..\..\idl\sapi.idl" +# Begin Custom Build +ProjDir=. +InputPath=.\sol.xml +InputName=sol + +"$(ProjDir)\sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputName) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Reco - Win32 Release x86" + +USERDEP__SOL_X="..\..\..\idl\sapi.idl" +# Begin Custom Build +ProjDir=. +InputPath=.\sol.xml +InputName=sol + +"$(ProjDir)\sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputName) + +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\jpn_reco.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# Begin Source File + +SOURCE=.\sol.cfg +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/reco.h b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.h new file mode 100644 index 00000000..e94703bd --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.h @@ -0,0 +1,272 @@ +/**************************************************************************** +* Reco.H * +*--------* +* Description: +* Header file for Reco tool. This file declares the various dialog classes. +* +****************************************************************************/ + +#if !defined(AFX_RECO_H__BD16E9D0_597E_11D2_960E_00C04F8EE628__INCLUDED_) +#define AFX_RECO_H__BD16E9D0_597E_11D2_960E_00C04F8EE628__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// +// Defines +// +#define MYGRAMMARID 101 +#define ITNGRAMMARID 102 +#define WM_RECOEVENT WM_APP // Window message used for recognition events + +#define MAX_LOADSTRING 250 + +// +// Constant strings +// +const WCHAR g_szDynRuleName[] = L"DynRule"; + +// +// Forward class declarations +// + +class CRecoDlgListItem; +class CRecoDlgClass; +class CDynGrammarDlgClass; + +// +// Helper class for CSpBasicQueue +// +class CDynItem +{ +public: + CDynItem(WCHAR *psz) : m_dstr(psz) {} ; +public: + CSpDynamicString m_dstr; + CDynItem * m_pNext; +}; + +/**************************************************************************** +* CRecoDlgListItem * +*------------------* +* +* This class stores the recognition result as well as a text string associated +* with the recognition. Note that the string will sometimes be and +* the pResult will be NULL. In other cases the string will be +* and pResult will be valid. +* +****************************************************************************/ + +class CRecoDlgListItem +{ +public: + CRecoDlgListItem(ISpRecoResult * pResult, const WCHAR * pwsz, BOOL fHypothesis) : + m_cpRecoResult(pResult), + m_dstr(pwsz), + m_fHypothesis(fHypothesis) + {} + + ISpRecoResult * GetRecoResult() const { return m_cpRecoResult; } + int GetTextLength() const { return m_dstr.Length(); } + const WCHAR * GetText() const { return m_dstr; } + BOOL IsHypothesis() const { return m_fHypothesis; } + +private: + CComPtr m_cpRecoResult; + CSpDynamicString m_dstr; + BOOL m_fHypothesis; +}; + + +/**************************************************************************** +* CRecoDlgClass * +*---------------* +* +* This class manages the main application dialog. +* +****************************************************************************/ + +class CRecoDlgClass +{ + friend CDynGrammarDlgClass; +// +// Public methods +// +public: + CRecoDlgClass(HINSTANCE hInstance) : + m_hInstance(hInstance), + m_bInSound(FALSE), + m_bGotReco(FALSE), + m_hfont(NULL) + { + m_szGrammarFile[0] = 0; + } + + static LRESULT CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +// +// Private methods +// +private: + HRESULT Create(BOOL bCreateChecked); + BOOL InitDialog(HWND hDlg); + HRESULT CreateRecoCtxt(LRESULT ItemData); + HRESULT UpdateRecoCtxtState(); + void Cleanup(); + void Reset(); + void RecoEvent(); + void SpecifyCAndCGrammar(); + void SetWordSequenceData(); + void EmulateRecognition(WCHAR *pszText); + void UpdateGrammarStatusWindow(); + HRESULT ConstructRuleDisplay(const SPPHRASERULE *pRule, CSpDynamicString & dstr, ULONG ulLevel); + HRESULT ConstructPropertyDisplay(const SPPHRASEELEMENT *pElem, const SPPHRASEPROPERTY *pProp, + CSpDynamicString & dstr, ULONG ulLevel); + BOOL UpdatePropWindow(const CRecoDlgListItem * pli); + HRESULT UpdateGrammarState(WORD wIdOfChangedControl); + + HRESULT GetTextFile(WCHAR ** ppwszCoMem, ULONG * pcch); + + HRESULT FeedDocumentFromFile(); + HRESULT FeedDocumentFromClipboard(); + HRESULT FeedDocument(const WCHAR * pwszCoMem, ULONG cch); + + HRESULT TrainFromFile(); + + int MessageBoxFromResource( UINT uiResource ); + +// +// Member data +// +private: + const HINSTANCE m_hInstance; // Instance handle of process + HWND m_hDlg; // Window handle of dialog + CComPtr m_cpCFGGrammar; // Loaded CFG grammar + CComPtr m_cpCFGVoice; + CComPtr m_cpITNGrammar; // Loaded ITN cfg grammar + CComPtr m_cpDictationGrammar; // Loaded dictation grammar + CComPtr m_cpSpellingGrammar; // Loaded spelling grammar + CComPtr m_cpRecoCtxt; // Recognition context + CComPtr m_cpRecognizer; // Recognition instance + CComPtr m_cpPhoneConv; // Phone converter + BOOL m_bInSound; + BOOL m_bGotReco; + TCHAR m_szGrammarFile[MAX_PATH]; // Fully qualified file path + TCHAR m_szGrammarFileTitle[MAX_PATH]; // Name of the file (no path) + LANGID m_langid; + HFONT m_hfont; + CSpBasicQueue m_ItemList; +}; + +/**************************************************************************** +* CDynGrammarDlgClass * +*---------------------* +* +* This class manages the dynamic rule dialog. +* +****************************************************************************/ + +class CDynGrammarDlgClass +{ +// +// Public methods +// +public: + CDynGrammarDlgClass(CRecoDlgClass * pParent, CSpBasicQueue *pItemList) : + m_pParent(pParent) + { + m_hinstRichEdit = LoadLibrary(_T("riched20.dll")); + m_hDynRule = NULL; + m_pItemList = pItemList; + } + + ~CDynGrammarDlgClass() + { + FreeLibrary(m_hinstRichEdit); + } + + static LRESULT CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +// +// Private methods +// +private: + BOOL InitDialog(HWND hDlg, CSpBasicQueue *pItemList); + void AddItem(); + void Cleanup(); + void ClearAll(); + +// +// Member data +// +private: + const CRecoDlgClass * m_pParent; + HWND m_hDlg; + SPSTATEHANDLE m_hDynRule; + HINSTANCE m_hinstRichEdit; + CSpBasicQueue * m_pItemList; +}; + +//=== This is for the alternates pop window +/**************************************************************************** +* CAlternatesDlgClass * +*---------------------* +* +****************************************************************************/ +#define NUM_ALTS 5 + +class CAlternatesDlgClass +{ + public: + CAlternatesDlgClass() + { + m_ulNumAltsReturned = 0; + memset( m_Alts, 0, NUM_ALTS * sizeof(ISpPhraseAlt*) ); + } + + ~CAlternatesDlgClass() + { + for( ULONG i = 0; i < m_ulNumAltsReturned; ++i ) + { + m_Alts[i]->Release(); + } + } + + static LRESULT CALLBACK AlternatesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + + //--- Member data + ISpRecoResult* m_pResult; + ISpPhraseAlt* m_Alts[NUM_ALTS]; + ULONG m_ulNumAltsReturned; +}; + +// +// This dialog function is only defined for the preview release of this tool. +// +LRESULT CALLBACK BetaHelpDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +// +// Helper function +// +inline char ConfidenceGroupChar(char Confidence) +{ + switch (Confidence) + { + case SP_LOW_CONFIDENCE: + return '-'; + + case SP_NORMAL_CONFIDENCE: + return ' '; + + case SP_HIGH_CONFIDENCE: + return '+'; + + default: + _ASSERTE(false); + return '?'; + } +} + + + +#endif // !defined(AFX_RECO_H__BD16E9D0_597E_11D2_960E_00C04F8EE628__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/reco.ico b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.ico new file mode 100644 index 00000000..38688352 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/reco.rc b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.rc new file mode 100644 index 00000000..2714efa5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/reco.rc @@ -0,0 +1,273 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) (unknown sub-lang: 0x0) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, 0x0 +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_SOL_CFG SRGRAMMAR DISCARDABLE "sol.cfg" +#endif // English (U.S.) (unknown sub-lang: 0x0) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_RECO ICON DISCARDABLE "RECO.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""jpn_reco.rc""\r\n" + "#include ""version.rc2""\r\n" + "\r\n" + "\0" +END + +4 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""chs_reco.rc""\r\n" + "\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_RECODLG DIALOG DISCARDABLE 0, 0, 274, 285 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Basic Speech Recognition" +MENU IDR_RECOMENU +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "Create &Recognition Context",IDC_CHECK_CREATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,10,104,12 + CONTROL "Retain Reco A&udio",IDC_CHECK_RETAIN_AUDIO,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,24,76,12 + CONTROL "Load &Dictation",IDC_CHECK_DICTATION,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,123,10,59,12 + CONTROL "&Activate Dictation",IDC_CHECK_DICTATION_ACTIVE,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,187,10,70,12 + CONTROL "&Load C&&C",IDC_CHECK_CFG,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,123,24,58,12 + CONTROL "Acti&vate C&&C",IDC_CHECK_CFG_ACTIVE,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,187,24,58,12 + CONTROL "Activate &Microphone",IDC_CHECK_MIC,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,38,104,12 + CONTROL "Load &Spelling",IDC_CHECK_SPELLING,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,123,39,59,12 + CONTROL "Activate S&pelling",IDC_CHECK_SPELLING_ACTIVE,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,187,39,70,12 + CONTROL "Shar&ed recognizer",IDC_RADIO_SHARED,"Button", + BS_AUTORADIOBUTTON,10,56,248,12 + CONTROL "I&nproc:",IDC_RADIO_INPROC,"Button",BS_AUTORADIOBUTTON, + 10,71,40,12 + COMBOBOX IDC_COMBO_ENGINES,52,71,207,60,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_LIST_PHRASES,7,92,251,70,LBS_OWNERDRAWFIXED | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL + EDITTEXT IDC_STATUS,7,166,251,79,ES_MULTILINE | ES_AUTOHSCROLL | + ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP + EDITTEXT IDC_EDIT_PARSETEXT,8,264,191,16,ES_AUTOHSCROLL + DEFPUSHBUTTON "Su&bmit",IDC_BUTTON_SUBMIT,207,264,50,14,WS_DISABLED + GROUPBOX "Grammars",IDC_STATIC,115,3,143,51 + LTEXT "Static",IDC_GRAMMAR_STATUS,7,250,193,9 + PUSHBUTTON "Al&ternates",IDC_BUTTON_ALTERNATES,207,248,49,14 +END + +IDD_DYNGRAMMARDLG DIALOG DISCARDABLE 0, 0, 217, 226 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dynamic Rules" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "",IDC_EDIT_NEWITEM,"RICHEDIT20A",WS_BORDER | WS_TABSTOP | + 0x80,7,7,203,14 + DEFPUSHBUTTON "&Add Item",IDC_BUTTON_ADDITEM,7,204,55,15,WS_DISABLED + LISTBOX IDC_LIST_ITEMS,5,25,205,170,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Clear all",IDC_BUTTON_CLEARALL,86,205,50,14 + PUSHBUTTON "OK",IDOK,160,205,50,14 +END + +IDD_DIALOG_BETAHELP DIALOG DISCARDABLE 0, 0, 427, 301 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Help for the Reco Tool" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,188,280,50,14 + LTEXT "",IDC_BETA_HELP,11,10,405,260 +END + +IDD_ALTS_DIALOG DIALOG DISCARDABLE 200, 150, 186, 109 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Alternates" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,38,88,50,14 + PUSHBUTTON "Cancel",IDCANCEL,93,88,50,14 + LISTBOX IDC_ALTS_LIST,7,7,172,79,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_RECODLG, DIALOG + BEGIN + BOTTOMMARGIN, 281 + END + + IDD_DYNGRAMMARDLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 210 + TOPMARGIN, 7 + BOTTOMMARGIN, 219 + END + + IDD_DIALOG_BETAHELP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 420 + TOPMARGIN, 7 + BOTTOMMARGIN, 294 + END + + IDD_ALTS_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 102 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_RECOMENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_FILE_EXIT + END + POPUP "&C&&C" + BEGIN + MENUITEM "&Load Grammar...", IDM_CFG_LOAD_GRAMMAR + MENUITEM "&Add Dynamic Rule", IDM_CFG_ADD_DYNAMIC_RULE + MENUITEM "Set Word &Sequence Data...", IDM_CFG_SET_WORD_SEQUENCE_DATA + + END + POPUP "D&ictation" + BEGIN + MENUITEM "&Train from File...", IDM_SLM_TRAIN_FROM_FILE + MENUITEM "&Adapt LM From File...", IDM_SLM_ADAPT_FROM_FILE + MENUITEM "A&dapt LM From Clipboard", IDM_SLM_ADAPT_FROM_CLIPBOARD + END + MENUITEM "&Help!", IDM_HELP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_GRAMMAR_LOAD_FAIL "An error occurred loading the requested grammar." + IDS_RECOCONTEXT_FAIL "An error occurred creating or initializing the recognition context, so speech recognition will not work." + IDS_RULESTATE_FAIL "An error occurred activating the requested grammar. This may indicate an error with your default Speech audio device." + IDS_DEVICE_BUSY "The grammar could not be activated, since your audio device is in already in use by another application. Please shut down all other speech applications and try again. " +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "jpn_reco.rc" +#include "chs_reco.rc" +#include "version.rc2" + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/resource.h b/mp/src/utils/sapi51/Samples/CPP/Reco/resource.h new file mode 100644 index 00000000..b0272593 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/resource.h @@ -0,0 +1,71 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by reco.rc +// +#define IDS_GRAMMAR_LOAD_FAIL 1 +#define IDS_RECOCONTEXT_FAIL 2 +#define IDS_RULESTATE_FAIL 3 +#define IDS_DEVICE_BUSY 4 +#define IDD_RECODLG 100 +#define IDI_RECO 107 +#define IDR_SOL_CFG 134 +#define IDD_DYNGRAMMARDLG 135 +#define IDD_DIALOG_BETAHELP 136 +#define IDR_RECOMENU 137 +#define IDD_ALTS_DIALOG 138 +#define IDC_BUTTON_EXIT 1006 +#define IDC_BUTTON_LOADGRAMMAR 1007 +#define IDC_LIST_PHRASES 1008 +#define IDC_BUTTON_ADD 1009 +#define IDC_BUTTON_DYNRULES 1010 +#define IDC_COMBO_ENGINES 1011 +#define IDC_CHECK_CREATE 1012 +#define IDC_RETAINALL 1013 +#define IDC_CHECK_RETAIN_AUDIO 1014 +#define IDC_CHECK_CFG 1015 +#define IDC_EDIT_PROPS 1016 +#define IDC_CHECK_CFG_ACTIVE 1017 +#define IDC_CHECK_DICTATION 1018 +#define IDC_BUTTON_CLEAR 1019 +#define IDC_CHECK_SPELLING 1019 +#define IDC_EDIT_NEWITEM 1020 +#define IDC_CHECK_DICTATION_ACTIVE 1021 +#define IDC_BUTTON_ADDITEM 1022 +#define IDC_CHECK_SPELLING_ACTIVE 1022 +#define IDC_LIST_ITEMS 1023 +#define IDC_CHECK_MIC 1024 +#define IDC_STATUS 1025 +#define IDC_GRAMMAR_STATUS 1026 +#define IDC_CHECK_ITN 1027 +#define IDC_BUTTON_CLEARALL 1028 +#define IDC_BUTTON_HELP 1031 +#define IDC_ALPHAHELPTEXT 1032 +#define IDC_BUTTON_SUBMIT 1032 +#define IDC_ALPHA_HELP 1034 +#define IDC_BETA_HELP 1034 +#define IDC_STATIC_ENGINE 1036 +#define IDC_EDIT_PARSETEXT 1037 +#define IDC_RADIO_SHARED 1039 +#define IDC_RADIO_INPROC 1040 +#define IDC_BUTTON_ALTERNATES 1041 +#define IDC_ALTS_LIST 1042 +#define IDM_FILE_EXIT 32771 +#define IDM_CFG_LOAD_GRAMMAR 32772 +#define IDM_CFG_ADD_DYNAMIC_RULE 32773 +#define IDM_SLM_ADAPT_FROM_FILE 32774 +#define IDM_SLM_ADAPT_FROM_CLIPBOARD 32775 +#define IDM_SLM_TRAIN_FROM_FILE 32776 +#define IDM_HELP 32777 +#define IDM_CFG_SET_WORD_SEQUENCE_DATA 32778 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 139 +#define _APS_NEXT_COMMAND_VALUE 32778 +#define _APS_NEXT_CONTROL_VALUE 1043 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/small.ico b/mp/src/utils/sapi51/Samples/CPP/Reco/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Reco/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/sol.xml b/mp/src/utils/sapi51/Samples/CPP/Reco/sol.xml new file mode 100644 index 00000000..ec65f76a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/sol.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + +

new +game

-please +
+ + please +

play the

+ ... + + please +
+ + please +

+ +

move

+

put

+ +

the

+

+ + + +

on

+

to

+
+

the

+ +
+ please +
+ + +

+ + red + black + + +

+

+ + +

of

+ + clubs + hearts + diamonds + spades + + +

+ + club + heart + diamond + spade + +
+
+ + + ace + two + three + four + five + six + seven + eight + nine + ten + jack + queen + king + lady + emperor + + +
diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Reco/stdafx.cpp new file mode 100644 index 00000000..a3f9e50c --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/stdafx.cpp @@ -0,0 +1,7 @@ +// stdafx.cpp : source file that includes just the standard includes +// Reco.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Reco/stdafx.h new file mode 100644 index 00000000..a31f0d3c --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/stdafx.h @@ -0,0 +1,51 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include +#include + +// C RunTime Header Files +#include +#include +#include +#include + +// ATL Header Files +#include + +// Multi-Language Header File +#include + +// RichEdit 2.0 +#include + +#ifdef _WIN32_WCE +#include +#define ICON_BIG 1 +#endif + +// SAPI Header Files +#include +#include + +// Local Header Files +#include "reco.h" +#include "resource.h" + + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Reco/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Reco/version.rc2 new file mode 100644 index 00000000..aed1ca9f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Reco/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Reco Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "RECO\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "reco.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.cpp b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.cpp new file mode 100644 index 00000000..818ecccf --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.cpp @@ -0,0 +1,1402 @@ +// SpAudioPlug.cpp : Implementation of CSimpleaudioApp and DLL registration. + +#include "stdafx.h" +#include "simpleaudio.h" +#include "SpAudioPlug.h" + +///////////////////////////////////////////////////////////////////////////// +// + + +template +void CBasicQueueByArray::_Clear() +{ + m_ulQueueSize = 0; + m_ulHeader = 0; + m_ulTail = 0; + m_ullTotalOut = 0; + m_ullTotalIn = 0; + m_ulSpaceNotifySize = 1; + m_ulDataNotifySize = 1; + if (m_pCoMemAlloc) + { + ::CoTaskMemFree(m_pCoMemAlloc); + m_pCoMemAlloc = NULL; + } +} + + + + +template +ULONG CBasicQueueByArray::_SpaceSize() +{ + return (m_ulHeader >= m_ulTail) ? (m_ulQueueSize - (m_ulHeader - m_ulTail) - 1) : (m_ulTail - m_ulHeader - 1); +} + +template +ULONG CBasicQueueByArray::_DataSize() +{ + return (m_ulHeader >= m_ulTail) ? (m_ulHeader - m_ulTail) : (m_ulQueueSize - (m_ulTail - m_ulHeader)); +} + + +template +CBasicQueueByArray::CBasicQueueByArray() : +m_pCoMemAlloc(NULL), +m_ulQueueSize(0), +m_ulHeader(0), +m_ulTail(0), +m_hSpaceAvailable(0), +m_hDataAvailable(0), +m_ullTotalOut(0), +m_ullTotalIn(0), +m_ulSpaceNotifySize(1), +m_ulDataNotifySize(1) +{ + InitializeCriticalSection(&m_CriticalSection); +} + +template +CBasicQueueByArray::CBasicQueueByArray(ULONG ulQueueSize, HRESULT *phr) : +m_pCoMemAlloc(NULL), +m_ulQueueSize(0), +m_ulHeader(0), +m_ulTail(0), +m_hSpaceAvailable(0), +m_hDataAvailable(0), +m_ullTotalOut(0), +m_ullTotalIn(0), +m_ulSpaceNotifySize(1), +m_ulDataNotifySize(1) +{ + InitializeCriticalSection(&m_CriticalSection); + *phr = Init(ulQueueSize); +} + + + +template +HRESULT CBasicQueueByArray::Resize(ULONG ulNewQueueSize) +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + HRESULT hr = S_OK; + if (ulNewQueueSize > m_ulQueueSize-1) + { + T* p = (T*)::CoTaskMemRealloc(m_pCoMemAlloc, sizeof(T)*(ulNewQueueSize+1)); + if (p == NULL) + { + hr = E_OUTOFMEMORY; + } + else + { + m_pCoMemAlloc = p; + if (m_ulHeader >= m_ulTail) + { + //We don't need to do anything. + } + else + { + //data are rounded from end of the queue to the beginning of the queue, we need to move the data to the end of the queue + memmove(m_pCoMemAlloc + ulNewQueueSize + 1 - (m_ulQueueSize - m_ulTail), m_pCoMemAlloc + m_ulTail, (m_ulQueueSize - m_ulTail)*sizeof(T)); + m_ulTail += ulNewQueueSize + 1 - m_ulQueueSize; + } + m_ulQueueSize = ulNewQueueSize + 1; + } + } + else if (ulNewQueueSize < m_ulQueueSize-1) + { + if (m_ulQueueSize-1-ulNewQueueSize > _SpaceSize()) + { + //This could cause loss of data + hr = E_INVALIDARG; + } + else + { + T* p = (T*)::CoTaskMemAlloc(sizeof(T) * (ulNewQueueSize+1)); + if (!p) + { + hr = E_OUTOFMEMORY; + } + else + { + if (m_ulHeader > m_ulTail) + { + //continous memory + memcpy(p, m_pCoMemAlloc + m_ulTail, (m_ulHeader-m_ulTail)*sizeof(T)); + } + else if (m_ulHeader < m_ulTail) + { + //copy the memory from m_ulTail to the end of the memory block + memcpy(p, m_pCoMemAlloc + m_ulTail, (m_ulQueueSize - m_ulTail)*sizeof(T)); + if (m_ulHeader) + { + memcpy(p + (m_ulQueueSize - m_ulTail), m_pCoMemAlloc, m_ulHeader*sizeof(T)); + } + } + m_ulHeader = _DataSize(); + m_ulTail = 0; + + ::CoTaskMemFree(m_pCoMemAlloc); + m_pCoMemAlloc = p; + m_ulQueueSize = ulNewQueueSize + 1; + } + } + } + + return hr; +} + + +template +HRESULT CBasicQueueByArray::Init(ULONG ulQueueSize, HANDLE hSpaceAvailable, HANDLE hDataAvailable, ULONG ulSpaceNotifySize, ULONG ulDataNotifySize) +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + HRESULT hr = S_OK; + if (ulSpaceNotifySize + ulDataNotifySize >= ulQueueSize) + { + //This could cause deadlock between client thread and SAPI read/write thread + return E_INVALIDARG; + } + _Clear(); + if (ulQueueSize) + { + //We allocated additional dummy space is to deal with the case that m_ulHeader catches up from behind to m_ulTail. + //We shouldn't use the dummy space to store any value + m_pCoMemAlloc = (T*)::CoTaskMemAlloc(sizeof(T)*(ulQueueSize + 1)); + if (m_pCoMemAlloc) + { + m_ulQueueSize = ulQueueSize + 1; + } + else + { + hr = E_OUTOFMEMORY; + } + } + + m_hSpaceAvailable = hSpaceAvailable; + m_hDataAvailable = hDataAvailable; + + m_ulSpaceNotifySize = ulSpaceNotifySize; + m_ulDataNotifySize = ulDataNotifySize; + + return hr; +} + + + +template +ULONG CBasicQueueByArray::QueueSize() +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + return m_ulQueueSize ? m_ulQueueSize -1 : 0; +} + + +template +void CBasicQueueByArray::InsertHead(T* pElements, ULONG ulCount, ULONG * pulReturnCount) +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + ULONG ulDataBeforeInsert= _DataSize(); //get the available data before we do the update + + ULONG ulEmpty = _SpaceSize(); + ULONG ulPushCount = (ulEmpty >= ulCount) ? ulCount : ulEmpty; + + if (ulPushCount <= (m_ulQueueSize - m_ulHeader)) + { + memcpy(m_pCoMemAlloc + m_ulHeader, pElements, sizeof(T)*ulPushCount); + } + else + { + memcpy(m_pCoMemAlloc + m_ulHeader, pElements, sizeof(T)*(m_ulQueueSize - m_ulHeader)); + memcpy(m_pCoMemAlloc, pElements + m_ulQueueSize - m_ulHeader, sizeof(T)*(ulPushCount - m_ulQueueSize + m_ulHeader)); + } + + m_ulHeader = (m_ulHeader + ulPushCount) % m_ulQueueSize; + if (pulReturnCount) + { + *pulReturnCount = ulPushCount; + } + + m_ullTotalIn += ulPushCount; + + if (ulDataBeforeInsert < m_ulDataNotifySize && m_ulDataNotifySize <= _DataSize()) + { + ::SetEvent(m_hDataAvailable); + } +} + + + +//When ulCount == 0, the caller wants to get the remaining +template +void CBasicQueueByArray::RemoveTail(T* pElements, ULONG ulCount, ULONG * pulReturnCount) +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + ULONG ulSpaceBeforeRemove = _SpaceSize(); //get the available space before we do the update + + ULONG ulOccupied = _DataSize(); + ULONG ulPopCount = (ulOccupied >= ulCount && ulCount) ? ulCount : ulOccupied; + + if (ulPopCount <= (m_ulQueueSize - m_ulTail)) + { + memcpy(pElements, m_pCoMemAlloc + m_ulTail, sizeof(T)*ulPopCount); + } + else + { + memcpy(pElements, m_pCoMemAlloc + m_ulTail, sizeof(T)*(m_ulQueueSize - m_ulTail)); + memcpy(pElements + m_ulQueueSize - m_ulTail, m_pCoMemAlloc, sizeof(T)*(ulPopCount - m_ulQueueSize + m_ulTail)); + } + + m_ulTail = (m_ulTail + ulPopCount) % m_ulQueueSize; + if (pulReturnCount) + { + *pulReturnCount = ulPopCount; + } + + m_ullTotalOut += ulPopCount; + + if (ulSpaceBeforeRemove < m_ulSpaceNotifySize && m_ulSpaceNotifySize <= _SpaceSize()) + { + ::SetEvent(m_hSpaceAvailable); + } +} + + + +template +void CBasicQueueByArray::ResetPos() +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + m_ulHeader = 0; + m_ulTail = 0; + m_ullTotalOut = 0; + m_ullTotalIn = 0; +} + + +/**************************************************************************** +* SpAudioPlug::Init * +*------------------------------* +* Description: +****************************************************************************/ +HRESULT SpAudioPlug::Init(VARIANT_BOOL fWrite, SpeechAudioFormatType FormatType) +{ + SPAUTO_OBJ_LOCK; + + HRESULT hr = S_OK; + if (fWrite == VARIANT_TRUE) + { + m_fWrite = TRUE; + } + else + { + m_fWrite = FALSE; + } + + SPSTREAMFORMAT eFormat = (SPSTREAMFORMAT)FormatType; + + if (eFormat == SPSF_Text) + { + return E_INVALIDARG; + } + + if (!m_autohAPIEvent) + { + m_autohAPIEvent = CreateEvent(NULL, TRUE, m_fWrite, NULL); + } + + if (m_State != SPAS_CLOSED) + { + hr = SPERR_DEVICE_BUSY; + } + else + { + if (eFormat != SPSF_NoAssignedFormat && m_Format.ComputeFormatEnum() != eFormat) + { + hr = m_Format.AssignFormat(eFormat); + if (SUCCEEDED(hr)) + { + static const SPAUDIOBUFFERINFO BuffInfo = {50, 500, 0}; + hr = SetBufferInfo(&BuffInfo); + } + } + + m_fautohAPIEventSet = m_fWrite; + } + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetData * +*------------------------------* +* Description: +****************************************************************************/ +HRESULT SpAudioPlug::SetData(VARIANT vData, long * pWritten) +{ + HRESULT hr = S_OK; + + //The method can only be called when the audio object is set to be input device. + if (m_fWrite || m_State != SPAS_RUN) + { + return STG_E_ACCESSDENIED; + } + else + { + bool fByRef = false; + switch (vData.vt) + { + case (VT_ARRAY | VT_BYREF | VT_UI1): + fByRef = true; + break; + case (VT_ARRAY | VT_UI1): + break; + default: + return E_INVALIDARG; + } + + BYTE *pArray = NULL; + ULONG ulDataSize = 0; + + hr = SafeArrayAccessData( fByRef ? *vData.pparray : vData.parray, + (void **)&pArray ); + if( SUCCEEDED( hr ) ) + { + ulDataSize = fByRef ? + (*vData.pparray)->rgsabound[0].cElements : + vData.parray->rgsabound[0].cElements; + } + + ULONG cbRemaining = ulDataSize; + ULONG ulWrite = 0; + BYTE * pHeader = pArray; + + if (pWritten) + { + *pWritten = 0; + } + + while(cbRemaining) + { + m_Queue.InsertHead(pHeader, cbRemaining, &ulWrite); + _ProcessEvent(); + + cbRemaining -= ulWrite; + pHeader += ulWrite; + if (pWritten) + { + *pWritten += ulWrite; + } + + if (ulWrite == 0) + { + DWORD dwReturn = ::WaitForSingleObject(m_hQueueHasSpaceEvent, INFINITE); + if (dwReturn == WAIT_OBJECT_0) + { + //It could be signalled by SetState thread, or Read thread + if (m_State == SPAS_CLOSED) + { + //Signalled by SetState thread + break; + } + else + { + //Signalled by Read thread + } + } + } + } + + SafeArrayUnaccessData( fByRef ? *vData.pparray : vData.parray); + + } + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::GetData * +*------------------------------* +* Description: +****************************************************************************/ +HRESULT SpAudioPlug::GetData(VARIANT* pData) +{ + HRESULT hr = S_OK; + + //The method can only be called when the audio object is set to be output device. + if (!m_fWrite) + { + return STG_E_ACCESSDENIED; + } + + //We can lock the queue several times on the same thread without blocking the client thread, this is character of critical section + //The reason we want to lock the queue explicitly is the possible inconsistent state between + m_Queue.Lock(); + ULONG ulDataAvailable = m_Queue.DataSize(); + if (ulDataAvailable) + { + BYTE *pArray = NULL; + SAFEARRAY* psa = SafeArrayCreateVector( VT_UI1, 0, ulDataAvailable); + if( psa ) + { + if( SUCCEEDED( hr = SafeArrayAccessData( psa, (void **)&pArray) ) ) + { + m_Queue.RemoveTail(pArray, ulDataAvailable, NULL); + SafeArrayUnaccessData( psa ); + VariantClear( pData ); + pData->vt = VT_ARRAY | VT_UI1; + pData->parray = psa; + } + else + { + // Free our memory if we failed. + hr = SafeArrayDestroy(psa); + VariantClear( pData ); + } + + } + else + { + hr = E_OUTOFMEMORY; + } + } + else + { + VariantClear( pData ); + hr = S_FALSE; + } + + + _ProcessEvent(); + + m_Queue.Unlock(); + + return hr; +} + + + +/**************************************************************************** +* SpAudioPlug::SpAudioPlug * +*------------------------------* +* Description: +* ctor +*********************************************************************/ +SpAudioPlug::SpAudioPlug() : +m_State(SPAS_CLOSED), +m_fWrite(TRUE), +m_SpEventSource(this), +m_cbEventBias(0), +m_ulBufferNotifySize(0), +m_hQueueHasDataEvent(NULL), +m_hQueueHasSpaceEvent(NULL), +m_autohAPIEvent(NULL) +{ + InitializeCriticalSection(&m_CriticalSection); +} + +/**************************************************************************** +* SpAudioPlug::FinalConstruct * +*-----------------------------* +* Description: +* Called by ATL when our object is constructed. +************************************************************************/ +HRESULT SpAudioPlug::FinalConstruct() +{ + HRESULT hr = S_OK; + + hr = m_Format.AssignFormat(SPSF_22kHz16BitMono); + + if (SUCCEEDED(hr)) + { + m_hQueueHasDataEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + } + + if (SUCCEEDED(hr)) + { + m_hQueueHasSpaceEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + } + + + + static const SPAUDIOBUFFERINFO BuffInfo = {50, 500, 0}; + hr = SetBufferInfo(&BuffInfo); + + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::FinalRelease * +*-----------------------------* +* Description: +* Called by ATL when our object is going away. +*********************************************************************/ +void SpAudioPlug::FinalRelease() +{ + if (m_hQueueHasDataEvent) + { + ::CloseHandle(m_hQueueHasDataEvent); + } + + if (m_hQueueHasSpaceEvent) + { + ::CloseHandle(m_hQueueHasSpaceEvent); + } + + if (m_autohAPIEvent) + { + CloseHandle(m_autohAPIEvent); + } + + DeleteCriticalSection(&m_CriticalSection); + + +} + + + +/**************************************************************************** +* SpAudioPlug::AddEvents * +*-----------------------* +* Description: +* ISpEventSink::AddEvents implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::AddEvents(const SPEVENT* pEventArray, ULONG ulCount) +{ + HRESULT hr = S_OK; + SPAUTO_OBJ_LOCK; + + if( SPIsBadReadPtr(pEventArray, sizeof(SPEVENT ) * ulCount)) + { + hr = E_INVALIDARG; + } + else + { + ULONGLONG ullDevicePosition = m_fWrite ? m_Queue.GetTotalOut() : m_Queue.GetTotalIn(); + hr = m_SpEventSource._AddEvents(pEventArray, ulCount); + m_SpEventSource._CompleteEvents(ullDevicePosition + m_cbEventBias); + } + return hr; +} + + + +/**************************************************************************** +* SpAudioPlug::GetEventInterest * +*------------------------------* +* Description: +* ISpEventSink::GetEventInterest implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetEventInterest(ULONGLONG * pullEventInterest) +{ + HRESULT hr = S_OK; + SPAUTO_OBJ_LOCK; + + if (SP_IS_BAD_WRITE_PTR(pullEventInterest)) + { + hr = E_POINTER; + } + else + { + *pullEventInterest = m_SpEventSource.m_ullEventInterest; + } + + return hr; +} + + + +/**************************************************************************** +* SpAudioPlug::_ProcessEvent * +*---------------------* +* Description: +* +* Return: +*********************************************************************/ +void SpAudioPlug::_ProcessEvent() +{ + BOOL fSetEvent; + if (m_fWrite) + { + if (m_Queue.DataSize() < m_ulBufferNotifySize) + { + fSetEvent = TRUE; + } + else + { + fSetEvent = FALSE; + } + } + else + { + if (m_Queue.DataSize() >= m_ulBufferNotifySize) + { + fSetEvent = TRUE; + } + else + { + fSetEvent = FALSE; + } + } + if (fSetEvent != m_fautohAPIEventSet) + { + if (fSetEvent) + { + SetEvent(m_autohAPIEvent); + } + else + { + ResetEvent(m_autohAPIEvent); + } + m_fautohAPIEventSet = fSetEvent; + } + + ULONGLONG ullDevicePosition = m_fWrite ? m_Queue.GetTotalOut() : m_Queue.GetTotalIn(); + m_SpEventSource._CompleteEvents(ullDevicePosition + m_cbEventBias); + +} + + +/**************************************************************************** +* SpAudioPlug::Read * +*---------------------* +* Description: +* ISequentialStream::Read implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Read(void * pv, ULONG cb, ULONG *pcbRead) +{ + SPDBG_FUNC("SpAudioPlug::Read"); + HRESULT hr = S_OK; + + if (SPIsBadWritePtr(pv, cb) || + SP_IS_BAD_OPTIONAL_WRITE_PTR(pcbRead)) + { + return E_POINTER; + } + + if (m_fWrite) + { + return STG_E_ACCESSDENIED; + } + + if (pcbRead) + { + *pcbRead = 0; + } + + ULONG cbRemaining = cb; + BYTE *pTail = (BYTE*)pv; + ULONG ulRead = 0; + + while(cbRemaining) + { + + m_Queue.RemoveTail(pTail, cbRemaining, &ulRead); + _ProcessEvent(); + + + + if (ulRead) + { + cbRemaining -= ulRead; + pTail += ulRead; + + if (pcbRead) + { + *pcbRead += ulRead; + } + } + else + { + if (m_State == SPAS_RUN) + { + DWORD dwReturn = ::WaitForSingleObject(m_hQueueHasDataEvent, 1000); + + if (dwReturn == WAIT_OBJECT_0) + { + //Signalled by SetData thread + } + else if (dwReturn == WAIT_TIMEOUT) + { + hr = SPERR_AUDIO_BUFFER_UNDERFLOW; + break; + } + + } + else + { + break; + } + } + + } + + + SPDBG_REPORT_ON_FAIL(hr); + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::Write * +*----------------------* +* Description: +* ISequentialStream::Write implementation. +* +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Write(const void * pv, ULONG cb, ULONG *pcb) +{ + SPDBG_FUNC("SpAudioPlug::Write"); + HRESULT hr = S_OK; + + if (!m_fWrite) + { + return STG_E_ACCESSDENIED; + } + else if (m_State != SPAS_RUN && m_State != SPAS_PAUSE) + { + return SPERR_AUDIO_STOPPED; + } + else + { + ULONG cbRemaining = cb; + ULONG ulWrite = 0; + BYTE * pHeader = (BYTE*)pv; + while(cbRemaining) + { + m_Queue.InsertHead(pHeader, cbRemaining, &ulWrite); + _ProcessEvent(); + + + cbRemaining -= ulWrite; + pHeader += ulWrite; + if (pcb) + { + *pcb += ulWrite; + } + + if (ulWrite == 0) + { + DWORD dwReturn = ::WaitForSingleObject(m_hQueueHasSpaceEvent, INFINITE); + if (dwReturn == WAIT_OBJECT_0) + { + //It could be signalled by SetState thread, or GetData thread + if (m_State == SPAS_CLOSED) + { + //Signalled by SetState thread + break; + } + else + { + //Signalled by GetData thread + } + } + } + } + + } + + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::Seek * +*---------------------* +* Description: +* IStream::Seek implementation. It can only be used to retrieve the current seek position +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER * plibNewPosition) +{ + SPDBG_FUNC("SpAudioPlug::Seek"); + SPAUTO_OBJ_LOCK; + + HRESULT hr = S_OK; + + if (dwOrigin != STREAM_SEEK_CUR || dlibMove.QuadPart) + { + hr = E_INVALIDARG; + } + else + { + if (SPIsBadWritePtr(plibNewPosition, sizeof(*plibNewPosition))) + { + hr = E_POINTER; + } + else + { + ULONGLONG ullSeekPosition = m_fWrite ? m_Queue.GetTotalIn() : m_Queue.GetTotalOut(); + plibNewPosition->QuadPart = ullSeekPosition; + } + } + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetSize * +*------------------------* +* Description: +* IStream::SetSize implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetSize(ULARGE_INTEGER libNewSize) +{ + SPDBG_FUNC("SpAudioPlug::SetSize"); + SPAUTO_OBJ_LOCK; + + return m_Queue.Resize(libNewSize.LowPart); +} + +/**************************************************************************** +* SpAudioPlug::CopyTo * +*-----------------------* +* Description: +* IStream::CopyTo implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) +{ + SPDBG_FUNC("SpAudioPlug::CopyTo"); + SPAUTO_OBJ_LOCK; + if (m_fWrite) + { + return STG_E_ACCESSDENIED; + } + else + { + return E_NOTIMPL; + } +} + +/**************************************************************************** +* SpAudioPlug::Commit * +*-----------------------* +* Description: +* IStream::Commit implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Commit(DWORD grfCommitFlags) +{ + SPDBG_FUNC("SpAudioPlug::Commit"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + if (m_fWrite && m_State == SPAS_RUN) + { + _ProcessEvent(); // Call this to clear the event if we're writing + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::Revert * +*-----------------------* +* Description: +* IStream::Revert implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Revert(void) +{ + SPDBG_FUNC("SpAudioPlug::Revert"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::LockRegion * +*---------------------------* +* Description: +* IStream::LockRegion implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +{ + SPDBG_FUNC("SpAudioPlug::LockRegion"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::UnlockRegion * +*-----------------------------* +* Description: +* IStream::UnlockRegion implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +{ + SPDBG_FUNC("SpAudioPlug::UnlockRegion"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::Stat * +*---------------------* +* Description: +* IStream::Stat implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Stat(STATSTG *pstatstg, DWORD grfStatFlag) +{ + SPDBG_FUNC("SpAudioPlug::Stat"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::Clone * +*----------------------* +* Description: +* IStream::Clone implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Clone(IStream **ppstm) +{ + SPDBG_FUNC("SpAudioPlug::Clone"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::GetFormat * +*--------------------------* +* Description: +* ISpStreamFormat::GetFormat implementation. +* GetFormat is called for input device +* +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetFormat(GUID * pguidFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + SPDBG_FUNC("SpAudioPlug::GetFormat"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + if (SP_IS_BAD_WRITE_PTR(pguidFormatId) || + SP_IS_BAD_WRITE_PTR(ppCoMemWaveFormatEx)) + { + return E_POINTER; + } + + //m_guidFormatId and m_pCoMemWaveFormatEx need to be initialized by ISpAudioPlug::Init + if (m_Format.FormatId() == GUID_NULL || m_Format.WaveFormatExPtr() == NULL) + { + hr = SPERR_UNINITIALIZED; + } + else + { + hr = m_Format.CopyTo(pguidFormatId, ppCoMemWaveFormatEx); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetState * +*-------------------------* +* Description: +* ISpAudio::SetState implementation. +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetState(SPAUDIOSTATE NewState, ULONGLONG ullReserved ) +{ + SPDBG_FUNC("SpAudioPlug::SetState"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + if (m_State != NewState) + { + m_State = NewState; + + if (NewState != SPAS_RUN) + { + if (NewState == SPAS_STOP || NewState == SPAS_CLOSED) + { + m_Queue.ResetPos(); + } + SetEvent(m_hQueueHasDataEvent); //Signal the read/getdata thread it exit + SetEvent(m_hQueueHasSpaceEvent); //Signal the write/setdata thread it exit + } + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetFormat * +*--------------------------* +* Description: +* ISpAudio::SetFormat implementation. We don't allow setting the format +* to anything other than the input format. +* We'll let the format converter do the right thing for us for +* the SR engine. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetFormat(REFGUID rguidFmtId, const WAVEFORMATEX * pWaveFormatEx) +{ + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + if (!m_Format.IsEqual(rguidFmtId, pWaveFormatEx)) + { + hr = SPERR_UNSUPPORTED_FORMAT; + } + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::GetStatus * +*--------------------------* +* Description: +* ISpAudio::GetStatus implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetStatus(SPAUDIOSTATUS *pStatus) +{ + SPDBG_FUNC("SpAudioPlug::GetStatus"); + SPAUTO_OBJ_LOCK; + HRESULT hr = S_OK; + if (SP_IS_BAD_WRITE_PTR(pStatus)) + { + hr = E_POINTER; + } + else + { + //Because there are more than one operation on m_Queue, we need to lock the queue explicitly + m_Queue.Lock(); + + if (m_State == SPAS_RUN) + { + long lDataInQueue = (long)(m_Queue.DataSize()); + pStatus->cbFreeBuffSpace = ((long)m_Queue.QueueSize()) - lDataInQueue; + + if (m_fWrite) + { + pStatus->cbNonBlockingIO = pStatus->cbFreeBuffSpace; + } + else + { + pStatus->cbNonBlockingIO = lDataInQueue; + } + } + else + { + pStatus->cbFreeBuffSpace = 0; + pStatus->cbNonBlockingIO = 0; + } + pStatus->CurSeekPos = m_fWrite ? m_Queue.GetTotalIn() : m_Queue.GetTotalOut(); + pStatus->State = m_State; + pStatus->CurDevicePos = m_fWrite ? m_Queue.GetTotalOut() : m_Queue.GetTotalIn();; + pStatus->dwReserved1 = 0; + pStatus->dwReserved2 = 0; + + m_Queue.Unlock(); + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetBufferInfo * +*------------------------------* +* Description: +* ISpAudio::SetBufferInfo implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetBufferInfo(const SPAUDIOBUFFERINFO * pInfo) +{ + SPDBG_FUNC("SpAudioPlug::SetBufferInfo"); + SPAUTO_OBJ_LOCK; + + HRESULT hr = S_OK; + + + if (m_State != SPAS_CLOSED) + { + hr = SPERR_DEVICE_BUSY; + } + else + { + m_BufferInfo = *pInfo; + if (m_fWrite) + { + m_Queue.Init(m_Format.WaveFormatExPtr()->nAvgBytesPerSec * pInfo->ulMsBufferSize / 1000, + m_hQueueHasSpaceEvent, + m_hQueueHasDataEvent, + m_Format.WaveFormatExPtr()->nAvgBytesPerSec *pInfo->ulMsMinNotification / 1000, + 1); + } + else + { + m_Queue.Init(m_Format.WaveFormatExPtr()->nAvgBytesPerSec * pInfo->ulMsBufferSize / 1000, + m_hQueueHasSpaceEvent, + m_hQueueHasDataEvent, + 1, + 1); + } + + m_cbEventBias = (m_Format.WaveFormatExPtr()->nAvgBytesPerSec * pInfo->ulMsEventBias) / 1000; + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::GetBufferInfo * +*------------------------------* +* Description: +* ISpAudio::GetBufferInfo implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetBufferInfo(SPAUDIOBUFFERINFO * pInfo) +{ + SPDBG_FUNC("SpAudioPlug::GetBufferInfo"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + *pInfo = m_BufferInfo; + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::GetDefaultFormat * +*---------------------------------* +* Description: +* ISpAudio::GetDefaultFormat implementation. +* GetDefaultFormat is called for output device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetDefaultFormat(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + SPDBG_FUNC("SpAudioPlug::GetDefaultFormat"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + if (SP_IS_BAD_WRITE_PTR(pFormatId) || + SP_IS_BAD_WRITE_PTR(ppCoMemWaveFormatEx)) + { + return E_POINTER; + } + + //m_guidFormatId and m_pCoMemWaveFormatEx need to be initialized by ISpAudioPlug::Init + if (m_Format.FormatId() == GUID_NULL || m_Format.WaveFormatExPtr() == NULL) + { + hr = SPERR_UNINITIALIZED; + } + else + { + hr = m_Format.CopyTo(pFormatId, ppCoMemWaveFormatEx); + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::EventHandle * +*----------------------------* +* Description: +* ISpAudio::EventHandle implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP_(HANDLE) SpAudioPlug::EventHandle() +{ + SPDBG_FUNC("SpAudioPlug::EventHandle"); + + SPAUTO_OBJ_LOCK; + + return m_autohAPIEvent; +} + +/**************************************************************************** +* SpAudioPlug::GetVolumeLevel * +*-------------------------------* +* Description: +* ISpAudio:GetVolumeLevel implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetVolumeLevel(ULONG *pLevel) +{ + SPDBG_FUNC("SpAudioPlug::GetVolumeLevel"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL ; +} + +/**************************************************************************** +* SpAudioPlug::SetVolumeLevel * +*-------------------------------* +* Description: +* ISpAudio::SetVolumeLevel implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetVolumeLevel(ULONG Level) +{ + SPDBG_FUNC("SpAudioPlug::SetVolumeLevel"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL ; +} + +/**************************************************************************** +* SpAudioPlug::GetBufferNotifySize * +*------------------------------------* +* Description: +* ISpAudio::GetBufferNotifySize implementation. Delegate to the actual +* audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetBufferNotifySize(ULONG *pcbSize) +{ + SPDBG_FUNC("SpAudioPlug::GetBufferNotifySize"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + *pcbSize = m_ulBufferNotifySize; + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetBufferNotifySize * +*------------------------------------* +* Description: +* ISpAudio::SetBufferNotifySize implementation. Delegate to the actual +* audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetBufferNotifySize(ULONG cbSize) +{ + SPDBG_FUNC("SpAudioPlug::SetBufferNotifySize"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + m_ulBufferNotifySize = cbSize; + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.h b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.h new file mode 100644 index 00000000..83d504ad --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.h @@ -0,0 +1,246 @@ +// SpAudioPlug.h: Definition of the SpAudioPlug class +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SPAUDIOPLUG_H__AD57CF29_3B4A_40A9_BB01_9BE69043E1DF__INCLUDED_) +#define AFX_SPAUDIOPLUG_H__AD57CF29_3B4A_40A9_BB01_9BE69043E1DF__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" // main symbols + + +//The queue object itself is thread safe. Different threads could call the different methods on the same object. +//The queue object uses contiguous memory block for queue operation. + +template +class CCriticalSectionLock +{ +private: +T* m_pObject; + +public: + CCriticalSectionLock(T* pObject) + { + m_pObject = pObject; + m_pObject->Lock(); + } + ~CCriticalSectionLock() + { + m_pObject->Unlock(); + } +}; + + +template +class CBasicQueueByArray +{ + private: + typedef CCriticalSectionLock< CBasicQueueByArray > CRITICAL_SECTION_AUTO_LOCK; + + T* m_pCoMemAlloc; + ULONG m_ulQueueSize; //In terms of the number of element of T in the queue, not the total bytes + ULONG m_ulHeader; //In terms of the number of element offset from the beginning of memory, range from 0 to m_ulQueueSize - 1 + ULONG m_ulTail; //In terms of the number of element offset from the beginning of memory, range from 0 to m_ulQueueSize - 1 + ULONGLONG m_ullTotalOut; //the total bytes read out of the queue by RemoveTail + ULONGLONG m_ullTotalIn; //the total bytes put into the queue by InsertHead + + CRITICAL_SECTION m_CriticalSection; + HANDLE m_hSpaceAvailable; //signalled when the queue has space + HANDLE m_hDataAvailable; //signalled when the the queue has m_ulNotifySize or more data + ULONG m_ulSpaceNotifySize; //when the available space is equal or more than this amount, we need to signal m_hSpaceAvailable + ULONG m_ulDataNotifySize; //when the available data is equal or more than this amount, we need to signal m_hDataAvailable + + void _Clear(); + + ULONG _SpaceSize(); + ULONG _DataSize(); + + + public: + CBasicQueueByArray(); + CBasicQueueByArray(ULONG ulQueueSize, HRESULT *phr); + ~CBasicQueueByArray() + { + DeleteCriticalSection(&m_CriticalSection); + if (m_pCoMemAlloc) + { + ::CoTaskMemFree(m_pCoMemAlloc); + } + } + + void Lock() + { + EnterCriticalSection(&m_CriticalSection); + } + + void Unlock() + { + LeaveCriticalSection(&m_CriticalSection); + } + + + HRESULT Resize(ULONG ulNewQueueSize); + + HRESULT Init + (ULONG ulQueueSize, HANDLE hSpaceAvailable, HANDLE hDataAvailable, ULONG ulSpaceNotifySize, ULONG ulDataNotifySize); + ULONG QueueSize(); + + void InsertHead(T* pElements, ULONG ulCount, ULONG * pulReturnCount); + void RemoveTail(T* pElements, ULONG ulCount, ULONG * pulReturnCount); + void ResetPos(); + ULONGLONG GetTotalOut() + { + CRITICAL_SECTION_AUTO_LOCK csl(this); + return m_ullTotalOut; + } + ULONGLONG GetTotalIn() + { + CRITICAL_SECTION_AUTO_LOCK csl(this); + return m_ullTotalIn; + } + ULONG DataSize() + { + CRITICAL_SECTION_AUTO_LOCK csl(this); + return _DataSize(); + } + + +}; + +///////////////////////////////////////////////////////////////////////////// +// SpAudioPlug + +class SpAudioPlug : + public ISpAudio, + public ISpEventSource, + public ISpEventSink, + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl, + public IDispatchImpl + +{ +public: + SpAudioPlug(); + HRESULT FinalConstruct(); + void FinalRelease(); + +BEGIN_COM_MAP(SpAudioPlug) + COM_INTERFACE_ENTRY(ISpAudioPlug) + COM_INTERFACE_ENTRY(ISequentialStream) + COM_INTERFACE_ENTRY(IStream) + COM_INTERFACE_ENTRY(ISpStreamFormat) + COM_INTERFACE_ENTRY(ISpAudio) + COM_INTERFACE_ENTRY(ISpNotifySource) + COM_INTERFACE_ENTRY(ISpEventSource) + COM_INTERFACE_ENTRY(ISpEventSink) + COM_INTERFACE_ENTRY2(IDispatch, ISpeechAudio) + COM_INTERFACE_ENTRY(ISpeechAudio) + COM_INTERFACE_ENTRY(ISpeechBaseStream) +END_COM_MAP() +//DECLARE_NOT_AGGREGATABLE(SpAudioPlug) +// Remove the comment from the line above if you don't want your object to +// support aggregation. + +DECLARE_REGISTRY_RESOURCEID(IDR_SpAudioPlug) + +// ISpAudioPlug + STDMETHODIMP Init(VARIANT_BOOL fWrite, SpeechAudioFormatType FormatType); + STDMETHODIMP SetData(VARIANT vData, long * pWritten); + STDMETHODIMP GetData(VARIANT* vData); + + + //--- ISequentialStream --- + STDMETHODIMP Read(void * pv, ULONG cb, ULONG *pcbRead); + STDMETHODIMP Write(const void * pv, ULONG cb, ULONG *pcbWritten); + + //--- IStream --- + STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition); + STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize); + STDMETHODIMP CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten); + STDMETHODIMP Commit(DWORD grfCommitFlags); + STDMETHODIMP Revert(void); + STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); + STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); + STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag); + STDMETHODIMP Clone(IStream **ppstm); + + //--- ISpStreamFormat --- + STDMETHODIMP GetFormat(GUID * pguidFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); + + //--- ISpAudio --- + STDMETHODIMP SetState(SPAUDIOSTATE NewState, ULONGLONG ullReserved ); + STDMETHODIMP SetFormat(REFGUID rguidFmtId, const WAVEFORMATEX * pWaveFormatEx); + STDMETHODIMP GetStatus(SPAUDIOSTATUS *pStatus); + STDMETHODIMP SetBufferInfo(const SPAUDIOBUFFERINFO * pInfo); + STDMETHODIMP GetBufferInfo(SPAUDIOBUFFERINFO * pInfo); + STDMETHODIMP GetDefaultFormat(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); + STDMETHODIMP_(HANDLE) EventHandle(); + STDMETHODIMP GetVolumeLevel(ULONG *pLevel); + STDMETHODIMP SetVolumeLevel(ULONG Level); + STDMETHODIMP GetBufferNotifySize(ULONG *pcbSize); + STDMETHODIMP SetBufferNotifySize(ULONG cbSize); + + //--- ISpNotifySource --- + //--- ISpEventSource --- + CSpEventSource m_SpEventSource; + DECLARE_SPEVENTSOURCE_METHODS(m_SpEventSource) + + //--- ISpEventSink --- + STDMETHODIMP AddEvents(const SPEVENT* pEventArray, ULONG ulCount); + STDMETHODIMP GetEventInterest(ULONGLONG * pullEventInterest); + + //--- ISpeechBaseStream ---------------------------------------- + STDMETHODIMP get_Format(ISpeechAudioFormat** ppStreamFormat) { return E_NOTIMPL; }; + STDMETHODIMP putref_Format(ISpeechAudioFormat* pFormat) { return E_NOTIMPL; }; + STDMETHODIMP Read(VARIANT* pvtBuffer, long NumBytes, long* pRead) { return E_NOTIMPL;} + STDMETHODIMP Write(VARIANT vtBuffer, long* pWritten) { return E_NOTIMPL;} + STDMETHODIMP Seek(VARIANT Pos, SpeechStreamSeekPositionType Origin, VARIANT* pNewPosition) { return E_NOTIMPL; }; + + //--- ISpeechAudio ---------------------------------- + STDMETHODIMP SetState( SpeechAudioState State ) { return E_NOTIMPL; }; + STDMETHODIMP get_Status( ISpeechAudioStatus** ppStatus ) { return E_NOTIMPL; }; + STDMETHODIMP get_BufferInfo(ISpeechAudioBufferInfo** ppBufferInfo) { return E_NOTIMPL; }; + STDMETHODIMP get_DefaultFormat(ISpeechAudioFormat** ppStreamFormat) { return E_NOTIMPL; }; + STDMETHODIMP get_Volume(long* pVolume) { return E_NOTIMPL; }; + STDMETHODIMP put_Volume(long Volume) { return E_NOTIMPL; }; + STDMETHODIMP get_BufferNotifySize(long* pBufferNotifySize) { return E_NOTIMPL; }; + STDMETHODIMP put_BufferNotifySize(long BufferNotifySize) { return E_NOTIMPL; }; + STDMETHODIMP get_EventHandle(long* pEventHandle) { return E_NOTIMPL; }; + + void Lock() + { + EnterCriticalSection(&m_CriticalSection); + } + + void Unlock() + { + LeaveCriticalSection(&m_CriticalSection); + } + + +private: + SPAUDIOSTATE m_State; + CSpStreamFormat m_Format; + CBasicQueueByArray m_Queue; + SPAUDIOBUFFERINFO m_BufferInfo; + ULONG m_cbEventBias; + BOOL m_fWrite; + HANDLE m_hQueueHasDataEvent; //The event is signaled by SetData/GetData thread or SAPI SetState thread. Read/Write thread waits for this event. + HANDLE m_hQueueHasSpaceEvent; //The event is signaled by Read/Write thread or SAPI SetState thread , SetData/GetData thread waits for this event. + + ULONG m_ulBufferNotifySize; + HANDLE m_autohAPIEvent; //When there are m_ulBufferNotifySize data available + BOOL m_fautohAPIEventSet; + CRITICAL_SECTION m_CriticalSection; + + void _ProcessEvent(); + +}; + +#define SPAUTO_OBJ_LOCK CCriticalSectionLock< SpAudioPlug > lck(this) + +#endif // !defined(AFX_SPAUDIOPLUG_H__AD57CF29_3B4A_40A9_BB01_9BE69043E1DF__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.rgs b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.rgs new file mode 100644 index 00000000..b13bb4d3 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.rgs @@ -0,0 +1,23 @@ +HKCR +{ + Simpleaudio.SpAudioPlug.1 = s 'SpAudioPlug Class' + { + CLSID = s '{F0CB433F-9453-466A-A35E-95909872E2A8}' + } + Simpleaudio.SpAudioPlug = s 'SpAudioPlug Class' + { + CLSID = s '{F0CB433F-9453-466A-A35E-95909872E2A8}' + } + NoRemove CLSID + { + ForceRemove {F0CB433F-9453-466A-A35E-95909872E2A8} = s 'SpAudioPlug Class' + { + ProgID = s 'Simpleaudio.SpAudioPlug.1' + VersionIndependentProgID = s 'Simpleaudio.SpAudioPlug' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'both' + } + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.cpp b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.cpp new file mode 100644 index 00000000..a5eea178 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.cpp @@ -0,0 +1,12 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.h b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.h new file mode 100644 index 00000000..a047f50f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.h @@ -0,0 +1,33 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__C748285E_9F4E_4F76_A1CD_B963593A52DD__INCLUDED_) +#define AFX_STDAFX_H__C748285E_9F4E_4F76_A1CD_B963593A52DD__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef STRICT +#define STRICT +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include +#include "sapi.h" +#include "sphelper.h" +#include "spddkhlp.h" +#include "speventq.h" + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__C748285E_9F4E_4F76_A1CD_B963593A52DD__INCLUDED) diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/resource.h b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/resource.h new file mode 100644 index 00000000..eeec4a4d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by simpleaudio.rc +// +#define IDS_PROJNAME 100 +#define IDS_SPAUDIOPLUG_DESC 101 +#define IDR_SpAudioPlug 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.cpp b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.cpp new file mode 100644 index 00000000..58ea3bc5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.cpp @@ -0,0 +1,72 @@ +// simpleaudio.cpp : Implementation of DLL Exports. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f simpleaudiops.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "simpleaudio.h" + +#include "simpleaudio_i.c" +#include "SpAudioPlug.h" + + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_SpAudioPlug, SpAudioPlug) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_SIMPLEAUDIOLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.def b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.def new file mode 100644 index 00000000..38f5c0f7 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.def @@ -0,0 +1,9 @@ +; simpleaudio.def : Declares the module parameters. + +LIBRARY "simpleaudio.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.dsp b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.dsp new file mode 100644 index 00000000..ea69409a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.dsp @@ -0,0 +1,336 @@ +# Microsoft Developer Studio Project File - Name="simpleaudio" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=simpleaudio - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "simpleaudio.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "simpleaudio.mak" CFG="simpleaudio - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "simpleaudio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "simpleaudio - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=.\Debug\simpleaudio.dll +InputPath=.\Debug\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\DebugU +TargetPath=.\DebugU\simpleaudio.dll +InputPath=.\DebugU\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=.\ReleaseMinSize\simpleaudio.dll +InputPath=.\ReleaseMinSize\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=.\ReleaseMinDependency\simpleaudio.dll +InputPath=.\ReleaseMinDependency\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=.\ReleaseUMinSize\simpleaudio.dll +InputPath=.\ReleaseUMinSize\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\simpleaudio.dll +InputPath=.\ReleaseUMinDependency\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "simpleaudio - Win32 Debug" +# Name "simpleaudio - Win32 Unicode Debug" +# Name "simpleaudio - Win32 Release MinSize" +# Name "simpleaudio - Win32 Release MinDependency" +# Name "simpleaudio - Win32 Unicode Release MinSize" +# Name "simpleaudio - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\simpleaudio.cpp +# End Source File +# Begin Source File + +SOURCE=.\simpleaudio.def +# End Source File +# Begin Source File + +SOURCE=.\simpleaudio.idl +# ADD MTL /tlb ".\simpleaudio.tlb" /h "simpleaudio.h" /iid "simpleaudio_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\simpleaudio.rc +# End Source File +# Begin Source File + +SOURCE=.\SpAudioPlug.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\SpAudioPlug.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\SpAudioPlug.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.idl b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.idl new file mode 100644 index 00000000..185773b1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.idl @@ -0,0 +1,59 @@ +// simpleaudio.idl : IDL source for simpleaudio.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (simpleaudio.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; +import "sapi.idl"; + + +typedef [hidden] enum DISPID_SpAudioPlug +{ + DISPID_SAPInit = 1000, + DISPID_SAPSetData, + DISPID_SAPGetData +} DISPID_SpAudioPlug; + + + +[ + object, + uuid(1CE52E86-6B75-4749-BBAC-3D23626DA468), + dual, + helpstring("ISpAudioPlug Interface"), + pointer_default(unique) +] +interface ISpAudioPlug : IDispatch +{ + + [helpstring("Init"), id(DISPID_SAPInit)] + HRESULT Init([in] VARIANT_BOOL fWrite, [in] SpeechAudioFormatType FormatType); + + [helpstring("SetData"), id(DISPID_SAPSetData)] + HRESULT SetData([in] VARIANT vData, [out, retval] long * pWritten); + + [helpstring("GetData"), id(DISPID_SAPGetData)] + HRESULT GetData([out, retval] VARIANT* vData); +}; + +[ + uuid(17709AA0-2512-4FFE-BB24-1F6C535DEBCA), + version(1.0), + helpstring("simpleaudio 1.0 Type Library") +] +library SIMPLEAUDIOLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(F0CB433F-9453-466A-A35E-95909872E2A8), + helpstring("SpAudioPlug Class") + ] + coclass SpAudioPlug + { + [default] interface ISpAudioPlug; + }; +}; diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.rc b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.rc new file mode 100644 index 00000000..51bae98e --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.rc @@ -0,0 +1,93 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""simpleaudio.tlb""\r\n" + "#include ""version.rc2""\r\n""\0" +END + + + +#endif // APSTUDIO_INVOKED + + + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_SpAudioPlug REGISTRY DISCARDABLE "SpAudioPlug.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "simpleaudio" + IDS_SPAUDIOPLUG_DESC "SpAudioPlug Class" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "simpleaudio.tlb" +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/version.rc2 new file mode 100644 index 00000000..9bf18fa9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/version.rc2 @@ -0,0 +1,45 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "\0" + VALUE "FileDescription", "simpleaudio Module\0" + VALUE "FileVersion", "1, 0, 0, 0\0" + VALUE "InternalName", "simpleaudio\0" + VALUE "LegalCopyright", "Copyright 2001\0" + VALUE "LegalTrademarks", "\0" + VALUE "OLESelfRegister", "\0" + VALUE "OriginalFilename", "simpleaudio.DLL\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "simpleaudio Module\0" + VALUE "ProductVersion", "1, 0, 0, 0\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/resource.h b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/resource.h new file mode 100644 index 00000000..ffe470be --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/resource.h @@ -0,0 +1,40 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by simpledict.rc +// +#define IDC_BUTTON_DELETEITEM 2 +#define IDC_BUTTON_CLEARALL 3 +#define IDD_RECODLG 100 +#define IDD_SIMPLEDICTDLG 100 +#define IDI_RECO 107 +#define IDR_SOL_CFG 134 +#define IDD_DYNGRAMMARDLG 135 +#define IDI_SIMPLEDICT 137 +#define IDC_BUTTON_EXIT 1006 +#define IDC_LIST_PHRASES 1008 +#define IDC_BUTTON_ADD 1009 +#define IDC_BUTTON_DYNRULES 1009 +#define IDC_COMBO_ENGINES 1010 +#define IDC_CHECK_CREATE 1011 +#define IDC_RETAINALL 1012 +#define IDC_RETAINRECO 1013 +#define IDC_CHECK_CFG 1014 +#define IDC_EDIT_PROPS 1015 +#define IDC_CHECK_DICTATION 1016 +#define IDC_BUTTON_CLEAR 1017 +#define IDC_EDIT_NEWITEM 1017 +#define IDC_BUTTON_ADDITEM 1018 +#define IDC_LIST_ITEMS 1019 +#define IDC_EDIT_DICT 1021 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 138 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1024 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.cpp b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.cpp new file mode 100644 index 00000000..7fbb5aa8 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.cpp @@ -0,0 +1,226 @@ +/**************************************************************************** +* SimpleDict.cpp +* A very simple dictation app. The user speaks, and whatever the +* engine recognizes appears in an edit box. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include +#include "simpledict.h" + +// Foward declarations of functions included in this code module: +LRESULT CALLBACK SimpleDictDlgProc( HWND, UINT, WPARAM, LPARAM ); + +// Entry point +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ +#ifdef _WIN32_WCE + if (SUCCEEDED(::CoInitializeEx(NULL,COINIT_MULTITHREADED))) +#else + if (SUCCEEDED(::CoInitialize(NULL))) +#endif + { + // NOTE: Extra scope provided so DlgInfo is destroyed before CoUninitialize is called. + { + CSimpleDict SimpleDictClass( hInstance ); + ::DialogBoxParam( hInstance, MAKEINTRESOURCE( IDD_SIMPLEDICTDLG ), NULL, + (DLGPROC) CSimpleDict::SimpleDictDlgProc, (LPARAM) &SimpleDictClass ); + } + ::CoUninitialize(); + } + return 0; +} + + + +/********************************************************************************************* +* CSimpleDict::SimpleDictDlgProc() +* Main message handler for SimpleDict dialog box. +* At initialization time, LPARAM is the CSimpleDict object, to which the +* window long is set. +**********************************************************************************************/ +LRESULT CALLBACK CSimpleDict::SimpleDictDlgProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + CSimpleDict *pThis = (CSimpleDict *) ::GetWindowLong( hDlg, GWL_USERDATA ); + switch( message ) + { + case WM_INITDIALOG: + ::SetWindowLong( hDlg, GWL_USERDATA, lParam ); + pThis = (CSimpleDict *) lParam; + if ( !pThis->InitDialog( hDlg ) ) + { + ::DestroyWindow( hDlg ); + } + break; + + case WM_RECOEVENT: + // All recognition events send this message, because that is how we + // specified we should be notified + pThis->RecoEvent(); + return TRUE; + break; + + case WM_COMMAND: + if ( LOWORD( wParam ) == IDC_BUTTON_EXIT ) + { + ::EndDialog( hDlg, TRUE ); + } + break; + + case WM_CLOSE: + ::EndDialog( hDlg, TRUE ); + break; + + case WM_DESTROY: + // Release the recognition context and the dictation grammar + pThis->m_cpRecoCtxt.Release(); + pThis->m_cpDictationGrammar.Release(); + + break; + + default: + return FALSE; + break; + } + + return TRUE; +} + +/********************************************************************************************* +* CSimpleDict::InitDialog() +* Creates the recognition context and activates the grammar. +* Returns TRUE iff successful. +**********************************************************************************************/ +bool CSimpleDict::InitDialog( HWND hDlg ) +{ + m_hDlg = hDlg; + + HRESULT hr = S_OK; + CComPtr cpRecoEngine; + hr = cpRecoEngine.CoCreateInstance(CLSID_SpInprocRecognizer); + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoEngine->CreateRecoContext( &m_cpRecoCtxt ); + } + + + // Set recognition notification for dictation + if (SUCCEEDED(hr)) + { + hr = m_cpRecoCtxt->SetNotifyWindowMessage( hDlg, WM_RECOEVENT, 0, 0 ); + } + + + if (SUCCEEDED(hr)) + { + // This specifies which of the recognition events are going to trigger notifications. + // Here, all we are interested in is the beginning and ends of sounds, as well as + // when the engine has recognized something + const ULONGLONG ullInterest = SPFEI(SPEI_RECOGNITION); + hr = m_cpRecoCtxt->SetInterest(ullInterest, ullInterest); + } + + // create default audio object + CComPtr cpAudio; + hr = SpCreateDefaultObjectFromCategoryId(SPCAT_AUDIOIN, &cpAudio); + + // set the input for the engine + hr = cpRecoEngine->SetInput(cpAudio, TRUE); + hr = cpRecoEngine->SetRecoState( SPRST_ACTIVE ); + + + + + + if (SUCCEEDED(hr)) + { + // Specifies that the grammar we want is a dictation grammar. + // Initializes the grammar (m_cpDictationGrammar) + hr = m_cpRecoCtxt->CreateGrammar( GID_DICTATION, &m_cpDictationGrammar ); + } + if (SUCCEEDED(hr)) + { + hr = m_cpDictationGrammar->LoadDictation(NULL, SPLO_STATIC); + } + if (SUCCEEDED(hr)) + { + hr = m_cpDictationGrammar->SetDictationState( SPRS_ACTIVE ); + } + if (FAILED(hr)) + { + m_cpDictationGrammar.Release(); + } + + return (hr == S_OK); +} + +/***************************************************************************************** +* CSimpleDict::RecoEvent() +* Called whenever the dialog process is notified of a recognition event. +* Inserts whatever is recognized into the edit box. +******************************************************************************************/ +void CSimpleDict::RecoEvent() +{ + USES_CONVERSION; + CSpEvent event; + + // Process all of the recognition events + while (event.GetFrom(m_cpRecoCtxt) == S_OK) + { + switch (event.eEventId) + { + case SPEI_SOUND_START: + m_bInSound = TRUE; + break; + + case SPEI_SOUND_END: + if (m_bInSound) + { + m_bInSound = FALSE; + if (!m_bGotReco) + { + // The sound has started and ended, + // but the engine has not succeeded in recognizing anything + const TCHAR szNoise[] = _T(""); + ::SendDlgItemMessage( m_hDlg, IDC_EDIT_DICT, + EM_REPLACESEL, TRUE, (LPARAM) szNoise ); + } + m_bGotReco = FALSE; + } + break; + + case SPEI_RECOGNITION: + // There may be multiple recognition results, so get all of them + { + m_bGotReco = TRUE; + static const WCHAR wszUnrecognized[] = L""; + + CSpDynamicString dstrText; + if (FAILED(event.RecoResult()->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, NULL))) + { + dstrText = wszUnrecognized; + } + + // Concatenate a space onto the end of the recognized word + dstrText.Append(L" "); + + ::SendDlgItemMessage( m_hDlg, IDC_EDIT_DICT, EM_REPLACESEL, TRUE, (LPARAM) W2T(dstrText) ); + + } + break; + + } + } +} + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.dsp b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.dsp new file mode 100644 index 00000000..655d0e80 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.dsp @@ -0,0 +1,134 @@ +# Microsoft Developer Studio Project File - Name="simpledict" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=simpledict - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "simpledict.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "simpledict.mak" CFG="simpledict - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "simpledict - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "simpledict - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "simpledict - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "simpledict - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "simpledict - Win32 Release" +# Name "simpledict - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\simpledict.cpp +# End Source File +# Begin Source File + +SOURCE=.\simpledict.rc +# End Source File +# Begin Source File + +SOURCE=.\stdafx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\simpledict.h +# End Source File +# Begin Source File + +SOURCE=.\stdafx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\reco.ico +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# End Group +# Begin Source File + +SOURCE=.\sol.cfg +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.h b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.h new file mode 100644 index 00000000..b5a0aeef --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.h @@ -0,0 +1,40 @@ +/**************************************************************************** +* SimpleDict.h +* Definition of the CSimpleDict class +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" +#define MAX_EDIT_TEXT 1000 +#define GID_DICTATION 0 // Dictation grammar has grammar ID 0 + +#define WM_RECOEVENT WM_APP // Window message used for recognition events + +class CSimpleDict +{ +public: + CSimpleDict( HINSTANCE hInstance ) : + m_hInstance( hInstance ), + m_bGotReco( FALSE ), + m_bInSound( FALSE ) + {} + + static LRESULT CALLBACK CSimpleDict::SimpleDictDlgProc( HWND, UINT, WPARAM, LPARAM ); + // Message handler + bool InitDialog( HWND hDlg ); // Starts up SR + void RecoEvent(); // Called whenever dialog process is notified of recognition + + HINSTANCE m_hInstance; + HWND m_hDlg; + BOOL m_bInSound; + BOOL m_bGotReco; + LCID m_lcid; + CComPtr m_cpRecoCtxt; + CComPtr m_cpDictationGrammar; +}; + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.ico b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.ico new file mode 100644 index 00000000..43f13171 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.rc b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.rc new file mode 100644 index 00000000..97734611 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.rc @@ -0,0 +1,113 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SIMPLEDICT ICON DISCARDABLE "simpledict.ico" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_SIMPLEDICTDLG DIALOG DISCARDABLE 30, 30, 274, 225 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Simple dictation application" +FONT 8, "MS Shell Dlg" +BEGIN + EDITTEXT IDC_EDIT_DICT,10,34,251,142,ES_MULTILINE | + ES_AUTOVSCROLL + PUSHBUTTON "E&xit",IDC_BUTTON_EXIT,201,194,60,18 + LTEXT "Dictate text here:",IDC_STATIC,10,8,251,16 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_SIMPLEDICTDLG, DIALOG + BEGIN + BOTTOMMARGIN, 213 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/small.ico b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/small.ico new file mode 100644 index 00000000..43f13171 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.cpp new file mode 100644 index 00000000..ef5c4607 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// Reco.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.h new file mode 100644 index 00000000..c9574613 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.h @@ -0,0 +1,41 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif // WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +#ifdef _WIN32_WCE +#include +#define ICON_BIG 1 +#endif + + +// Local Header Files + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleDict/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/version.rc2 new file mode 100644 index 00000000..ab3fadac --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleDict/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Simple Dictation Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SimpleDict\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "SimpleDict.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.cpp b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.cpp new file mode 100644 index 00000000..10dc14d9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.cpp @@ -0,0 +1,62 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + callnot.cpp + +Abstract: + + Implementation of the ITTAPIEventNotification interface. + + This is an outgoing interface that is defined by TAPI 3.0. This + is basically a callback function that TAPI 3.0 calls to inform + the application of events related to calls (on a specific address) + + Please refer to COM documentation for information on outgoing + interfaces. + + An application must implement and register this interface in order + to receive calls and events related to calls + +--*/ + +#include +#include "callnot.h" + +/////////////////////////////////////////////////////////////////// +// CallEventNotification +// +// The only method in the ITCallEventNotification interface. This gets +// called by TAPI 3.0 when there is a call event to report. This just +// posts the message to our UI thread, so that we do as little as +// possible on TAPI's callback thread. +// +/////////////////////////////////////////////////////////////////// + +HRESULT +STDMETHODCALLTYPE +CTAPIEventNotification::Event( + TAPI_EVENT TapiEvent, + IDispatch * pEvent + ) +{ + // + // Addref the event so it doesn't go away. + // + + pEvent->AddRef(); + + // + // Post a message to our own UI thread. + // + + PostMessage( m_hWnd, + WM_PRIVATETAPIEVENT, + (WPARAM) TapiEvent, + (LPARAM) pEvent + ); + + return S_OK; +} + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.h b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.h new file mode 100644 index 00000000..a2d94428 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.h @@ -0,0 +1,113 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + callnot.h + +Abstract: + + Declaration of the CTAPIEventNotification object + +--*/ + +#ifndef __TAPIEventNotification_H__ +#define __TAPIEventNotification_H__ + +#define WM_PRIVATETAPIEVENT WM_USER+101 + +///////////////////////////////////////////////////////////////////////////// +// CTAPIEventNotification +class CTAPIEventNotification : public ITTAPIEventNotification +{ +private: + // Refcount for COM + LONG m_dwRefCount; + + // Member data + HWND m_hWnd; + +public: + + // CTAPIEventNotification implements ITTAPIEventNotification + // Declare ITTAPIEventNotification methods here + HRESULT STDMETHODCALLTYPE Event( + TAPI_EVENT TapiEvent, + IDispatch * pEvent + ); + + +// other COM stuff: +public: + + // constructor + CTAPIEventNotification() {} + // destructor + ~CTAPIEventNotification(){} + + // initialization function + // this stuff could also be done in the + // constructor + HRESULT Initialize( ) + { + m_dwRefCount = 1; + return S_OK; + } + + void Shutdown() + { + } + + void SetHWND( HWND hWnd ) + { + m_hWnd = hWnd; + } + + // IUnknown implementation + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) + { + if (iid == IID_ITTAPIEventNotification) + { + AddRef(); + *ppvObject = (void *)this; + return S_OK; + } + + if (iid == IID_IUnknown) + { + AddRef(); + *ppvObject = (void *)this; + return S_OK; + } + + return E_NOINTERFACE; + } + + // + // reference counting needs to be thread safe + // + + ULONG STDMETHODCALLTYPE AddRef() + { + ULONG l = InterlockedIncrement(&m_dwRefCount); + return l; + } + + ULONG STDMETHODCALLTYPE Release() + { + ULONG l = InterlockedDecrement(&m_dwRefCount); + + if ( 0 == l) + { + delete this; + } + + return l; + } + + +}; + +#endif //__TAPIEventNotification_H__ + + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.cpp b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.cpp new file mode 100644 index 00000000..659cf536 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.cpp @@ -0,0 +1,1312 @@ +////////////////////////////////////////////////////////// +// SIMPLETELEPHONY.EXE +// +// Sample application that handles incoming TAPI calls +// and does some speech recognition and text-to-speech. +// +// In order to receive incoming calls, the application must +// implement and register the outgoing ITCallNotification +// interface. +// +// This application will register to receive calls on +// all addresses that support at least the audio media type. +// +// NOTE: This application is limited to working with one +// call at at time, and will not work correctly if multiple +// calls are present at the same time. +// +// NOTE: The call-handling sequence in this application is +// short, so it is fine to make it all the way through to +// the end of the call even if the caller hung up in the +// middle. If your telephony app involves a lengthy +// call-handling sequence, you need a separate thread to +// listen for TAPI's CS_DISCONNECT message; otherwise your +// app will have no way of being notified of the hang-up, +// and your app will appear to have hung. +////////////////////////////////////////////////////////// + +/**************************************************************************** +* Operator.cpp +* Implementation of the COperator class for the simpletelephony +* project. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include // In general, you need to have the + // Microsoft Platform SDK installed + // in order to have this file +#include "operator.h" +#include "resource.h" + +#define CALLER_TIMEOUT 8000 // Wait 8 seconds before giving up on a caller + +/********************************************************** +* WinMain * +*---------* +* Description: +* Main entry point for the application +***********************************************************/ +int WINAPI WinMain( + HINSTANCE hInst, + HINSTANCE hPrevInst, + LPSTR lpCmdLine, + int nCmdShow + ) +{ + // Initialize COM. + if (FAILED(::CoInitialize( NULL ))) + { + return 0; + } + + // Create an instance of our main call-handling class + COperator *pOperator = new COperator( hInst ); + if ( !pOperator ) + { + return 0; + } + + // Does initialization of SAPI and TAPI objects + HRESULT hr = pOperator->Initialize(); + if ( FAILED( hr ) ) + { + return 0; + } + + // everything is initialized, so + // start the main dialog box + ::DialogBoxParam( hInst, + MAKEINTRESOURCE(IDD_MAINDLG), + NULL, + MainDialogProc, + (LPARAM) pOperator + ); + + // This does the cleanup of SAPI and TAPI objects + delete pOperator; + + ::CoUninitialize(); + + return 1; +} + +/********************************************************** +* COperator::~COperator * +*-----------------------* +* Description: +* Destructor for the COperator class. +* Cleans up SAPI and TAPI objects. +***********************************************************/ +COperator::~COperator() +{ + ShutdownSapi(); + ShutdownTapi(); +} /* COperator::~COperator */ + +/********************************************************** +* COperator::Initialize * +*-----------------------* +* Description: +* Initializes SAPI and TAPI +* Return: +* S_OK if both SAPI and TAPI initialized successfully +***********************************************************/ +HRESULT COperator::Initialize() +{ + HRESULT hr = InitializeSapi(); + if ( SUCCEEDED( hr ) ) + { + hr = InitializeTapi(); + } + return hr; +} /* COperator::Initialize */ + +/********************************************************** +* COperator::InitializeSapi * +*---------------------------* +* Description: +* Various SAPI initializations. +* Return: +* S_OK if SAPI initialized successfully +* Return values of failed SAPI initialization +* functions +***********************************************************/ +HRESULT COperator::InitializeSapi() +{ + // Create a voice for speaking on this machine + HRESULT hr = m_cpLocalVoice.CoCreateInstance( CLSID_SpVoice ); + if ( FAILED( hr ) ) + { + DoMessage( L"Could not create a TTS voice on the local machine" ); + return hr; + } + + // Create a reco engine for recognizing speech over the phone + // This is an inproc recognizer since it will likely be + // using a format other than the default + hr = m_cpIncomingRecognizer.CoCreateInstance( CLSID_SpInprocRecognizer ); + if ( FAILED(hr) ) + { + DoMessage(L"CoCreateInstance on inproc reco engine failed"); + return hr; + } + + // Create a reco context for this engine + hr = m_cpIncomingRecognizer->CreateRecoContext( &m_cpIncomingRecoCtxt ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not create recognition context"); + return hr; + } + + // Set interest only in PHRASE_START, RECOGNITION, FALSE_RECOGNITION + const ULONGLONG ullInterest = SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | + SPFEI(SPEI_FALSE_RECOGNITION); + hr = m_cpIncomingRecoCtxt->SetInterest( ullInterest, ullInterest ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not set interest in SAPI events"); + return hr; + } + + // Retain recognized audio + hr = m_cpIncomingRecoCtxt->SetAudioOptions( SPAO_RETAIN_AUDIO, NULL, NULL ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not set audio options to retain recognized audio"); + return hr; + } + + // Create a dictation grammar and load it + hr = m_cpIncomingRecoCtxt->CreateGrammar( 0, &m_cpDictGrammar ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not create dictation grammar"); + return hr; + } + + hr = m_cpDictGrammar->LoadDictation( NULL, SPLO_STATIC ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not load dictation"); + return hr; + } + + // Create a voice for talking on the phone. + hr = m_cpIncomingRecoCtxt->GetVoice( &m_cpOutgoingVoice ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not create a TTS voice for speaking over the phone"); + return hr; + } + + return S_OK; +} /* COperator::InitializeSapi */ + + +/********************************************************** +* COperator::InitializeTapi * +*---------------------------* +* Description: +* Various TAPI initializations +* Return: +* S_OK iff TAPI initialized successfully +* Return values of failed TAPI initialization +* functions +***********************************************************/ +HRESULT COperator::InitializeTapi() +{ + // Cocreate the TAPI object + HRESULT hr = CoCreateInstance( + CLSID_TAPI, + NULL, + CLSCTX_INPROC_SERVER, + IID_ITTAPI, + (LPVOID *)&m_pTapi + ); + + if ( FAILED(hr) ) + { + DoMessage(L"CoCreateInstance on TAPI failed"); + return hr; + } + + // call ITTAPI::Initialize(). this must be called before + // any other tapi functions are called. + hr = m_pTapi->Initialize(); + + if ( FAILED(hr) ) + { + DoMessage(L"TAPI failed to initialize"); + m_pTapi->Release(); + m_pTapi = NULL; + return hr; + } + + // Create our own event notification object and register it + // See callnot.h and callnot.cpp + m_pTAPIEventNotification = new CTAPIEventNotification; + if ( NULL == m_pTAPIEventNotification ) + { + return E_OUTOFMEMORY; + } + hr = m_pTAPIEventNotification->Initialize(); + + if ( SUCCEEDED( hr ) ) + { + hr = RegisterTapiEventInterface(); + } + + // Set the Event filter to only give us only the events we process + if ( SUCCEEDED( hr ) ) + { + hr = m_pTapi->put_EventFilter(TE_CALLNOTIFICATION | TE_CALLSTATE); + } + + if ( FAILED( hr ) ) + { + DoMessage( L"Could not set up TAPI event notifications" ); + return hr; + } + + + // Find all address objects that we will use to listen for calls on + hr = ListenOnAddresses(); + + if ( FAILED(hr) ) + { + DoMessage(L"Could not find any addresses to listen on"); + + m_pTapi->Release(); + m_pTapi = NULL; + + return hr; + } + + return S_OK; +} /* COperator::InitializeTapi */ + +/********************************************************** +* COperator::ShutdownSapi * +*-------------------------* +* Description: +* Releases all SAPI objects +***********************************************************/ +void COperator::ShutdownSapi() +{ + m_cpMMSysAudioIn.Release(); + m_cpMMSysAudioOut.Release(); + m_cpDictGrammar.Release(); + m_cpIncomingRecoCtxt.Release(); + m_cpIncomingRecognizer.Release(); + m_cpLocalVoice.Release(); + m_cpOutgoingVoice.Release(); +} /* COperator::ShutdownSapi */ + +/********************************************************** +* COperator::ShutdownTapi * +*-------------------------* +* Description: +* Releases all TAPI objects +***********************************************************/ +void COperator::ShutdownTapi() +{ + // if there is still a call, release it + if (NULL != m_pCall) + { + m_pCall->Release(); + m_pCall = NULL; + } + + // release main object. + if (NULL != m_pTapi) + { + m_pTapi->Shutdown(); + m_pTapi->Release(); + } +} /* COperator::ShutdownTapi */ + + +/********************************************************** +* MainDialogProc * +*----------------* +* Description: +* Main dialog proc for this sample +***********************************************************/ +BOOL CALLBACK MainDialogProc( + HWND hDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam + ) +{ + // This is set to be the window long in WM_INITDIALOG + COperator *pThis = (COperator *) ::GetWindowLong( hDlg, GWL_USERDATA ); + + switch (uMsg) + { + case WM_INITDIALOG: + { + // Get the pointer to the COperator object from the lParam. + // Store it in the window long as user data + pThis = (COperator *) lParam; + ::SetWindowLong( hDlg, GWL_USERDATA, (LPARAM) pThis ); + + // Hand the window handle to the event notification object + // so that this window will get window messages about incoming calls + pThis->m_pTAPIEventNotification->SetHWND( hDlg ); + + // Get the window handle + pThis->m_hDlg = hDlg; + + // Wait for a call + ::EnableWindow( ::GetDlgItem( hDlg, IDC_ANSWER ), FALSE ); + pThis->SetStatusMessage( L"Waiting for a call..." ); + + return 0; + } + + case WM_PRIVATETAPIEVENT: + { + // This message is received whenever a TAPI event occurs + pThis->OnTapiEvent( (TAPI_EVENT) wParam, + (IDispatch *) lParam ); + + return 0; + } + + case WM_COMMAND: + { + if ( LOWORD(wParam) == IDCANCEL ) + { + // Quit + EndDialog( hDlg, 0 ); + + return 1; + } + + switch ( LOWORD(wParam) ) + { + case IDC_AUTOANSWER: + { + // Auto answer check box state was changed + pThis->m_fAutoAnswer = !pThis->m_fAutoAnswer; + return 1; + } + + case IDC_ANSWER: + { + // Answer the call + + pThis->SetStatusMessage(L"Answering..."); + + if ( S_OK == pThis->AnswerTheCall() ) + { + pThis->SetStatusMessage(L"Connected"); + + ::EnableWindow( ::GetDlgItem( hDlg, IDC_ANSWER ), FALSE ); + + // Connected: Talk to the caller + + // PLEASE NOTE: This is a single-threaded app, so if the caller + // hangs up after the call-handling sequence has started, the + // app will not be notified until after the entire call sequence + // has finished. + // If you want to be able to cut the call-handling short because + // the caller hung up, you need to have a separate thread listening + // for TAPI's CS_DISCONNECT notification. + HRESULT hrHandleCall = pThis->HandleCall(); + if ( FAILED( hrHandleCall ) ) + { + if ( TAPI_E_DROPPED == hrHandleCall ) + { + pThis->SetStatusMessage( L"Caller hung up prematurely" ); + } + else + { + pThis->DoMessage( L"Error encountered handling the call" ); + } + } + + // Hang up if we still need to + if ( NULL != pThis->m_pCall ) + { + // The caller is still around; hang up on him + pThis->SetStatusMessage(L"Disconnecting..."); + if (S_OK != pThis->DisconnectTheCall()) + { + pThis->DoMessage(L"Disconnect failed"); + } + } + } + else + { + ::EnableWindow( ::GetDlgItem( hDlg, IDC_ANSWER ), FALSE ); + pThis->DoMessage(L"Answer failed"); + } + + // Waiting for the next call... + pThis->SetStatusMessage(L"Waiting for a call..."); + + return 1; + } + + case IDC_DISCONNECTED: + { + // This message is sent from OnTapiEvent() + // Disconnected notification -- release the call + pThis->ReleaseTheCall(); + + ::EnableWindow( ::GetDlgItem( hDlg, IDC_ANSWER ), FALSE ); + + pThis->SetStatusMessage(L"Waiting for a call..."); + + return 1; + } + default: + + return 0; + } + } + default: + + return 0; + } +} /* MainDialogProc */ + +/////////////////////////////////////////////////////////// +// TAPI actions +/////////////////////////////////////////////////////////// + +/********************************************************** +* COperator::RegisterTapiEventInterface * +*---------------------------------------* +* Description: +* Get a unique identifier (m_ulAdvice) for +* this connection point. +* Return: +* S_OK +* Failed HRESULTs from QI(), +* IConnectionPointContainer::FindConnectionPoint(), +* or IConnectionPoint::Advise() +***********************************************************/ +HRESULT COperator::RegisterTapiEventInterface() +{ + HRESULT hr = S_OK; + IConnectionPointContainer * pCPC; + IConnectionPoint * pCP; + + + hr = m_pTapi->QueryInterface( IID_IConnectionPointContainer, + (void **)&pCPC ); + + if ( SUCCEEDED( hr ) ) + { + hr = pCPC->FindConnectionPoint( IID_ITTAPIEventNotification, + &pCP ); + pCPC->Release(); + } + + if ( SUCCEEDED( hr ) ) + { + hr = pCP->Advise( m_pTAPIEventNotification, + &m_ulAdvise ); + + pCP->Release(); + } + return hr; +} /* COperator::RegisterTapiEventInterface */ + +/********************************************************** +* COperator::ListenOnAddresses * +*------------------------------* +* Description: +* Find all addresses that support audio in and audio +* out. Call ListenOnThisAddress to start listening +* Return: +* S_OK +* S_FALSE if there are no addresses to listen on +* Failed HRESULT ITTAPI::EnumberateAddresses() +* or IEnumAddress::Next() +************************************************************/ +HRESULT COperator::ListenOnAddresses() +{ + // enumerate the addresses + IEnumAddress * pEnumAddress; + HRESULT hr = m_pTapi->EnumerateAddresses( &pEnumAddress ); + + if ( FAILED(hr) ) + { + return hr; + } + + ITAddress * pAddress; + bool fAddressExists = false; + while ( true ) + { + // get the next address + hr = pEnumAddress->Next( 1, &pAddress, NULL ); + if (S_OK != hr) + { + // Done dealing with all the addresses + break; + } + + // Does the address support audio? + if ( AddressSupportsMediaType(pAddress, TAPIMEDIATYPE_AUDIO) ) + { + // If it does then we'll listen. + HRESULT hrListen = ListenOnThisAddress( pAddress ); + + if ( S_OK == hrListen ) + { + fAddressExists = true; + } + } + pAddress->Release(); + + } + pEnumAddress->Release(); + + if ( !fAddressExists ) + { + DoMessage( L"Could not find any addresses to listen on" ); + } + + if ( FAILED( hr ) ) + { + return hr; + } + else + { + return fAddressExists ? S_OK : S_FALSE; + } +} /* COperator::ListenOnAddress */ + +/********************************************************** +* COperator::ListenOnThisAddress * +*--------------------------------* +* Description: +* Call RegisterCallNotifications() to inform TAPI +* that we want notifications of calls on this +* address. We already registered our notification +* interface with TAPI, so now we are just telling +* TAPI that we want calls from this address to +* trigger our existing notification interface. +* Return: +* Return value of ITTAPI::RegisterCallNotifications() +************************************************************/ +HRESULT COperator::ListenOnThisAddress( ITAddress * pAddress ) +{ + // RegisterCallNotifications takes a media type set of flags indicating + // the set of media types we are interested in. We know the + // address supports audio (see COperator::ListenOnAddress()) + long lMediaTypes = TAPIMEDIATYPE_AUDIO; + + long lRegister; + return m_pTapi->RegisterCallNotifications( + pAddress, + VARIANT_TRUE, + VARIANT_TRUE, + lMediaTypes, + m_ulAdvise, + &lRegister ); +} /* COperator::ListenOnAddress */ + + +/********************************************************** +* COperator::AnswerTheCall * +*--------------------------* +* Description: +* Called whenever notification is received of an +* incoming call and the app wants to answer it. +* Answers and handles the call. +* Return: +* S_OK +* Failed retval of QI(), ITCallInfo::get_Address(), +* COperator::SetAudioOutForCall(), +************************************************************/ +HRESULT COperator::AnswerTheCall() +{ + + if (NULL == m_pCall) + { + return E_UNEXPECTED; + } + + // Get the LegacyCallMediaControl interface so that we can + // get a device ID to reroute the audio + ITLegacyCallMediaControl *pLegacyCallMediaControl; + HRESULT hr = m_pCall->QueryInterface( IID_ITLegacyCallMediaControl, + (void**)&pLegacyCallMediaControl ); + + + // Set the audio for the SAPI objects so that the call + // can be handled + if ( SUCCEEDED( hr ) ) + { + hr = SetAudioOutForCall( pLegacyCallMediaControl ); + if ( FAILED( hr ) ) + { + DoMessage( L"Could not set up audio out for text-to-speech" ); + } + } + if ( SUCCEEDED( hr ) ) + { + hr = SetAudioInForCall( pLegacyCallMediaControl ); + if ( FAILED( hr ) ) + { + DoMessage( L"Could not set up audio in for speech recognition" ); + } + } + pLegacyCallMediaControl->Release(); + if ( FAILED(hr) ) + { + return hr; + } + + // Now we can actually answer the call + hr = m_pCall->Answer(); + + return hr; +} /* COperator::AnswerTheCall */ + +/********************************************************** +* COperator::DisconnectTheCall * +*------------------------------* +* Description: +* Disconnects the call +* Return: +* S_OK +* S_FALSE if there was no call +* Failed return value of ITCall::Disconnect() +************************************************************/ +HRESULT COperator::DisconnectTheCall() +{ + HRESULT hr = S_OK; + if (NULL != m_pCall) + { + // Hang up + return m_pCall->Disconnect( DC_NORMAL ); + + // Do not release the call yet, as that would prevent + // us from receiving the disconnected notification. + } + else + { + return S_FALSE; + } +} /* COperator::DisconnectTheCall */ + +/********************************************************** +* COperator::ReleaseTheCall * +*---------------------------* +* Description: +* Releases the call +************************************************************/ +void COperator::ReleaseTheCall() +{ + if (NULL != m_pCall) + { + m_pCall->Release(); + m_pCall = NULL; + } + + // Let go of the SAPI audio in and audio out objects + if ( m_cpMMSysAudioOut ) + { + m_cpMMSysAudioOut->SetState( SPAS_STOP, 0 ); + } + if ( m_cpMMSysAudioIn ) + { + m_cpMMSysAudioIn->SetState( SPAS_STOP, 0 ); + } + + m_cpMMSysAudioOut.Release(); + m_cpMMSysAudioIn.Release(); +} /* COperator::ReleaseTheCall */ + +/********************************************************** +* COperator::OnTapiEvent * +*------------------------* +* Description: +* This is the real TAPI event handler, called on our +* UI thread upon receipt of the WM_PRIVATETAPIEVENT +* message. +* Return: +* S_OK +************************************************************/ +HRESULT COperator::OnTapiEvent( TAPI_EVENT TapiEvent, + IDispatch * pEvent ) +{ + HRESULT hr; + switch ( TapiEvent ) + { + case TE_CALLNOTIFICATION: + { + // TE_CALLNOTIFICATION means that the application is being notified + // of a new call. + // + // Note that we don't answer to call at this point. The application + // should wait for a CS_OFFERING CallState message before answering + // the call. + // + ITCallNotificationEvent * pNotify; + hr = pEvent->QueryInterface( IID_ITCallNotificationEvent, (void **)&pNotify ); + if (S_OK != hr) + { + DoMessage( L"Incoming call, but failed to get the interface"); + } + else + { + CALL_PRIVILEGE cp; + ITCallInfo * pCall; + + // Get the call + hr = pNotify->get_Call( &pCall ); + pNotify->Release(); + if ( SUCCEEDED(hr) ) + { + // Check to see if we own the call + hr = pCall->get_Privilege( &cp ); + if ( FAILED(hr) || (CP_OWNER != cp) ) + { + // Just ignore it if we don't own it + pCall->Release(); + pEvent->Release(); // We addrefed it CTAPIEventNotification::Event() + return S_OK; + } + + // Get the ITBasicCallControl interface and save it in our + // member variable. + hr = pCall->QueryInterface( IID_ITBasicCallControl, + (void**)&m_pCall ); + pCall->Release(); + + if ( SUCCEEDED(hr) ) + { + // Update UI + ::EnableWindow( ::GetDlgItem( m_hDlg, IDC_ANSWER ), TRUE ); + SetStatusMessage(L"Incoming Owner Call"); + } + } + } + + break; + } + + case TE_CALLSTATE: + { + // TE_CALLSTATE is a call state event. pEvent is + // an ITCallStateEvent + + // Get the interface + ITCallStateEvent * pCallStateEvent; + hr = pEvent->QueryInterface( IID_ITCallStateEvent, (void **)&pCallStateEvent ); + if ( FAILED(hr) ) + { + break; + } + + // Get the CallState that we are being notified of. + CALL_STATE cs; + hr = pCallStateEvent->get_State( &cs ); + pCallStateEvent->Release(); + if ( FAILED(hr) ) + { + break; + } + + // If it's offering to be answered, update our UI + if (CS_OFFERING == cs) + { + if (m_fAutoAnswer) + { + ::PostMessage(m_hDlg, WM_COMMAND, IDC_ANSWER, 0); + } + else + { + SetStatusMessage(L"Click the Answer button"); + } + } + else if (CS_DISCONNECTED == cs) + { + ::PostMessage(m_hDlg, WM_COMMAND, IDC_DISCONNECTED, 0); + } + else if (CS_CONNECTED == cs) + { + // Nothing to do -- we handle connection synchronously + } + break; + } + default: + break; + } + + pEvent->Release(); // We addrefed it CTAPIEventNotification::Event() + + return S_OK; +} + +/////////////////////////////////////////////////////////// +// SAPI actions +/////////////////////////////////////////////////////////// + +/********************************************************** +* COperator::SetAudioOutForCall * +*-------------------------------* +* Description: +* Uses the legacy call media control in TAPI to +* get the device IDs for audio out. +* Uses these device IDs to set up the audio +* for text-to-speech +* Return: +* S_OK +* E_INVALIDARG if the pLegacyCallMediaControl is NULL +* E_OUTOFMEMORY +* SPERR_DEVICE_NOT_SUPPORTED if no supported +* formats could be found +* Failed return value of QI(), +* ITLegacyCallMediaControl::GetID(), +* CoCreateInstance(), +* ISpMMSysAudio::SetDeviceID(), +* ISpMMSysAudio::SetFormat(), +* ISpVoice::SetOutput() +************************************************************/ +HRESULT COperator::SetAudioOutForCall( ITLegacyCallMediaControl *pLegacyCallMediaControl ) +{ + if (NULL == m_pCall) + { + return E_UNEXPECTED; + } + + if ( NULL == pLegacyCallMediaControl ) + { + return E_INVALIDARG; + } + + // Get the device ID from ITLegacyCallMediaControl::GetID() + UINT *puDeviceID; + BSTR bstrWavOut = ::SysAllocString( L"wave/out" ); + if ( !bstrWavOut ) + { + return E_OUTOFMEMORY; + } + DWORD dwSize = sizeof( puDeviceID ); + HRESULT hr = pLegacyCallMediaControl->GetID( bstrWavOut, &dwSize, (BYTE**) &puDeviceID ); + ::SysFreeString( bstrWavOut ); + + // Find out what, if any, formats are supported + GUID guidWave = SPDFID_WaveFormatEx; + WAVEFORMATEX *pWaveFormatEx = NULL; + if ( SUCCEEDED(hr) ) + { + // Loop through all of the SAPI audio formats and query the wave/out device + // about whether it supports each one. + // We will take the first one that we find + SPSTREAMFORMAT enumFmtId; + MMRESULT mmr = MMSYSERR_ALLOCATED; + for ( DWORD dw = 0; (MMSYSERR_NOERROR != mmr) && (dw < SPSF_NUM_FORMATS); dw++ ) + { + if ( pWaveFormatEx && ( MMSYSERR_NOERROR != mmr ) ) + { + // No dice: The audio device does not support this format + + // Free up the WAVEFORMATEX pointer + ::CoTaskMemFree( pWaveFormatEx ); + pWaveFormatEx = NULL; + } + + // Get the next format from SAPI and convert it into a WAVEFORMATEX + enumFmtId = (SPSTREAMFORMAT) (SPSF_8kHz8BitMono + dw); + HRESULT hrConvert = SpConvertStreamFormatEnum( + enumFmtId, &guidWave, &pWaveFormatEx ); + + if ( SUCCEEDED( hrConvert ) ) + { + // This call to waveOutOpen() does not actually open the device; + // it just queries the device whether it supports the given format + mmr = ::waveOutOpen( NULL, *puDeviceID, pWaveFormatEx, 0, 0, WAVE_FORMAT_QUERY ); + } + } + + // If we made it all the way through the loop without breaking, that + // means we found no supported formats + if ( enumFmtId == SPSF_NUM_FORMATS ) + { + return SPERR_DEVICE_NOT_SUPPORTED; + } + } + + // Cocreate a SAPI audio out object + if ( SUCCEEDED( hr ) ) + { + hr = m_cpMMSysAudioOut.CoCreateInstance( CLSID_SpMMAudioOut ); + } + + // Give the audio out object the device ID + if ( SUCCEEDED(hr) ) + { + hr = m_cpMMSysAudioOut->SetDeviceId( *puDeviceID ); + } + + // Use the format that we found works + if ( SUCCEEDED( hr ) ) + { + _ASSERTE( pWaveFormatEx ); + hr = m_cpMMSysAudioOut->SetFormat( guidWave, pWaveFormatEx ); + } + + // We are now done with the wave format pointer + if ( pWaveFormatEx ) + { + ::CoTaskMemFree( pWaveFormatEx ); + } + + // Set the appropriate output to the outgoing voice + if ( SUCCEEDED( hr ) ) + { + _ASSERTE( m_cpOutgoingVoice ); + hr = m_cpOutgoingVoice->SetOutput( m_cpMMSysAudioOut, FALSE ); + } + + return hr; +} /* COperator::SetAudioOutForCall */ + +/********************************************************** +* COperator::SetAudioInForCall * +*------------------------------* +* Description: +* Uses the legacy call media control in TAPI to +* get the device IDs for audio input. +* Uses these device IDs to set up the audio +* for speech recognition +* Return: +* S_OK +* E_INVALIDARG if pLegacyCallMediaControl is NULL +* E_OUTOFMEMORY +* SPERR_DEVICE_NOT_SUPPORTED if no supported +* formats could be found +* Failed return value of QI(), +* ITLegacyCallMediaControl::GetID(), +* CoCreateInstance(), +* ISpMMSysAudio::SetDeviceID(), +* ISpMMSysAudio::SetFormat() +************************************************************/ +HRESULT COperator::SetAudioInForCall( ITLegacyCallMediaControl *pLegacyCallMediaControl ) +{ + if ( NULL == m_pCall ) + { + return E_UNEXPECTED; + } + + if ( NULL == pLegacyCallMediaControl ) + { + return E_INVALIDARG; + } + + // Get the device ID + UINT *puDeviceID; + BSTR bstrWavIn = ::SysAllocString( L"wave/in" ); + if ( !bstrWavIn ) + { + return E_OUTOFMEMORY; + } + DWORD dwSize = sizeof( puDeviceID ); + HRESULT hr = pLegacyCallMediaControl->GetID( bstrWavIn, &dwSize, (BYTE**) &puDeviceID ); + ::SysFreeString( bstrWavIn ); + + // Find out what, if any, formats are supported + GUID guidWave = SPDFID_WaveFormatEx; + WAVEFORMATEX *pWaveFormatEx = NULL; + if ( SUCCEEDED(hr) ) + { + // Loop through all of the SAPI audio formats and query the wave/out device + // about each one. + // We will take the first one that we find + SPSTREAMFORMAT enumFmtId; + MMRESULT mmr = MMSYSERR_ALLOCATED; + for ( DWORD dw = 0; (MMSYSERR_NOERROR != mmr) && (dw < SPSF_NUM_FORMATS); dw++ ) + { + if ( pWaveFormatEx && ( MMSYSERR_NOERROR != mmr ) ) + { + // Free up the WAVEFORMATEX pointer + ::CoTaskMemFree( pWaveFormatEx ); + pWaveFormatEx = NULL; + } + + // Get the next format from SAPI and convert it into a WAVEFORMATEX + enumFmtId = (SPSTREAMFORMAT) (SPSF_8kHz8BitMono + dw); + HRESULT hrConvert = SpConvertStreamFormatEnum( + enumFmtId, &guidWave, &pWaveFormatEx ); + if ( SUCCEEDED( hrConvert ) ) + { + // This call to waveOutOpen() does not actually open the device; + // it just queries the device whether it supports the given format + mmr = ::waveInOpen( NULL, *puDeviceID, pWaveFormatEx, 0, 0, WAVE_FORMAT_QUERY ); + } + } + + // If we made it all the way through the loop without breaking, that + // means we found no supported formats + if ( SPSF_NUM_FORMATS == dw ) + { + return SPERR_DEVICE_NOT_SUPPORTED; + } + } + + // Cocreate a SAPI audio in object + if ( SUCCEEDED( hr ) ) + { + hr = m_cpMMSysAudioIn.CoCreateInstance( CLSID_SpMMAudioIn ); + } + + // Give the audio in object the device ID + if ( SUCCEEDED(hr) ) + { + hr = m_cpMMSysAudioIn->SetDeviceId( *puDeviceID ); + } + + // Use the format that we found works + if ( SUCCEEDED( hr ) ) + { + _ASSERTE( pWaveFormatEx ); + hr = m_cpMMSysAudioIn->SetFormat( guidWave, pWaveFormatEx ); + } + + // We are now done with the wave format pointer + if ( pWaveFormatEx ) + { + ::CoTaskMemFree( pWaveFormatEx ); + } + + // Set this as input to the reco context + if ( SUCCEEDED( hr ) ) + { + hr = m_cpIncomingRecognizer->SetInput( m_cpMMSysAudioIn, FALSE ); + } + + return hr; +} /* COperator::SetAudioInForCall */ + + +/********************************************************** +* COperator::HandleCall * +*-----------------------* +* Description: +* Deals with the call +* Return: +* S_OK +* Failed return value of ISpMMSysAudio::SetState(), +* ISpVoice::Speak() +************************************************************/ +HRESULT COperator::HandleCall() +{ + // PLEASE NOTE: This is a single-threaded app, so if the caller + // hangs up after the call-handling sequence has started, the + // app will not be notified until after the entire call sequence + // has finished. + // If you want to be able to cut the call-handling short because + // the caller hung up, you need to have a separate thread listening + // for TAPI's CS_DISCONNECT notification. + + _ASSERTE( m_cpMMSysAudioOut ); + HRESULT hr = S_OK; + + // Now that the call is connected, we can start up the audio output + hr = m_cpOutgoingVoice->Speak( L"Hello, please say something to me", 0, NULL ); + + // Start listening + if ( SUCCEEDED( hr ) ) + { + hr = m_cpDictGrammar->SetDictationState( SPRS_ACTIVE ); + } + + // We are expecting a PHRASESTART followed by either a RECOGNITION or a + // FALSERECOGNITION + + // Wait for the PHRASE_START + CSpEvent event; + WORD eLastEventID = SPEI_FALSE_RECOGNITION; + hr = m_cpIncomingRecoCtxt->WaitForNotifyEvent(CALLER_TIMEOUT); + if ( SUCCEEDED( hr ) ) + { + hr = event.GetFrom( m_cpIncomingRecoCtxt ); + } + + // Enter this block only if we have not timed out (the user started speaking) + if ( ( S_OK == hr ) && ( SPEI_PHRASE_START == event.eEventId ) ) + { + // Caller has started to speak, block "forever" until the + // result (or lack thereof) comes back. + // This is all right, since every PHRASE_START is guaranteed + // to be followed up by a RECOGNITION or FALSE_RECOGNITION + hr = m_cpIncomingRecoCtxt->WaitForNotifyEvent(INFINITE); + + if ( S_OK == hr ) + { + // Get the RECOGNITION or FALSE_RECOGNITION + hr = event.GetFrom( m_cpIncomingRecoCtxt ); + eLastEventID = event.eEventId; + + // This had better be either a RECOGNITION or FALSERECOGNITION! + _ASSERTE( (SPEI_RECOGNITION == event.eEventId) || + (SPEI_FALSE_RECOGNITION == event.eEventId) ); + } + } + + + // Make sure a recognition result was actually received (as opposed to a false recognition + // or timeout on the caller) + WCHAR *pwszCoMemText = NULL; + ISpRecoResult *pResult = NULL; + if ( SUCCEEDED( hr ) && ( SPEI_RECOGNITION == event.eEventId ) ) + { + // Get the text of the result + pResult = event.RecoResult(); + + BYTE bDisplayAttr; + hr = pResult->GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, &pwszCoMemText, &bDisplayAttr ); + } + if ( SUCCEEDED( hr ) && pResult ) + { + // Speak the result back locally + m_cpLocalVoice->Speak( L"I think the person on the phone said", SPF_ASYNC, 0 ); + m_cpLocalVoice->Speak( pwszCoMemText, SPF_ASYNC, 0 ); + m_cpLocalVoice->Speak( L"when he said", SPF_ASYNC, 0 ); + + // Get the audio so that the local voice can speak it back + CComPtr cpStreamFormat; + HRESULT hrAudio = pResult->GetAudio( 0, 0, &cpStreamFormat ); + if ( SUCCEEDED( hrAudio ) ) + { + m_cpLocalVoice->SpeakStream( cpStreamFormat, SPF_ASYNC, 0 ); + } + else + { + m_cpLocalVoice->Speak( L"no audio was available", SPF_ASYNC, 0 ); + } + } + + // Stop listening + if ( SUCCEEDED( hr ) ) + { + hr = m_cpDictGrammar->SetDictationState( SPRS_INACTIVE ); + } + + // Close the audio input so that we can open the audio output + // (half-duplex device) + if ( SUCCEEDED( hr ) ) + { + hr = m_cpMMSysAudioIn->SetState( SPAS_CLOSED, 0 ); + } + + // The caller may have hung up on us, in which case we don't want to do + // the following + if ( m_pCall ) + { + if ( pResult ) + { + // There's a result to playback + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( L"I think I heard you say", 0, 0 ); + } + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( pwszCoMemText, 0, 0 ); + } + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( L"when you said", 0, 0 ); + } + if ( SUCCEEDED( hr ) ) + { + hr = pResult->SpeakAudio( NULL, 0, NULL, NULL ); + } + } + else + { + // Caller didn't say anything + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( L"I don't believe you said anything!", 0, 0 ); + } + } + + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( L"OK bye now", 0, 0 ); + } + } + else + { + m_cpLocalVoice->Speak( L"Prematurely terminated call", 0, 0 ); + } + + if ( pwszCoMemText ) + { + ::CoTaskMemFree( pwszCoMemText ); + } + + return m_pCall ? hr : TAPI_E_DROPPED; +} /* COperator::HandleCall */ + +/////////////////////////////////////////////////////////// +// Miscellany +/////////////////////////////////////////////////////////// + +/********************************************************** +* COperator::DoMessage * +*----------------------* +* Description: +* Displays a MessageBox +************************************************************/ +void COperator::DoMessage( LPWSTR pszMessage ) +{ + USES_CONVERSION; + ::MessageBox( m_hDlg, W2T(pszMessage), W2T((WCHAR *) gszTelephonySample), MB_OK ); +} /* COperator::DoMessage */ + + +/********************************************************** +* COperator::SetStatusMessage * +*-----------------------------* +* Description: +* Displays a status message +************************************************************/ +void COperator::SetStatusMessage( LPWSTR pszMessage ) +{ + USES_CONVERSION; + ::SetDlgItemText( m_hDlg, IDC_STATUS, W2T(pszMessage) ); +} /* COperator::SetStatusMessage */ + +/************************************************************* +* AddressSupportsMediaType * +*--------------------------* +* Return: +* TRUE iff the given address supports the given media +**************************************************************/ +BOOL AddressSupportsMediaType( ITAddress * pAddress, + long lMediaType ) +{ + VARIANT_BOOL bSupport = VARIANT_FALSE; + ITMediaSupport * pMediaSupport; + + if ( SUCCEEDED( pAddress->QueryInterface( IID_ITMediaSupport, + (void **)&pMediaSupport ) ) ) + { + // does it support this media type? + pMediaSupport->QueryMediaType( lMediaType, + &bSupport ); + + pMediaSupport->Release(); + } + return (bSupport == VARIANT_TRUE); +} /* AddressSupportsMediaType */ diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.h b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.h new file mode 100644 index 00000000..ae80d8cd --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.h @@ -0,0 +1,116 @@ +/**************************************************************************** +* Operator.h +* Definition of the COperator class +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#ifndef MAXULONG_PTR +#error This sample application requires a newer version of the Platform SDK than you have installed. +#endif // MAXULONG_PTR + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include "callnot.h" + +// Global data +const WCHAR gszTelephonySample[] = L"SAPI 5.0 Telephony sample"; + +class COperator +{ +public: + COperator::COperator( HINSTANCE hInst ) : + m_hDlg( NULL ), + m_pTapi( NULL ), + m_pCall( NULL ), + m_fAutoAnswer( FALSE ), + m_pTAPIEventNotification( NULL ) + {}; + COperator::~COperator(); + + HRESULT Initialize(); + +private: + // Setup and shutdown + + HRESULT InitializeSapi(); + + HRESULT InitializeTapi(); + + void ShutdownSapi(); + + void ShutdownTapi(); + + // Main dialog proc is a friend function + + friend BOOL CALLBACK MainDialogProc( HWND hDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam ); + + // TAPI actions + + HRESULT RegisterTapiEventInterface(); + + HRESULT ListenOnAddresses(); + + HRESULT ListenOnThisAddress( ITAddress * pAddress ); + + HRESULT AnswerTheCall(); + + HRESULT DisconnectTheCall(); + + void ReleaseTheCall(); + + HRESULT OnTapiEvent( + TAPI_EVENT TapiEvent, + IDispatch * pEvent ); + + // SAPI actions + + HRESULT SetAudioOutForCall( ITLegacyCallMediaControl *pLegacyCallMediaControl ); + HRESULT SetAudioInForCall( ITLegacyCallMediaControl *pLegacyCallMediaControl ); + + HRESULT HandleCall(); + + // Miscellany + + void DoMessage( LPWSTR pszMessage ); + + void SetStatusMessage( LPWSTR pszMessage ); + + +private: + // Win32 data + HWND m_hDlg; + BOOL m_fAutoAnswer; + + // TAPI data + ITTAPI * m_pTapi; + ITBasicCallControl * m_pCall; + CTAPIEventNotification * m_pTAPIEventNotification; + ULONG m_ulAdvise; + + // SAPI data + + // Audio + CComPtr m_cpMMSysAudioOut; + CComPtr m_cpMMSysAudioIn; + + // Text to speech + CComPtr m_cpLocalVoice; + CComPtr m_cpOutgoingVoice; + + // Speech Recognition + CComPtr m_cpIncomingRecognizer; + CComPtr m_cpIncomingRecoCtxt; + CComPtr m_cpDictGrammar; +}; + +// Helper function +BOOL AddressSupportsMediaType( ITAddress * pAddress, + long lMediaType ); + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/resource.h b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/resource.h new file mode 100644 index 00000000..8c7332fe --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/resource.h @@ -0,0 +1,22 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by simpletelephony.rc +// +#define IDD_MAINDLG 101 +#define IDC_STATUS 1000 +#define IDC_ANSWER 1001 +#define IDC_DISCONNECT 1002 +#define IDC_DISCONNECTED 1003 +#define IDC_AUTOANSWER 1004 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.dsp b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.dsp new file mode 100644 index 00000000..3be1d986 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.dsp @@ -0,0 +1,131 @@ +# Microsoft Developer Studio Project File - Name="simpletelephony" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=simpletelephony - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "simpletelephony.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "simpletelephony.mak" CFG="simpletelephony - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "simpletelephony - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "simpletelephony - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "simpletelephony - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib t3iid.lib strmiids.lib winmm.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "simpletelephony - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib t3iid.lib strmiids.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" /libpath:"..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "simpletelephony - Win32 Release" +# Name "simpletelephony - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Callnot.Cpp +# End Source File +# Begin Source File + +SOURCE=.\operator.cpp +# End Source File +# Begin Source File + +SOURCE=.\simpletelephony.rc +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Callnot.h +# End Source File +# Begin Source File + +SOURCE=.\operator.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.ico b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.ico new file mode 100644 index 00000000..43f13171 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.rc b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.rc new file mode 100644 index 00000000..9f2aed7e --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.rc @@ -0,0 +1,121 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MAINDLG DIALOG DISCARDABLE 0, 0, 280, 50 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "SAPI 5.0 Telephony Sample" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Answer",IDC_ANSWER,220,6,50,14 + PUSHBUTTON "Exit",IDCANCEL,220,27,50,14 + EDITTEXT IDC_STATUS,37,11,173,14,ES_AUTOHSCROLL | ES_READONLY + LTEXT "Status",IDC_STATIC,7,11,28,8 + CONTROL "Auto Answer",IDC_AUTOANSWER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,37,31,56,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +SIMPLETELEPHONY ICON DISCARDABLE "simpletelephony.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// SMALLICON +// + +SIMPLETELEPHONY SMALLICON MOVEABLE PURE "simpletelephony.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_MAINDLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 270 + TOPMARGIN, 6 + BOTTOMMARGIN, 40 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/version.rc2 new file mode 100644 index 00000000..a8072b0b --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/SimpleTelephony/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Simple Telephony Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SimpleTelephony\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "SimpleTelephony.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/appicon.ico b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/appicon.ico new file mode 100644 index 00000000..91f966f2 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/appicon.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic eyes closed.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic eyes closed.bmp new file mode 100644 index 00000000..2c557fb2 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic eyes closed.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic.bmp new file mode 100644 index 00000000..fa27d542 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_eyes_narrow.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_eyes_narrow.bmp new file mode 100644 index 00000000..bf32c74a Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_eyes_narrow.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_10.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_10.bmp new file mode 100644 index 00000000..21be2766 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_10.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_11.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_11.bmp new file mode 100644 index 00000000..46426010 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_11.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_12.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_12.bmp new file mode 100644 index 00000000..28123d5f Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_12.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_13.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_13.bmp new file mode 100644 index 00000000..76ad8c8d Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_13.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_2.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_2.bmp new file mode 100644 index 00000000..97352cab Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_2.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_3.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_3.bmp new file mode 100644 index 00000000..7e5adfb7 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_3.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_4.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_4.bmp new file mode 100644 index 00000000..d8fed73c Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_4.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_5.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_5.bmp new file mode 100644 index 00000000..1f8b8279 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_5.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_6.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_6.bmp new file mode 100644 index 00000000..a41a2e20 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_6.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_7.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_7.bmp new file mode 100644 index 00000000..92620857 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_7.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_8.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_8.bmp new file mode 100644 index 00000000..2702594a Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_8.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_9.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_9.bmp new file mode 100644 index 00000000..fce5f6b8 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_9.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthclo.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthclo.bmp new file mode 100644 index 00000000..630e5f3f Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthclo.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthmed.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthmed.bmp new file mode 100644 index 00000000..87fca9c3 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthmed.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthnar.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthnar.bmp new file mode 100644 index 00000000..3f00d5c1 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthnar.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop1.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop1.bmp new file mode 100644 index 00000000..315edf83 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop1.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop2.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop2.bmp new file mode 100644 index 00000000..eabfea9c Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop2.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop3.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop3.bmp new file mode 100644 index 00000000..a520cbb5 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop3.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop4.bmp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop4.bmp new file mode 100644 index 00000000..9c4d1d15 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop4.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/childwin.cpp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/childwin.cpp new file mode 100644 index 00000000..9ec8f4ce --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/childwin.cpp @@ -0,0 +1,100 @@ +///////////////////////////////////////////////////////////////////////// +// ChidWin.CPP +// +// This module handles all actions that take place in the child window. +// The child window is used for displaying the mouth bitmaps. +// +// Revision History: +// 07/18/99 Created +//Copyright (c) Microsoft Corporation. All rights reserved. +// +///////////////////////////////////////////////////////////////////////// + +#include "globals.h" + + +// --------------------------------------------------------------------------- +// ChildWndProc +// --------------------------------------------------------------------------- +// Description: Main window procedure. +// Arguments: +// HWND [in] Window handle. +// UINT [in] Message identifier. +// WPARAM [in] Depends on message. +// LPARAM [in] Depends on message. +// Returns: +// LPARAM Depends on message. +LPARAM CALLBACK ChildWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + HDC hdc=NULL, hmemDC=NULL; + PAINTSTRUCT ps; + HBRUSH hbrBkGnd=NULL; + RECT rect; + + // Call the appropriate message handler + switch(uMsg) + { + case WM_PAINT: + { + // Get the Display Context so we have someplace to blit. + hdc = BeginPaint( hWnd, &ps ); + + // Create a compatible DC. + hmemDC = CreateCompatibleDC( hdc ); + + GetClientRect( hWnd, &rect ); + // Create a bitmap big enough for our client rectangle. + HBITMAP hmemBMP = CreateCompatibleBitmap( hdc, + rect.right - rect.left, + rect.bottom - rect.top ); + + // Select the bitmap into the off-screen DC. + HGDIOBJ hobjOld = SelectObject( hmemDC, hmemBMP ); + + // Erase the background. + hbrBkGnd = CreateSolidBrush( GetSysColor(COLOR_3DFACE) ); + FillRect( hmemDC, &rect, hbrBkGnd ); + DeleteObject( hbrBkGnd ); + + // Draw into memory DC + ImageList_Draw( g_hListBmp, 0, hmemDC, 0, 0, INDEXTOOVERLAYMASK(g_iBmp) ); + if( g_iBmp%6 == 2 ) + { + ImageList_Draw( g_hListBmp, WEYESNAR, hmemDC, 0, 0, 0 ); + } + if( g_iBmp%6 == 5 ) + { + ImageList_Draw( g_hListBmp, WEYESCLO, hmemDC, 0, 0, 0 ); + } + + + // Blit to window DC + StretchBlt( hdc, 0, 0, rect.right, rect.bottom, + hmemDC, 0, 0, rect.right, rect.bottom, SRCCOPY ); + + // Replace the previous GDI object to the DC + SelectObject( hmemDC, hobjOld ); + + // Done with off-screen bitmap and DC. + DeleteObject( hmemBMP ); + + DeleteDC( hmemDC ); + + DeleteDC( hdc ); + + // Clean up and get outta here + EndPaint( hWnd, &ps ); + } + break; + + case WM_DESTROY: + // Delete Mouth Bitmaps + ImageList_Destroy( g_hListBmp ); + break; + + + } + + // Call the default message handler + return DefWindowProc(hWnd, uMsg, wParam, lParam); +} diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/dlgmain.cpp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/dlgmain.cpp new file mode 100644 index 00000000..9b0f6fe7 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/dlgmain.cpp @@ -0,0 +1,1275 @@ +///////////////////////////////////////////////////////////////////////// +// DlgMain.CPP +// +// This module handles the main dialog box, and it's controls. +// +// The main dialog is actually the application's main window class, there +// is no conventional "Window class", only this dialog class which is +// registered in WinMain. +// +// Revision History: +// 06/06/99 Created +//Copyright (c) Microsoft Corporation. All rights reserved. +// +///////////////////////////////////////////////////////////////////////// + +#include "globals.h" + +// +// Other local functions +// +inline void TTSAppStatusMessage( HWND hWnd, TCHAR* szMessage ); + +// --------------------------------------------------------------------------- +// CTTSApp::DlgProcMain +// --------------------------------------------------------------------------- +// Description: Main window procedure. +// Arguments: +// HWND [in] Window handle. +// UINT [in] Message identifier. +// WPARAM [in] Depends on message. +// LPARAM [in] Depends on message. +// Returns: +// LPARAM Depends on message. +LRESULT CALLBACK CTTSApp::DlgProcMain(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + CTTSApp* pThis = (CTTSApp *)::GetWindowLong( hwnd, GWL_USERDATA ); + + // Call the appropriate function to handle the messages + switch(uMsg) + { + case WM_INITDIALOG: + ::SetWindowLong( hwnd, GWL_USERDATA, lParam ); + pThis = (CTTSApp *)lParam; + return pThis->OnInitDialog( hwnd ); + + case WM_TTSAPPCUSTOMEVENT: + pThis->MainHandleSynthEvent(); + return TRUE; + + case WM_HSCROLL: + pThis->HandleScroll( (HWND) lParam ); + return TRUE; + + case WM_COMMAND: + if( pThis ) + { + pThis->MainHandleCommand( (int)(LOWORD(wParam)), (HWND)lParam, + (UINT)HIWORD(wParam) ); + } + return TRUE; + + case WM_CLOSE: + pThis->MainHandleClose(); + return TRUE; + } + + return FALSE; +} + +///////////////////////////////////////////////////////////////// +HRESULT CTTSApp::InitSapi() +///////////////////////////////////////////////////////////////// +{ + HRESULT hr; + + hr = m_cpVoice.CoCreateInstance( CLSID_SpVoice ); + + return hr; +} + +///////////////////////////////////////////////////////////////// +HIMAGELIST CTTSApp::InitImageList() +///////////////////////////////////////////////////////////////// +{ + HIMAGELIST hListBmp; + HBITMAP hBmp; + + hListBmp = ImageList_Create( CHARACTER_WIDTH, CHARACTER_HEIGHT, ILC_COLOR32 | ILC_MASK, 1, 0 ); + if (hListBmp) + { + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICFULL ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH2 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH3 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH4 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH5 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH6 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH7 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH8 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH9 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH10 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH11 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH12 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH13 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICEYESNAR ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICEYESCLO ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + ImageList_SetOverlayImage( hListBmp, 1, 1 ); + ImageList_SetOverlayImage( hListBmp, 2, 2 ); + ImageList_SetOverlayImage( hListBmp, 3, 3 ); + ImageList_SetOverlayImage( hListBmp, 4, 4 ); + ImageList_SetOverlayImage( hListBmp, 5, 5 ); + ImageList_SetOverlayImage( hListBmp, 6, 6 ); + ImageList_SetOverlayImage( hListBmp, 7, 7 ); + ImageList_SetOverlayImage( hListBmp, 8, 8 ); + ImageList_SetOverlayImage( hListBmp, 9, 9 ); + ImageList_SetOverlayImage( hListBmp, 10, 10 ); + ImageList_SetOverlayImage( hListBmp, 11, 11 ); + ImageList_SetOverlayImage( hListBmp, 12, 12 ); + ImageList_SetOverlayImage( hListBmp, 13, 13 ); + ImageList_SetOverlayImage( hListBmp, 14, WEYESNAR ); + ImageList_SetOverlayImage( hListBmp, 15, WEYESCLO ); + } + return hListBmp; +} + +///////////////////////////////////////////////////////////////// +BOOL CTTSApp::OnInitDialog( HWND hWnd ) +///////////////////////////////////////////////////////////////// +{ + HRESULT hr = S_OK; + + // Store this as the "Main Dialog" + m_hWnd = hWnd; + + // Add some default text to the main edit control + SetDlgItemText( hWnd, IDE_EDITBOX, _T("Enter text you wish spoken here.") ); + + // Set the event mask in the rich edit control so that it notifies us when text is + // changed in the control + SendMessage( GetDlgItem( hWnd, IDE_EDITBOX ), EM_SETEVENTMASK, 0, ENM_CHANGE ); + + // Initialize the Output Format combo box + for( int i=0; i cpStream; + HRESULT hrOutputStream = m_cpVoice->GetOutputStream(&cpStream); + + if (hrOutputStream == S_OK) + { + CSpStreamFormat Fmt; + hr = Fmt.AssignFormat(cpStream); + if (SUCCEEDED(hr)) + { + SPSTREAMFORMAT eFmt = Fmt.ComputeFormatEnum(); + for( i=0; iSetNotifyWindowMessage( hWnd, WM_TTSAPPCUSTOMEVENT, 0, 0 ); + } + + // We're interested in all TTS events + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->SetInterest( SPFEI_ALL_TTS_EVENTS, SPFEI_ALL_TTS_EVENTS ); + } + + // Get default rate and volume + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->GetRate( &m_DefaultRate ); + // initialize sliders and edit boxes with default rate + if ( SUCCEEDED( hr ) ) + { + SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETRANGE, TRUE, MAKELONG( SPMIN_RATE, SPMAX_RATE ) ); + SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETPOS, TRUE, m_DefaultRate ); + SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETPAGESIZE, TRUE, 5 ); + } + } + + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->GetVolume( &m_DefaultVolume ); + // initialize sliders and edit boxes with default volume + if ( SUCCEEDED( hr ) ) + { + SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETRANGE, TRUE, MAKELONG( SPMIN_VOLUME, SPMAX_VOLUME ) ); + SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETPOS, TRUE, m_DefaultVolume ); + SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETPAGESIZE, TRUE, 10 ); + } + } + + // If any SAPI initialization failed, shut down! + if( FAILED( hr ) ) + { + MessageBox( NULL, _T("Error initializing speech objects. Shutting down."), _T("Error"), MB_OK ); + SendMessage( hWnd, WM_CLOSE, 0, 0 ); + return(FALSE); + + } + else + { + // + // Create the child windows to which we'll blit our result + // + HWND hCharWnd = GetDlgItem(hWnd, IDC_CHARACTER); + RECT rc; + + GetClientRect(hCharWnd, &rc); + rc.left = (rc.right - CHARACTER_WIDTH) / 2; + rc.top = (rc.bottom - CHARACTER_HEIGHT) / 2; + m_hChildWnd = CreateWindow( CHILD_CLASS, NULL, + WS_CHILDWINDOW | WS_VISIBLE, + rc.left, rc.top, + rc.left + CHARACTER_WIDTH, rc.top + CHARACTER_HEIGHT, + hCharWnd, NULL, m_hInst, NULL ); + + if ( !m_hChildWnd ) + { + MessageBox( hWnd, _T("Error initializing speech objects. Shutting down."), _T("Error"), MB_OK ); + SendMessage( hWnd, WM_CLOSE, 0, 0 ); + return(FALSE); + + } + else + { + // Load Mouth Bitmaps and use and ImageList since we'll blit the mouth + // and eye positions over top of the full image + g_hListBmp = InitImageList(); + } + } + return(TRUE); + +} + +///////////////////////////////////////////////////////////////// +void CTTSApp::Stop() +///////////////////////////////////////////////////////////////// +// +// Resets global audio state to stopped, updates the Pause/Resume button +// and repaints the mouth in a closed position +// +{ + // Stop current rendering with a PURGEBEFORESPEAK... + HRESULT hr = m_cpVoice->Speak( NULL, SPF_PURGEBEFORESPEAK, 0 ); + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Stop error\r\n") ); + } + + SetWindowText( GetDlgItem( m_hWnd, IDB_PAUSE ), _T("Pause") ); + m_bPause = FALSE; + m_bStop = TRUE; + // Mouth closed + g_iBmp = 0; + SendMessage( m_hChildWnd, WM_PAINT, 0, 0 ); + InvalidateRect( m_hChildWnd, NULL, FALSE ); +} + +///////////////////////////////////////////////////////////////// +void CTTSApp::MainHandleCommand( int id, HWND hWndControl, UINT codeNotify ) +///////////////////////////////////////////////////////////////// +// +// Handle each of the WM_COMMAND messages that come in, and deal with +// them appropriately +// +{ + UINT cNumChar = 0; + HRESULT hr = S_OK; + TCHAR szAFileName[NORM_SIZE] = _T(""); + static BOOL bIsUnicode = FALSE; + BOOL bWavFileOpened = FALSE; + int iFormat; + CComPtr cpWavStream; + CComPtr cpOldStream; + HWND hwndEdit; + BOOL bFileOpened = FALSE; + + // Get handle to the main edit box + hwndEdit = GetDlgItem( m_hWnd, IDE_EDITBOX ); + + switch(id) + { + // About Box display + case IDC_ABOUT: + ::DialogBox( m_hInst, (LPCTSTR)IDD_ABOUT, m_hWnd, (DLGPROC)About ); + break; + + // Any change to voices is sent to VoiceChange() function + case IDC_COMBO_VOICES: + if( codeNotify == CBN_SELCHANGE ) + { + hr = VoiceChange(); + } + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Error changing voices\r\n") ); + } + + break; + + // If user wants to speak a file pop the standard windows open file + // dialog box and load the text into a global buffer (m_pszwFileText) + // which will be used when the user hits speak. + case IDB_OPEN: + bFileOpened = CallOpenFileDialog( szAFileName, + _T("TXT (*.txt)\0*.txt\0XML (*.xml)\0*.xml\0All Files (*.*)\0*.*\0") ); + if( bFileOpened ) + { + DWORD dwFileSize = 0; + + USES_CONVERSION; + wcscpy( m_szWFileName, T2W( szAFileName ) ); + ReadTheFile( szAFileName, &bIsUnicode, &m_pszwFileText ); + + if( bIsUnicode ) + { + // Unicode source + UpdateEditCtlW( m_pszwFileText ); + } + else + { + // MBCS source +#ifdef _UNICODE + TCHAR *pszFileText = _tcsdup( m_pszwFileText ); +#else + // We're compiling ANSI, so we need to convert the string to MBCS + // Note that a W2T may not be good here, since this string might + // be very big + TCHAR *pszFileText = NULL; + int iNeeded = ::WideCharToMultiByte( CP_ACP, 0, m_pszwFileText, -1, NULL, 0, NULL, NULL ); + pszFileText = (TCHAR *) ::malloc( sizeof( TCHAR ) * ( iNeeded + 1 ) ); + ::WideCharToMultiByte( CP_ACP, 0, m_pszwFileText, -1, pszFileText, iNeeded + 1, NULL, NULL ); +#endif + if ( pszFileText ) + { + SetDlgItemText( m_hWnd, IDE_EDITBOX, pszFileText ); + free( pszFileText ); + } + + } + } + else + { + wcscpy( m_szWFileName, L"" ); + } + // Always SetFocus back to main edit window so text highlighting will work + SetFocus( hwndEdit ); + break; + + // Handle speak + case IDB_SPEAK: + HandleSpeak(); + break; + + case IDB_PAUSE: + if( !m_bStop ) + { + if( !m_bPause ) + { + SetWindowText( GetDlgItem( m_hWnd, IDB_PAUSE ), _T("Resume") ); + // Pause the voice... + m_cpVoice->Pause(); + m_bPause = TRUE; + TTSAppStatusMessage( m_hWnd, _T("Pause\r\n") ); + } + else + { + SetWindowText( GetDlgItem( m_hWnd, IDB_PAUSE ), _T("Pause") ); + m_cpVoice->Resume(); + m_bPause = FALSE; + } + } + SetFocus( hwndEdit ); + break; + + case IDB_STOP: + TTSAppStatusMessage( m_hWnd, _T("Stop\r\n") ); + // Set the global audio state to stop + Stop(); + SetFocus( hwndEdit ); + break; + + case IDB_SKIP: + { + SetFocus( hwndEdit ); + int fSuccess = false; + int SkipNum = GetDlgItemInt( m_hWnd, IDC_SKIP_EDIT, &fSuccess, true ); + ULONG ulGarbage = 0; + WCHAR szGarbage[] = L"Sentence"; + if ( fSuccess ) + { + TTSAppStatusMessage( m_hWnd, _T("Skip\r\n") ); + hr = m_cpVoice->Skip( szGarbage, SkipNum, &ulGarbage ); + } + else + { + TTSAppStatusMessage( m_hWnd, _T("Skip failed\r\n") ); + } + break; + } + + case IDE_EDITBOX: + // Set the global audio state to stop if user has changed contents of edit control + if( codeNotify == EN_CHANGE ) + { + Stop(); + } + break; + + case IDB_SPEAKWAV: + bWavFileOpened = CallOpenFileDialog( szAFileName, + _T("WAV (*.wav)\0*.wav\0All Files (*.*)\0*.*\0") ); + // Speak the wav file using SpeakStream + if( bWavFileOpened ) + { + CComPtr cpWavStream; + WCHAR szwWavFileName[NORM_SIZE] = L"";; + + USES_CONVERSION; + wcscpy( szwWavFileName, T2W( szAFileName ) ); + + // User helper function found in sphelper.h to open the wav file and + // get back an IStream pointer to pass to SpeakStream + hr = SPBindToFile( szwWavFileName, SPFM_OPEN_READONLY, &cpWavStream ); + + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->SpeakStream( cpWavStream, SPF_ASYNC, NULL ); + } + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Speak error\r\n") ); + } + } + break; + + // Reset all values to defaults + case IDB_RESET: + TTSAppStatusMessage( m_hWnd, _T("Reset\r\n") ); + SendDlgItemMessage( m_hWnd, IDC_VOLUME_SLIDER, TBM_SETPOS, TRUE, m_DefaultVolume ); + SendDlgItemMessage( m_hWnd, IDC_RATE_SLIDER, TBM_SETPOS, TRUE, m_DefaultRate ); + SendDlgItemMessage( m_hWnd, IDC_SAVETOWAV, BM_SETCHECK, BST_UNCHECKED, 0 ); + SendDlgItemMessage( m_hWnd, IDC_EVENTS, BM_SETCHECK, BST_UNCHECKED, 0 ); + SetDlgItemText( m_hWnd, IDE_EDITBOX, _T("Enter text you wish spoken here.") ); + + // reset output format + SendDlgItemMessage( m_hWnd, IDC_COMBO_OUTPUT, CB_SETCURSEL, m_DefaultFormatIndex, 0 ); + SendMessage( m_hWnd, WM_COMMAND, MAKEWPARAM(IDC_COMBO_OUTPUT, CBN_SELCHANGE), 0 ); + + // Change the volume and the rate to reflect what the UI says + HandleScroll( ::GetDlgItem( m_hWnd, IDC_VOLUME_SLIDER ) ); + HandleScroll( ::GetDlgItem( m_hWnd, IDC_RATE_SLIDER ) ); + + SetFocus( hwndEdit ); + break; + + case IDC_COMBO_OUTPUT: + if( codeNotify == CBN_SELCHANGE ) + { + // Get the audio output format and set it's GUID + iFormat = SendDlgItemMessage( m_hWnd, IDC_COMBO_OUTPUT, CB_GETCURSEL, 0, 0 ); + SPSTREAMFORMAT eFmt = (SPSTREAMFORMAT)SendDlgItemMessage( m_hWnd, IDC_COMBO_OUTPUT, + CB_GETITEMDATA, iFormat, 0 ); + CSpStreamFormat Fmt; + Fmt.AssignFormat(eFmt); + if ( m_cpOutAudio ) + { + hr = m_cpOutAudio->SetFormat( Fmt.FormatId(), Fmt.WaveFormatExPtr() ); + } + else + { + hr = E_FAIL; + } + + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->SetOutput( m_cpOutAudio, FALSE ); + } + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Format rejected\r\n") ); + } + + EnableSpeakButtons( SUCCEEDED( hr ) ); + } + break; + + case IDC_SAVETOWAV: + { + USES_CONVERSION; + + TCHAR szFileName[256]; + _tcscpy(szFileName, _T("\0")); + + BOOL bFileOpened = CallSaveFileDialog( szFileName, + _T("WAV (*.wav)\0*.wav\0All Files (*.*)\0*.*\0") ); + + if (bFileOpened == FALSE) break; + + wcscpy( m_szWFileName, T2W(szFileName) ); + + CSpStreamFormat OriginalFmt; + hr = m_cpVoice->GetOutputStream( &cpOldStream ); + if (hr == S_OK) + { + hr = OriginalFmt.AssignFormat(cpOldStream); + } + else + { + hr = E_FAIL; + } + // User SAPI helper function in sphelper.h to create a wav file + if (SUCCEEDED(hr)) + { + hr = SPBindToFile( m_szWFileName, SPFM_CREATE_ALWAYS, &cpWavStream, &OriginalFmt.FormatId(), OriginalFmt.WaveFormatExPtr() ); + } + if( SUCCEEDED( hr ) ) + { + // Set the voice's output to the wav file instead of the speakers + hr = m_cpVoice->SetOutput(cpWavStream, TRUE); + } + + if ( SUCCEEDED( hr ) ) + { + // Do the Speak + HandleSpeak(); + } + + // Set output back to original stream + // Wait until the speak is finished if saving to a wav file so that + // the smart pointer cpWavStream doesn't get released before its + // finished writing to the wav. + m_cpVoice->WaitUntilDone( INFINITE ); + cpWavStream.Release(); + + // Reset output + m_cpVoice->SetOutput( cpOldStream, FALSE ); + + TCHAR szTitle[MAX_PATH]; + TCHAR szConfString[MAX_PATH]; + if ( SUCCEEDED( hr ) ) + { + LoadString( m_hInst, IDS_SAVE_NOTIFY, szConfString, MAX_PATH ); + LoadString( m_hInst, IDS_NOTIFY_TITLE, szTitle, MAX_PATH ); + MessageBox( m_hWnd, szConfString, szTitle, MB_OK | MB_ICONINFORMATION ); + } + else + { + LoadString( m_hInst, IDS_SAVE_ERROR, szConfString, MAX_PATH ); + MessageBox( m_hWnd, szConfString, NULL, MB_ICONEXCLAMATION ); + } + + break; + } + } + + return; +} + +///////////////////////////////////////////////////////////////////////////////////////////// +void CTTSApp::HandleSpeak() +///////////////////////////////////////////////////////////////////////////////////////////// +{ + HWND hwndEdit; + HRESULT hr = S_OK; + WCHAR *szWTextString = NULL; + + // Get handle to the main edit box + hwndEdit = GetDlgItem( m_hWnd, IDE_EDITBOX ); + + TTSAppStatusMessage( m_hWnd, _T("Speak\r\n") ); + SetFocus( hwndEdit ); + m_bStop = FALSE; + + // only get the string if we're not paused + if( !m_bPause ) + { + // Find the length of the string in the buffer + GETTEXTLENGTHEX gtlx; + gtlx.codepage = 1200; + gtlx.flags = GTL_DEFAULT; + LONG lTextLen = SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_GETTEXTLENGTHEX, (WPARAM) >lx, 0 ); + szWTextString = new WCHAR[ lTextLen + 1 ]; + + GETTEXTEX GetText; + + GetText.cb = (lTextLen + 1) * sizeof( WCHAR ); + GetText.codepage = 1200; + GetText.flags = GT_DEFAULT; + GetText.lpDefaultChar = NULL; + GetText.lpUsedDefChar = NULL; + + // Get the string in a unicode buffer + SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_GETTEXTEX, (WPARAM)&GetText, (LPARAM)szWTextString ); + + // do we speak or interpret the XML + hr = m_cpVoice->Speak( szWTextString, SPF_ASYNC | ((IsDlgButtonChecked( m_hWnd, IDC_SPEAKXML )) ? SPF_IS_XML : SPF_IS_NOT_XML), 0 ); + + delete[] szWTextString; + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Speak error\r\n") ); + } + } + m_bPause = FALSE; + SetWindowText( GetDlgItem( m_hWnd, IDB_PAUSE ), _T("Pause") ); + SetFocus( hwndEdit ); + // Set state to run + hr = m_cpVoice->Resume(); + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Speak error\r\n") ); + } +} + +///////////////////////////////////////////////////////////////// +void CTTSApp::MainHandleSynthEvent() +///////////////////////////////////////////////////////////////// +// +// Handles the WM_TTSAPPCUSTOMEVENT application defined message and all +// of it's appropriate SAPI5 events. +// +{ + + CSpEvent event; // helper class in sphelper.h for events that releases any + // allocated memory in it's destructor - SAFER than SPEVENT + SPVOICESTATUS Stat; + WPARAM nStart; + LPARAM nEnd; + int i = 0; + HRESULT hr = S_OK; + + while( event.GetFrom(m_cpVoice) == S_OK ) + { + switch( event.eEventId ) + { + case SPEI_START_INPUT_STREAM: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("StartStream event\r\n") ); + } + break; + + case SPEI_END_INPUT_STREAM: + // Set global boolean stop to TRUE when finished speaking + m_bStop = TRUE; + // Highlight entire text + nStart = 0; + nEnd = SendDlgItemMessage( m_hWnd, IDE_EDITBOX, WM_GETTEXTLENGTH, 0, 0 ); + SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_SETSEL, nStart, nEnd ); + // Mouth closed + g_iBmp = 0; + InvalidateRect( m_hChildWnd, NULL, FALSE ); + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("EndStream event\r\n") ); + } + break; + + case SPEI_VOICE_CHANGE: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Voicechange event\r\n") ); + } + break; + + case SPEI_TTS_BOOKMARK: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + // Get the string associated with the bookmark + // and add the null terminator. + USES_CONVERSION; + TCHAR szBuff2[MAX_PATH] = _T("Bookmark event: "); + + WCHAR *pwszEventString = new WCHAR[ wcslen( event.String() ) + 1]; + if ( pwszEventString ) + { + wcscpy( pwszEventString, event.String() ); + _tcscat( szBuff2, W2T(pwszEventString) ); + free( pwszEventString ); + } + + _tcscat( szBuff2, _T("\r\n") ); + TTSAppStatusMessage( m_hWnd, szBuff2 ); + } + break; + + case SPEI_WORD_BOUNDARY: + hr = m_cpVoice->GetStatus( &Stat, NULL ); + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Voice GetStatus error\r\n") ); + } + + // Highlight word + nStart = (LPARAM)( Stat.ulInputWordPos / sizeof(char) ); + nEnd = nStart + Stat.ulInputWordLen; + SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_SETSEL, nStart, nEnd ); + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + + TTSAppStatusMessage( m_hWnd, _T("Wordboundary event\r\n") ); + } + break; + + case SPEI_PHONEME: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Phoneme event\r\n") ); + } + break; + + case SPEI_VISEME: + // Get the current mouth viseme position and map it to one of the + // 7 mouth bitmaps. + g_iBmp = g_aMapVisemeToImage[event.Viseme()]; // current viseme + + InvalidateRect( m_hChildWnd, NULL, FALSE ); + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Viseme event\r\n") ); + } + break; + + case SPEI_SENTENCE_BOUNDARY: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Sentence event\r\n") ); + } + break; + + case SPEI_TTS_AUDIO_LEVEL: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + USES_CONVERSION; + WCHAR wszBuff[MAX_PATH]; + swprintf(wszBuff, L"Audio level: %d\r\n", (ULONG)event.wParam); + TTSAppStatusMessage( m_hWnd, W2T(wszBuff) ); + } + break; + + case SPEI_TTS_PRIVATE: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Private engine event\r\n") ); + } + break; + + default: + TTSAppStatusMessage( m_hWnd, _T("Unknown message\r\n") ); + break; + } + } +} + +///////////////////////////////////////////////////////////////////////// +void CTTSApp::HandleScroll( HWND hCtl ) +///////////////////////////////////////////////////////////////////////// +{ + static long hpos = 1; + HWND hVolume, hRate; + HRESULT hr = S_OK; + + // Get the current position of the slider + hpos = SendMessage( hCtl, TBM_GETPOS, 0, 0 ); + + // Get the Handle for the scroll bar so it can be associated with an edit box + hVolume = GetDlgItem( m_hWnd, IDC_VOLUME_SLIDER ); + hRate = GetDlgItem( m_hWnd, IDC_RATE_SLIDER ); + + if( hCtl == hVolume ) + { + hr = m_cpVoice->SetVolume((USHORT)hpos); + } + else if( hCtl == hRate ) + { + hr = m_cpVoice->SetRate(hpos); + } + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Error setting volume / rate\r\n") ); + } + + return; +} + +///////////////////////////////////////////////////////////////// +void CTTSApp::MainHandleClose() +///////////////////////////////////////////////////////////////// +{ + // Call helper functions from sphelper.h to destroy combo boxes + // created with SpInitTokenComboBox + SpDestroyTokenComboBox( GetDlgItem( m_hWnd, IDC_COMBO_VOICES ) ); + + // Terminate the app + PostQuitMessage(0); + + // Return success + return; +} + +///////////////////////////////////////////////////////////////// +HRESULT CTTSApp::VoiceChange() +///////////////////////////////////////////////////////////////// +// +// This function is called during initialization and whenever the +// selection for the voice combo box changes. +// It gets the token pointer associated with the voice. +// If the new voice is different from the one that's currently +// selected, it first stops any synthesis that is going on and +// sets the new voice on the global voice object. +// +{ + HRESULT hr = S_OK; + GUID* pguidAudioFormat = NULL; + int iFormat = 0; + + // Get the token associated with the selected voice + ISpObjectToken* pToken = SpGetCurSelComboBoxToken( GetDlgItem( m_hWnd, IDC_COMBO_VOICES ) ); + + //Determine if it is the current voice + CComPtr pOldToken; + hr = m_cpVoice->GetVoice( &pOldToken ); + + if (SUCCEEDED(hr)) + { + if (pOldToken != pToken) + { + // Stop speaking. This is not necesary, for the next call to work, + // but just to show that we are changing voices. + hr = m_cpVoice->Speak( NULL, SPF_PURGEBEFORESPEAK, 0); + // And set the new voice on the global voice object + if (SUCCEEDED (hr) ) + { + hr = m_cpVoice->SetVoice( pToken ); + } + } + } + + EnableSpeakButtons( SUCCEEDED( hr ) ); + + return hr; +} + +///////////////////////////////////////////////////////////////// +BOOL CTTSApp::CallOpenFileDialog( TCHAR* szFileName, TCHAR* szFilter ) +///////////////////////////////////////////////////////////////// +// +// Display the open dialog box to retrieve the user-selected +// .txt or .xml file for synthisizing +{ + OPENFILENAME ofn; + BOOL bRetVal = TRUE; + LONG lRetVal; + HKEY hkResult; + TCHAR szPath[256] = _T(""); + DWORD size = 256; + + // Open the last directory used by this app (stored in registry) + lRetVal = RegCreateKeyEx( HKEY_CURRENT_USER, + _T("SOFTWARE\\Microsoft\\Speech\\AppData\\TTSApp"), 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkResult, NULL ); + + if( lRetVal == ERROR_SUCCESS ) + { + RegQueryValueEx( hkResult, _T("TTSFiles"), NULL, NULL, (PBYTE)szPath, &size ); + } + + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + ZeroMemory( &ofn, ofnsize); + + + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hWnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrCustomFilter = NULL; + ofn.nFilterIndex = 1; + ofn.lpstrInitialDir = szPath; + ofn.lpstrFile = szFileName; + ofn.nMaxFile = 256; + ofn.lpstrTitle = NULL; + ofn.lpstrFileTitle = NULL; + ofn.lpstrDefExt = NULL; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_READONLY | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY; + + // Pop the dialog + bRetVal = GetOpenFileName( &ofn ); + + // Write the directory path you're in to the registry + TCHAR pathstr[256] = _T(""); + _tcscpy( pathstr, szFileName ); + + int i=0; + while( pathstr[i] != NULL ) + { + i++; + } + while( pathstr[i] != '\\' ) + { + i --; + } + pathstr[i] = NULL; + + // Now write the string to the registry + RegSetValueEx( hkResult, _T("TTSFiles"), NULL, REG_EXPAND_SZ, (PBYTE)pathstr, _tcslen(pathstr)+1 ); + + RegCloseKey( hkResult ); + + return bRetVal; +} + +///////////////////////////////////////////////////////////////// +BOOL CTTSApp::CallSaveFileDialog( TCHAR* szFileName, TCHAR* szFilter ) +///////////////////////////////////////////////////////////////// +// +// Display the save dialog box to save the wav file +{ + OPENFILENAME ofn; + BOOL bRetVal = TRUE; + LONG lRetVal; + HKEY hkResult; + TCHAR szPath[256] = _T(""); + DWORD size = 256; + + // Open the last directory used by this app (stored in registry) + lRetVal = RegCreateKeyEx( HKEY_CLASSES_ROOT, _T("PathTTSDataFiles"), 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkResult, NULL ); + + if( lRetVal == ERROR_SUCCESS ) + { + RegQueryValueEx( hkResult, _T("TTSFiles"), NULL, NULL, (PBYTE)szPath, &size ); + + RegCloseKey( hkResult ); + } + + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + ZeroMemory( &ofn, ofnsize); + + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hWnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrCustomFilter = NULL; + ofn.nFilterIndex = 1; + ofn.lpstrInitialDir = szPath; + ofn.lpstrFile = szFileName; + ofn.nMaxFile = 256; + ofn.lpstrTitle = NULL; + ofn.lpstrFileTitle = NULL; + ofn.lpstrDefExt = _T("wav"); + ofn.Flags = OFN_OVERWRITEPROMPT; + + // Pop the dialog + bRetVal = GetSaveFileName( &ofn ); + + if ( ofn.Flags & OFN_EXTENSIONDIFFERENT ) + { + _tcscat( szFileName, _T(".wav") ); + } + + // Write the directory path you're in to the registry + TCHAR pathstr[256] = _T(""); + _tcscpy( pathstr, szFileName ); + + int i=0; + while( pathstr[i] != NULL ) + { + i++; + } + while( pathstr[i] != '\\' ) + { + i --; + } + pathstr[i] = NULL; + + // Now write the string to the registry + lRetVal = RegCreateKeyEx( HKEY_CLASSES_ROOT, _T("PathTTSDataFiles"), 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkResult, NULL ); + + if( lRetVal == ERROR_SUCCESS ) + { + RegSetValueEx( hkResult, _T("TTSFiles"), NULL, REG_EXPAND_SZ, (PBYTE)pathstr, _tcslen(pathstr)+1 ); + + RegCloseKey( hkResult ); + } + + return bRetVal; +} + +///////////////////////////////////////////////////// +HRESULT CTTSApp::ReadTheFile( TCHAR* szFileName, BOOL* bIsUnicode, WCHAR** ppszwBuff ) +///////////////////////////////////////////////////// +// +// This file opens and reads the contents of a file. It +// returns a pointer to the string. +// Warning, this function allocates memory for the string on +// the heap so the caller must free it with 'delete'. +// +{ + // Open up the file and copy it's contents into a buffer to return + HRESULT hr = 0; + HANDLE hFile; + DWORD dwSize = 0; + DWORD dwBytesRead = 0; + + // First delete any memory previously allocated by this function + if( m_pszwFileText ) + { + delete m_pszwFileText; + } + + hFile = CreateFile( szFileName, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY, NULL ); + if( hFile == INVALID_HANDLE_VALUE ) + { + *ppszwBuff = NULL; + hr = E_FAIL; + } + + if( SUCCEEDED( hr ) ) + { + dwSize = GetFileSize( hFile, NULL ); + if( dwSize == 0xffffffff ) + { + *ppszwBuff = NULL; + hr = E_FAIL; + } + } + + if( SUCCEEDED( hr ) ) + { + // Read the file contents into a wide buffer and then determine + // if it's a unicode or ascii file + WCHAR Signature = 0; + + ReadFile( hFile, &Signature, 2, &dwBytesRead, NULL ); + + // Check to see if its a unicode file by looking at the signature of the first character. + if( 0xFEFF == Signature ) + { + *ppszwBuff = new WCHAR [dwSize/2]; + + *bIsUnicode = TRUE; + ReadFile( hFile, *ppszwBuff, dwSize-2, &dwBytesRead, NULL ); + (*ppszwBuff)[dwSize/2-1] = NULL; + + CloseHandle( hFile ); + } + else // MBCS source + { + char* pszABuff = new char [dwSize+1]; + *ppszwBuff = new WCHAR [dwSize+1]; + + *bIsUnicode = FALSE; + SetFilePointer( hFile, NULL, NULL, FILE_BEGIN ); + ReadFile( hFile, pszABuff, dwSize, &dwBytesRead, NULL ); + pszABuff[dwSize] = NULL; + ::MultiByteToWideChar( CP_ACP, 0, pszABuff, -1, *ppszwBuff, dwSize + 1 ); + + delete( pszABuff ); + CloseHandle( hFile ); + } + } + + return hr; +} + +///////////////////////////////////////////////////////////////////////// +void CTTSApp::UpdateEditCtlW( WCHAR* pszwText ) +///////////////////////////////////////////////////////////////////////// +{ + CComPtr cpRichEdit; + CComPtr cpTextDocument; + ITextServices* pTextServices=NULL; + HRESULT hr = S_OK; + + // Use rich edit control interface pointers to update text + if( SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_GETOLEINTERFACE, 0, (LPARAM)(LPVOID FAR *)&cpRichEdit ) ) + { + hr = cpRichEdit.QueryInterface( &cpTextDocument ); + + if( SUCCEEDED( hr ) ) + { + hr = cpTextDocument->QueryInterface( IID_ITextServices, (void**)&pTextServices ); + } + + if (SUCCEEDED(hr)) + { + BSTR bstr = SysAllocString( pszwText ); + + hr = pTextServices->TxSetText( bstr ); + + pTextServices->Release(); + + SysFreeString( bstr ); + } + } + + // Add text the old fashon way by converting it to ansi. Note information + // loss will occur because of the WC2MB conversion. + if( !cpRichEdit || FAILED( hr ) ) + { + USES_CONVERSION; + TCHAR *pszFileText = _tcsdup( W2T(pszwText) ); + SetDlgItemText( m_hWnd, IDE_EDITBOX, pszFileText ); + free( pszFileText ); + } +} + +///////////////////////////////////////////////////////////////////////// +void CTTSApp::EnableSpeakButtons( BOOL fEnable ) +///////////////////////////////////////////////////////////////////////// +{ + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_SPEAK ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_PAUSE ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_STOP ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_SKIP ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_SPEAKWAV ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDC_SAVETOWAV ), fEnable ); +} + +///////////////////////////////////////////////////// +inline void TTSAppStatusMessage( HWND hWnd, TCHAR* szMessage ) +///////////////////////////////////////////////////// +// +// This function prints debugging messages to the debug edit control +// +{ + static TCHAR szDebugText[MAX_SIZE]=_T(""); + static int i = 0; + + // Clear out the buffer after 100 lines of text have been written + // to the debug window since it can only hold 4096 characters. + if( i == 100 ) + { + _tcscpy( szDebugText, _T("") ); + i = 0; + } + // Attach the new message to the ongoing list of messages + _tcscat( szDebugText, szMessage ); + SetDlgItemText( hWnd, IDC_DEBUG, szDebugText ); + + SendDlgItemMessage( hWnd, IDC_DEBUG, EM_LINESCROLL, 0, i ); + + i++; + + return; +} + +/***************************************************************************************** +* About() * +*---------* +* Description: +* Message handler for the "About" box. +******************************************************************************************/ +LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch( message ) + { + case WM_COMMAND: + { + WORD wId = LOWORD(wParam); + WORD wEvent = HIWORD(wParam); + + switch( wId ) + { + case IDOK: + case IDCANCEL: + EndDialog( hDlg, LOWORD(wParam) ); + return TRUE; + } + } + } + return FALSE; +} /* About */ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/globals.cpp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/globals.cpp new file mode 100644 index 00000000..447ee6e1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/globals.cpp @@ -0,0 +1,110 @@ +#include "globals.h" +//Copyright (c) Microsoft Corporation. All rights reserved. + +// Other global variables +int g_iBmp = 0; // current bmp +HIMAGELIST g_hListBmp = 0; // image list +const int g_aMapVisemeToImage[22] = { 0, // SP_VISEME_0 = 0, // Silence + 11, // SP_VISEME_1, // AE, AX, AH + 11, // SP_VISEME_2, // AA + 11, // SP_VISEME_3, // AO + 10, // SP_VISEME_4, // EY, EH, UH + 11, // SP_VISEME_5, // ER + 9, // SP_VISEME_6, // y, IY, IH, IX + 2, // SP_VISEME_7, // w, UW + 13, // SP_VISEME_8, // OW + 9, // SP_VISEME_9, // AW + 12, // SP_VISEME_10, // OY + 11, // SP_VISEME_11, // AY + 9, // SP_VISEME_12, // h + 3, // SP_VISEME_13, // r + 6, // SP_VISEME_14, // l + 7, // SP_VISEME_15, // s, z + 8, // SP_VISEME_16, // SH, CH, JH, ZH + 5, // SP_VISEME_17, // TH, DH + 4, // SP_VISEME_18, // f, v + 7, // SP_VISEME_19, // d, t, n + 9, // SP_VISEME_20, // k, g, NG + 1 };// SP_VISEME_21, // p, b, m + + +// Output formats +const SPSTREAMFORMAT g_aOutputFormat[NUM_OUTPUTFORMATS] = {SPSF_8kHz8BitMono, + SPSF_8kHz8BitStereo, + SPSF_8kHz16BitMono, + SPSF_8kHz16BitStereo, + SPSF_11kHz8BitMono, + SPSF_11kHz8BitStereo, + SPSF_11kHz16BitMono, + SPSF_11kHz16BitStereo, + SPSF_12kHz8BitMono, + SPSF_12kHz8BitStereo, + SPSF_12kHz16BitMono, + SPSF_12kHz16BitStereo, + SPSF_16kHz8BitMono, + SPSF_16kHz8BitStereo, + SPSF_16kHz16BitMono, + SPSF_16kHz16BitStereo, + SPSF_22kHz8BitMono, + SPSF_22kHz8BitStereo, + SPSF_22kHz16BitMono, + SPSF_22kHz16BitStereo, + SPSF_24kHz8BitMono, + SPSF_24kHz8BitStereo, + SPSF_24kHz16BitMono, + SPSF_24kHz16BitStereo, + SPSF_32kHz8BitMono, + SPSF_32kHz8BitStereo, + SPSF_32kHz16BitMono, + SPSF_32kHz16BitStereo, + SPSF_44kHz8BitMono, + SPSF_44kHz8BitStereo, + SPSF_44kHz16BitMono, + SPSF_44kHz16BitStereo, + SPSF_48kHz8BitMono, + SPSF_48kHz8BitStereo, + SPSF_48kHz16BitMono, + SPSF_48kHz16BitStereo}; + +TCHAR* g_aszOutputFormat[NUM_OUTPUTFORMATS] = {_T("8kHz 8 Bit Mono"), + _T("8kHz 8 Bit Stereo"), + _T("8kHz 16 Bit Mono"), + _T("8kHz 16 Bit Stereo"), + _T("11kHz 8 Bit Mono"), + _T("11kHz 8 Bit Stereo"), + _T("11kHz 16 Bit Mono"), + _T("11kHz 16 Bit Stereo"), + _T("12kHz 8 Bit Mono"), + _T("12kHz 8 Bit Stereo"), + _T("12kHz 16 Bit Mono"), + _T("12kHz 16 Bit Stereo"), + _T("16kHz 8 Bit Mono"), + _T("16kHz 8 Bit Stereo"), + _T("16kHz 16 Bit Mono"), + _T("16kHz 16 Bit Stereo"), + _T("22kHz 8 Bit Mono"), + _T("22kHz 8 Bit Stereo"), + _T("22kHz 16 Bit Mono"), + _T("22kHz 16 Bit Stereo"), + _T("24kHz 8 Bit Mono"), + _T("24kHz 8 Bit Stereo"), + _T("24kHz 16 Bit Mono"), + _T("24kHz 16 Bit Stereo"), + _T("32kHz 8 Bit Mono"), + _T("32kHz 8 Bit Stereo"), + _T("32kHz 16 Bit Mono"), + _T("32kHz 16 Bit Stereo"), + _T("44kHz 8 Bit Mono"), + _T("44kHz 8 Bit Stereo"), + _T("44kHz 16 Bit Mono"), + _T("44kHz 16 Bit Stereo"), + _T("48kHz 8 Bit Mono"), + _T("48kHz 8 Bit Stereo"), + _T("48kHz 16 Bit Mono"), + _T("48kHz 16 Bit Stereo")}; + +// ITextServices interface guid +const IID IID_ITextServices = {0X8D33F740,0XCF58,0x11ce,{0XA8,0X9D,0X00,0XAA,0X00,0X6C,0XAD,0XC5}}; + +// ITextDocument interface guid +const IID IID_ITextDocument = {0x8CC497C0,0xA1DF,0x11ce,{0x80,0x98,0x00,0xAA,0x00,0x47,0xBE,0x5D}}; diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/globals.h b/mp/src/utils/sapi51/Samples/CPP/TTSApp/globals.h new file mode 100644 index 00000000..4a584a73 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/globals.h @@ -0,0 +1,18 @@ + #ifndef __TTSAPP_GLOBALS_H__ +#define __TTSAPP_GLOBALS_H__ + +// App includes +#include "TTSApp.h" + + +// Other global variables +extern int g_iBmp; +extern HIMAGELIST g_hListBmp; +extern const int g_aMapVisemeToImage[22]; + +// Output formats +extern const SPSTREAMFORMAT g_aOutputFormat[NUM_OUTPUTFORMATS]; +extern TCHAR* g_aszOutputFormat[NUM_OUTPUTFORMATS]; + + +#endif // __TTSAPP_GLOBALS_H__ diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/resource.h b/mp/src/utils/sapi51/Samples/CPP/TTSApp/resource.h new file mode 100644 index 00000000..3d53da69 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/resource.h @@ -0,0 +1,61 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ttsapp.rc +// +#define IDS_SAVE_NOTIFY 1 +#define IDS_NOTIFY_TITLE 2 +#define IDS_SAVE_ERROR 3 +#define IDS_AUDIOOUT_ERROR 4 +#define IDS_VOICE_INIT_ERROR 4 +#define IDS_UNSUPPORTED_FORMAT 5 +#define IDI_APPICON 101 +#define IDD_MAIN 101 +#define IDB_MICFULL 127 +#define IDB_MICEYESCLO 128 +#define IDB_MICEYESNAR 129 +#define IDB_MICMOUTH10 148 +#define IDB_MICMOUTH11 149 +#define IDB_MICMOUTH12 150 +#define IDB_MICMOUTH13 151 +#define IDB_MICMOUTH2 152 +#define IDB_MICMOUTH3 153 +#define IDB_MICMOUTH4 154 +#define IDB_MICMOUTH5 155 +#define IDB_MICMOUTH6 156 +#define IDB_MICMOUTH7 157 +#define IDB_MICMOUTH8 158 +#define IDB_MICMOUTH9 159 +#define IDD_ABOUT 161 +#define IDE_EDITBOX 1000 +#define IDC_ABOUT_TTSAPP_VERSION 1000 +#define IDC_MOUTHPOS 1001 +#define IDB_SPEAK 1002 +#define IDB_PAUSE 1003 +#define IDB_STOP 1004 +#define IDC_EVENTS 1006 +#define IDC_DEBUG 1007 +#define IDC_SPEAKXML 1008 +#define IDB_OPEN 1009 +#define IDC_COMBO_VOICES 1011 +#define IDB_RESET 1012 +#define IDC_RATE_SLIDER 1014 +#define IDC_VOLUME_SLIDER 1015 +#define IDC_COMBO_OUTPUT 1018 +#define IDC_SAVETOWAV 1020 +#define IDB_SPEAKWAV 1021 +#define IDC_CHARACTER 1023 +#define IDB_SKIP 1026 +#define IDC_SKIP_EDIT 1031 +#define IDC_SKIP_SPIN 1032 +#define IDC_ABOUT 1033 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 165 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1036 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/textserv.h b/mp/src/utils/sapi51/Samples/CPP/TTSApp/textserv.h new file mode 100644 index 00000000..fc945847 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/textserv.h @@ -0,0 +1,420 @@ +/* @doc EXTERNAL + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * @module TEXTSRV.H Text Service Interface | + * + * Define interfaces between the Text Services component and the host + * + * Original Author: + * Christian Fortini + * + * History: + * 8/1/95 ricksa Revised interface definition + */ + +#ifndef _TEXTSERV_H +#define _TEXTSERV_H + +#if _MSC_VER > 1000 +#pragma once +#endif + +EXTERN_C const IID IID_ITextServices; +EXTERN_C const IID IID_ITextHost; + +// Note: error code is first outside of range reserved for OLE. +#define S_MSG_KEY_IGNORED \ + MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0x201) + +// Enums used by property methods + +/* + * TXTBACKSTYLE + * + * @enum Defines different background styles control + */ +enum TXTBACKSTYLE { + TXTBACK_TRANSPARENT = 0, //@emem background should show through + TXTBACK_OPAQUE, //@emem erase background +}; + + +/* + * TXTHITRESULT + * + * @enum Defines different hitresults + */ +enum TXTHITRESULT { + TXTHITRESULT_NOHIT = 0, //@emem no hit + TXTHITRESULT_TRANSPARENT = 1, //@emem point is within the text's rectangle, but + //in a transparent region + TXTHITRESULT_CLOSE = 2, //@emem point is close to the text + TXTHITRESULT_HIT = 3 //@emem dead-on hit +}; + +/* + * TXTNATURALSIZE + * + * @enum useful values for TxGetNaturalSize. + * + * @xref + */ +enum TXTNATURALSIZE { + TXTNS_FITTOCONTENT = 1, //@emem Get a size that fits the content + TXTNS_ROUNDTOLINE = 2 //@emem Round to the nearest whole line. +}; + +/* + * TXTVIEW + * + * @enum useful values for TxDraw lViewId parameter + * + * @xref + */ +enum TXTVIEW { + TXTVIEW_ACTIVE = 0, + TXTVIEW_INACTIVE = -1 +}; + + +/* + * CHANGETYPE + * + * @enum used for CHANGENOTIFY.dwChangeType; indicates what happened + * for a particular change. + */ +enum CHANGETYPE +{ + CN_GENERIC = 0, //@emem Nothing special happened + CN_TEXTCHANGED = 1, //@emem the text changed + CN_NEWUNDO = 2, //@emem A new undo action was added + CN_NEWREDO = 4 //@emem A new redo action was added +}; + +/* + * @struct CHANGENOTIFY | + * + * passed during an EN_CHANGE notification; contains information about + * what actually happened for a change. + */ +struct CHANGENOTIFY { + DWORD dwChangeType; //@field TEXT changed, etc + void * pvCookieData; //@field cookie for the undo action + // associated with the change. +}; + +// The TxGetPropertyBits and OnTxPropertyBitsChange methods can pass the following bits: + +// NB!!! Do NOT rely on the ordering of these bits yet; the are subject +// to change. +#define TXTBIT_RICHTEXT 1 // rich-text control +#define TXTBIT_MULTILINE 2 // single vs multi-line control +#define TXTBIT_READONLY 4 // read only text +#define TXTBIT_SHOWACCELERATOR 8 // underline accelerator character +#define TXTBIT_USEPASSWORD 0x10 // use password char to display text +#define TXTBIT_HIDESELECTION 0x20 // show selection when inactive +#define TXTBIT_SAVESELECTION 0x40 // remember selection when inactive +#define TXTBIT_AUTOWORDSEL 0x80 // auto-word selection +#define TXTBIT_VERTICAL 0x100 // vertical +#define TXTBIT_SELBARCHANGE 0x200 // notification that the selection bar width + // has changed. + // FUTURE: move this bit to the end to + // maintain the division between + // properties and notifications. +#define TXTBIT_WORDWRAP 0x400 // if set, then multi-line controls + // should wrap words to fit the available + // display +#define TXTBIT_ALLOWBEEP 0x800 // enable/disable beeping +#define TXTBIT_DISABLEDRAG 0x1000 // disable/enable dragging +#define TXTBIT_VIEWINSETCHANGE 0x2000 // the inset changed +#define TXTBIT_BACKSTYLECHANGE 0x4000 +#define TXTBIT_MAXLENGTHCHANGE 0x8000 +#define TXTBIT_SCROLLBARCHANGE 0x10000 +#define TXTBIT_CHARFORMATCHANGE 0x20000 +#define TXTBIT_PARAFORMATCHANGE 0x40000 +#define TXTBIT_EXTENTCHANGE 0x80000 +#define TXTBIT_CLIENTRECTCHANGE 0x100000 // the client rectangle changed +#define TXTBIT_USECURRENTBKG 0x200000 // tells the renderer to use the current background + // color rather than the system default for an entire line + + +/* + * ITextServices + * + * @class An interface extending Microsoft's Text Object Model to provide + * extra functionality for windowless operation. In conjunction + * with ITextHost, ITextServices provides the means by which the + * the RichEdit control can be used *without* creating a window. + * + * @base public | IUnknown + */ +class ITextServices : public IUnknown +{ +public: + + //@cmember Generic Send Message interface + virtual HRESULT TxSendMessage( + UINT msg, + WPARAM wparam, + LPARAM lparam, + LRESULT *plresult) = 0; + + //@cmember Rendering + virtual HRESULT TxDraw( + DWORD dwDrawAspect, + LONG lindex, + void * pvAspect, + DVTARGETDEVICE * ptd, + HDC hdcDraw, + HDC hicTargetDev, + LPCRECTL lprcBounds, + LPCRECTL lprcWBounds, + LPRECT lprcUpdate, + BOOL (CALLBACK * pfnContinue) (DWORD), + DWORD dwContinue, + LONG lViewId) = 0; + + //@cmember Horizontal scrollbar support + virtual HRESULT TxGetHScroll( + LONG *plMin, + LONG *plMax, + LONG *plPos, + LONG *plPage, + BOOL * pfEnabled ) = 0; + + //@cmember Horizontal scrollbar support + virtual HRESULT TxGetVScroll( + LONG *plMin, + LONG *plMax, + LONG *plPos, + LONG *plPage, + BOOL * pfEnabled ) = 0; + + //@cmember Setcursor + virtual HRESULT OnTxSetCursor( + DWORD dwDrawAspect, + LONG lindex, + void * pvAspect, + DVTARGETDEVICE * ptd, + HDC hdcDraw, + HDC hicTargetDev, + LPCRECT lprcClient, + INT x, + INT y) = 0; + + //@cmember Hit-test + virtual HRESULT TxQueryHitPoint( + DWORD dwDrawAspect, + LONG lindex, + void * pvAspect, + DVTARGETDEVICE * ptd, + HDC hdcDraw, + HDC hicTargetDev, + LPCRECT lprcClient, + INT x, + INT y, + DWORD * pHitResult) = 0; + + //@cmember Inplace activate notification + virtual HRESULT OnTxInPlaceActivate(LPCRECT prcClient) = 0; + + //@cmember Inplace deactivate notification + virtual HRESULT OnTxInPlaceDeactivate() = 0; + + //@cmember UI activate notification + virtual HRESULT OnTxUIActivate() = 0; + + //@cmember UI deactivate notification + virtual HRESULT OnTxUIDeactivate() = 0; + + //@cmember Get text in control + virtual HRESULT TxGetText(BSTR *pbstrText) = 0; + + //@cmember Set text in control + virtual HRESULT TxSetText(LPCWSTR pszText) = 0; + + //@cmember Get x position of + virtual HRESULT TxGetCurTargetX(LONG *) = 0; + //@cmember Get baseline position + virtual HRESULT TxGetBaseLinePos(LONG *) = 0; + + //@cmember Get Size to fit / Natural size + virtual HRESULT TxGetNaturalSize( + DWORD dwAspect, + HDC hdcDraw, + HDC hicTargetDev, + DVTARGETDEVICE *ptd, + DWORD dwMode, + const SIZEL *psizelExtent, + LONG *pwidth, + LONG *pheight) = 0; + + //@cmember Drag & drop + virtual HRESULT TxGetDropTarget( IDropTarget **ppDropTarget ) = 0; + + //@cmember Bulk bit property change notifications + virtual HRESULT OnTxPropertyBitsChange(DWORD dwMask, DWORD dwBits) = 0; + + //@cmember Fetch the cached drawing size + virtual HRESULT TxGetCachedSize(DWORD *pdwWidth, DWORD *pdwHeight)=0; +}; + + +/* + * ITextHost + * + * @class Interface to be used by text services to obtain text host services + * + * @base public | IUnknown + */ +class ITextHost : public IUnknown +{ +public: + + //@cmember Get the DC for the host + virtual HDC TxGetDC() = 0; + + //@cmember Release the DC gotten from the host + virtual INT TxReleaseDC(HDC hdc) = 0; + + //@cmember Show the scroll bar + virtual BOOL TxShowScrollBar(INT fnBar, BOOL fShow) = 0; + + //@cmember Enable the scroll bar + virtual BOOL TxEnableScrollBar (INT fuSBFlags, INT fuArrowflags) = 0; + + //@cmember Set the scroll range + virtual BOOL TxSetScrollRange( + INT fnBar, + LONG nMinPos, + INT nMaxPos, + BOOL fRedraw) = 0; + + //@cmember Set the scroll position + virtual BOOL TxSetScrollPos (INT fnBar, INT nPos, BOOL fRedraw) = 0; + + //@cmember InvalidateRect + virtual void TxInvalidateRect(LPCRECT prc, BOOL fMode) = 0; + + //@cmember Send a WM_PAINT to the window + virtual void TxViewChange(BOOL fUpdate) = 0; + + //@cmember Create the caret + virtual BOOL TxCreateCaret(HBITMAP hbmp, INT xWidth, INT yHeight) = 0; + + //@cmember Show the caret + virtual BOOL TxShowCaret(BOOL fShow) = 0; + + //@cmember Set the caret position + virtual BOOL TxSetCaretPos(INT x, INT y) = 0; + + //@cmember Create a timer with the specified timeout + virtual BOOL TxSetTimer(UINT idTimer, UINT uTimeout) = 0; + + //@cmember Destroy a timer + virtual void TxKillTimer(UINT idTimer) = 0; + + //@cmember Scroll the content of the specified window's client area + virtual void TxScrollWindowEx ( + INT dx, + INT dy, + LPCRECT lprcScroll, + LPCRECT lprcClip, + HRGN hrgnUpdate, + LPRECT lprcUpdate, + UINT fuScroll) = 0; + + //@cmember Get mouse capture + virtual void TxSetCapture(BOOL fCapture) = 0; + + //@cmember Set the focus to the text window + virtual void TxSetFocus() = 0; + + //@cmember Establish a new cursor shape + virtual void TxSetCursor(HCURSOR hcur, BOOL fText) = 0; + + //@cmember Converts screen coordinates of a specified point to the client coordinates + virtual BOOL TxScreenToClient (LPPOINT lppt) = 0; + + //@cmember Converts the client coordinates of a specified point to screen coordinates + virtual BOOL TxClientToScreen (LPPOINT lppt) = 0; + + //@cmember Request host to activate text services + virtual HRESULT TxActivate( LONG * plOldState ) = 0; + + //@cmember Request host to deactivate text services + virtual HRESULT TxDeactivate( LONG lNewState ) = 0; + + //@cmember Retrieves the coordinates of a window's client area + virtual HRESULT TxGetClientRect(LPRECT prc) = 0; + + //@cmember Get the view rectangle relative to the inset + virtual HRESULT TxGetViewInset(LPRECT prc) = 0; + + //@cmember Get the default character format for the text + virtual HRESULT TxGetCharFormat(const CHARFORMATW **ppCF ) = 0; + + //@cmember Get the default paragraph format for the text + virtual HRESULT TxGetParaFormat(const PARAFORMAT **ppPF) = 0; + + //@cmember Get the background color for the window + virtual COLORREF TxGetSysColor(int nIndex) = 0; + + //@cmember Get the background (either opaque or transparent) + virtual HRESULT TxGetBackStyle(TXTBACKSTYLE *pstyle) = 0; + + //@cmember Get the maximum length for the text + virtual HRESULT TxGetMaxLength(DWORD *plength) = 0; + + //@cmember Get the bits representing requested scroll bars for the window + virtual HRESULT TxGetScrollBars(DWORD *pdwScrollBar) = 0; + + //@cmember Get the character to display for password input + virtual HRESULT TxGetPasswordChar(TCHAR *pch) = 0; + + //@cmember Get the accelerator character + virtual HRESULT TxGetAcceleratorPos(LONG *pcp) = 0; + + //@cmember Get the native size + virtual HRESULT TxGetExtent(LPSIZEL lpExtent) = 0; + + //@cmember Notify host that default character format has changed + virtual HRESULT OnTxCharFormatChange (const CHARFORMATW * pcf) = 0; + + //@cmember Notify host that default paragraph format has changed + virtual HRESULT OnTxParaFormatChange (const PARAFORMAT * ppf) = 0; + + //@cmember Bulk access to bit properties + virtual HRESULT TxGetPropertyBits(DWORD dwMask, DWORD *pdwBits) = 0; + + //@cmember Notify host of events + virtual HRESULT TxNotify(DWORD iNotify, void *pv) = 0; + + // Far East Methods for getting the Input Context +//#ifdef WIN95_IME + virtual HIMC TxImmGetContext() = 0; + virtual void TxImmReleaseContext( HIMC himc ) = 0; +//#endif + + //@cmember Returns HIMETRIC size of the control bar. + virtual HRESULT TxGetSelectionBarWidth (LONG *lSelBarWidth) = 0; + +}; + +//+----------------------------------------------------------------------- +// Factories +//------------------------------------------------------------------------ + +// Text Services factory +STDAPI CreateTextServices( + IUnknown *punkOuter, + ITextHost *pITextHost, + IUnknown **ppUnk); + +typedef HRESULT (STDAPICALLTYPE * PCreateTextServices)( + IUnknown *punkOuter, + ITextHost *pITextHost, + IUnknown **ppUnk); + +#endif // _TEXTSERV_H diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/tom.h b/mp/src/utils/sapi51/Samples/CPP/TTSApp/tom.h new file mode 100644 index 00000000..bd43fb22 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/tom.h @@ -0,0 +1,6612 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 3.01.75 */ +/* at Thu May 07 14:12:12 1998 + */ +/* Compiler settings for tom.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: none +*/ +//@@MIDL_FILE_HEADING( ) +#include "rpc.h" +#include "rpcndr.h" +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __tomtmp_h__ +#define __tomtmp_h__ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __ITextDocument_FWD_DEFINED__ +#define __ITextDocument_FWD_DEFINED__ +typedef interface ITextDocument ITextDocument; +#endif /* __ITextDocument_FWD_DEFINED__ */ + + +#ifndef __ITextRange_FWD_DEFINED__ +#define __ITextRange_FWD_DEFINED__ +typedef interface ITextRange ITextRange; +#endif /* __ITextRange_FWD_DEFINED__ */ + + +#ifndef __ITextSelection_FWD_DEFINED__ +#define __ITextSelection_FWD_DEFINED__ +typedef interface ITextSelection ITextSelection; +#endif /* __ITextSelection_FWD_DEFINED__ */ + + +#ifndef __ITextFont_FWD_DEFINED__ +#define __ITextFont_FWD_DEFINED__ +typedef interface ITextFont ITextFont; +#endif /* __ITextFont_FWD_DEFINED__ */ + + +#ifndef __ITextPara_FWD_DEFINED__ +#define __ITextPara_FWD_DEFINED__ +typedef interface ITextPara ITextPara; +#endif /* __ITextPara_FWD_DEFINED__ */ + + +#ifndef __ITextStoryRanges_FWD_DEFINED__ +#define __ITextStoryRanges_FWD_DEFINED__ +typedef interface ITextStoryRanges ITextStoryRanges; +#endif /* __ITextStoryRanges_FWD_DEFINED__ */ + + +#ifndef __ITextDocument2_FWD_DEFINED__ +#define __ITextDocument2_FWD_DEFINED__ +typedef interface ITextDocument2 ITextDocument2; +#endif /* __ITextDocument2_FWD_DEFINED__ */ + + +#ifndef __ITextMsgFilter_FWD_DEFINED__ +#define __ITextMsgFilter_FWD_DEFINED__ +typedef interface ITextMsgFilter ITextMsgFilter; +#endif /* __ITextMsgFilter_FWD_DEFINED__ */ + + +#ifndef __ITextDocument_FWD_DEFINED__ +#define __ITextDocument_FWD_DEFINED__ +typedef interface ITextDocument ITextDocument; +#endif /* __ITextDocument_FWD_DEFINED__ */ + + +#ifndef __ITextRange_FWD_DEFINED__ +#define __ITextRange_FWD_DEFINED__ +typedef interface ITextRange ITextRange; +#endif /* __ITextRange_FWD_DEFINED__ */ + + +#ifndef __ITextSelection_FWD_DEFINED__ +#define __ITextSelection_FWD_DEFINED__ +typedef interface ITextSelection ITextSelection; +#endif /* __ITextSelection_FWD_DEFINED__ */ + + +#ifndef __ITextFont_FWD_DEFINED__ +#define __ITextFont_FWD_DEFINED__ +typedef interface ITextFont ITextFont; +#endif /* __ITextFont_FWD_DEFINED__ */ + + +#ifndef __ITextPara_FWD_DEFINED__ +#define __ITextPara_FWD_DEFINED__ +typedef interface ITextPara ITextPara; +#endif /* __ITextPara_FWD_DEFINED__ */ + + +#ifndef __ITextStoryRanges_FWD_DEFINED__ +#define __ITextStoryRanges_FWD_DEFINED__ +typedef interface ITextStoryRanges ITextStoryRanges; +#endif /* __ITextStoryRanges_FWD_DEFINED__ */ + + +#ifndef __ITextDocument2_FWD_DEFINED__ +#define __ITextDocument2_FWD_DEFINED__ +typedef interface ITextDocument2 ITextDocument2; +#endif /* __ITextDocument2_FWD_DEFINED__ */ + + +#ifndef __ITextMsgFilter_FWD_DEFINED__ +#define __ITextMsgFilter_FWD_DEFINED__ +typedef interface ITextMsgFilter ITextMsgFilter; +#endif /* __ITextMsgFilter_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +/**************************************** + * Generated header for interface: __MIDL_itf_tom_0000 + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [local] */ + + + + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_tom_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_tom_0000_v0_0_s_ifspec; + + +#ifndef __tom_LIBRARY_DEFINED__ +#define __tom_LIBRARY_DEFINED__ + +/**************************************** + * Generated header for library: tom + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [version][uuid] */ + + +typedef /* [public] */ +enum __MIDL___MIDL_itf_tom_0000_0001 + { tomFalse = 0, + tomTrue = -1, + tomUndefined = -9999999, + tomToggle = -9999998, + tomAutoColor = -9999997, + tomDefault = -9999996, + tomSuspend = -9999995, + tomResume = -9999994, + tomApplyNow = 0, + tomApplyLater = 1, + tomTrackParms = 2, + tomCacheParms = 3, + tomBackward = 0xc0000001, + tomForward = 0x3fffffff, + tomMove = 0, + tomExtend = 1, + tomNoSelection = 0, + tomSelectionIP = 1, + tomSelectionNormal = 2, + tomSelectionFrame = 3, + tomSelectionColumn = 4, + tomSelectionRow = 5, + tomSelectionBlock = 6, + tomSelectionInlineShape = 7, + tomSelectionShape = 8, + tomSelStartActive = 1, + tomSelAtEOL = 2, + tomSelOvertype = 4, + tomSelActive = 8, + tomSelReplace = 16, + tomEnd = 0, + tomStart = 32, + tomCollapseEnd = 0, + tomCollapseStart = 1, + tomClientCoord = 256, + tomNone = 0, + tomSingle = 1, + tomWords = 2, + tomDouble = 3, + tomDotted = 4, + tomDash = 5, + tomDashDot = 6, + tomDashDotDot = 7, + tomWave = 8, + tomThick = 9, + tomHair = 10, + tomLineSpaceSingle = 0, + tomLineSpace1pt5 = 1, + tomLineSpaceDouble = 2, + tomLineSpaceAtLeast = 3, + tomLineSpaceExactly = 4, + tomLineSpaceMultiple = 5, + tomAlignLeft = 0, + tomAlignCenter = 1, + tomAlignRight = 2, + tomAlignJustify = 3, + tomAlignDecimal = 3, + tomAlignBar = 4, + tomAlignInterWord = 3, + tomAlignInterLetter = 4, + tomAlignScaled = 5, + tomAlignGlyphs = 6, + tomAlignSnapGrid = 7, + tomSpaces = 0, + tomDots = 1, + tomDashes = 2, + tomLines = 3, + tomThickLines = 4, + tomEquals = 5, + tomTabBack = -3, + tomTabNext = -2, + tomTabHere = -1, + tomListNone = 0, + tomListBullet = 1, + tomListNumberAsArabic = 2, + tomListNumberAsLCLetter = 3, + tomListNumberAsUCLetter = 4, + tomListNumberAsLCRoman = 5, + tomListNumberAsUCRoman = 6, + tomListNumberAsSequence = 7, + tomListParentheses = 0x10000, + tomListPeriod = 0x20000, + tomListPlain = 0x30000, + tomCharacter = 1, + tomWord = 2, + tomSentence = 3, + tomParagraph = 4, + tomLine = 5, + tomStory = 6, + tomScreen = 7, + tomSection = 8, + tomColumn = 9, + tomRow = 10, + tomWindow = 11, + tomCell = 12, + tomCharFormat = 13, + tomParaFormat = 14, + tomTable = 15, + tomObject = 16, + tomMatchWord = 2, + tomMatchCase = 4, + tomMatchPattern = 8, + tomUnknownStory = 0, + tomMainTextStory = 1, + tomFootnotesStory = 2, + tomEndnotesStory = 3, + tomCommentsStory = 4, + tomTextFrameStory = 5, + tomEvenPagesHeaderStory = 6, + tomPrimaryHeaderStory = 7, + tomEvenPagesFooterStory = 8, + tomPrimaryFooterStory = 9, + tomFirstPageHeaderStory = 10, + tomFirstPageFooterStory = 11, + tomNoAnimation = 0, + tomLasVegasLights = 1, + tomBlinkingBackground = 2, + tomSparkleText = 3, + tomMarchingBlackAnts = 4, + tomMarchingRedAnts = 5, + tomShimmer = 6, + tomWipeDown = 7, + tomWipeRight = 8, + tomAnimationMax = 8, + tomLowerCase = 0, + tomUpperCase = 1, + tomTitleCase = 2, + tomSentenceCase = 4, + tomToggleCase = 5, + tomReadOnly = 0x100, + tomShareDenyRead = 0x200, + tomShareDenyWrite = 0x400, + tomPasteFile = 0x1000, + tomCreateNew = 0x10, + tomCreateAlways = 0x20, + tomOpenExisting = 0x30, + tomOpenAlways = 0x40, + tomTruncateExisting = 0x50, + tomRTF = 0x1, + tomText = 0x2, + tomHTML = 0x3, + tomWordDocument = 0x4, + tomBold = 0x80000001, + tomItalic = 0x80000002, + tomUnderline = 0x80000004, + tomStrikeout = 0x80000008, + tomProtected = 0x80000010, + tomLink = 0x80000020, + tomSmallCaps = 0x80000040, + tomAllCaps = 0x80000080, + tomHidden = 0x80000100, + tomOutline = 0x80000200, + tomShadow = 0x80000400, + tomEmboss = 0x80000800, + tomImprint = 0x80001000, + tomDisabled = 0x80002000, + tomRevised = 0x80004000, + tomNormalCaret = 0, + tomKoreanBlockCaret = 0x1, + tomIncludeInset = 0x1, + tomIgnoreCurrentFont = 0, + tomMatchFontCharset = 0x1, + tomMatchFontSignature = 0x2, + tomCharset = 0x80000000 + } tomConstants; + + + + + + + + + + +EXTERN_C const IID LIBID_tom; + +#ifndef __ITextDocument_INTERFACE_DEFINED__ +#define __ITextDocument_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextDocument + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextDocument; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C0-A1DF-11ce-8098-00AA0047BE5D") + ITextDocument : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetName( + /* [retval][out] */ BSTR __RPC_FAR *pName) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSelection( + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryRanges( + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSaved( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSaved( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDefaultTabStop( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDefaultTabStop( + /* [in] */ float Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE New( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Open( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Save( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Freeze( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Unfreeze( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE BeginEditCollection( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndEditCollection( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Undo( + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Redo( + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Range( + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE RangeFromPoint( + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextDocumentVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextDocument __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextDocument __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextDocument __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextDocument __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextDocument __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextDocument __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextDocument __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelection )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryCount )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryRanges )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSaved )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSaved )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDefaultTabStop )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultTabStop )( + ITextDocument __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *New )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Unfreeze )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEditCollection )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndEditCollection )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Undo )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Redo )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Range )( + ITextDocument __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RangeFromPoint )( + ITextDocument __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + END_INTERFACE + } ITextDocumentVtbl; + + interface ITextDocument + { + CONST_VTBL struct ITextDocumentVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextDocument_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextDocument_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextDocument_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextDocument_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextDocument_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextDocument_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextDocument_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextDocument_GetName(This,pName) \ + (This)->lpVtbl -> GetName(This,pName) + +#define ITextDocument_GetSelection(This,ppSel) \ + (This)->lpVtbl -> GetSelection(This,ppSel) + +#define ITextDocument_GetStoryCount(This,pCount) \ + (This)->lpVtbl -> GetStoryCount(This,pCount) + +#define ITextDocument_GetStoryRanges(This,ppStories) \ + (This)->lpVtbl -> GetStoryRanges(This,ppStories) + +#define ITextDocument_GetSaved(This,pValue) \ + (This)->lpVtbl -> GetSaved(This,pValue) + +#define ITextDocument_SetSaved(This,Value) \ + (This)->lpVtbl -> SetSaved(This,Value) + +#define ITextDocument_GetDefaultTabStop(This,pValue) \ + (This)->lpVtbl -> GetDefaultTabStop(This,pValue) + +#define ITextDocument_SetDefaultTabStop(This,Value) \ + (This)->lpVtbl -> SetDefaultTabStop(This,Value) + +#define ITextDocument_New(This) \ + (This)->lpVtbl -> New(This) + +#define ITextDocument_Open(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Open(This,pVar,Flags,CodePage) + +#define ITextDocument_Save(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Save(This,pVar,Flags,CodePage) + +#define ITextDocument_Freeze(This,pCount) \ + (This)->lpVtbl -> Freeze(This,pCount) + +#define ITextDocument_Unfreeze(This,pCount) \ + (This)->lpVtbl -> Unfreeze(This,pCount) + +#define ITextDocument_BeginEditCollection(This) \ + (This)->lpVtbl -> BeginEditCollection(This) + +#define ITextDocument_EndEditCollection(This) \ + (This)->lpVtbl -> EndEditCollection(This) + +#define ITextDocument_Undo(This,Count,prop) \ + (This)->lpVtbl -> Undo(This,Count,prop) + +#define ITextDocument_Redo(This,Count,prop) \ + (This)->lpVtbl -> Redo(This,Count,prop) + +#define ITextDocument_Range(This,cp1,cp2,ppRange) \ + (This)->lpVtbl -> Range(This,cp1,cp2,ppRange) + +#define ITextDocument_RangeFromPoint(This,x,y,ppRange) \ + (This)->lpVtbl -> RangeFromPoint(This,x,y,ppRange) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetName_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + +void __RPC_STUB ITextDocument_GetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetSelection_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + +void __RPC_STUB ITextDocument_GetSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetStoryCount_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_GetStoryCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetStoryRanges_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + +void __RPC_STUB ITextDocument_GetStoryRanges_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetSaved_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextDocument_GetSaved_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_SetSaved_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextDocument_SetSaved_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetDefaultTabStop_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextDocument_GetDefaultTabStop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_SetDefaultTabStop_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextDocument_SetDefaultTabStop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_New_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_New_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Open_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + +void __RPC_STUB ITextDocument_Open_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Save_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + +void __RPC_STUB ITextDocument_Save_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Freeze_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_Freeze_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Unfreeze_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_Unfreeze_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_BeginEditCollection_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_BeginEditCollection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_EndEditCollection_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_EndEditCollection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Undo_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + +void __RPC_STUB ITextDocument_Undo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Redo_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + +void __RPC_STUB ITextDocument_Redo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Range_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextDocument_Range_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_RangeFromPoint_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextDocument_RangeFromPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextDocument_INTERFACE_DEFINED__ */ + + +#ifndef __ITextRange_INTERFACE_DEFINED__ +#define __ITextRange_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextRange + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextRange; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C2-A1DF-11ce-8098-00AA0047BE5D") + ITextRange : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetText( + /* [retval][out] */ BSTR __RPC_FAR *pbstr) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetText( + /* [in] */ BSTR bstr) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetChar( + /* [retval][out] */ long __RPC_FAR *pch) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetChar( + /* [in] */ long ch) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFormattedText( + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFormattedText( + /* [in] */ ITextRange __RPC_FAR *pRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStart( + /* [retval][out] */ long __RPC_FAR *pcpFirst) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStart( + /* [in] */ long cpFirst) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEnd( + /* [retval][out] */ long __RPC_FAR *pcpLim) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEnd( + /* [in] */ long cpLim) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFont( + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFont( + /* [in] */ ITextFont __RPC_FAR *pFont) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPara( + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPara( + /* [in] */ ITextPara __RPC_FAR *pPara) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryLength( + /* [retval][out] */ long __RPC_FAR *pcch) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryType( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Collapse( + /* [in] */ long bStart) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Expand( + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetIndex( + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetIndex( + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetRange( + /* [in] */ long cpActive, + /* [in] */ long cpOther) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE InRange( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE InStory( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Select( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE StartOf( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndOf( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Move( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStart( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEnd( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStartWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEndWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStartUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEndUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindText( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindTextStart( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindTextEnd( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Delete( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Cut( + /* [out] */ VARIANT __RPC_FAR *pVar) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Copy( + /* [out] */ VARIANT __RPC_FAR *pVar) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Paste( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanPaste( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanEdit( + /* [retval][out] */ long __RPC_FAR *pbCanEdit) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ChangeCase( + /* [in] */ long Type) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetPoint( + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetPoint( + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ScrollIntoView( + /* [in] */ long Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEmbeddedObject( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextRangeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextRange __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextRange __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextRange __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextRange __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextRange __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextRange __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextRange __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetText )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetText )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetChar )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetChar )( + ITextRange __RPC_FAR * This, + /* [in] */ long ch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFormattedText )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFormattedText )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStart )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStart )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpFirst); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnd )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpLim); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFont )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFont )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPara )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPara )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryLength )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryType )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Collapse )( + ITextRange __RPC_FAR * This, + /* [in] */ long bStart); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Expand )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIndex )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndex )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRange )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InRange )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InStory )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Select )( + ITextRange __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartOf )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndOf )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStart )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindText )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextStart )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Cut )( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Copy )( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Paste )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanPaste )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanEdit )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChangeCase )( + ITextRange __RPC_FAR * This, + /* [in] */ long Type); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPoint )( + ITextRange __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPoint )( + ITextRange __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ScrollIntoView )( + ITextRange __RPC_FAR * This, + /* [in] */ long Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmbeddedObject )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + END_INTERFACE + } ITextRangeVtbl; + + interface ITextRange + { + CONST_VTBL struct ITextRangeVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextRange_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextRange_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextRange_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextRange_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextRange_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextRange_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextRange_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextRange_GetText(This,pbstr) \ + (This)->lpVtbl -> GetText(This,pbstr) + +#define ITextRange_SetText(This,bstr) \ + (This)->lpVtbl -> SetText(This,bstr) + +#define ITextRange_GetChar(This,pch) \ + (This)->lpVtbl -> GetChar(This,pch) + +#define ITextRange_SetChar(This,ch) \ + (This)->lpVtbl -> SetChar(This,ch) + +#define ITextRange_GetDuplicate(This,ppRange) \ + (This)->lpVtbl -> GetDuplicate(This,ppRange) + +#define ITextRange_GetFormattedText(This,ppRange) \ + (This)->lpVtbl -> GetFormattedText(This,ppRange) + +#define ITextRange_SetFormattedText(This,pRange) \ + (This)->lpVtbl -> SetFormattedText(This,pRange) + +#define ITextRange_GetStart(This,pcpFirst) \ + (This)->lpVtbl -> GetStart(This,pcpFirst) + +#define ITextRange_SetStart(This,cpFirst) \ + (This)->lpVtbl -> SetStart(This,cpFirst) + +#define ITextRange_GetEnd(This,pcpLim) \ + (This)->lpVtbl -> GetEnd(This,pcpLim) + +#define ITextRange_SetEnd(This,cpLim) \ + (This)->lpVtbl -> SetEnd(This,cpLim) + +#define ITextRange_GetFont(This,pFont) \ + (This)->lpVtbl -> GetFont(This,pFont) + +#define ITextRange_SetFont(This,pFont) \ + (This)->lpVtbl -> SetFont(This,pFont) + +#define ITextRange_GetPara(This,pPara) \ + (This)->lpVtbl -> GetPara(This,pPara) + +#define ITextRange_SetPara(This,pPara) \ + (This)->lpVtbl -> SetPara(This,pPara) + +#define ITextRange_GetStoryLength(This,pcch) \ + (This)->lpVtbl -> GetStoryLength(This,pcch) + +#define ITextRange_GetStoryType(This,pValue) \ + (This)->lpVtbl -> GetStoryType(This,pValue) + +#define ITextRange_Collapse(This,bStart) \ + (This)->lpVtbl -> Collapse(This,bStart) + +#define ITextRange_Expand(This,Unit,pDelta) \ + (This)->lpVtbl -> Expand(This,Unit,pDelta) + +#define ITextRange_GetIndex(This,Unit,pIndex) \ + (This)->lpVtbl -> GetIndex(This,Unit,pIndex) + +#define ITextRange_SetIndex(This,Unit,Index,Extend) \ + (This)->lpVtbl -> SetIndex(This,Unit,Index,Extend) + +#define ITextRange_SetRange(This,cpActive,cpOther) \ + (This)->lpVtbl -> SetRange(This,cpActive,cpOther) + +#define ITextRange_InRange(This,pRange,pb) \ + (This)->lpVtbl -> InRange(This,pRange,pb) + +#define ITextRange_InStory(This,pRange,pb) \ + (This)->lpVtbl -> InStory(This,pRange,pb) + +#define ITextRange_IsEqual(This,pRange,pb) \ + (This)->lpVtbl -> IsEqual(This,pRange,pb) + +#define ITextRange_Select(This) \ + (This)->lpVtbl -> Select(This) + +#define ITextRange_StartOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> StartOf(This,Unit,Extend,pDelta) + +#define ITextRange_EndOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndOf(This,Unit,Extend,pDelta) + +#define ITextRange_Move(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Move(This,Unit,Count,pDelta) + +#define ITextRange_MoveStart(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveStart(This,Unit,Count,pDelta) + +#define ITextRange_MoveEnd(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveEnd(This,Unit,Count,pDelta) + +#define ITextRange_MoveWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveStartWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveEndWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveUntil(This,Cset,Count,pDelta) + +#define ITextRange_MoveStartUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartUntil(This,Cset,Count,pDelta) + +#define ITextRange_MoveEndUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndUntil(This,Cset,Count,pDelta) + +#define ITextRange_FindText(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindText(This,bstr,cch,Flags,pLength) + +#define ITextRange_FindTextStart(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextStart(This,bstr,cch,Flags,pLength) + +#define ITextRange_FindTextEnd(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextEnd(This,bstr,cch,Flags,pLength) + +#define ITextRange_Delete(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Delete(This,Unit,Count,pDelta) + +#define ITextRange_Cut(This,pVar) \ + (This)->lpVtbl -> Cut(This,pVar) + +#define ITextRange_Copy(This,pVar) \ + (This)->lpVtbl -> Copy(This,pVar) + +#define ITextRange_Paste(This,pVar,Format) \ + (This)->lpVtbl -> Paste(This,pVar,Format) + +#define ITextRange_CanPaste(This,pVar,Format,pb) \ + (This)->lpVtbl -> CanPaste(This,pVar,Format,pb) + +#define ITextRange_CanEdit(This,pbCanEdit) \ + (This)->lpVtbl -> CanEdit(This,pbCanEdit) + +#define ITextRange_ChangeCase(This,Type) \ + (This)->lpVtbl -> ChangeCase(This,Type) + +#define ITextRange_GetPoint(This,Type,px,py) \ + (This)->lpVtbl -> GetPoint(This,Type,px,py) + +#define ITextRange_SetPoint(This,x,y,Type,Extend) \ + (This)->lpVtbl -> SetPoint(This,x,y,Type,Extend) + +#define ITextRange_ScrollIntoView(This,Value) \ + (This)->lpVtbl -> ScrollIntoView(This,Value) + +#define ITextRange_GetEmbeddedObject(This,ppv) \ + (This)->lpVtbl -> GetEmbeddedObject(This,ppv) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetText_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + +void __RPC_STUB ITextRange_GetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextRange_SetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetChar_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + +void __RPC_STUB ITextRange_GetChar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetChar_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long ch); + + +void __RPC_STUB ITextRange_SetChar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetDuplicate_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextRange_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetFormattedText_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextRange_GetFormattedText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetFormattedText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + +void __RPC_STUB ITextRange_SetFormattedText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStart_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + +void __RPC_STUB ITextRange_GetStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpFirst); + + +void __RPC_STUB ITextRange_SetStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + +void __RPC_STUB ITextRange_GetEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpLim); + + +void __RPC_STUB ITextRange_SetEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetFont_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + +void __RPC_STUB ITextRange_GetFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetFont_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + +void __RPC_STUB ITextRange_SetFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetPara_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + +void __RPC_STUB ITextRange_GetPara_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetPara_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + +void __RPC_STUB ITextRange_SetPara_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStoryLength_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + +void __RPC_STUB ITextRange_GetStoryLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStoryType_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextRange_GetStoryType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Collapse_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long bStart); + + +void __RPC_STUB ITextRange_Collapse_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Expand_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Expand_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetIndex_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + +void __RPC_STUB ITextRange_GetIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetIndex_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + +void __RPC_STUB ITextRange_SetIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetRange_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + +void __RPC_STUB ITextRange_SetRange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_InRange_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_InRange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_InStory_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_InStory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_IsEqual_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Select_Proxy( + ITextRange __RPC_FAR * This); + + +void __RPC_STUB ITextRange_Select_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_StartOf_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_StartOf_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_EndOf_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_EndOf_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Move_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Move_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStartWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStartWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEndWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEndWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStartUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStartUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEndUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEndUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindTextStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindTextStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindTextEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindTextEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Delete_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Delete_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Cut_Proxy( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + +void __RPC_STUB ITextRange_Cut_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Copy_Proxy( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + +void __RPC_STUB ITextRange_Copy_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Paste_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + +void __RPC_STUB ITextRange_Paste_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_CanPaste_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_CanPaste_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_CanEdit_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + +void __RPC_STUB ITextRange_CanEdit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_ChangeCase_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Type); + + +void __RPC_STUB ITextRange_ChangeCase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetPoint_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + +void __RPC_STUB ITextRange_GetPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetPoint_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + +void __RPC_STUB ITextRange_SetPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_ScrollIntoView_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextRange_ScrollIntoView_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetEmbeddedObject_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + +void __RPC_STUB ITextRange_GetEmbeddedObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextRange_INTERFACE_DEFINED__ */ + + +#ifndef __ITextSelection_INTERFACE_DEFINED__ +#define __ITextSelection_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextSelection + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextSelection; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C1-A1DF-11ce-8098-00AA0047BE5D") + ITextSelection : public ITextRange + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFlags( + /* [retval][out] */ long __RPC_FAR *pFlags) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFlags( + /* [in] */ LONG Flags) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetType( + /* [retval][out] */ long __RPC_FAR *pType) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveLeft( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveRight( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveUp( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveDown( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE HomeKey( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndKey( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE TypeText( + /* [in] */ BSTR bstr) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextSelectionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextSelection __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextSelection __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextSelection __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextSelection __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextSelection __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextSelection __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextSelection __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetText )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetChar )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetChar )( + ITextSelection __RPC_FAR * This, + /* [in] */ long ch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFormattedText )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFormattedText )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStart )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpFirst); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnd )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpLim); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFont )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFont )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPara )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPara )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryLength )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryType )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Collapse )( + ITextSelection __RPC_FAR * This, + /* [in] */ long bStart); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Expand )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIndex )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndex )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRange )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InRange )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InStory )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Select )( + ITextSelection __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartOf )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndOf )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Cut )( + ITextSelection __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Copy )( + ITextSelection __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Paste )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanPaste )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanEdit )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChangeCase )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Type); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPoint )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPoint )( + ITextSelection __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ScrollIntoView )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmbeddedObject )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFlags )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pFlags); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFlags )( + ITextSelection __RPC_FAR * This, + /* [in] */ LONG Flags); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetType )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pType); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveLeft )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveRight )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUp )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveDown )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HomeKey )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndKey )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *TypeText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + END_INTERFACE + } ITextSelectionVtbl; + + interface ITextSelection + { + CONST_VTBL struct ITextSelectionVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextSelection_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextSelection_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextSelection_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextSelection_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextSelection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextSelection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextSelection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextSelection_GetText(This,pbstr) \ + (This)->lpVtbl -> GetText(This,pbstr) + +#define ITextSelection_SetText(This,bstr) \ + (This)->lpVtbl -> SetText(This,bstr) + +#define ITextSelection_GetChar(This,pch) \ + (This)->lpVtbl -> GetChar(This,pch) + +#define ITextSelection_SetChar(This,ch) \ + (This)->lpVtbl -> SetChar(This,ch) + +#define ITextSelection_GetDuplicate(This,ppRange) \ + (This)->lpVtbl -> GetDuplicate(This,ppRange) + +#define ITextSelection_GetFormattedText(This,ppRange) \ + (This)->lpVtbl -> GetFormattedText(This,ppRange) + +#define ITextSelection_SetFormattedText(This,pRange) \ + (This)->lpVtbl -> SetFormattedText(This,pRange) + +#define ITextSelection_GetStart(This,pcpFirst) \ + (This)->lpVtbl -> GetStart(This,pcpFirst) + +#define ITextSelection_SetStart(This,cpFirst) \ + (This)->lpVtbl -> SetStart(This,cpFirst) + +#define ITextSelection_GetEnd(This,pcpLim) \ + (This)->lpVtbl -> GetEnd(This,pcpLim) + +#define ITextSelection_SetEnd(This,cpLim) \ + (This)->lpVtbl -> SetEnd(This,cpLim) + +#define ITextSelection_GetFont(This,pFont) \ + (This)->lpVtbl -> GetFont(This,pFont) + +#define ITextSelection_SetFont(This,pFont) \ + (This)->lpVtbl -> SetFont(This,pFont) + +#define ITextSelection_GetPara(This,pPara) \ + (This)->lpVtbl -> GetPara(This,pPara) + +#define ITextSelection_SetPara(This,pPara) \ + (This)->lpVtbl -> SetPara(This,pPara) + +#define ITextSelection_GetStoryLength(This,pcch) \ + (This)->lpVtbl -> GetStoryLength(This,pcch) + +#define ITextSelection_GetStoryType(This,pValue) \ + (This)->lpVtbl -> GetStoryType(This,pValue) + +#define ITextSelection_Collapse(This,bStart) \ + (This)->lpVtbl -> Collapse(This,bStart) + +#define ITextSelection_Expand(This,Unit,pDelta) \ + (This)->lpVtbl -> Expand(This,Unit,pDelta) + +#define ITextSelection_GetIndex(This,Unit,pIndex) \ + (This)->lpVtbl -> GetIndex(This,Unit,pIndex) + +#define ITextSelection_SetIndex(This,Unit,Index,Extend) \ + (This)->lpVtbl -> SetIndex(This,Unit,Index,Extend) + +#define ITextSelection_SetRange(This,cpActive,cpOther) \ + (This)->lpVtbl -> SetRange(This,cpActive,cpOther) + +#define ITextSelection_InRange(This,pRange,pb) \ + (This)->lpVtbl -> InRange(This,pRange,pb) + +#define ITextSelection_InStory(This,pRange,pb) \ + (This)->lpVtbl -> InStory(This,pRange,pb) + +#define ITextSelection_IsEqual(This,pRange,pb) \ + (This)->lpVtbl -> IsEqual(This,pRange,pb) + +#define ITextSelection_Select(This) \ + (This)->lpVtbl -> Select(This) + +#define ITextSelection_StartOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> StartOf(This,Unit,Extend,pDelta) + +#define ITextSelection_EndOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndOf(This,Unit,Extend,pDelta) + +#define ITextSelection_Move(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Move(This,Unit,Count,pDelta) + +#define ITextSelection_MoveStart(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveStart(This,Unit,Count,pDelta) + +#define ITextSelection_MoveEnd(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveEnd(This,Unit,Count,pDelta) + +#define ITextSelection_MoveWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveStartWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveEndWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveUntil(This,Cset,Count,pDelta) + +#define ITextSelection_MoveStartUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartUntil(This,Cset,Count,pDelta) + +#define ITextSelection_MoveEndUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndUntil(This,Cset,Count,pDelta) + +#define ITextSelection_FindText(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindText(This,bstr,cch,Flags,pLength) + +#define ITextSelection_FindTextStart(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextStart(This,bstr,cch,Flags,pLength) + +#define ITextSelection_FindTextEnd(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextEnd(This,bstr,cch,Flags,pLength) + +#define ITextSelection_Delete(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Delete(This,Unit,Count,pDelta) + +#define ITextSelection_Cut(This,pVar) \ + (This)->lpVtbl -> Cut(This,pVar) + +#define ITextSelection_Copy(This,pVar) \ + (This)->lpVtbl -> Copy(This,pVar) + +#define ITextSelection_Paste(This,pVar,Format) \ + (This)->lpVtbl -> Paste(This,pVar,Format) + +#define ITextSelection_CanPaste(This,pVar,Format,pb) \ + (This)->lpVtbl -> CanPaste(This,pVar,Format,pb) + +#define ITextSelection_CanEdit(This,pbCanEdit) \ + (This)->lpVtbl -> CanEdit(This,pbCanEdit) + +#define ITextSelection_ChangeCase(This,Type) \ + (This)->lpVtbl -> ChangeCase(This,Type) + +#define ITextSelection_GetPoint(This,Type,px,py) \ + (This)->lpVtbl -> GetPoint(This,Type,px,py) + +#define ITextSelection_SetPoint(This,x,y,Type,Extend) \ + (This)->lpVtbl -> SetPoint(This,x,y,Type,Extend) + +#define ITextSelection_ScrollIntoView(This,Value) \ + (This)->lpVtbl -> ScrollIntoView(This,Value) + +#define ITextSelection_GetEmbeddedObject(This,ppv) \ + (This)->lpVtbl -> GetEmbeddedObject(This,ppv) + + +#define ITextSelection_GetFlags(This,pFlags) \ + (This)->lpVtbl -> GetFlags(This,pFlags) + +#define ITextSelection_SetFlags(This,Flags) \ + (This)->lpVtbl -> SetFlags(This,Flags) + +#define ITextSelection_GetType(This,pType) \ + (This)->lpVtbl -> GetType(This,pType) + +#define ITextSelection_MoveLeft(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveLeft(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveRight(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveRight(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveUp(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveUp(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveDown(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveDown(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_HomeKey(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> HomeKey(This,Unit,Extend,pDelta) + +#define ITextSelection_EndKey(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndKey(This,Unit,Extend,pDelta) + +#define ITextSelection_TypeText(This,bstr) \ + (This)->lpVtbl -> TypeText(This,bstr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_GetFlags_Proxy( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pFlags); + + +void __RPC_STUB ITextSelection_GetFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_SetFlags_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ LONG Flags); + + +void __RPC_STUB ITextSelection_SetFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_GetType_Proxy( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pType); + + +void __RPC_STUB ITextSelection_GetType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveLeft_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveLeft_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveRight_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveRight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveUp_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveUp_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveDown_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveDown_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_HomeKey_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_HomeKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_EndKey_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_EndKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_TypeText_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextSelection_TypeText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextSelection_INTERFACE_DEFINED__ */ + + +#ifndef __ITextFont_INTERFACE_DEFINED__ +#define __ITextFont_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextFont + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextFont; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C3-A1DF-11ce-8098-00AA0047BE5D") + ITextFont : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDuplicate( + /* [in] */ ITextFont __RPC_FAR *pFont) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanChange( + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStyle( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStyle( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAllCaps( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAllCaps( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAnimation( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAnimation( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetBackColor( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetBackColor( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetBold( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetBold( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEmboss( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEmboss( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetForeColor( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetForeColor( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetHidden( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetHidden( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEngrave( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEngrave( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetItalic( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetItalic( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKerning( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKerning( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLanguageID( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetLanguageID( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetName( + /* [retval][out] */ BSTR __RPC_FAR *pbstr) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetName( + /* [in] */ BSTR bstr) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetOutline( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetOutline( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPosition( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPosition( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetProtected( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetProtected( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetShadow( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetShadow( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSize( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSize( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSmallCaps( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSmallCaps( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpacing( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpacing( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStrikeThrough( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStrikeThrough( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSubscript( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSubscript( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSuperscript( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSuperscript( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetUnderline( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetUnderline( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetWeight( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetWeight( + /* [in] */ long Value) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextFontVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextFont __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextFont __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextFont __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextFont __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextFont __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextFont __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextFont __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDuplicate )( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanChange )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStyle )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStyle )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAllCaps )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAllCaps )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAnimation )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAnimation )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBackColor )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetBackColor )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBold )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetBold )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmboss )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEmboss )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetForeColor )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetForeColor )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHidden )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetHidden )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEngrave )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEngrave )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetItalic )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetItalic )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKerning )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKerning )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLanguageID )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetLanguageID )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetName )( + ITextFont __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetOutline )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetOutline )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPosition )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPosition )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProtected )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetProtected )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetShadow )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetShadow )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSize )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSize )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSmallCaps )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSmallCaps )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpacing )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpacing )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStrikeThrough )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStrikeThrough )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSubscript )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSubscript )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSuperscript )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSuperscript )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetUnderline )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetUnderline )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWeight )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWeight )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + END_INTERFACE + } ITextFontVtbl; + + interface ITextFont + { + CONST_VTBL struct ITextFontVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextFont_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextFont_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextFont_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextFont_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextFont_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextFont_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextFont_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextFont_GetDuplicate(This,ppFont) \ + (This)->lpVtbl -> GetDuplicate(This,ppFont) + +#define ITextFont_SetDuplicate(This,pFont) \ + (This)->lpVtbl -> SetDuplicate(This,pFont) + +#define ITextFont_CanChange(This,pB) \ + (This)->lpVtbl -> CanChange(This,pB) + +#define ITextFont_IsEqual(This,pFont,pB) \ + (This)->lpVtbl -> IsEqual(This,pFont,pB) + +#define ITextFont_Reset(This,Value) \ + (This)->lpVtbl -> Reset(This,Value) + +#define ITextFont_GetStyle(This,pValue) \ + (This)->lpVtbl -> GetStyle(This,pValue) + +#define ITextFont_SetStyle(This,Value) \ + (This)->lpVtbl -> SetStyle(This,Value) + +#define ITextFont_GetAllCaps(This,pValue) \ + (This)->lpVtbl -> GetAllCaps(This,pValue) + +#define ITextFont_SetAllCaps(This,Value) \ + (This)->lpVtbl -> SetAllCaps(This,Value) + +#define ITextFont_GetAnimation(This,pValue) \ + (This)->lpVtbl -> GetAnimation(This,pValue) + +#define ITextFont_SetAnimation(This,Value) \ + (This)->lpVtbl -> SetAnimation(This,Value) + +#define ITextFont_GetBackColor(This,pValue) \ + (This)->lpVtbl -> GetBackColor(This,pValue) + +#define ITextFont_SetBackColor(This,Value) \ + (This)->lpVtbl -> SetBackColor(This,Value) + +#define ITextFont_GetBold(This,pValue) \ + (This)->lpVtbl -> GetBold(This,pValue) + +#define ITextFont_SetBold(This,Value) \ + (This)->lpVtbl -> SetBold(This,Value) + +#define ITextFont_GetEmboss(This,pValue) \ + (This)->lpVtbl -> GetEmboss(This,pValue) + +#define ITextFont_SetEmboss(This,Value) \ + (This)->lpVtbl -> SetEmboss(This,Value) + +#define ITextFont_GetForeColor(This,pValue) \ + (This)->lpVtbl -> GetForeColor(This,pValue) + +#define ITextFont_SetForeColor(This,Value) \ + (This)->lpVtbl -> SetForeColor(This,Value) + +#define ITextFont_GetHidden(This,pValue) \ + (This)->lpVtbl -> GetHidden(This,pValue) + +#define ITextFont_SetHidden(This,Value) \ + (This)->lpVtbl -> SetHidden(This,Value) + +#define ITextFont_GetEngrave(This,pValue) \ + (This)->lpVtbl -> GetEngrave(This,pValue) + +#define ITextFont_SetEngrave(This,Value) \ + (This)->lpVtbl -> SetEngrave(This,Value) + +#define ITextFont_GetItalic(This,pValue) \ + (This)->lpVtbl -> GetItalic(This,pValue) + +#define ITextFont_SetItalic(This,Value) \ + (This)->lpVtbl -> SetItalic(This,Value) + +#define ITextFont_GetKerning(This,pValue) \ + (This)->lpVtbl -> GetKerning(This,pValue) + +#define ITextFont_SetKerning(This,Value) \ + (This)->lpVtbl -> SetKerning(This,Value) + +#define ITextFont_GetLanguageID(This,pValue) \ + (This)->lpVtbl -> GetLanguageID(This,pValue) + +#define ITextFont_SetLanguageID(This,Value) \ + (This)->lpVtbl -> SetLanguageID(This,Value) + +#define ITextFont_GetName(This,pbstr) \ + (This)->lpVtbl -> GetName(This,pbstr) + +#define ITextFont_SetName(This,bstr) \ + (This)->lpVtbl -> SetName(This,bstr) + +#define ITextFont_GetOutline(This,pValue) \ + (This)->lpVtbl -> GetOutline(This,pValue) + +#define ITextFont_SetOutline(This,Value) \ + (This)->lpVtbl -> SetOutline(This,Value) + +#define ITextFont_GetPosition(This,pValue) \ + (This)->lpVtbl -> GetPosition(This,pValue) + +#define ITextFont_SetPosition(This,Value) \ + (This)->lpVtbl -> SetPosition(This,Value) + +#define ITextFont_GetProtected(This,pValue) \ + (This)->lpVtbl -> GetProtected(This,pValue) + +#define ITextFont_SetProtected(This,Value) \ + (This)->lpVtbl -> SetProtected(This,Value) + +#define ITextFont_GetShadow(This,pValue) \ + (This)->lpVtbl -> GetShadow(This,pValue) + +#define ITextFont_SetShadow(This,Value) \ + (This)->lpVtbl -> SetShadow(This,Value) + +#define ITextFont_GetSize(This,pValue) \ + (This)->lpVtbl -> GetSize(This,pValue) + +#define ITextFont_SetSize(This,Value) \ + (This)->lpVtbl -> SetSize(This,Value) + +#define ITextFont_GetSmallCaps(This,pValue) \ + (This)->lpVtbl -> GetSmallCaps(This,pValue) + +#define ITextFont_SetSmallCaps(This,Value) \ + (This)->lpVtbl -> SetSmallCaps(This,Value) + +#define ITextFont_GetSpacing(This,pValue) \ + (This)->lpVtbl -> GetSpacing(This,pValue) + +#define ITextFont_SetSpacing(This,Value) \ + (This)->lpVtbl -> SetSpacing(This,Value) + +#define ITextFont_GetStrikeThrough(This,pValue) \ + (This)->lpVtbl -> GetStrikeThrough(This,pValue) + +#define ITextFont_SetStrikeThrough(This,Value) \ + (This)->lpVtbl -> SetStrikeThrough(This,Value) + +#define ITextFont_GetSubscript(This,pValue) \ + (This)->lpVtbl -> GetSubscript(This,pValue) + +#define ITextFont_SetSubscript(This,Value) \ + (This)->lpVtbl -> SetSubscript(This,Value) + +#define ITextFont_GetSuperscript(This,pValue) \ + (This)->lpVtbl -> GetSuperscript(This,pValue) + +#define ITextFont_SetSuperscript(This,Value) \ + (This)->lpVtbl -> SetSuperscript(This,Value) + +#define ITextFont_GetUnderline(This,pValue) \ + (This)->lpVtbl -> GetUnderline(This,pValue) + +#define ITextFont_SetUnderline(This,Value) \ + (This)->lpVtbl -> SetUnderline(This,Value) + +#define ITextFont_GetWeight(This,pValue) \ + (This)->lpVtbl -> GetWeight(This,pValue) + +#define ITextFont_SetWeight(This,Value) \ + (This)->lpVtbl -> SetWeight(This,Value) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetDuplicate_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont); + + +void __RPC_STUB ITextFont_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetDuplicate_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + +void __RPC_STUB ITextFont_SetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_CanChange_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextFont_CanChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_IsEqual_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextFont_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_Reset_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetStyle_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetStyle_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetAllCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetAllCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetAllCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetAllCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetAnimation_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetAnimation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetAnimation_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetAnimation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetBackColor_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetBackColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetBackColor_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetBackColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetBold_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetBold_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetBold_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetBold_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetEmboss_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetEmboss_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetEmboss_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetEmboss_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetForeColor_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetForeColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetForeColor_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetForeColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetHidden_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetHidden_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetHidden_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetHidden_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetEngrave_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetEngrave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetEngrave_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetEngrave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetItalic_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetItalic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetItalic_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetItalic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetKerning_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetKerning_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetKerning_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetKerning_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetLanguageID_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetLanguageID_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetLanguageID_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetLanguageID_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetName_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + +void __RPC_STUB ITextFont_GetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetName_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextFont_SetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetOutline_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetOutline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetOutline_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetOutline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetPosition_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetPosition_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetProtected_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetProtected_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetProtected_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetProtected_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetShadow_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetShadow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetShadow_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetShadow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSize_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSize_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSmallCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSmallCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSmallCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSmallCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSpacing_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSpacing_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetStrikeThrough_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetStrikeThrough_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetStrikeThrough_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetStrikeThrough_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSubscript_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSubscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSubscript_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSubscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSuperscript_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSuperscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSuperscript_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSuperscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetUnderline_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetUnderline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetUnderline_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetUnderline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetWeight_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetWeight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetWeight_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetWeight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextFont_INTERFACE_DEFINED__ */ + + +#ifndef __ITextPara_INTERFACE_DEFINED__ +#define __ITextPara_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextPara + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextPara; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C4-A1DF-11ce-8098-00AA0047BE5D") + ITextPara : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDuplicate( + /* [in] */ ITextPara __RPC_FAR *pPara) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanChange( + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStyle( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStyle( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAlignment( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAlignment( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetHyphenation( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetHyphenation( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFirstLineIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKeepTogether( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKeepTogether( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKeepWithNext( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKeepWithNext( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLeftIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLineSpacing( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLineSpacingRule( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListAlignment( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListAlignment( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListLevelIndex( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListLevelIndex( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListStart( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListStart( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListTab( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListTab( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListType( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListType( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetNoLineNumber( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetNoLineNumber( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPageBreakBefore( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPageBreakBefore( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetRightIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetRightIndent( + /* [in] */ float Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetIndents( + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetLineSpacing( + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpaceAfter( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpaceAfter( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpaceBefore( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpaceBefore( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetWidowControl( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetWidowControl( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetTabCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddTab( + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ClearAllTabs( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE DeleteTab( + /* [in] */ float tbPos) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetTab( + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextParaVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextPara __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextPara __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextPara __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextPara __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextPara __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextPara __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextPara __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDuplicate )( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanChange )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStyle )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStyle )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAlignment )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAlignment )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHyphenation )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetHyphenation )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFirstLineIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKeepTogether )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKeepTogether )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKeepWithNext )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKeepWithNext )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLeftIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineSpacing )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineSpacingRule )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListAlignment )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListAlignment )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListLevelIndex )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListLevelIndex )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListStart )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListStart )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListTab )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListType )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListType )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNoLineNumber )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNoLineNumber )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPageBreakBefore )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPageBreakBefore )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRightIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRightIndent )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndents )( + ITextPara __RPC_FAR * This, + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetLineSpacing )( + ITextPara __RPC_FAR * This, + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpaceAfter )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpaceAfter )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpaceBefore )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpaceBefore )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWidowControl )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWidowControl )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTabCount )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ClearAllTabs )( + ITextPara __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DeleteTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTab )( + ITextPara __RPC_FAR * This, + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader); + + END_INTERFACE + } ITextParaVtbl; + + interface ITextPara + { + CONST_VTBL struct ITextParaVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextPara_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextPara_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextPara_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextPara_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextPara_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextPara_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextPara_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextPara_GetDuplicate(This,ppPara) \ + (This)->lpVtbl -> GetDuplicate(This,ppPara) + +#define ITextPara_SetDuplicate(This,pPara) \ + (This)->lpVtbl -> SetDuplicate(This,pPara) + +#define ITextPara_CanChange(This,pB) \ + (This)->lpVtbl -> CanChange(This,pB) + +#define ITextPara_IsEqual(This,pPara,pB) \ + (This)->lpVtbl -> IsEqual(This,pPara,pB) + +#define ITextPara_Reset(This,Value) \ + (This)->lpVtbl -> Reset(This,Value) + +#define ITextPara_GetStyle(This,pValue) \ + (This)->lpVtbl -> GetStyle(This,pValue) + +#define ITextPara_SetStyle(This,Value) \ + (This)->lpVtbl -> SetStyle(This,Value) + +#define ITextPara_GetAlignment(This,pValue) \ + (This)->lpVtbl -> GetAlignment(This,pValue) + +#define ITextPara_SetAlignment(This,Value) \ + (This)->lpVtbl -> SetAlignment(This,Value) + +#define ITextPara_GetHyphenation(This,pValue) \ + (This)->lpVtbl -> GetHyphenation(This,pValue) + +#define ITextPara_SetHyphenation(This,Value) \ + (This)->lpVtbl -> SetHyphenation(This,Value) + +#define ITextPara_GetFirstLineIndent(This,pValue) \ + (This)->lpVtbl -> GetFirstLineIndent(This,pValue) + +#define ITextPara_GetKeepTogether(This,pValue) \ + (This)->lpVtbl -> GetKeepTogether(This,pValue) + +#define ITextPara_SetKeepTogether(This,Value) \ + (This)->lpVtbl -> SetKeepTogether(This,Value) + +#define ITextPara_GetKeepWithNext(This,pValue) \ + (This)->lpVtbl -> GetKeepWithNext(This,pValue) + +#define ITextPara_SetKeepWithNext(This,Value) \ + (This)->lpVtbl -> SetKeepWithNext(This,Value) + +#define ITextPara_GetLeftIndent(This,pValue) \ + (This)->lpVtbl -> GetLeftIndent(This,pValue) + +#define ITextPara_GetLineSpacing(This,pValue) \ + (This)->lpVtbl -> GetLineSpacing(This,pValue) + +#define ITextPara_GetLineSpacingRule(This,pValue) \ + (This)->lpVtbl -> GetLineSpacingRule(This,pValue) + +#define ITextPara_GetListAlignment(This,pValue) \ + (This)->lpVtbl -> GetListAlignment(This,pValue) + +#define ITextPara_SetListAlignment(This,Value) \ + (This)->lpVtbl -> SetListAlignment(This,Value) + +#define ITextPara_GetListLevelIndex(This,pValue) \ + (This)->lpVtbl -> GetListLevelIndex(This,pValue) + +#define ITextPara_SetListLevelIndex(This,Value) \ + (This)->lpVtbl -> SetListLevelIndex(This,Value) + +#define ITextPara_GetListStart(This,pValue) \ + (This)->lpVtbl -> GetListStart(This,pValue) + +#define ITextPara_SetListStart(This,Value) \ + (This)->lpVtbl -> SetListStart(This,Value) + +#define ITextPara_GetListTab(This,pValue) \ + (This)->lpVtbl -> GetListTab(This,pValue) + +#define ITextPara_SetListTab(This,Value) \ + (This)->lpVtbl -> SetListTab(This,Value) + +#define ITextPara_GetListType(This,pValue) \ + (This)->lpVtbl -> GetListType(This,pValue) + +#define ITextPara_SetListType(This,Value) \ + (This)->lpVtbl -> SetListType(This,Value) + +#define ITextPara_GetNoLineNumber(This,pValue) \ + (This)->lpVtbl -> GetNoLineNumber(This,pValue) + +#define ITextPara_SetNoLineNumber(This,Value) \ + (This)->lpVtbl -> SetNoLineNumber(This,Value) + +#define ITextPara_GetPageBreakBefore(This,pValue) \ + (This)->lpVtbl -> GetPageBreakBefore(This,pValue) + +#define ITextPara_SetPageBreakBefore(This,Value) \ + (This)->lpVtbl -> SetPageBreakBefore(This,Value) + +#define ITextPara_GetRightIndent(This,pValue) \ + (This)->lpVtbl -> GetRightIndent(This,pValue) + +#define ITextPara_SetRightIndent(This,Value) \ + (This)->lpVtbl -> SetRightIndent(This,Value) + +#define ITextPara_SetIndents(This,StartIndent,LeftIndent,RightIndent) \ + (This)->lpVtbl -> SetIndents(This,StartIndent,LeftIndent,RightIndent) + +#define ITextPara_SetLineSpacing(This,LineSpacingRule,LineSpacing) \ + (This)->lpVtbl -> SetLineSpacing(This,LineSpacingRule,LineSpacing) + +#define ITextPara_GetSpaceAfter(This,pValue) \ + (This)->lpVtbl -> GetSpaceAfter(This,pValue) + +#define ITextPara_SetSpaceAfter(This,Value) \ + (This)->lpVtbl -> SetSpaceAfter(This,Value) + +#define ITextPara_GetSpaceBefore(This,pValue) \ + (This)->lpVtbl -> GetSpaceBefore(This,pValue) + +#define ITextPara_SetSpaceBefore(This,Value) \ + (This)->lpVtbl -> SetSpaceBefore(This,Value) + +#define ITextPara_GetWidowControl(This,pValue) \ + (This)->lpVtbl -> GetWidowControl(This,pValue) + +#define ITextPara_SetWidowControl(This,Value) \ + (This)->lpVtbl -> SetWidowControl(This,Value) + +#define ITextPara_GetTabCount(This,pCount) \ + (This)->lpVtbl -> GetTabCount(This,pCount) + +#define ITextPara_AddTab(This,tbPos,tbAlign,tbLeader) \ + (This)->lpVtbl -> AddTab(This,tbPos,tbAlign,tbLeader) + +#define ITextPara_ClearAllTabs(This) \ + (This)->lpVtbl -> ClearAllTabs(This) + +#define ITextPara_DeleteTab(This,tbPos) \ + (This)->lpVtbl -> DeleteTab(This,tbPos) + +#define ITextPara_GetTab(This,iTab,ptbPos,ptbAlign,ptbLeader) \ + (This)->lpVtbl -> GetTab(This,iTab,ptbPos,ptbAlign,ptbLeader) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetDuplicate_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara); + + +void __RPC_STUB ITextPara_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetDuplicate_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + +void __RPC_STUB ITextPara_SetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_CanChange_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextPara_CanChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_IsEqual_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextPara_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_Reset_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetStyle_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetStyle_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetHyphenation_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetHyphenation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetHyphenation_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetHyphenation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetFirstLineIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetFirstLineIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetKeepTogether_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetKeepTogether_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetKeepTogether_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetKeepTogether_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetKeepWithNext_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetKeepWithNext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetKeepWithNext_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetKeepWithNext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLeftIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLeftIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLineSpacing_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLineSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLineSpacingRule_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLineSpacingRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListLevelIndex_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListLevelIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListLevelIndex_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListLevelIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListStart_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListStart_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListTab_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetListTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListType_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListType_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetNoLineNumber_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetNoLineNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetNoLineNumber_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetNoLineNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetPageBreakBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetPageBreakBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetPageBreakBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetPageBreakBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetRightIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetRightIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetRightIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetRightIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetIndents_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent); + + +void __RPC_STUB ITextPara_SetIndents_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetLineSpacing_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing); + + +void __RPC_STUB ITextPara_SetLineSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetSpaceAfter_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetSpaceAfter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetSpaceAfter_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetSpaceAfter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetSpaceBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetSpaceBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetSpaceBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetSpaceBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetWidowControl_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetWidowControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetWidowControl_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetWidowControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetTabCount_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextPara_GetTabCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_AddTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader); + + +void __RPC_STUB ITextPara_AddTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_ClearAllTabs_Proxy( + ITextPara __RPC_FAR * This); + + +void __RPC_STUB ITextPara_ClearAllTabs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_DeleteTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos); + + +void __RPC_STUB ITextPara_DeleteTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader); + + +void __RPC_STUB ITextPara_GetTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextPara_INTERFACE_DEFINED__ */ + + +#ifndef __ITextStoryRanges_INTERFACE_DEFINED__ +#define __ITextStoryRanges_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextStoryRanges + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextStoryRanges; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C5-A1DF-11ce-8098-00AA0047BE5D") + ITextStoryRanges : public IDispatch + { + public: + virtual /* [restricted][id] */ HRESULT STDMETHODCALLTYPE _NewEnum( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextStoryRangesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextStoryRanges __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextStoryRanges __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextStoryRanges __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [restricted][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *_NewEnum )( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Item )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCount )( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + END_INTERFACE + } ITextStoryRangesVtbl; + + interface ITextStoryRanges + { + CONST_VTBL struct ITextStoryRangesVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextStoryRanges_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextStoryRanges_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextStoryRanges_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextStoryRanges_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextStoryRanges_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextStoryRanges_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextStoryRanges_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextStoryRanges__NewEnum(This,ppunkEnum) \ + (This)->lpVtbl -> _NewEnum(This,ppunkEnum) + +#define ITextStoryRanges_Item(This,Index,ppRange) \ + (This)->lpVtbl -> Item(This,Index,ppRange) + +#define ITextStoryRanges_GetCount(This,pCount) \ + (This)->lpVtbl -> GetCount(This,pCount) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [restricted][id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges__NewEnum_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum); + + +void __RPC_STUB ITextStoryRanges__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges_Item_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextStoryRanges_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges_GetCount_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextStoryRanges_GetCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextStoryRanges_INTERFACE_DEFINED__ */ + + +#ifndef __ITextDocument2_INTERFACE_DEFINED__ +#define __ITextDocument2_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextDocument2 + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextDocument2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("01c25500-4268-11d1-883a-3c8b00c10000") + ITextDocument2 : public ITextDocument + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachMsgFilter( + /* [in] */ IUnknown __RPC_FAR *pFilter) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetEffectColor( + /* [in] */ long Index, + /* [in] */ COLORREF cr) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetEffectColor( + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetCaretType( + /* [retval][out] */ long __RPC_FAR *pCaretType) = 0; + + virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE SetCaretType( + /* [in] */ long CaretType) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetImmContext( + /* [retval][out] */ long __RPC_FAR *pContext) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ReleaseImmContext( + /* [in] */ long Context) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPreferredFont( + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetNotificationMode( + /* [retval][out] */ long __RPC_FAR *pMode) = 0; + + virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE SetNotificationMode( + /* [in] */ long Mode) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetClientRect( + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetSelectionEx( + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetWindow( + /* [out] */ long __RPC_FAR *phWnd) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetFEFlags( + /* [out] */ long __RPC_FAR *pFlags) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UpdateWindow( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CheckTextLimit( + long cch, + long __RPC_FAR *pcch) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IMEInProgress( + long Mode) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextDocument2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextDocument2 __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextDocument2 __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelection )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryCount )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryRanges )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSaved )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSaved )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDefaultTabStop )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultTabStop )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *New )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Unfreeze )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEditCollection )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndEditCollection )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Undo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Redo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Range )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RangeFromPoint )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachMsgFilter )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pFilter); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEffectColor )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [in] */ COLORREF cr); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEffectColor )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCaretType )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCaretType); + + /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetCaretType )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long CaretType); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetImmContext )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pContext); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ReleaseImmContext )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Context); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPreferredFont )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNotificationMode )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pMode); + + /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNotificationMode )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Mode); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetClientRect )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelectionEx )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWindow )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *phWnd); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFEFlags )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *pFlags); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UpdateWindow )( + ITextDocument2 __RPC_FAR * This); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CheckTextLimit )( + ITextDocument2 __RPC_FAR * This, + long cch, + long __RPC_FAR *pcch); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IMEInProgress )( + ITextDocument2 __RPC_FAR * This, + long Mode); + + END_INTERFACE + } ITextDocument2Vtbl; + + interface ITextDocument2 + { + CONST_VTBL struct ITextDocument2Vtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextDocument2_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextDocument2_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextDocument2_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextDocument2_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextDocument2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextDocument2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextDocument2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextDocument2_GetName(This,pName) \ + (This)->lpVtbl -> GetName(This,pName) + +#define ITextDocument2_GetSelection(This,ppSel) \ + (This)->lpVtbl -> GetSelection(This,ppSel) + +#define ITextDocument2_GetStoryCount(This,pCount) \ + (This)->lpVtbl -> GetStoryCount(This,pCount) + +#define ITextDocument2_GetStoryRanges(This,ppStories) \ + (This)->lpVtbl -> GetStoryRanges(This,ppStories) + +#define ITextDocument2_GetSaved(This,pValue) \ + (This)->lpVtbl -> GetSaved(This,pValue) + +#define ITextDocument2_SetSaved(This,Value) \ + (This)->lpVtbl -> SetSaved(This,Value) + +#define ITextDocument2_GetDefaultTabStop(This,pValue) \ + (This)->lpVtbl -> GetDefaultTabStop(This,pValue) + +#define ITextDocument2_SetDefaultTabStop(This,Value) \ + (This)->lpVtbl -> SetDefaultTabStop(This,Value) + +#define ITextDocument2_New(This) \ + (This)->lpVtbl -> New(This) + +#define ITextDocument2_Open(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Open(This,pVar,Flags,CodePage) + +#define ITextDocument2_Save(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Save(This,pVar,Flags,CodePage) + +#define ITextDocument2_Freeze(This,pCount) \ + (This)->lpVtbl -> Freeze(This,pCount) + +#define ITextDocument2_Unfreeze(This,pCount) \ + (This)->lpVtbl -> Unfreeze(This,pCount) + +#define ITextDocument2_BeginEditCollection(This) \ + (This)->lpVtbl -> BeginEditCollection(This) + +#define ITextDocument2_EndEditCollection(This) \ + (This)->lpVtbl -> EndEditCollection(This) + +#define ITextDocument2_Undo(This,Count,prop) \ + (This)->lpVtbl -> Undo(This,Count,prop) + +#define ITextDocument2_Redo(This,Count,prop) \ + (This)->lpVtbl -> Redo(This,Count,prop) + +#define ITextDocument2_Range(This,cp1,cp2,ppRange) \ + (This)->lpVtbl -> Range(This,cp1,cp2,ppRange) + +#define ITextDocument2_RangeFromPoint(This,x,y,ppRange) \ + (This)->lpVtbl -> RangeFromPoint(This,x,y,ppRange) + + +#define ITextDocument2_AttachMsgFilter(This,pFilter) \ + (This)->lpVtbl -> AttachMsgFilter(This,pFilter) + +#define ITextDocument2_SetEffectColor(This,Index,cr) \ + (This)->lpVtbl -> SetEffectColor(This,Index,cr) + +#define ITextDocument2_GetEffectColor(This,Index,pcr) \ + (This)->lpVtbl -> GetEffectColor(This,Index,pcr) + +#define ITextDocument2_GetCaretType(This,pCaretType) \ + (This)->lpVtbl -> GetCaretType(This,pCaretType) + +#define ITextDocument2_SetCaretType(This,CaretType) \ + (This)->lpVtbl -> SetCaretType(This,CaretType) + +#define ITextDocument2_GetImmContext(This,pContext) \ + (This)->lpVtbl -> GetImmContext(This,pContext) + +#define ITextDocument2_ReleaseImmContext(This,Context) \ + (This)->lpVtbl -> ReleaseImmContext(This,Context) + +#define ITextDocument2_GetPreferredFont(This,cp,CodePage,Option,pbstr,pPitchAndFamily) \ + (This)->lpVtbl -> GetPreferredFont(This,cp,CodePage,Option,pbstr,pPitchAndFamily) + +#define ITextDocument2_GetNotificationMode(This,pMode) \ + (This)->lpVtbl -> GetNotificationMode(This,pMode) + +#define ITextDocument2_SetNotificationMode(This,Mode) \ + (This)->lpVtbl -> SetNotificationMode(This,Mode) + +#define ITextDocument2_GetClientRect(This,Type,pLeft,pTop,pRight,pBottom) \ + (This)->lpVtbl -> GetClientRect(This,Type,pLeft,pTop,pRight,pBottom) + +#define ITextDocument2_GetSelectionEx(This,ppSel) \ + (This)->lpVtbl -> GetSelectionEx(This,ppSel) + +#define ITextDocument2_GetWindow(This,phWnd) \ + (This)->lpVtbl -> GetWindow(This,phWnd) + +#define ITextDocument2_GetFEFlags(This,pFlags) \ + (This)->lpVtbl -> GetFEFlags(This,pFlags) + +#define ITextDocument2_UpdateWindow(This) \ + (This)->lpVtbl -> UpdateWindow(This) + +#define ITextDocument2_CheckTextLimit(This,cch,pcch) \ + (This)->lpVtbl -> CheckTextLimit(This,cch,pcch) + +#define ITextDocument2_IMEInProgress(This,Mode) \ + (This)->lpVtbl -> IMEInProgress(This,Mode) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_AttachMsgFilter_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pFilter); + + +void __RPC_STUB ITextDocument2_AttachMsgFilter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetEffectColor_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [in] */ COLORREF cr); + + +void __RPC_STUB ITextDocument2_SetEffectColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetEffectColor_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr); + + +void __RPC_STUB ITextDocument2_GetEffectColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetCaretType_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCaretType); + + +void __RPC_STUB ITextDocument2_GetCaretType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetCaretType_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long CaretType); + + +void __RPC_STUB ITextDocument2_SetCaretType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetImmContext_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pContext); + + +void __RPC_STUB ITextDocument2_GetImmContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_ReleaseImmContext_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Context); + + +void __RPC_STUB ITextDocument2_ReleaseImmContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetPreferredFont_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily); + + +void __RPC_STUB ITextDocument2_GetPreferredFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetNotificationMode_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pMode); + + +void __RPC_STUB ITextDocument2_GetNotificationMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetNotificationMode_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Mode); + + +void __RPC_STUB ITextDocument2_SetNotificationMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetClientRect_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom); + + +void __RPC_STUB ITextDocument2_GetClientRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetSelectionEx_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + +void __RPC_STUB ITextDocument2_GetSelectionEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetWindow_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *phWnd); + + +void __RPC_STUB ITextDocument2_GetWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetFEFlags_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *pFlags); + + +void __RPC_STUB ITextDocument2_GetFEFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_UpdateWindow_Proxy( + ITextDocument2 __RPC_FAR * This); + + +void __RPC_STUB ITextDocument2_UpdateWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_CheckTextLimit_Proxy( + ITextDocument2 __RPC_FAR * This, + long cch, + long __RPC_FAR *pcch); + + +void __RPC_STUB ITextDocument2_CheckTextLimit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_IMEInProgress_Proxy( + ITextDocument2 __RPC_FAR * This, + long Mode); + + +void __RPC_STUB ITextDocument2_IMEInProgress_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextDocument2_INTERFACE_DEFINED__ */ + + +#ifndef __ITextMsgFilter_INTERFACE_DEFINED__ +#define __ITextMsgFilter_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextMsgFilter + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][version][uuid] */ + + + +EXTERN_C const IID IID_ITextMsgFilter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("a3787420-4267-11d1-883a-3c8b00c10000") + ITextMsgFilter : public IUnknown + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachDocument( + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE HandleMessage( + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachMsgFilter( + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextMsgFilterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextMsgFilter __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextMsgFilter __RPC_FAR * This); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachDocument )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HandleMessage )( + ITextMsgFilter __RPC_FAR * This, + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachMsgFilter )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter); + + END_INTERFACE + } ITextMsgFilterVtbl; + + interface ITextMsgFilter + { + CONST_VTBL struct ITextMsgFilterVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextMsgFilter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextMsgFilter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextMsgFilter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextMsgFilter_AttachDocument(This,hwnd,pTextDoc) \ + (This)->lpVtbl -> AttachDocument(This,hwnd,pTextDoc) + +#define ITextMsgFilter_HandleMessage(This,pmsg,pwparam,plparam,plres) \ + (This)->lpVtbl -> HandleMessage(This,pmsg,pwparam,plparam,plres) + +#define ITextMsgFilter_AttachMsgFilter(This,pMsgFilter) \ + (This)->lpVtbl -> AttachMsgFilter(This,pMsgFilter) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_AttachDocument_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc); + + +void __RPC_STUB ITextMsgFilter_AttachDocument_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_HandleMessage_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres); + + +void __RPC_STUB ITextMsgFilter_HandleMessage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_AttachMsgFilter_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter); + + +void __RPC_STUB ITextMsgFilter_AttachMsgFilter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextMsgFilter_INTERFACE_DEFINED__ */ + +#endif /* __tom_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * ); + +unsigned long __RPC_USER HWND_UserSize( unsigned long __RPC_FAR *, unsigned long , HWND __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER HWND_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, HWND __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER HWND_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, HWND __RPC_FAR * ); +void __RPC_USER HWND_UserFree( unsigned long __RPC_FAR *, HWND __RPC_FAR * ); + +unsigned long __RPC_USER VARIANT_UserSize( unsigned long __RPC_FAR *, unsigned long , VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +void __RPC_USER VARIANT_UserFree( unsigned long __RPC_FAR *, VARIANT __RPC_FAR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.dsp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.dsp new file mode 100644 index 00000000..021eac1b --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.dsp @@ -0,0 +1,194 @@ +# Microsoft Developer Studio Project File - Name="TTSApp" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=TTSApp - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ttsapp.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ttsapp.mak" CFG="TTSApp - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TTSApp - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "TTSApp - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TTSApp - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\..\..\sdk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\..\sdk\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\..\sdk\lib\i386" + +!ELSEIF "$(CFG)" == "TTSApp - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\..\sdk\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /FR /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\..\sdk\lib\i386" + +!ENDIF + +# Begin Target + +# Name "TTSApp - Win32 Release" +# Name "TTSApp - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\childwin.cpp +# End Source File +# Begin Source File + +SOURCE=.\dlgmain.cpp +# End Source File +# Begin Source File + +SOURCE=.\globals.cpp +# End Source File +# Begin Source File + +SOURCE=.\ttsapp.rc +# End Source File +# Begin Source File + +SOURCE=.\winmain.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\globals.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\ttsapp.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\appicon.ico +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 10.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 11.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 12.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 13.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 2.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 3.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 4.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 5.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 6.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 7.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 8.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 9.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth wide.bmp" +# End Source File +# Begin Source File + +SOURCE=.\res\mic.bmp +# End Source File +# End Group +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.h b/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.h new file mode 100644 index 00000000..4f89d26a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.h @@ -0,0 +1,107 @@ +#ifndef _INC_TTSAPP +#define _INC_TTSAPP + +#include // System includes +#include // ATL +#include +#include // Common controls +#include +#include // Required for rich edit control +#include +#include "tom.h" +#include "textserv.h" +#include "resource.h" +#include +#include +#include // Required for showing property page +#include // SAPI includes +#include +#include + + +// Constant definitions +#define MAX_SIZE 102400 //100K +#define NORM_SIZE 256 +#define NUM_OUTPUTFORMATS 36 +#define WM_TTSAPPCUSTOMEVENT WM_APP // Window message used for systhesis events +#define CHILD_CLASS _T("TTSAppChildWin") // Child window for blitting mouth to +#define WEYESNAR 14 // eye positions +#define WEYESCLO 15 +#define NUM_PHONEMES 6 +#define CHARACTER_WIDTH 128 +#define CHARACTER_HEIGHT 128 +#define MAX_FILE_PATH 256 + +// +// Prototypes for dialog procs +// +LPARAM CALLBACK ChildWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK About( HWND, UINT, WPARAM, LPARAM ); + +// Main Object used by app +class CTTSApp +{ +public: + CTTSApp(HINSTANCE hInstance) : + m_hInst(hInstance), m_hWnd(0) + { + m_bPause = FALSE; // pause audio? + m_bStop = TRUE; // stop audio? + m_DefaultVolume = 0; // default volume + m_DefaultRate = 0; // default rate + m_DefaultFormatIndex = 0; // default output format + m_pszwFileText = NULL; // text from file + m_szWFileName[0] = NULL; // wide text from file + } + ~CTTSApp() + { + // delete any allocated memory + if( m_pszwFileText ) + { + delete m_pszwFileText; + } + } + + // Member Functions + static LRESULT CALLBACK DlgProcMain (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + HRESULT InitSapi(); + void Stop(); + HRESULT VoiceChange(); + HRESULT ReadTheFile( TCHAR* szFileName, BOOL* bIsUnicode, WCHAR** ppszwBuff ); + void UpdateEditCtlW( WCHAR* pszwText ); + BOOL CallOpenFileDialog( TCHAR* szFileName, TCHAR* szFilter ); + BOOL CallSaveFileDialog( TCHAR* szFileName, TCHAR* szFilter ); + HIMAGELIST InitImageList(); + +// +// Private methods +// +private: + // Message handling member functions + BOOL OnInitDialog( HWND hWnd ); + void MainHandleSynthEvent(); + void HandleScroll( HWND hCtl ); + void MainHandleCommand( int id, HWND hWndControl, UINT codeNotify ); + void MainHandleClose(); + void HandleSpeak (); + void EnableSpeakButtons( BOOL fEnable ); + +// +// Member data +// +private: + const HINSTANCE m_hInst; + HWND m_hWnd; + HWND m_hChildWnd; + CComPtr m_cpVoice; + CComPtr m_cpOutAudio; + BOOL m_bPause; + BOOL m_bStop; + USHORT m_DefaultVolume; + long m_DefaultRate; + int m_DefaultFormatIndex; + WCHAR* m_pszwFileText; + WCHAR m_szWFileName[MAX_FILE_PATH]; +}; + +#endif // _INC_TTSAPP diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.rc b/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.rc new file mode 100644 index 00000000..f23bd635 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.rc @@ -0,0 +1,197 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APPICON ICON DISCARDABLE "res\\appicon.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MAIN DIALOG DISCARDABLE 0, 0, 379, 223 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "SAPI5 TTSAPP" +FONT 8, "MS Shell Dlg" +BEGIN + PUSHBUTTON "About",IDC_ABOUT,313,194,54,14 + PUSHBUTTON "Open File",IDB_OPEN,313,16,54,14 + PUSHBUTTON "Speak",IDB_SPEAK,313,38,54,14 + PUSHBUTTON "Pause",IDB_PAUSE,313,60,54,14 + PUSHBUTTON "Stop",IDB_STOP,313,82,54,14 + PUSHBUTTON "Skip",IDB_SKIP,313,104,29,13 + EDITTEXT IDC_SKIP_EDIT,342,104,25,13,ES_AUTOHSCROLL + CONTROL "Spin2",IDC_SKIP_SPIN,"msctls_updown32",UDS_WRAP | + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS,361,55,10,14 + PUSHBUTTON "Speak .wav",IDB_SPEAKWAV,313,125,54,14 + PUSHBUTTON "Reset",IDB_RESET,313,147,54,14 + PUSHBUTTON "Save to .wav",IDC_SAVETOWAV,313,169,54,14 + CONTROL "",IDE_EDITBOX,"RichEdit20A",WS_BORDER | WS_VSCROLL | + WS_TABSTOP | 0x44,102,7,198,118 + LTEXT "Voice",IDC_STATIC,99,138,33,9 + COMBOBOX IDC_COMBO_VOICES,135,136,156,58,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Rate",IDC_STATIC,99,157,24,10 + CONTROL "Slider1",IDC_RATE_SLIDER,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,130,155,167,14 + LTEXT "Volume",IDC_STATIC,99,177,24,10 + CONTROL "Slider1",IDC_VOLUME_SLIDER,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,130,175,167,14 + LTEXT "Format",IDC_STATIC,99,197,33,9 + COMBOBOX IDC_COMBO_OUTPUT,135,195,156,86,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + CONTROL "Show all events",IDC_EVENTS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,19,190,63,10 + CONTROL "Process XML",IDC_SPEAKXML,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,19,204,63,10 + EDITTEXT IDC_DEBUG,9,102,80,84,ES_MULTILINE | ES_READONLY | + WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP + GROUPBOX "Mouth Position",IDC_MOUTHPOS,9,7,80,91 + CONTROL "",IDC_CHARACTER,"Static",SS_BLACKFRAME,12,17,74,75 + GROUPBOX "Options",IDC_STATIC,307,3,65,185 +END + +IDD_ABOUT DIALOG DISCARDABLE 0, 0, 313, 68 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +CAPTION "About TTSApp" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_APPICON,IDC_STATIC,7,7,20,20 + LTEXT "TTSApp ",IDC_STATIC,37,7,56,8 + LTEXT "(c) 2001 Microsoft Corporation. All rights reserved.", + IDC_STATIC,37,23,267,8 + DEFPUSHBUTTON "OK",IDOK,266,7,40,14,WS_GROUP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 372 + TOPMARGIN, 7 + BOTTOMMARGIN, 216 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 306 + TOPMARGIN, 7 + BOTTOMMARGIN, 60 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_MICFULL BITMAP DISCARDABLE "res\\mic.bmp" +IDB_MICEYESCLO BITMAP DISCARDABLE "res\\mic eyes closed.bmp" +IDB_MICEYESNAR BITMAP DISCARDABLE "res\\mic_eyes_narrow.bmp" +IDB_MICMOUTH10 BITMAP DISCARDABLE "res\\mic_mouth_10.bmp" +IDB_MICMOUTH11 BITMAP DISCARDABLE "res\\mic_mouth_11.bmp" +IDB_MICMOUTH12 BITMAP DISCARDABLE "res\\mic_mouth_12.bmp" +IDB_MICMOUTH13 BITMAP DISCARDABLE "res\\mic_mouth_13.bmp" +IDB_MICMOUTH2 BITMAP DISCARDABLE "res\\mic_mouth_2.bmp" +IDB_MICMOUTH3 BITMAP DISCARDABLE "res\\mic_mouth_3.bmp" +IDB_MICMOUTH4 BITMAP DISCARDABLE "res\\mic_mouth_4.bmp" +IDB_MICMOUTH5 BITMAP DISCARDABLE "res\\mic_mouth_5.bmp" +IDB_MICMOUTH6 BITMAP DISCARDABLE "res\\mic_mouth_6.bmp" +IDB_MICMOUTH7 BITMAP DISCARDABLE "res\\mic_mouth_7.bmp" +IDB_MICMOUTH8 BITMAP DISCARDABLE "res\\mic_mouth_8.bmp" +IDB_MICMOUTH9 BITMAP DISCARDABLE "res\\mic_mouth_9.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_SAVE_NOTIFY "WAV file successfully written!" + IDS_NOTIFY_TITLE "File Saved" + IDS_SAVE_ERROR "An error was encountered attempting to save to a .wav file. Please make sure that the file is not in use by another application." + IDS_VOICE_INIT_ERROR "The voice could not be initialized. Please select a different TTS voice and/or a different audio output device." + IDS_UNSUPPORTED_FORMAT "The selected format is not supported by the current default audio output device. Please either select a different format, or select a different default audio output device from the Speech Control Panel." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/TTSApp/version.rc2 new file mode 100644 index 00000000..e61d542b --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "TTSApp Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TTSApp\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TTSApp.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/TTSApp/winmain.cpp b/mp/src/utils/sapi51/Samples/CPP/TTSApp/winmain.cpp new file mode 100644 index 00000000..851d8d76 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TTSApp/winmain.cpp @@ -0,0 +1,101 @@ +#include "globals.h" + +///////////////////////////////////////////////////////////////////////// +// SAPI5 TTSAPP +// +// Dialog box application used to manually verify SAPI5 TTS methods +// +// +// Revision History: +// 06/18/99 Created +//Copyright (c) Microsoft Corporation. All rights reserved. +// +///////////////////////////////////////////////////////////////////////// + +// +// Function prototypes +// +int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCmdLine, int nCmdShow ); + +// --------------------------------------------------------------------------- +// WinMain +// --------------------------------------------------------------------------- +// Description: Program entry point. +// Arguments: +// HINSTANCE [in] Program instance handle. +// HINSTANCE [in] Unused in Win32. +// LPSTR [in] Program command line. +// int [in] Command to pass to ShowWindow(). +// Returns: +// int 0 if all goes well. + +int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCmdLine, int nCmdShow ) +{ + HWND hWnd = NULL; + HWND hChild = NULL; + WNDCLASSEX wc; + HRESULT hr = S_OK; + + // Initialize the Win95 control library + InitCommonControls(); + + // Load the library containing the rich edit control + HMODULE hMod = LoadLibrary( TEXT( "riched20.dll" ) ); + if( !hMod ) + { + MessageBox( NULL, _T("Couldn't find riched32.dll. Shutting down!"), + _T("Error - Missing dll"), MB_OK ); + } + + if ( hMod ) + { + // Initialize COM library on the current thread and identify the concurrency model as + // single-thread apartment (STA). Applications must initialize the COM library before they + // can call COM library functions other than CoGetMalloc and memory allocation functions. + // New application developers may choose to use CoInitializeEx rather than CoInitialize, allowing + // them to set the concurrency model to apartment or multi-threaded. + CoInitialize( NULL ); + + // Register the child window class + ZeroMemory( &wc, sizeof( wc ) ); + wc.cbSize = sizeof( wc ); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = ChildWndProc; + wc.hInstance = hInst; + wc.hIcon = LoadIcon( hInst, (LPCTSTR) IDI_APPICON ); + wc.hCursor = LoadCursor( NULL, IDC_CROSS ); + wc.hbrBackground = GetSysColorBrush( COLOR_3DFACE ); + wc.lpszMenuName = NULL; + wc.lpszClassName = CHILD_CLASS; + wc.hIconSm = LoadIcon( hInst, (LPCTSTR) IDI_APPICON ); + + if( RegisterClassEx( &wc ) ) + { + CTTSApp DlgClass( hInst ); + hr = DlgClass.InitSapi(); + + if( SUCCEEDED( hr ) ) + { + // Create the main dialog + DialogBoxParam( hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)CTTSApp::DlgProcMain, + (LPARAM)&DlgClass ); + } + else + { + // Error - shut down + MessageBox( NULL, + _T("Error initializing TTSApp. Shutting down."), + _T("Error"), MB_OK ); + } + } + + FreeLibrary( hMod ); + } + + // Unload COM + CoUninitialize(); + + // Return 0 + return 0; + +} diff --git a/mp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.cpp b/mp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.cpp new file mode 100644 index 00000000..f6c0fb53 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.cpp @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include +#include "sphelper.h" +//Copyright (c) Microsoft Corporation. All rights reserved. + +inline HRESULT BlockForResult(ISpRecoContext * pRecoCtxt, ISpRecoResult ** ppResult) +{ + HRESULT hr = S_OK; + CSpEvent event; + + while (SUCCEEDED(hr) && + SUCCEEDED(hr = event.GetFrom(pRecoCtxt)) && + hr == S_FALSE) + { + hr = pRecoCtxt->WaitForNotifyEvent(INFINITE); + } + + *ppResult = event.RecoResult(); + if (*ppResult) + { + (*ppResult)->AddRef(); + } + + return hr; +} + +const WCHAR * StopWord() +{ + const WCHAR * pchStop; + + LANGID LangId = ::SpGetUserDefaultUILanguage(); + + switch (LangId) + { + case MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT): + pchStop = L"\x7d42\x4e86\\\x30b7\x30e5\x30fc\x30ea\x30e7\x30fc/\x3057\x3085\x3046\x308a\x3087\x3046";; + break; + + default: + pchStop = L"Stop"; + break; + } + + return pchStop; +} + +int main(int argc, char* argv[]) +{ + HRESULT hr = E_FAIL; + bool fUseTTS = true; // turn TTS play back on or off + bool fReplay = true; // turn Audio replay on or off + + // Process optional arguments + if (argc > 1) + { + int i; + + for (i = 1; i < argc; i++) + { + if (_stricmp(argv[i], "-noTTS") == 0) + { + fUseTTS = false; + continue; + } + if (_stricmp(argv[i], "-noReplay") == 0) + { + fReplay = false; + continue; + } + printf ("Usage: %s [-noTTS] [-noReplay] \n", argv[0]); + return hr; + } + } + + if (SUCCEEDED(hr = ::CoInitialize(NULL))) + { + { + CComPtr cpRecoCtxt; + CComPtr cpGrammar; + CComPtr cpVoice; + hr = cpRecoCtxt.CoCreateInstance(CLSID_SpSharedRecoContext); + if(SUCCEEDED(hr)) + { + hr = cpRecoCtxt->GetVoice(&cpVoice); + } + + if (cpRecoCtxt && cpVoice && + SUCCEEDED(hr = cpRecoCtxt->SetNotifyWin32Event()) && + SUCCEEDED(hr = cpRecoCtxt->SetInterest(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION))) && + SUCCEEDED(hr = cpRecoCtxt->SetAudioOptions(SPAO_RETAIN_AUDIO, NULL, NULL)) && + SUCCEEDED(hr = cpRecoCtxt->CreateGrammar(0, &cpGrammar)) && + SUCCEEDED(hr = cpGrammar->LoadDictation(NULL, SPLO_STATIC)) && + SUCCEEDED(hr = cpGrammar->SetDictationState(SPRS_ACTIVE))) + { + USES_CONVERSION; + + const WCHAR * const pchStop = StopWord(); + CComPtr cpResult; + + printf( "I will repeat everything you say.\nSay \"%s\" to exit.\n", W2A(pchStop) ); + + while (SUCCEEDED(hr = BlockForResult(cpRecoCtxt, &cpResult))) + { + cpGrammar->SetDictationState( SPRS_INACTIVE ); + + CSpDynamicString dstrText; + + if (SUCCEEDED(cpResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, + TRUE, &dstrText, NULL))) + { + printf("I heard: %s\n", W2A(dstrText)); + + if (fUseTTS) + { + cpVoice->Speak( L"I heard", SPF_ASYNC, NULL); + cpVoice->Speak( dstrText, SPF_ASYNC, NULL ); + } + + if (fReplay) + { + if (fUseTTS) + cpVoice->Speak( L"when you said", SPF_ASYNC, NULL); + else + printf ("\twhen you said...\n"); + cpResult->SpeakAudio(NULL, 0, NULL, NULL); + } + + cpResult.Release(); + } + if (_wcsicmp(dstrText, pchStop) == 0) + { + break; + } + + cpGrammar->SetDictationState( SPRS_ACTIVE ); + } + } + } + ::CoUninitialize(); + } + return hr; +} diff --git a/mp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.dsp b/mp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.dsp new file mode 100644 index 00000000..01046457 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.dsp @@ -0,0 +1,90 @@ +# Microsoft Developer Studio Project File - Name="talkback" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=talkback - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "talkback.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "talkback.mak" CFG="talkback - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "talkback - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "talkback - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "talkback - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "talkback - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "talkback - Win32 Release" +# Name "talkback - Win32 Debug" +# Begin Source File + +SOURCE=.\talkback.cpp +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/TalkBack/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/TalkBack/version.rc2 new file mode 100644 index 00000000..d96d6b00 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TalkBack/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "TalkBack Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TalkBack\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TalkBack.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.cpp b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.cpp new file mode 100644 index 00000000..a0b6d06e --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.cpp @@ -0,0 +1,1008 @@ +// ASRStream.cpp : Implementation of CASRStream +#include "stdafx.h" +#include "STCustomStream.h" +#include "ASRStream.h" +#include "Spddkhlp.h" + +const WAIT_TIME_OUT = 20000; // 20 seconds +///////////////////////////////////////////////////////////////////////////// +// CASRStream + +//////////////////////////////////////////////////////////////////////// +HRESULT CASRStream::FinalConstruct() +{ + + HRESULT hr = S_OK; + + //Initialize data members + m_ulBufferSize = 0; + m_ulActualRead = 0; + m_pnDataBuffer = NULL; + m_ulLeftOver = 0; + m_ulLeftOverPos = 0; + m_nNumberOfSamples = 0; + m_pSampleReadyEvents = NULL; + m_ppStreamSamples = NULL; + m_pnLeftOverBuffer = NULL; + + m_bFlag = FALSE; + m_bPurgeFlag = FALSE; + + return hr; +} + +//////////////////////////////////////////////////////////////////////// +void CASRStream::FinalRelease() +{ + + //Release objects + CleanUp(); + + m_cpSRMediaStream.Release(); + +} + +//////////////////////////////////////////////////////////////////////// +// Initialize the SR render stream and store the wave format +// +STDMETHODIMP CASRStream::InitSRRenderStream( IUnknown *pRenderTerminal) +{ + + HRESULT hr = S_OK; + CComQIPtr cpTerminal(pRenderTerminal); + + //Release the stream, if it exists + if ( m_cpSRMediaStream ) + { + m_cpSRMediaStream.Release(); + } + + //Query the IMediaStream interface from the terminal + if ( cpTerminal ) + { + hr = cpTerminal->QueryInterface(IID_IMediaStream, (void**)&m_cpSRMediaStream); + + } + else + { + hr = E_INVALIDARG; + cpTerminal.Release(); + return hr; + } + + + //Get the ITAMMediaFormat and then retrieve the format + ITAMMediaFormat *pITFormat; + hr = cpTerminal->QueryInterface(IID_ITAMMediaFormat, (void **)&pITFormat); + + if (FAILED(hr)) + { + cpTerminal.Release(); + return hr; + } + + AM_MEDIA_TYPE *pmt; + if(SUCCEEDED(hr)) + { + hr = pITFormat->get_MediaFormat(&pmt); + } + pITFormat->Release(); + + //Store the wave format + if(SUCCEEDED(hr)) + { + hr = m_StreamFormat.AssignFormat (SPDFID_WaveFormatEx, ( WAVEFORMATEX * )pmt->pbFormat ); + ::CoTaskMemFree(pmt); + } + + cpTerminal.Release(); + return hr; +} + +//////////////////////////////////////////////////////////////////////// +// Release the internal objects +// +STDMETHODIMP CASRStream::CleanUp() +{ + HRESULT hr = S_OK; + m_hCritSec.Lock(); + + //Release objects + if ( m_pSampleReadyEvents) + { + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + } + + if ( m_ppStreamSamples ) + { + ReleaseSamples(m_ppStreamSamples, m_nNumberOfSamples); + m_ppStreamSamples = NULL; + } + + if ( m_pnDataBuffer ) + { + delete[] m_pnDataBuffer; + m_pnDataBuffer = NULL; + } + + if ( m_pnLeftOverBuffer ) + { + delete[] m_pnLeftOverBuffer; + m_pnLeftOverBuffer = NULL; + } + + m_hCritSec.Unlock(); + + return hr; +} + +//////////////////////////////////////////////////////////////////////// +// Set the purge stream flag to TRUE so that SR engine will get the less +// audio data than it wants. The SR engine will stop calling Read(), because +// the SR engine thinks it reaches the end of the stream. +// +STDMETHODIMP CASRStream::PurgeStream() +{ + HRESULT hr = S_OK; + m_hCritSec.Lock(); + + m_bPurgeFlag = TRUE; + m_bFlag = FALSE; + + m_hCritSec.Unlock(); + + return hr; +} + +//////////////////////////////////////////////////////////////////////// +// Set the purge stream flag to FALSE. This allows the SR engine to +// to get the data in the next Read() calls. +// Reset the other variables. +// +STDMETHODIMP CASRStream::RestartStream() +{ + HRESULT hr = S_OK; + m_hCritSec.Lock(); + + hr = CleanUp(); + + m_ulBufferSize = 0; + m_ulActualRead = 0; + + m_ulLeftOver = 0; + m_ulLeftOverPos = 0; + m_nNumberOfSamples = 0; + + m_bFlag = FALSE; + m_bPurgeFlag = FALSE; + + m_hCritSec.Unlock(); + + return hr; +} +//////////////////////////////////////////////////////////////////////// +// read the terminal's allocator properties to return the number of samples +// the terminal provides +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::GetNumberOfSamplesOnStream(IMediaStream *pTerminalMediaStream, + OUT DWORD *pnNumberOfSamples) +{ + + HRESULT hr = S_OK; + + + // + // don't return garbage + // + + *pnNumberOfSamples = 0; + + + // + // get allocator properties + // + + ITAllocatorProperties *pAllocProperites = NULL; + + hr = pTerminalMediaStream->QueryInterface(IID_ITAllocatorProperties, + (void **)&pAllocProperites); + + if (FAILED(hr)) + { + return hr; + } + + + // + // we want to know the number of samples we will be getting + // + + ALLOCATOR_PROPERTIES AllocProperties; + + hr = pAllocProperites->GetAllocatorProperties(&AllocProperties); + + pAllocProperites->Release(); + pAllocProperites = NULL; + + + if (FAILED(hr)) + { + return hr; + } + + *pnNumberOfSamples = AllocProperties.cBuffers; + + return S_OK; +} + +////////////////////////////////////////////////////////////////////////////// +// close the handles passed into the function and release the array of handles +// +/////////////////////////////////////////////////////////////////////////////// + +void CASRStream::ReleaseEvents(OUT HANDLE *pEvents, // array of events to be freed + DWORD nNumberOfEvents // number of events the array + ) +{ + + // + // close all the handles in the array + // + + for (DWORD i = 0; i < nNumberOfEvents; i++) + { + CloseHandle(pEvents[i]); + pEvents[i] = NULL; + } + + + // + // free the array itself + // + + FreeMemory(pEvents); + pEvents = NULL; +} + + +////////////////////////////////////////////////////////////////////////////// +// allocate the array of events of size nNumberOfSamples +// +// return pointer to the allocated and initialized array if success +// or NULL if failed +// +/////////////////////////////////////////////////////////////////////////////// + +HANDLE* CASRStream::AllocateEvents(DWORD nNumberOfEvents) +{ + + // + // pointer to an array of event handles + // + + HANDLE *pSampleReadyEvents = NULL; + + pSampleReadyEvents = + (HANDLE*)AllocateMemory(sizeof(HANDLE) * nNumberOfEvents); + + if (NULL == pSampleReadyEvents) + { + //Failed to allocate sample ready events. + + return NULL; + } + + + // + // create an event for every allocated handle + // + + + for (DWORD i = 0; i < nNumberOfEvents; i++) + { + + pSampleReadyEvents[i] = CreateEvent(NULL, FALSE, FALSE, NULL); + + if (NULL == pSampleReadyEvents[i]) + { + + // + // close handles we have created already + // + + for (DWORD j = 0; j< i; j++) + { + CloseHandle(pSampleReadyEvents[j]); + + pSampleReadyEvents[j] = NULL; + } + + + FreeMemory(pSampleReadyEvents); + pSampleReadyEvents = NULL; + + return NULL; + + } + + } // creating events for each sample + + + // + // succeded creating events. return the pointer to the array + // + + return pSampleReadyEvents; + +} + +////////////////////////////////////////////////////////////////////////////// +// aborts and releases every sample in the array of samples of size +// nNumberOfSamples and deallocates the array itself +// +// ppStreamSamples becomes invalid when the function returns +// +/////////////////////////////////////////////////////////////////////////////// + +void CASRStream::ReleaseSamples(IStreamSample **ppStreamSamples, + DWORD nNumberOfSamples) +{ + + for (DWORD i = 0; i < nNumberOfSamples; i++) + { + ppStreamSamples[i]->CompletionStatus(COMPSTAT_WAIT | + COMPSTAT_ABORT, + INFINITE); + + + // + // regardless of the error code, release the sample + // + + ppStreamSamples[i]->Release(); + ppStreamSamples[i] = NULL; + } + + FreeMemory(ppStreamSamples); + ppStreamSamples = NULL; +} + +////////////////////////////////////////////////////////////////////////////// +// allocate the array of nNumberOfSamples samples, and initialize each sample +// pointer in the array with samples from the supplied stream. +// +// return pointer to the allocated and initialized array if success +// or NULL if failed +// +/////////////////////////////////////////////////////////////////////////////// + +IStreamSample ** CASRStream::AllocateStreamSamples(IMediaStream *pMediaStream, + DWORD nNumberOfSamples) +{ + + // + // allocate stream sample array + // + + IStreamSample **ppStreamSamples = (IStreamSample **) + AllocateMemory( sizeof(IStreamSample*) * nNumberOfSamples ); + + + if (NULL == ppStreamSamples) + { + return NULL; + } + + + // + // allocate samples from the stream and put them into the array + // + + for (DWORD i = 0; i < nNumberOfSamples; i++) + { + + HRESULT hr = pMediaStream->AllocateSample(0, &ppStreamSamples[i]); + + if (FAILED(hr)) + { + + for (DWORD j = 0; j < i; j++) + { + ppStreamSamples[j]->Release(); + ppStreamSamples[j] = NULL; + } + + FreeMemory(ppStreamSamples); + ppStreamSamples = NULL; + + return NULL; + + } // failed AllocateSample() + + } // allocating samples on the stream + + + + // + // succeeded allocating samples + // + + return ppStreamSamples; + +} + + +////////////////////////////////////////////////////////////////////////////// +// call Update() on every sample of the array of stream samples to associate it +// with an event from the array of events. The events will be signaled when the +// corresponding sample has data and is ready to render to SAPI +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::AssociateEventsWithSamples(HANDLE *pSampleReadyEvents, + IStreamSample **ppStreamSamples, + DWORD nNumberOfSamples) +{ + + for (DWORD i = 0; i < nNumberOfSamples; i++) + { + + // + // the event passed to Update will be signaled when the sample is + // filled with data + // + + HRESULT hr = + ppStreamSamples[i]->Update(0, pSampleReadyEvents[i], NULL, 0); + + + if (FAILED(hr)) + { + + // + // abort the samples we have Update()'d + // + + for (DWORD j = 0; j < i; j++) + { + + // + // no need to check the return code here -- best effort attempt + // if failed -- too bad + // + + ppStreamSamples[j]->CompletionStatus(COMPSTAT_WAIT | + COMPSTAT_ABORT, + INFINITE); + } + + return hr; + + } // Update() failed + + } // Update()'ing all samples + + + return S_OK; +} + + +////////////////////////////////////////////////////////////////////////////// +// +// This function writes the data portion of the sample into the SAPI +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::ReadStreamSample(IStreamSample *pStreamSample, ULONG start) +{ + + // + // get the sample's IMemoryData interface so we can get to the + // sample's data + // + + IMemoryData *pSampleMemoryData = NULL; + + HRESULT hr = pStreamSample->QueryInterface(IID_IMemoryData, + (void **)&pSampleMemoryData); + + if (FAILED(hr)) + { + return hr; + } + + // + // get to the sample's data buffer + // + DWORD nBufferSize = 0; + BYTE *pnDataBuffer = NULL; + DWORD nActualDataSize = 0; + + hr = pSampleMemoryData->GetInfo(&nBufferSize, + &pnDataBuffer, + &nActualDataSize); + + + if ( SUCCEEDED ( hr ) ) + { + m_ulActualRead = (ULONG) nActualDataSize; + if ( nActualDataSize + start <= m_ulBufferSize ) + { + //If SR engine wants more data then the media stream contains, copy it directly + //to the current buffer + memcpy ( (BYTE *)&m_pnDataBuffer[start], (BYTE *)pnDataBuffer, nActualDataSize * sizeof(BYTE)); + } + else + { // we have left over data + memcpy ( (BYTE *)&m_pnDataBuffer[start], (BYTE *)pnDataBuffer, (m_ulBufferSize - start - m_ulLeftOver ) * sizeof(BYTE)); + + ULONG ulLeftOver = nActualDataSize + start + m_ulLeftOver - m_ulBufferSize; + + if ( m_pnLeftOverBuffer ) + { + delete[] m_pnLeftOverBuffer; + m_pnLeftOverBuffer = NULL; + } + + m_pnLeftOverBuffer = new BYTE[ ulLeftOver ]; + + if ( m_pnLeftOverBuffer == NULL ) + { + hr = E_OUTOFMEMORY; + } + else + { + memcpy ( (BYTE *)m_pnLeftOverBuffer, (BYTE *)&pnDataBuffer[m_ulBufferSize - start - m_ulLeftOver], ulLeftOver * sizeof(BYTE)); + } + } + } + + pSampleMemoryData->Release(); + pSampleMemoryData = NULL; + + return hr; +} + + + + +////////////////////////////////////////////////////////////////////////////// +// given the return code fom WaitForMultipleObjects, this function determines +// which sample was signal and returns S_OK and the id of the signaled sample +// or E_FAIL if WaitForMultipleEvents returned an error +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::GetSampleID(DWORD nWaitCode, // code from WaitForMultiple... + DWORD nNumberOfSamples, // the total number of samples + DWORD *pnSampleID) // the calculated id of the + // signaled sample +{ + + + // + // event abandoned? + // + + if ( (nWaitCode >= WAIT_ABANDONED_0) && + (nWaitCode < WAIT_ABANDONED_0 + nNumberOfSamples) ) + { + return E_FAIL; + } + + + // + // any other error? + // + + if ( (WAIT_OBJECT_0 + nNumberOfSamples <= nWaitCode) ) + { + return E_FAIL; + } + + + // + // which sample was signaled? + // + + *pnSampleID = nWaitCode - WAIT_OBJECT_0; + + return S_OK; +} + + +////////////////////////////////////////////////////////////////////////////// +// +// extract samples from the terminal's media stream and render it to SR engine +// +// returns when the call is disconnected (call disconnect causes media streaming +// terminal to abort the samples +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::RenderAudioStream(ULONG start) +{ + + HRESULT hr = S_OK; + DWORD nSampleID = 0; + + if ( !m_bFlag ) + { + //turn off the flag. Only initialize once for each connection + m_bFlag = TRUE; + + // get the number of stream samples we will be using + hr = GetNumberOfSamplesOnStream(m_cpSRMediaStream, &m_nNumberOfSamples); + + if (FAILED(hr)) + { + return hr; + } + + // + // the number of samples directly corresponds the number of events we will + // be waiting on later. WaitForMultipleObjects has a limit of + // MAXIMUM_WAIT_OBJECTS events. + // + + if (m_nNumberOfSamples > MAXIMUM_WAIT_OBJECTS) + { + return E_FAIL; + } + + + // + // allocate events that will be signaled when each sample is ready to be + // read + // + + m_pSampleReadyEvents = AllocateEvents(m_nNumberOfSamples); + + if (NULL == m_pSampleReadyEvents) + { + return E_OUTOFMEMORY; + } + + // + // allocate array of stream samples + // + + m_ppStreamSamples = AllocateStreamSamples(m_cpSRMediaStream, + m_nNumberOfSamples); + + if (NULL == m_ppStreamSamples) + { + // + // release events we have allocated + // + + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + + return E_FAIL; + } + + + // + // we have the samples, we have the events. + // associate events with samples so events get signaled when the + // corresponding samples are ready to be read + // + + hr = AssociateEventsWithSamples(m_pSampleReadyEvents, + m_ppStreamSamples, + m_nNumberOfSamples); + + if (FAILED(hr)) + { + // + // release events and samples we have allocated + // + + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + + ReleaseSamples(m_ppStreamSamples, m_nNumberOfSamples); + m_ppStreamSamples = NULL; + + return E_FAIL; + } + + } + if ( SUCCEEDED ( hr ) ) + { + + // + // wait for the events associated with the samples + // when a samples has data, the corresponding event will be + // signaled + // + + DWORD nWaitCode = WaitForMultipleObjects(m_nNumberOfSamples, + m_pSampleReadyEvents, + FALSE, + WAIT_TIME_OUT); + + + // + // get the id of the sample that was signaled. fail if Wait returned + // error + // + + hr = GetSampleID(nWaitCode, m_nNumberOfSamples, &nSampleID); + + } + + + // + // we filtered out all invalid error codes. so nSampleID has no + // choice but be a valid sample index. + // + + _ASSERTE(nSampleID < m_nNumberOfSamples); + + if ( SUCCEEDED ( hr ) ) + { + + // + // make sure the sample is ready to be read + // + + hr = m_ppStreamSamples[nSampleID]->CompletionStatus(COMPSTAT_WAIT, 0); + } + + + // + // we have the sample that was signaled and which is now ready to be + // read. Record the sample. + // + if ( SUCCEEDED ( hr ) ) + { + hr = ReadStreamSample(m_ppStreamSamples[nSampleID], start); + } + + + // + // we are done with this sample. return it to the source stream + // to be refilled with data + // + if ( SUCCEEDED ( hr ) ) + { + + hr = m_ppStreamSamples[nSampleID]->Update(0, m_pSampleReadyEvents[nSampleID],NULL,0); + + } + + if (FAILED(hr)) + { + // + // release events and samples we have allocated + // + + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + + ReleaseSamples(m_ppStreamSamples, m_nNumberOfSamples); + m_ppStreamSamples = NULL; + } + + return hr; +} + +////////////////////////////////////////////////////////////////////////////// +// +// use win32 heap api to allocate memory on the application's heap +// and zero the allocated memory +// +/////////////////////////////////////////////////////////////////////////////// +void *CASRStream::AllocateMemory(SIZE_T nMemorySize) +{ + // + // use HeapAlloc to allocate and clear memory + // + + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nMemorySize); +} + + +////////////////////////////////////////////////////////////////////////////// +// +// use win32 heap api to free memory previously allocated on the application's +// heap +// +/////////////////////////////////////////////////////////////////////////////// +void CASRStream::FreeMemory(void *pMemory) +{ + + // + // get size of the allocated memory + // + + DWORD nMemorySize = HeapSize(GetProcessHeap(), 0, pMemory); + + + // + // fill memory with 0xdd's before freeing, so it is easier to debug + // failures caused by using pointer to deallocated memory + // + + if (NULL != pMemory) + { + FillMemory(pMemory, nMemorySize, 0xdd); + } + + + // + // use HeapFree to free memory. use return code to log the result, but + // do not return it to the caller + // + + BOOL bFreeSuccess = HeapFree(GetProcessHeap(), 0, pMemory); + + if (FALSE == bFreeSuccess) + { + // + // if this assertion fires, it is likely there is a problem with the + // memory we are trying to deallocate. Was it allocated using heapalloc + // and on the same heap? Is this a valid pointer? + // + + _ASSERTE(FALSE); + } + +} + +////////////////////////////////////////////////////////////////////////////// +// +// SR engine calls the Read to get the audio through SAPI +// +/////////////////////////////////////////////////////////////////////////////// +STDMETHODIMP CASRStream::Read(void * pv, ULONG cb, ULONG *pcbRead) +{ + m_hCritSec.Lock(); + + ULONG start; + LONG len = cb; + BYTE * pnData = (BYTE *)pv; + HRESULT hr = S_OK; + + + if (m_bPurgeFlag) + { + //the app wants to stop rendering the stream + m_bPurgeFlag = FALSE; + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + + ReleaseSamples(m_ppStreamSamples, m_nNumberOfSamples); + m_ppStreamSamples = NULL; + + *pcbRead = 0; + m_hCritSec.Unlock(); + return hr; + } + + //allocate the buffer + if ( m_pnDataBuffer == NULL ) + { + m_ulBufferSize = cb; + m_pnDataBuffer = new BYTE [ m_ulBufferSize ]; + if ( m_pnDataBuffer == NULL ) + { + m_hCritSec.Unlock(); + return E_OUTOFMEMORY; + } + } + else if ( m_ulBufferSize != cb) + { + //allocate a new buffer + delete []m_pnDataBuffer; + m_ulBufferSize = cb; + m_pnDataBuffer = new BYTE [ m_ulBufferSize ]; + if ( m_pnDataBuffer == NULL ) + { + m_hCritSec.Unlock(); + return E_OUTOFMEMORY; + } + } + + //copy the data left from the previous Read(). + if ( m_pnLeftOverBuffer && m_ulLeftOver > 0 ) + { + memcpy ( pnData, (BYTE *)&m_pnLeftOverBuffer[m_ulLeftOverPos], min(cb, m_ulLeftOver) * sizeof(BYTE) ); + } + + //Read the data from MST + start = 0; + len = cb - m_ulLeftOver; + + while ( SUCCEEDED ( hr ) && len > 0 ) + { + hr = RenderAudioStream( start ); + start += m_ulActualRead; + len = cb - m_ulLeftOver - start; + } + + if ( SUCCEEDED ( hr ) ) + { + // tell SR engine, we have cb bytes available. + *pcbRead = cb; + + // Copy the rest of data outside and set the postion and number of bytes left in + // the left over data buffer + long lRead = *pcbRead - m_ulLeftOver; + if ( lRead > 0 ) + { + m_ulLeftOverPos = 0; + memcpy ( &pnData[m_ulLeftOver], (BYTE *)m_pnDataBuffer, (*pcbRead - m_ulLeftOver) * sizeof(BYTE) ); + } + else + { + m_ulLeftOverPos += cb; + } + + if ( len < 0 ) + { + m_ulLeftOver = -len; + } + else + { + m_ulLeftOverPos = 0; + m_ulLeftOver = 0; + } + } + + m_hCritSec.Unlock(); + + return hr; +} + +////////////////////////////////////////////////////////////////////////////// +// +// This method is called by SAPI +// +/////////////////////////////////////////////////////////////////////////////// +STDMETHODIMP CASRStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + // We only accept queries for the current stream position + if (STREAM_SEEK_CUR != dwOrigin || dlibMove.QuadPart) + { + return E_INVALIDARG; + } + + // Validate the OUT parameter + if (SPIsBadWritePtr(plibNewPosition, sizeof(ULARGE_INTEGER))) + { + return E_POINTER; + } + + m_hCritSec.Lock(); + + plibNewPosition->QuadPart = (LONG)dlibMove.LowPart; + + m_hCritSec.Unlock(); + + return S_OK; +} + +//////////////////////////////////////////////////////////////////////////////// +// This method is called by SAPI +// +/////////////////////////////////////////////////////////////////////////////// +STDMETHODIMP CASRStream::GetFormat(GUID * pFmtId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + m_hCritSec.Lock(); + + HRESULT hr = S_OK; + + hr = m_StreamFormat.ParamValidateCopyTo( pFmtId, ppCoMemWaveFormatEx ); + + + m_hCritSec.Unlock(); + + return hr; +} + diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.h b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.h new file mode 100644 index 00000000..a65dd936 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.h @@ -0,0 +1,141 @@ +// ASRStream.h : Declaration of the CASRStream + +#ifndef __ASRSTREAM_H_ +#define __ASRSTREAM_H_ + +#include "resource.h" // main symbols +#include "sapi.h" + +#include +#include +#include "SAPI.h" +#include "sphelper.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CASRStream +class ATL_NO_VTABLE CASRStream : + public CComObjectRootEx, + public CComCoClass, + public ISpStreamFormat, + public IDispatchImpl +{ +public: + CASRStream() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_ASRSTREAM) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CASRStream) + COM_INTERFACE_ENTRY(IASRStream) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISpStreamFormat) + COM_INTERFACE_ENTRY(IStream) + +END_COM_MAP() + +// IASRStream +public: + STDMETHOD(InitSRRenderStream)(IUnknown *pRenderTerminal); + STDMETHOD(PurgeStream)(); + STDMETHOD(RestartStream)(); + STDMETHOD(CleanUp)(); + HRESULT FinalConstruct(); + void FinalRelease(); + + + // + // IStream + // + + STDMETHODIMP Read(void * pv, ULONG cb, ULONG * pcbRead); + STDMETHODIMP Write(const void * pv, ULONG cb, ULONG * pcbWritten) + { + return STG_E_ACCESSDENIED; + } + STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition); + STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize) + { + return STG_E_ACCESSDENIED; + } + STDMETHODIMP CopyTo(IStream *pStreamDest, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) + { + return E_NOTIMPL; + } + STDMETHODIMP Commit(DWORD grfCommitFlags) + { + return E_NOTIMPL; + } + STDMETHODIMP Revert(void) + { + return E_NOTIMPL; + } + STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) + { + return E_NOTIMPL; + } + STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) + { + return E_NOTIMPL; + } + STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag) + { + return E_NOTIMPL; + } + STDMETHODIMP Clone(IStream ** ppstm) + { + return E_NOTIMPL; + } + // + // ISpStreamFormat + // + STDMETHODIMP GetFormat(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); + + +private: + + HRESULT RenderAudioStream(ULONG start); + HRESULT GetSampleID(DWORD nWaitCode, DWORD nNumberOfSamples, DWORD *pnSampleID); + HRESULT ReadStreamSample(IStreamSample *pStreamSample, ULONG start ); + HRESULT AssociateEventsWithSamples(HANDLE *pSampleReadyEvents, + IStreamSample **ppStreamSamples, + DWORD nNumberOfSamples); + IStreamSample ** AllocateStreamSamples( IMediaStream *pMediaStream, DWORD nNumberOfSamples); + void ReleaseSamples(IStreamSample **ppStreamSamples, DWORD nNumberOfSamples); + HANDLE* AllocateEvents(DWORD nNumberOfEvents); + void ReleaseEvents(HANDLE *pEvents, DWORD nNumberOfEvents ); + HRESULT GetNumberOfSamplesOnStream(IMediaStream *pTerminalMediaStream,DWORD *pnNumberOfSamples); + void *AllocateMemory(SIZE_T nMemorySize); + void FreeMemory(void *pMemory); + +private: + + CComAutoCriticalSection m_hCritSec; + ULONG m_ulBufferSize; + ULONG m_ulActualRead; + BYTE * m_pnDataBuffer; + ULONG m_ulLeftOver; + ULONG m_ulLeftOverPos; + BYTE * m_pnLeftOverBuffer; + DWORD m_nNumberOfSamples ; + BOOL m_bFlag ; + BOOL m_bPurgeFlag; + HANDLE * m_pSampleReadyEvents ; + CComPtr m_cpSRMediaStream; + IStreamSample **m_ppStreamSamples ; + CSpStreamFormat m_StreamFormat; + +}; + +#endif //__ASRSTREAM_H_ diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.rgs b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.rgs new file mode 100644 index 00000000..95092201 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.rgs @@ -0,0 +1,26 @@ +HKCR +{ + STCustomStream.ASRStream.1 = s 'ASRStream Class' + { + CLSID = s '{6CD93B97-482E-409B-B2EB-128231F0FEA1}' + } + STCustomStream.ASRStream = s 'ASRStream Class' + { + CLSID = s '{6CD93B97-482E-409B-B2EB-128231F0FEA1}' + CurVer = s 'STCustomStream.ASRStream.1' + } + NoRemove CLSID + { + ForceRemove {6CD93B97-482E-409B-B2EB-128231F0FEA1} = s 'ASRStream Class' + { + ProgID = s 'STCustomStream.ASRStream.1' + VersionIndependentProgID = s 'STCustomStream.ASRStream' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{EDAEECD8-0D75-499E-9B69-187ACACF2C05}' + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.cpp b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.cpp new file mode 100644 index 00000000..1d4e2052 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.cpp @@ -0,0 +1,74 @@ +// STCustomStream.cpp : Implementation of DLL Exports. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f STCustomStreamps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "STCustomStream.h" + +#include "STCustomStream_i.c" +#include "ASRStream.h" +#include "TTSStream.h" + + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_ASRStream, CASRStream) +OBJECT_ENTRY(CLSID_TTSStream, CTTSStream) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_STCUSTOMSTREAMLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.def b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.def new file mode 100644 index 00000000..95e294b1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.def @@ -0,0 +1,9 @@ +; STCustomStream.def : Declares the module parameters. + +LIBRARY "STCustomStream.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.dsp b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.dsp new file mode 100644 index 00000000..b41477ed --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.dsp @@ -0,0 +1,337 @@ +# Microsoft Developer Studio Project File - Name="STCustomStream" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=STCustomStream - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "STCustomStream.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "STCustomStream.mak" CFG="STCustomStream - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "STCustomStream - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "STCustomStream - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\include" /I "..\..\..\..\..\sdk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib t3iid.lib strmiids.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\..\sdk\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=.\Debug\STCustomStream.dll +InputPath=.\Debug\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\DebugU +TargetPath=.\DebugU\STCustomStream.dll +InputPath=.\DebugU\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=.\ReleaseMinSize\STCustomStream.dll +InputPath=.\ReleaseMinSize\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=.\ReleaseMinDependency\STCustomStream.dll +InputPath=.\ReleaseMinDependency\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=.\ReleaseUMinSize\STCustomStream.dll +InputPath=.\ReleaseUMinSize\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /I "..\..\..\..\..\sdk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib t3iid.lib strmiids.lib winmm.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\..\lib\i386" /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\STCustomStream.dll +InputPath=.\ReleaseUMinDependency\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "STCustomStream - Win32 Debug" +# Name "STCustomStream - Win32 Unicode Debug" +# Name "STCustomStream - Win32 Release MinSize" +# Name "STCustomStream - Win32 Release MinDependency" +# Name "STCustomStream - Win32 Unicode Release MinSize" +# Name "STCustomStream - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\ASRStream.cpp +# End Source File +# Begin Source File + +SOURCE=.\STCustomStream.cpp +# End Source File +# Begin Source File + +SOURCE=.\STCustomStream.def +# End Source File +# Begin Source File + +SOURCE=.\STCustomStream.idl +# ADD MTL /tlb ".\STCustomStream.tlb" /h "STCustomStream.h" /iid "STCustomStream_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\STCustomStream.rc +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TTSStream.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\ASRStream.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TTSStream.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\ASRStream.rgs +# End Source File +# Begin Source File + +SOURCE=.\TTSStream.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.idl b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.idl new file mode 100644 index 00000000..6b85fd66 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.idl @@ -0,0 +1,63 @@ +// STCustomStream.idl : IDL source for STCustomStream.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (STCustomStream.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; + + + [ + object, + uuid(C78CDA8E-DC97-4B4A-964E-2CEDAC7145A7), + dual, + helpstring("IASRStream Interface"), + pointer_default(unique) + ] + interface IASRStream : IDispatch + { + [id(1), helpstring("method InitSRRenderStream")] HRESULT InitSRRenderStream(IUnknown *pRenderTerminal); + [id(2), helpstring("method PurgeStream")] HRESULT PurgeStream(); + [id(3), helpstring("method PurgeStream")] HRESULT RestartStream(); + + }; + [ + object, + uuid(006FF399-A14C-4767-9347-65A4388B7B14), + dual, + helpstring("ITTSStream Interface"), + pointer_default(unique) + ] + interface ITTSStream : IDispatch + { + [id(1), helpstring("method InitTTSCaptureStream")] HRESULT InitTTSCaptureStream(IUnknown *pCaptureTerminal); + }; + +[ + uuid(EDAEECD8-0D75-499E-9B69-187ACACF2C05), + version(1.0), + helpstring("STCustomStream 1.0 Type Library") +] +library STCUSTOMSTREAMLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(6CD93B97-482E-409B-B2EB-128231F0FEA1), + helpstring("ASRStream Class") + ] + coclass ASRStream + { + [default] interface IASRStream; + }; + [ + uuid(B827D5CC-96FA-4A1E-9877-D54586D433F4), + helpstring("TTSStream Class") + ] + coclass TTSStream + { + [default] interface ITTSStream; + }; +}; diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.rc b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.rc new file mode 100644 index 00000000..892c33b1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.rc @@ -0,0 +1,87 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""STCustomStream.tlb""\r\n" + "\0" +END +4 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END +#endif // APSTUDIO_INVOKED + + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_ASRSTREAM REGISTRY DISCARDABLE "ASRStream.rgs" +IDR_TTSSTREAM REGISTRY DISCARDABLE "TTSStream.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "STCustomStream" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "STCustomStream.tlb" + +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.cpp b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.cpp new file mode 100644 index 00000000..a5eea178 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.cpp @@ -0,0 +1,12 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.h b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.h new file mode 100644 index 00000000..4c9214ea --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__BA631C5B_6B4E_4A40_AAAD_4ED7DD4AA2BB__INCLUDED_) +#define AFX_STDAFX_H__BA631C5B_6B4E_4A40_AAAD_4ED7DD4AA2BB__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +//#define STRICT +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif +#define _ATL_APARTMENT_THREADED + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include + +#ifndef MAXULONG_PTR +#error This sample application requires a newer version of the Platform SDK than you have installed. +#endif // MAXULONG_PTR + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__BA631C5B_6B4E_4A40_AAAD_4ED7DD4AA2BB__INCLUDED) diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.cpp b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.cpp new file mode 100644 index 00000000..502583a1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.cpp @@ -0,0 +1,436 @@ +// TTSStream.cpp : Implementation of CTTSStream +#include "stdafx.h" +#include "STCustomStream.h" +#include "TTSStream.h" + +#include "Spddkhlp.h" +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CTTSStream + +class CStreamSampleQueue; + +// contains an IStreamSample ptr and is doubly-linked in +// a CStreamSampleQueue +class CQueueElem +{ +public: + + friend CStreamSampleQueue; + + CQueueElem( + IN IStreamSample *pStreamSample, + IN CQueueElem *pPrev, + IN CQueueElem *pNext + ) + : m_pStreamSample(pStreamSample), + m_pPrev(pPrev), + m_pNext(pNext) + { + } + +protected: + + IStreamSample *m_pStreamSample; + CQueueElem *m_pPrev; + CQueueElem *m_pNext; +}; + +// queues CQueueElem instances (FIFO) +// keeps the instances in a doubly-linked list +class CStreamSampleQueue +{ +public: + + CStreamSampleQueue() + : m_Head(NULL, &m_Head, &m_Head) + {} + + IStreamSample *Dequeue() + { + if (m_Head.m_pNext == &m_Head) return NULL; + + CQueueElem *TargetQueueElem = m_Head.m_pNext; + m_Head.m_pNext = m_Head.m_pNext->m_pNext; + m_Head.m_pNext->m_pNext->m_pPrev = &m_Head; + + IStreamSample *ToReturn = TargetQueueElem->m_pStreamSample; + delete TargetQueueElem; + + return ToReturn; + } + + BOOL Enqueue( + IN IStreamSample *pStreamSample + ) + { + CQueueElem *TargetQueueElem = + new CQueueElem(pStreamSample, m_Head.m_pPrev, &m_Head); + if (NULL == TargetQueueElem) return FALSE; + + m_Head.m_pPrev->m_pNext = TargetQueueElem; + m_Head.m_pPrev = TargetQueueElem; + + return TRUE; + } + + +protected: + + CQueueElem m_Head; +}; + +////////////////////////////////////////////////////////////////////////////// +// Query the media stream interface and get the stream format from the capture +// terminal. This stream object is used for the H.323 connections. If +// you want to use it over the voice modem or other voice boards, you need to +// set the media stream format by using ITAMMediaFormat::put_MediaFormat(), +// which is mandatory or the terminal will not be able to connect. + +STDMETHODIMP CTTSStream::InitTTSCaptureStream( IUnknown *pCaptureTerminal) +{ + + HRESULT hr = S_OK; + CComQIPtr cpTerminal(pCaptureTerminal); + + m_cpTTSMediaStream.Release(); + + + //Query the IMediaStream interface from the terminal + if ( cpTerminal ) + { + hr = cpTerminal->QueryInterface(IID_IMediaStream, (void**)&m_cpTTSMediaStream); + + } + else + { + hr = E_INVALIDARG; + cpTerminal.Release(); + return hr; + } + + //Get the ITAMMediaFormat and then retrieve the format + ITAMMediaFormat *pITFormat; + hr = cpTerminal->QueryInterface(IID_ITAMMediaFormat, (void **)&pITFormat); + + if (FAILED(hr)) + { + cpTerminal.Release(); + return hr; + } + + AM_MEDIA_TYPE *pmt; + if(SUCCEEDED(hr)) + { + hr = pITFormat->get_MediaFormat(&pmt); + } + + //Store the wave format + if(SUCCEEDED(hr)) + { + hr = m_StreamFormat.AssignFormat (SPDFID_WaveFormatEx, ( WAVEFORMATEX * )pmt->pbFormat ); + ::CoTaskMemFree(pmt); + } + + //Release the objects + pITFormat->Release(); + cpTerminal.Release(); + return hr; +} + +////////////////////////////////////////////////////////////////////////////// +//Release the objects +// +void CTTSStream::FinalRelease() +{ + m_cpTTSMediaStream.Release(); + +} + +////////////////////////////////////////////////////////////////////////////// +// TTS engines call this method, Write(), through SAPI whenever the audio data +// is ready. +// +STDMETHODIMP CTTSStream::Write(const void * pv, ULONG cb, ULONG * pcbWritten) +{ + + m_hCritSec.Lock(); + HRESULT hr = S_OK; + ULONG lWritten = 0; + ULONG ulPos =0; + BYTE * pbData = (BYTE *)pv; + + + if (SPIsBadReadPtr(pv, cb) || SP_IS_BAD_OPTIONAL_WRITE_PTR(pcbWritten)) + { + hr = STG_E_INVALIDPOINTER; + } + + //wait for the media stream to be active. Maximum is 6 seconds + hr = WaitUntilReady(6000); + m_bFlag = 0; + + // + // create a queue (STL deque) that will hold all the samples that we ever + // submitted to media streaming terminal + // + // we need this so when we are finished reading the data, we can go through + // the list of all the samples that we have submitted and make sure mst + // is finished processing them + // + + CStreamSampleQueue DestSampleQ; + + // + // keep reading samples from the buffer and sending them. + // + while ( SUCCEEDED ( hr ) ) + { + + // + // allocate a sample on the terminal's media stream + // + // Note: the call to AllocateSample() will block if we filled all the + // samples with data, and there are no more samples for us to fill + // (waiting for media streaming terminal to process samples we have + // submitted). When MST is is done with at least one sample, the call + // will return. This logic will ensure that MST always has work and is + // never starved for samples. + // + + IStreamSample *pStreamSample = NULL; + + hr = m_cpTTSMediaStream->AllocateSample(0, &pStreamSample); + + if (FAILED(hr)) + { + break; + } + + // + // get IMemoryData on the sample so we can get to the sample's memory + // data + // + + IMemoryData *pSampleMemoryData = NULL; + + hr = pStreamSample->QueryInterface(IID_IMemoryData, + (void**)&pSampleMemoryData); + + if (FAILED(hr)) + { + pStreamSample->Release(); + pStreamSample = NULL; + + break; + + } + + // + // get to the sample's memory buffer + // + + ULONG nBufferSize = 0; + + BYTE *pBuffer = NULL; + + hr = pSampleMemoryData->GetInfo(&nBufferSize, &pBuffer, NULL); + + if (FAILED(hr)) + { + pStreamSample->Release(); + pStreamSample = NULL; + + pSampleMemoryData->Release(); + pSampleMemoryData = NULL; + + break; + + } + + // + // read ISptream into memory buffer provided by the sample + // + + nBufferSize = min ( nBufferSize, cb - ulPos); + memcpy ( pBuffer, (BYTE *)(pbData+ ulPos), nBufferSize); + + ulPos += nBufferSize; + + // + // tell the sample how many useful bytes are in the sample's buffer + // + + hr = pSampleMemoryData->SetActual(nBufferSize); + + pSampleMemoryData->Release(); + pSampleMemoryData = NULL; + + if (FAILED(hr)) + { + pStreamSample->Release(); + pStreamSample = NULL; + break; + } + + + // + // we are done with the sample. now let media streaming terminal + // process it asynchronously. when the terminal is finished with + // the sample, this sample will be returned to us from the call + // to AllocateSample() + // + + hr = pStreamSample->Update(SSUPDATE_ASYNC, NULL, NULL, 0); + + // + // with some MSPs, starting the stream can be done asynchronously, so + // there may be a delay between the time when terminal is selected + // (or call connected) and the time when the stream becomes usable. + // + // attempting to use the stream before the stream is active would + // result in the Update() returning error VFW_E_NOT_COMMITTED. + // + // Usually an application would not start using the stream until + // it gets media event CME_STREAM_ACTIVE. This requires the app + // to register a callback interface by calling + // ITTAPI::RegisterCallNotifications. Refer to documentation and other + // samples for more details on how this is done. + // + + //Break the loop when we reach the end of the buffer or errors + if ( FAILED(hr) || ulPos == cb ) + { + pStreamSample->Release(); + pStreamSample = NULL; + + break; + } + + + // + // keep the sample we have just submitted. on exit, we will wait + // for it to be processed by mst + // + + if (!DestSampleQ.Enqueue(pStreamSample)) + { + break; + } + + } // IStream reading/sample-filling loop + + if ( SUCCEEDED ( hr ) ) + { + //There is no error here, so set the hr to S_OK in case that some engines + //stop calling Write() when hr is not S_OK. + hr = S_OK; + + // + // walk through the list of all the samples we have submitted and wait for + // each sample to be done + // + IStreamSample *pStreamSample = DestSampleQ.Dequeue(); + while (NULL != pStreamSample) + { + // ignore any error values + pStreamSample->CompletionStatus(COMPSTAT_WAIT, INFINITE); + pStreamSample->Release(); + pStreamSample = NULL; + + pStreamSample = DestSampleQ.Dequeue(); + } + if ( pStreamSample ) + { + pStreamSample->Release(); + pStreamSample = NULL; + } + } + + m_hCritSec.Unlock(); + return hr; +}; + +//////////////////////////////////////////////////////////////////////// +// Wait until the stream is active +// +HRESULT CTTSStream::WaitUntilReady( DWORD WaitTime) +{ + HRESULT hr = S_OK; + IStreamSample *pStreamSample = NULL; + + //only checks if the stream is active at the first time per connection + if ( !m_bFlag ) + { + return hr; + } + + hr = m_cpTTSMediaStream->AllocateSample(0, &pStreamSample); + + if ( SUCCEEDED ( hr ) ) + { + //0x80040211 is the error code of VFW_E_NOT_COMMITTED in DirectShow + //VFW_E_NOT_COMMITTED error means: + //"Cannot allocate a sample when the allocator is not active" + + DWORD dwStart = GetTickCount(); + do + { + hr = pStreamSample->Update(SSUPDATE_ASYNC, NULL, NULL, 0); + + }while ( (0x80040211 == hr) && ((GetTickCount() - dwStart) < WaitTime) ); + } + + if (pStreamSample) + { + pStreamSample->Release(); + pStreamSample = NULL; + } + + return hr; +} + +//////////////////////////////////////////////////////////////////////// +// This method is used by SAPI +// +STDMETHODIMP CTTSStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + // We only accept queries for the current stream position + if (STREAM_SEEK_CUR != dwOrigin || dlibMove.QuadPart) + { + return E_INVALIDARG; + } + + // Validate the OUT parameter + if (SPIsBadWritePtr(plibNewPosition, sizeof(ULARGE_INTEGER))) + { + return E_POINTER; + } + + m_hCritSec.Lock(); + + plibNewPosition->QuadPart = (LONG)dlibMove.LowPart; + + m_hCritSec.Unlock(); + + return S_OK; +} + +//////////////////////////////////////////////////////////////////////// +// This method is used by SAPI +// +STDMETHODIMP CTTSStream::GetFormat(GUID * pFmtId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + m_hCritSec.Lock(); + + HRESULT hr = S_OK; + + hr = m_StreamFormat.ParamValidateCopyTo( pFmtId, ppCoMemWaveFormatEx ); + + + m_hCritSec.Unlock(); + + return hr; +} diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.h b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.h new file mode 100644 index 00000000..2af49d58 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.h @@ -0,0 +1,114 @@ +// TTSStream.h : Declaration of the CTTSStream + +#ifndef __TTSSTREAM_H_ +#define __TTSSTREAM_H_ + +#include "resource.h" // main symbols +#include "sapi.h" + +#include +#include +#include "SAPI.h" +#include "sphelper.h" +#include +#include +#include +#include +#include +#include +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CTTSStream +class ATL_NO_VTABLE CTTSStream : + public CComObjectRootEx, + public CComCoClass, + public ISpStreamFormat, + public IDispatchImpl +{ +public: + CTTSStream() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_TTSSTREAM) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CTTSStream) + COM_INTERFACE_ENTRY(ITTSStream) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISpStreamFormat) + COM_INTERFACE_ENTRY(IStream) +END_COM_MAP() + +// ITTSStream +public: + + STDMETHOD(InitTTSCaptureStream)(IUnknown *pCaptureTerminal); + STDMETHOD(WaitUntilReady)(DWORD WaitTime); + void FinalRelease(); + + + // + // IStream + // + + STDMETHODIMP Read(void * pv, ULONG cb, ULONG * pcbRead) + { + return STG_E_ACCESSDENIED; + } + STDMETHODIMP Write(const void * pv, ULONG cb, ULONG * pcbWritten); + STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition); + STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize) + { + return STG_E_ACCESSDENIED; + } + STDMETHODIMP CopyTo(IStream *pStreamDest, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) + { + return E_NOTIMPL; + } + STDMETHODIMP Commit(DWORD grfCommitFlags) + { + return E_NOTIMPL; + } + STDMETHODIMP Revert(void) + { + return E_NOTIMPL; + } + STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) + { + return E_NOTIMPL; + } + STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) + { + return E_NOTIMPL; + } + STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag) + { + return E_NOTIMPL; + } + STDMETHODIMP Clone(IStream ** ppstm) + { + return E_NOTIMPL; + } + // + // ISpStreamFormat + // + STDMETHODIMP GetFormat(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); + + +public: + + CSpStreamFormat m_StreamFormat; + +private: + + CComAutoCriticalSection m_hCritSec; + CComPtr m_cpTTSMediaStream; + BOOL m_bFlag:1; + +}; + +#endif //__TTSSTREAM_H_ diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.rgs b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.rgs new file mode 100644 index 00000000..64380b41 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.rgs @@ -0,0 +1,26 @@ +HKCR +{ + STCustomStream.TTSStream.1 = s 'TTSStream Class' + { + CLSID = s '{B827D5CC-96FA-4A1E-9877-D54586D433F4}' + } + STCustomStream.TTSStream = s 'TTSStream Class' + { + CLSID = s '{B827D5CC-96FA-4A1E-9877-D54586D433F4}' + CurVer = s 'STCustomStream.TTSStream.1' + } + NoRemove CLSID + { + ForceRemove {B827D5CC-96FA-4A1E-9877-D54586D433F4} = s 'TTSStream Class' + { + ProgID = s 'STCustomStream.TTSStream.1' + VersionIndependentProgID = s 'STCustomStream.TTSStream' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{EDAEECD8-0D75-499E-9B69-187ACACF2C05}' + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/resource.h b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/resource.h new file mode 100644 index 00000000..1cec0f24 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by STCustomStream.rc +// +#define IDS_PROJNAME 100 +#define IDR_ASRSTREAM 101 +#define IDR_TTSSTREAM 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/version.rc2 new file mode 100644 index 00000000..4d8225ab --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/TapiCustomStream/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Tapi custom audio stream sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "Tapi custom audio stream sample\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "STCustomStream.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5.x samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.bmp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.cpp new file mode 100644 index 00000000..3d3a3c7d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.cpp @@ -0,0 +1,345 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + CComPtr cpAudio; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set rules to active, we are now listening for commands + hr = g_cpCmdGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + break; + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + } + } + break; + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + return ( 1 ); + + } + return ( 0 ); +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.h new file mode 100644 index 00000000..99d66a5c --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.h @@ -0,0 +1,39 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); + + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.rc b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.rc new file mode 100644 index 00000000..c29ccc6e --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.rc @@ -0,0 +1,112 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.xml b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.xml new file mode 100644 index 00000000..f3549018 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.xml @@ -0,0 +1,26 @@ + + + + + + + + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + +

counter

+

shop

+

store

+
+
+ +
diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffees0.dsp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffees0.dsp new file mode 100644 index 00000000..53600ff9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffees0.dsp @@ -0,0 +1,194 @@ +# Microsoft Developer Studio Project File - Name="coffees0" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=coffees0 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "coffees0.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "coffees0.mak" CFG="coffees0 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "coffees0 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "coffees0 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "coffees0 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "coffees0 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "coffees0 - Win32 Debug x86" +# Name "coffees0 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.ICO +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "XML" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "coffees0 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "coffees0 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/common.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/common.h new file mode 100644 index 00000000..338ded59 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/common.h @@ -0,0 +1,22 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/display.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/display.cpp new file mode 100644 index 00000000..028d0fe7 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/display.cpp @@ -0,0 +1,249 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/resource.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/resource.h new file mode 100644 index 00000000..4b35bfef --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/resource.h @@ -0,0 +1,54 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_FAILEDINIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/small.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.cpp new file mode 100644 index 00000000..c2905d4e --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/version.rc2 new file mode 100644 index 00000000..bf912a5a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 0 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees0\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees0.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.bmp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.cpp new file mode 100644 index 00000000..062e8b6e --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.cpp @@ -0,0 +1,489 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + CComPtr cpAudio; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set rules to active, we are now listening for commands + hr = g_cpCmdGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + break; + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + } + } + break; + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + } + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + KillTimer( hWnd, 0 ); + return ( 1 ); + } + return ( 0 ); +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.h new file mode 100644 index 00000000..99d66a5c --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.h @@ -0,0 +1,39 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); + + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.rc b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.rc new file mode 100644 index 00000000..684f4e0f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.rc @@ -0,0 +1,119 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.xml b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.xml new file mode 100644 index 00000000..9c9406ea --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + +

counter

+

shop

+

store

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + +
diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffees1.dsp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffees1.dsp new file mode 100644 index 00000000..db4df998 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffees1.dsp @@ -0,0 +1,202 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS1" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS1 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS1.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS1.mak" CFG="CoffeeS1 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS1 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS1 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS1 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS1 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS1 - Win32 Debug x86" +# Name "CoffeeS1 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\Coffee.bmp +# End Source File +# Begin Source File + +SOURCE=.\coffee.ico +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS1 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS1 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# Begin Source File + +SOURCE=.\itckrist.ttf +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/common.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/common.h new file mode 100644 index 00000000..6e4ccee9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/common.h @@ -0,0 +1,29 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/display.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/display.cpp new file mode 100644 index 00000000..028d0fe7 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/display.cpp @@ -0,0 +1,249 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/resource.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/resource.h new file mode 100644 index 00000000..3b973e80 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/resource.h @@ -0,0 +1,54 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_FAILEDINIT 138 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/small.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/version.rc2 new file mode 100644 index 00000000..f1df95f7 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 1 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees1\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees1.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.bmp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.cpp new file mode 100644 index 00000000..66d53818 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.cpp @@ -0,0 +1,589 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + CComPtr cpAudio; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + break; + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + } + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd ); + return ( 1 ); + + case WM_INITPANE: + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } +} + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.h new file mode 100644 index 00000000..74e0fe44 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.h @@ -0,0 +1,42 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd ); + + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.rc b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.rc new file mode 100644 index 00000000..77ae5003 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.rc @@ -0,0 +1,122 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the SAPI coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.xml b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.xml new file mode 100644 index 00000000..03eed6f9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + +
diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffees2.dsp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffees2.dsp new file mode 100644 index 00000000..199f6840 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffees2.dsp @@ -0,0 +1,198 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS2 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS2.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS2.mak" CFG="CoffeeS2 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS2 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS2 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS2 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS2 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS2 - Win32 Debug x86" +# Name "CoffeeS2 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\Coffee.bmp +# End Source File +# Begin Source File + +SOURCE=.\coffee.ico +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS2 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS2 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/common.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/common.h new file mode 100644 index 00000000..786bca60 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/common.h @@ -0,0 +1,32 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/display.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/display.cpp new file mode 100644 index 00000000..469f8ca4 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/display.cpp @@ -0,0 +1,300 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/resource.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/resource.h new file mode 100644 index 00000000..5d5233af --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/resource.h @@ -0,0 +1,57 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_FAILEDINIT 141 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/small.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/version.rc2 new file mode 100644 index 00000000..086aafdd --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 2 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees2\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees2.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.bmp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.cpp new file mode 100644 index 00000000..19c91f29 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.cpp @@ -0,0 +1,631 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + // Let the entry pane know its time to do initialization work + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + CComPtr cpAudio; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + // Get the default voice associated with our reco context + hr = g_cpRecoCtxt->GetVoice(&g_cpVoice); + if ( FAILED( hr ) ) + { + break; + } + + break; + + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } + // Release voice, if created + if ( g_cpVoice ) + { + g_cpVoice.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_INITPANE: + { + TCHAR tBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + // Speak the welcome prompt, and do not wait for the operation to complete + g_cpVoice->Speak( T2W(tBuf), SPF_ASYNC, NULL); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Speak the order + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + + } + + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + // Speak the didn't understand string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd ); + return ( 1 ); + + case WM_INITPANE: + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.h new file mode 100644 index 00000000..712b14d6 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.h @@ -0,0 +1,43 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +CComPtr g_cpVoice; // Pointer to our tts voice +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd ); + + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.rc b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.rc new file mode 100644 index 00000000..77ae5003 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.rc @@ -0,0 +1,122 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the SAPI coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.xml b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.xml new file mode 100644 index 00000000..03eed6f9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + +
diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffees3.dsp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffees3.dsp new file mode 100644 index 00000000..98eead6f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffees3.dsp @@ -0,0 +1,194 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS3" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS3 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS3.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS3.mak" CFG="CoffeeS3 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS3 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS3 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS3 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS3 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS3 - Win32 Debug x86" +# Name "CoffeeS3 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.ICO +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS3 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS3 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/common.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/common.h new file mode 100644 index 00000000..786bca60 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/common.h @@ -0,0 +1,32 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/display.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/display.cpp new file mode 100644 index 00000000..469f8ca4 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/display.cpp @@ -0,0 +1,300 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/resource.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/resource.h new file mode 100644 index 00000000..5d5233af --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/resource.h @@ -0,0 +1,57 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_FAILEDINIT 141 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/small.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/version.rc2 new file mode 100644 index 00000000..ceebba85 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 3 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees3\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees3.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.bmp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.cpp new file mode 100644 index 00000000..32fec4ce --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.cpp @@ -0,0 +1,890 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + // Let the entry pane know its time to do initialization work + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + // Call the current pane's handler first + (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + // Get the default voice associated with our reco context + hr = g_cpRecoCtxt->GetVoice(&g_cpVoice); + if ( FAILED( hr ) ) + { + break; + } + + break; + + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } + // Release voice, if created + if ( g_cpVoice ) + { + g_cpVoice.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + + case VID_Manage: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Employees: + PostMessage( hWnd, WM_MANAGEEMPLOYEES, NULL, NULL ); + break; + } + } + break; + + case VID_HearTheVoice: + { + PostMessage( hWnd, WM_HEARTHEVOICE, NULL, NULL ); + } + break; + + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_INITPANE: + { + TCHAR tBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + // Speak the welcome prompt, and do not wait for the operation to complete + g_cpVoice->Speak( T2W(tBuf), SPF_ASYNC, NULL); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Speak the order + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + + } + + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + // Speak the didn't understand string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + HRESULT hr; + + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_MANAGEEMPLOYEES: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = ManageEmployeesPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd ); + return ( 1 ); + + case WM_INITPANE: + // Set management rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } +} + +/****************************************************************************** +* ManageEmployeesPaneProc * +*-------------------------* +* Description: +* Handles messages specifically for the manage employees pane. +* +******************************************************************************/ +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + static ULONG ulNumTokens; + static ULONG ulCurToken; + static WCHAR** ppszTokenIds; + static CSpDynamicString* ppcDesciptionString; // This is string helper class in sphelper.h + + switch ( message ) + { + case WM_GOTOOFFICE: + { + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + { + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + case WM_PAINT: + { + // Do the actual UI paint + ManageEmployeesPanePaint( hWnd, ulNumTokens, ppcDesciptionString, ulCurToken ); + return ( 1 ); + } + + case WM_INITPANE: + { + ISpObjectToken *pToken = NULL; // Token interface pointer + CComPtr cpEnum; // Pointer to token enumerator + ULONG ulIndex = 0; + ulCurToken = 0xffffffff; + + // Get a token enumerator for tts voices available + HRESULT hr = SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum); + if ( S_OK == hr ) + { + // Get the numbers of tokens found + hr = cpEnum->GetCount( &ulNumTokens ); + + if ( SUCCEEDED( hr ) && 0 != ulNumTokens ) + { + // Create arrays we need for storing data + ppcDesciptionString = new CSpDynamicString [ulNumTokens]; + if ( NULL == ppcDesciptionString ) + { + hr = E_OUTOFMEMORY; + break; + } + + ppszTokenIds = new WCHAR* [ulNumTokens]; + if ( NULL == ppszTokenIds ) + { + hr = E_OUTOFMEMORY; + break; + } + ZeroMemory( ppszTokenIds, ulNumTokens*sizeof( WCHAR* ) ); + + // Get the next token in the enumeration + // State is maintained in the enumerator + while (cpEnum->Next(1, &pToken, NULL) == S_OK) + { + // Get a string which describes the token, in our case, the voice name + hr = SpGetDescription( pToken, &ppcDesciptionString[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Get the token id, for a low overhead way to retrieve the token later + // without holding on to the object itself + hr = pToken->GetId( &ppszTokenIds[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + ulIndex++; + + // Release the token itself + pToken->Release(); + pToken = NULL; + } + } + + // if we've failed to properly initialize, then we should completely shut-down + if ( S_OK != hr ) + { + if ( pToken ) + { + pToken->Release(); + } + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + } + // Find out which token corresponds to our voice which is currently in use + else + { + WCHAR *pszCurTokenId = NULL; + + // Get the token representing the current voice + HRESULT hr = g_cpVoice->GetVoice( &pToken ); + if ( SUCCEEDED( hr ) ) + { + // Get the current token ID, and compare it against others to figure out + // which desciption string is the one currently selected. + hr = pToken->GetId( &pszCurTokenId ); + if ( SUCCEEDED( hr ) ) + { + ulIndex = 0; + while ( ulIndex < ulNumTokens && + 0 != _wcsicmp( pszCurTokenId, ppszTokenIds[ulIndex] ) ) + { + ulIndex++; + } + + // We found it, so set the current index to that of the current token + if ( ulIndex < ulNumTokens ) + { + ulCurToken = ulIndex; + } + + CoTaskMemFree( pszCurTokenId ); + } + + pToken->Release(); + + } + + } + + } + + // Set the hear voice rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + return ( 1 ); + } + + case WM_DESTROY: + // Windows is closing down, so we should cleanup + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + return ( 1 ); + + case WM_HEARTHEVOICE: + // Set the voice to play + LoadString( g_hInst, IDS_VOICESPEAK, g_szCounterDisplay, MAX_LOADSTRING ); + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL ); + } + return ( 0 ); +} + +/****************************************************************************** +* ManageEmployeesPaneCleanup * +*----------------------------* +* Description: +* Helper function to cleanup objects allocated while the ManageEmployees +* pane is running. +* +******************************************************************************/ +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens) +{ + ULONG ulIndex; + + // Free all allocated token ids + if ( ppszTokenIds ) + { + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + if ( NULL != ppszTokenIds[ulIndex] ) + { + CoTaskMemFree( ppszTokenIds[ulIndex] ); + } + } + + delete [] ppszTokenIds; + } + + if ( ppcDesciptionString ) + { + delete [] ppcDesciptionString; + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.h new file mode 100644 index 00000000..8e613441 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.h @@ -0,0 +1,48 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +CComPtr g_cpVoice; // Pointer to our tts voice +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd ); +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, + CSpDynamicString* ppcDesciptionString, ULONG ulCurToken); + + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.rc b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.rc new file mode 100644 index 00000000..ca610473 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.rc @@ -0,0 +1,132 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the SAPI coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_MANAGEEMPLOYEES "Manage the Employees" + IDS_EMPLOYEEDUTY "Employee On Duty:" + IDS_VOICESPEAK "I will be the best employee you've ever had. Let me work." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HEARTHEM "Hear Them Speak!" + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.xml b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.xml new file mode 100644 index 00000000..33219a3f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + Please +

Manage

+ the + +
+ +

Hear Them Speak

+
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + + + +

employees

+
+
+
diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffees4.dsp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffees4.dsp new file mode 100644 index 00000000..86c95a6d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffees4.dsp @@ -0,0 +1,190 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS4" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS4 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS4.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS4.mak" CFG="CoffeeS4 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS4 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS4 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS4 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS4 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS4 - Win32 Debug x86" +# Name "CoffeeS4 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.ICO +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS4 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS4 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/common.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/common.h new file mode 100644 index 00000000..69055fbc --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/common.h @@ -0,0 +1,34 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define WM_MANAGEEMPLOYEES WM_USER+212 // Notification to go to employee management pane +#define WM_HEARTHEVOICE WM_USER+213 // The User wants to hear the selected employee speak +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/display.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/display.cpp new file mode 100644 index 00000000..ce12b4fa --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/display.cpp @@ -0,0 +1,408 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sphelper.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* ManageEmployeesPanePaint * +*---------------------------* +* Description: +* Do the paint on the manage employees pane. +* +******************************************************************************/ +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken) +{ + USES_CONVERSION; + + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 200; + LoadString( g_hInst, IDS_EMPLOYEEDUTY, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + if ( 8 < ulNumTokens ) + { + ulNumTokens = 8; + } + ULONG ulIndex = 0; + rc.bottom +=5; + while( ulIndex < ulNumTokens ) + { + TCHAR * pszTitle = W2T( ppcDesciptionString[ulIndex] ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, pszTitle, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != ulCurToken ) + { + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + + ulIndex++; + + } + + LoadString( g_hInst, IDS_HEARTHEM, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = ( clientRC.bottom - iHeight ) - 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/resource.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/resource.h new file mode 100644 index 00000000..8562daf3 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/resource.h @@ -0,0 +1,61 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_MANAGEEMPLOYEES 141 +#define IDS_EMPLOYEEDUTY 142 +#define IDS_VOICESPEAK 143 +#define IDS_HEARTHEM 144 +#define IDS_FAILEDINIT 145 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/small.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/version.rc2 new file mode 100644 index 00000000..4aedb696 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 4 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees4\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees4.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.bmp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.cpp new file mode 100644 index 00000000..c78194ec --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.cpp @@ -0,0 +1,1016 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include // Defines for dynamic grammars +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + // Let the entry pane know its time to do initialization work + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + // Call the current pane's handler first + (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + // Get the default voice associated with our reco context + hr = g_cpRecoCtxt->GetVoice(&g_cpVoice); + if ( FAILED( hr ) ) + { + break; + } + + break; + + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } + // Release voice, if created + if ( g_cpVoice ) + { + g_cpVoice.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + + case VID_Manage: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Employees: + PostMessage( hWnd, WM_MANAGEEMPLOYEES, NULL, NULL ); + break; + } + } + break; + + case VID_HearTheVoice: + { + PostMessage( hWnd, WM_HEARTHEVOICE, NULL, NULL ); + } + break; + + case VID_OtherRules: + { + PostMessage( hWnd, WM_MISCCOMMAND, NULL, + (LPARAM) pElements->pProperties->vValue.ulVal ); + } + break; + + case DYN_TTSVOICERULE: + { + PostMessage( hWnd, WM_TTSVOICESEL, NULL, + (LPARAM) pElements->pProperties->vValue.ulVal ); + } + break; + + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_INITPANE: + { + TCHAR tBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + // Speak the welcome prompt, and do not wait for the operation to complete + g_cpVoice->Speak( T2W(tBuf), SPF_ASYNC, NULL); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Speak the order + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + + } + + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + // Speak the didn't understand string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + HRESULT hr; + + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_MANAGEEMPLOYEES: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = ManageEmployeesPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, 2 ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd ); + return ( 1 ); + + case WM_INITPANE: + // Set management rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } +} + +/****************************************************************************** +* ManageEmployeesPaneProc * +*-------------------------* +* Description: +* Handles messages specifically for the manage employees pane. +* +******************************************************************************/ +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + static ULONG ulNumTokens; + static ULONG ulCurToken; + static WCHAR** ppszTokenIds; + static CSpDynamicString* ppcDesciptionString; // This is string helper class in sphelper.h + static UINT iCurEnum; // Indicates if we should list males, females, or both + + switch ( message ) + { + case WM_GOTOOFFICE: + { + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + { + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + case WM_PAINT: + { + // Do the actual UI paint + ManageEmployeesPanePaint( hWnd, ulNumTokens, ppcDesciptionString, ulCurToken, iCurEnum ); + return ( 1 ); + } + + case WM_INITPANE: + { + ISpObjectToken *pToken = NULL; // Token interface pointer + CComPtr cpEnum; // Pointer to token enumerator + ULONG ulIndex = 0; + ulCurToken = 0xffffffff; + WCHAR *szRequiredAttributes = NULL; + SPSTATEHANDLE hDynamicRuleHandle; // Handle to our dynamic rule + + // Set the required attributes field for the enum if we have special needs + // based on our LPARAM in + if ( 0 == lParam ) + { + szRequiredAttributes = L"Gender=Male"; + } + else if ( 1 == lParam ) + { + szRequiredAttributes = L"Gender=Female"; + } + + // Get a token enumerator for tts voices available + HRESULT hr = SpEnumTokens(SPCAT_VOICES, szRequiredAttributes, NULL, &cpEnum); + if ( S_OK == hr ) + { + // Get the numbers of tokens found + hr = cpEnum->GetCount( &ulNumTokens ); + + if ( SUCCEEDED( hr ) && 0 != ulNumTokens ) + { + // Create arrays we need for storing data + ppcDesciptionString = new CSpDynamicString [ulNumTokens]; + if ( NULL == ppcDesciptionString ) + { + hr = E_OUTOFMEMORY; + break; + } + + ppszTokenIds = new WCHAR* [ulNumTokens]; + if ( NULL == ppszTokenIds ) + { + hr = E_OUTOFMEMORY; + break; + } + ZeroMemory( ppszTokenIds, ulNumTokens*sizeof( WCHAR* ) ); + + // Get the next token in the enumeration + // State is maintained in the enumerator + while (cpEnum->Next(1, &pToken, NULL) == S_OK) + { + // Get a string which describes the token, in our case, the voice name + hr = SpGetDescription( pToken, &ppcDesciptionString[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Get the token id, for a low overhead way to retrieve the token later + // without holding on to the object itself + hr = pToken->GetId( &ppszTokenIds[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + ulIndex++; + + // Release the token itself + pToken->Release(); + pToken = NULL; + } + } + + // if we've failed to properly initialize, then we should completely shut-down + if ( S_OK != hr ) + { + if ( pToken ) + { + pToken->Release(); + } + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + } + // Find out which token corresponds to our voice which is currently in use + else + { + WCHAR *pszCurTokenId = NULL; + + // Get the token representing the current voice + HRESULT hr = g_cpVoice->GetVoice( &pToken ); + if ( SUCCEEDED( hr ) ) + { + // Get the current token ID, and compare it against others to figure out + // which desciption string is the one currently selected. + hr = pToken->GetId( &pszCurTokenId ); + if ( SUCCEEDED( hr ) ) + { + ulIndex = 0; + while ( ulIndex < ulNumTokens && + 0 != _wcsicmp( pszCurTokenId, ppszTokenIds[ulIndex] ) ) + { + ulIndex++; + } + + // We found it, so set the current index to that of the current token + if ( ulIndex < ulNumTokens ) + { + ulCurToken = ulIndex; + } + + CoTaskMemFree( pszCurTokenId ); + } + + pToken->Release(); + + } + + } + + } + + // Initially, we see both genders + _ASSERTE( lParam >= 0 && lParam <= 2); + iCurEnum = lParam; + + // Create a dynamic rule containing the description strings of the voice tokens + hr = g_cpCmdGrammar->GetRule(NULL, DYN_TTSVOICERULE, SPRAF_TopLevel | SPRAF_Active | SPRAF_Dynamic, TRUE, &hDynamicRuleHandle); + if ( SUCCEEDED( hr ) ) + { + // Clear the rule first + hr = g_cpCmdGrammar->ClearRule( hDynamicRuleHandle ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Commit the changes + hr = g_cpCmdGrammar->Commit(0); + _ASSERTE( SUCCEEDED( hr ) ); + + // Add description names as the word, ulIndex as id + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + SPPROPERTYINFO prop; + prop.pszName = L"Id"; + prop.pszValue = L"Property"; + prop.vValue.vt = VT_I4; + prop.vValue.ulVal = ulIndex; + hr = g_cpCmdGrammar->AddWordTransition( hDynamicRuleHandle, NULL, ppcDesciptionString[ulIndex], L" ", + SPWT_LEXICAL, 1.0, &prop); + _ASSERTE( SUCCEEDED( hr ) ); + } + + // Commit the changes + hr = g_cpCmdGrammar->Commit(0); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the dynamic rules to active + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + } + + // Set the hear voice rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_DESTROY: + // Windows is closing down, so we should cleanup + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + return ( 1 ); + + case WM_HEARTHEVOICE: + // Set the voice to play + LoadString( g_hInst, IDS_VOICESPEAK, g_szCounterDisplay, MAX_LOADSTRING ); + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL ); + return ( 1 ); + + case WM_MISCCOMMAND: + { + // Find out the offset from the first property we're interested in, so we can verify that + // it's within range. + int iSelection = lParam - VID_MalesOnly; + if ( 0 <= iSelection && 2 >= iSelection ) + { + // If we have a new listing criteria, we basically shutdown the pane and start it again + if ( (UINT) iSelection != iCurEnum ) + { + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + PostMessage( hWnd, WM_INITPANE, 0, (LPARAM) iSelection ); + } + } + return ( 1 ); + } + + case WM_TTSVOICESEL: + { + // If we are out of range, it is a programming error + _ASSERTE( 0 <= lParam && ulNumTokens > (ULONG) lParam ); + + // The returned Id is an index into our tokenId table, so create a token from the id + CComPtr< ISpObjectToken > pToken; + HRESULT hr = SpGetTokenFromId( ppszTokenIds[lParam], &pToken, FALSE); + if ( SUCCEEDED( hr ) ) + { + // Set our current voice from the returned token + hr = g_cpVoice->SetVoice( pToken ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Change our current voice index + ulCurToken = lParam; + } + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + } + return ( 0 ); +} + +/****************************************************************************** +* ManageEmployeesPaneCleanup * +*----------------------------* +* Description: +* Helper function to cleanup objects allocated while the ManageEmployees +* pane is running. +* +******************************************************************************/ +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens) +{ + ULONG ulIndex; + + // Free all allocated token ids + if ( ppszTokenIds ) + { + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + if ( NULL != ppszTokenIds[ulIndex] ) + { + CoTaskMemFree( ppszTokenIds[ulIndex] ); + } + } + + delete [] ppszTokenIds; + } + + if ( ppcDesciptionString ) + { + delete [] ppcDesciptionString; + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.h new file mode 100644 index 00000000..c6d09e13 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.h @@ -0,0 +1,48 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +CComPtr g_cpVoice; // Pointer to our tts voice +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd ); +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken, UINT iEnumType ); + + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.rc b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.rc new file mode 100644 index 00000000..88a22081 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.rc @@ -0,0 +1,136 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the SAPI coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_MANAGEEMPLOYEES "Manage the Employees" + IDS_EMPLOYEEDUTY "Employee On Duty:" + IDS_VOICESPEAK "I will be the best employee you've ever had. Let me work." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HEARTHEM "Hear Them Speak!" + IDS_SHOW "Show:" + IDS_MALESONLY "Males Only" + IDS_FEMALESONLY "Females Only" + IDS_BOTHGENDERS "Both Genders" + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.xml b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.xml new file mode 100644 index 00000000..89a39974 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + Please +

Manage

+ the + +
+ +

Hear Them Speak

+
+ + +

?Show Males Only

+

?Show Females Only

+

?Show Both Genders

+
+
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + + + +

employees

+
+
+
diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffees5.dsp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffees5.dsp new file mode 100644 index 00000000..b58f58db --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffees5.dsp @@ -0,0 +1,178 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS5" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS5 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS5.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS5.mak" CFG="CoffeeS5 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS5 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS5 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS5 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS5 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS5 - Win32 Debug x86" +# Name "CoffeeS5 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "Xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS5 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\Coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS5 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/common.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/common.h new file mode 100644 index 00000000..41fa0e5f --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/common.h @@ -0,0 +1,37 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define WM_MANAGEEMPLOYEES WM_USER+212 // Notification to go to employee management pane +#define WM_HEARTHEVOICE WM_USER+213 // The User wants to hear the selected employee speak +#define WM_MISCCOMMAND WM_USER+214 // Notification that something described under "other commands" was recognized +#define WM_TTSVOICESEL WM_USER+215 // Notification that the user selected a voice +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order +#define DYN_TTSVOICERULE 1001 // ID for the dynamic tts voice rule + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/display.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/display.cpp new file mode 100644 index 00000000..938bc669 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/display.cpp @@ -0,0 +1,442 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sphelper.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* ManageEmployeesPanePaint * +*---------------------------* +* Description: +* Do the paint on the manage employees pane. +* +******************************************************************************/ +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken, UINT iEnumType ) +{ + USES_CONVERSION; + + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 200; + LoadString( g_hInst, IDS_EMPLOYEEDUTY, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + if ( 8 < ulNumTokens ) + { + ulNumTokens = 8; + } + ULONG ulIndex = 0; + rc.bottom +=5; + while( ulIndex < ulNumTokens ) + { + TCHAR * pszTitle = W2T( ppcDesciptionString[ulIndex] ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, pszTitle, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != ulCurToken ) + { + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + + ulIndex++; + + } + + LoadString( g_hInst, IDS_HEARTHEM, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = ( clientRC.bottom - iHeight ) - 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_SHOW, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 50; + rc.right += 50; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.bottom +=5; + for ( ulIndex = 0; ulIndex < 3; ulIndex++ ) + { + LoadString( g_hInst, IDS_MALESONLY+ulIndex, tBuf, MAX_LOADSTRING ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 75; + rc.right += 75; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != iEnumType ) + { + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + } + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/resource.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/resource.h new file mode 100644 index 00000000..ebc0567c --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/resource.h @@ -0,0 +1,65 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_MANAGEEMPLOYEES 141 +#define IDS_EMPLOYEEDUTY 142 +#define IDS_VOICESPEAK 143 +#define IDS_HEARTHEM 144 +#define IDS_SHOW 145 +#define IDS_MALESONLY 146 +#define IDS_FEMALESONLY 147 +#define IDS_BOTHGENDERS 148 +#define IDS_FAILEDINIT 149 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/small.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/version.rc2 new file mode 100644 index 00000000..74efacb5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 5 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees5\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees5.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.bmp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.bmp differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.cpp new file mode 100644 index 00000000..0656a4f2 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.cpp @@ -0,0 +1,1162 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include // Contains definitions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + // Initialize shop name string + TCHAR tLoadBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_SHOPNAME, g_szShopName, NORMAL_LOADSTRING ); + LoadString( g_hInst, IDS_WELCOME, tLoadBuf, MAX_LOADSTRING ); + _stprintf( g_szCounterDisplay, tLoadBuf, g_szShopName ); + + // Let the entry pane know its time to do initialization work + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + // Call the current pane's handler first + (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + // Get the default voice associated with our reco context + hr = g_cpRecoCtxt->GetVoice(&g_cpVoice); + if ( FAILED( hr ) ) + { + break; + } + + break; + + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } + // Release voice, if created + if ( g_cpVoice ) + { + g_cpVoice.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpRecoResult *pPhrase, HWND hWnd) +{ + USES_CONVERSION; + + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + + case VID_Manage: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Employees: + PostMessage( hWnd, WM_MANAGEEMPLOYEES, NULL, NULL ); + break; + + case VID_ShopName: + PostMessage( hWnd, WM_MANAGENAME, NULL, NULL ); + break; + } + } + break; + + case VID_HearTheVoice: + { + PostMessage( hWnd, WM_HEARTHEVOICE, NULL, NULL ); + } + break; + + case VID_OtherRules: + { + PostMessage( hWnd, WM_MISCCOMMAND, NULL, + (LPARAM) pElements->pProperties->vValue.ulVal ); + } + break; + + case DYN_TTSVOICERULE: + { + PostMessage( hWnd, WM_TTSVOICESEL, NULL, + (LPARAM) pElements->pProperties->vValue.ulVal ); + } + break; + + case VID_Rename: + { + WCHAR *wszCoMemNameText = NULL; + WCHAR *wszCoMemValueText = NULL; + + // Figure out where dictation starts and get that text + // Since we know how many words are in our rule ( 5 ) we can get the text + // after them, which will be the dictation. + if ( 5 <= pElements->Rule.ulCountOfElements ) + { + if ( SUCCEEDED( pPhrase->GetText( 5, pElements->Rule.ulCountOfElements - 5, FALSE, + &wszCoMemNameText, NULL ) ) ) + { + int ilen = wcslen( pElements->pProperties->pszName ); + ilen = (ilen + wcslen( wszCoMemNameText ) + 2) * sizeof(WCHAR); + wszCoMemValueText = (WCHAR *) CoTaskMemAlloc( ilen ); + if ( wszCoMemValueText ) + { + wcscpy( wszCoMemValueText, pElements->pProperties->pszName ); + wcscat( wszCoMemValueText, L" " ); + wcscat( wszCoMemValueText, wszCoMemNameText ); + + // Copy new shop name to global shop name + _tcsncpy( g_szShopName, W2T(wszCoMemNameText), NORMAL_LOADSTRING - 1 ); + PostMessage( hWnd, WM_RENAMEWINDOW, 0, (LPARAM) wszCoMemValueText ); + + CoTaskMemFree( wszCoMemNameText ); + } + } + } + } + break; + + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_INITPANE: + { + TCHAR tLoadBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_WELCOME, tLoadBuf, MAX_LOADSTRING ); + _stprintf( g_szCounterDisplay, tLoadBuf, g_szShopName ); + + // Speak the welcome prompt, and do not wait for the operation to complete + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd, g_szShopName ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Speak the order + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + + } + + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + // Speak the didn't understand string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + HRESULT hr; + + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_MANAGEEMPLOYEES: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = ManageEmployeesPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, 2 ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_MANAGENAME: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = ChangeNamePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, 0 ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd, g_szShopName); + return ( 1 ); + + case WM_INITPANE: + // Set management rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + // Some panes only want to know about this if a significant amount of time has passed + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } + PostMessage( hWnd, WM_FALSERECO, 0, 0 ); +} + +/****************************************************************************** +* ManageEmployeesPaneProc * +*-------------------------* +* Description: +* Handles messages specifically for the manage employees pane. +* +******************************************************************************/ +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + static ULONG ulNumTokens; + static ULONG ulCurToken; + static WCHAR** ppszTokenIds; + static CSpDynamicString* ppcDesciptionString; // This is string helper class in sphelper.h + static UINT iCurEnum; // Indicates if we should list males, females, or both + + switch ( message ) + { + case WM_GOTOOFFICE: + { + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + { + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + case WM_PAINT: + { + // Do the actual UI paint + ManageEmployeesPanePaint( hWnd, ulNumTokens, ppcDesciptionString, ulCurToken, iCurEnum ); + return ( 1 ); + } + + case WM_INITPANE: + { + ISpObjectToken *pToken = NULL; // Token interface pointer + CComPtr cpEnum; // Pointer to token enumerator + ULONG ulIndex = 0; + ulCurToken = 0xffffffff; + WCHAR *szRequiredAttributes = NULL; + SPSTATEHANDLE hDynamicRuleHandle; // Handle to our dynamic rule + + // Set the required attributes field for the enum if we have special needs + // based on our LPARAM in + if ( 0 == lParam ) + { + szRequiredAttributes = L"Gender=Male"; + } + else if ( 1 == lParam ) + { + szRequiredAttributes = L"Gender=Female"; + } + + // Get a token enumerator for tts voices available + HRESULT hr = SpEnumTokens(SPCAT_VOICES, szRequiredAttributes, NULL, &cpEnum); + if ( S_OK == hr ) + { + // Get the numbers of tokens found + hr = cpEnum->GetCount( &ulNumTokens ); + + if ( SUCCEEDED( hr ) && 0 != ulNumTokens ) + { + // Create arrays we need for storing data + ppcDesciptionString = new CSpDynamicString [ulNumTokens]; + if ( NULL == ppcDesciptionString ) + { + hr = E_OUTOFMEMORY; + break; + } + + ppszTokenIds = new WCHAR* [ulNumTokens]; + if ( NULL == ppszTokenIds ) + { + hr = E_OUTOFMEMORY; + break; + } + ZeroMemory( ppszTokenIds, ulNumTokens*sizeof( WCHAR* ) ); + + // Get the next token in the enumeration + // State is maintained in the enumerator + while (cpEnum->Next(1, &pToken, NULL) == S_OK) + { + // Get a string which describes the token, in our case, the voice name + hr = SpGetDescription( pToken, &ppcDesciptionString[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Get the token id, for a low overhead way to retrieve the token later + // without holding on to the object itself + hr = pToken->GetId( &ppszTokenIds[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + ulIndex++; + + // Release the token itself + pToken->Release(); + pToken = NULL; + } + } + + // if we've failed to properly initialize, then we should completely shut-down + if ( S_OK != hr ) + { + if ( pToken ) + { + pToken->Release(); + } + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + } + // Find out which token corresponds to our voice which is currently in use + else + { + WCHAR *pszCurTokenId = NULL; + + // Get the token representing the current voice + HRESULT hr = g_cpVoice->GetVoice( &pToken ); + if ( SUCCEEDED( hr ) ) + { + // Get the current token ID, and compare it against others to figure out + // which desciption string is the one currently selected. + hr = pToken->GetId( &pszCurTokenId ); + if ( SUCCEEDED( hr ) ) + { + ulIndex = 0; + while ( ulIndex < ulNumTokens && + 0 != _wcsicmp( pszCurTokenId, ppszTokenIds[ulIndex] ) ) + { + ulIndex++; + } + + // We found it, so set the current index to that of the current token + if ( ulIndex < ulNumTokens ) + { + ulCurToken = ulIndex; + } + + CoTaskMemFree( pszCurTokenId ); + } + + pToken->Release(); + + } + + } + + } + + // Initially, we see both genders + _ASSERTE( lParam >= 0 && lParam <= 2); + iCurEnum = lParam; + + // Create a dynamic rule containing the description strings of the voice tokens + hr = g_cpCmdGrammar->GetRule(NULL, DYN_TTSVOICERULE, SPRAF_TopLevel | SPRAF_Active | SPRAF_Dynamic, TRUE, &hDynamicRuleHandle); + if ( SUCCEEDED( hr ) ) + { + // Clear the rule first + hr = g_cpCmdGrammar->ClearRule( hDynamicRuleHandle ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Commit the changes + hr = g_cpCmdGrammar->Commit(0); + _ASSERTE( SUCCEEDED( hr ) ); + + // Add description names as the word, ulIndex as id + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + SPPROPERTYINFO prop; + prop.pszName = L"Id"; + prop.pszValue = L"Property"; + prop.vValue.vt = VT_I4; + prop.vValue.ulVal = ulIndex; + hr = g_cpCmdGrammar->AddWordTransition( hDynamicRuleHandle, NULL, ppcDesciptionString[ulIndex], L" ", + SPWT_LEXICAL, 1.0, &prop); + _ASSERTE( SUCCEEDED( hr ) ); + } + + // Commit the changes + hr = g_cpCmdGrammar->Commit(0); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the dynamic rules to active + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + } + + // Set the hear voice rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_DESTROY: + // Windows is closing down, so we should cleanup + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + return ( 1 ); + + case WM_HEARTHEVOICE: + // Set the voice to play + LoadString( g_hInst, IDS_VOICESPEAK, g_szCounterDisplay, MAX_LOADSTRING ); + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL ); + return ( 1 ); + + case WM_MISCCOMMAND: + { + // Find out the offset from the first property we're interested in, so we can verify that + // it's within range. + int iSelection = lParam - VID_MalesOnly; + if ( 0 <= iSelection && 2 >= iSelection ) + { + // If we have a new listing criteria, we basically shutdown the pane and start it again + if ( (UINT) iSelection != iCurEnum ) + { + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + PostMessage( hWnd, WM_INITPANE, 0, (LPARAM) iSelection ); + } + } + return ( 1 ); + } + + case WM_TTSVOICESEL: + { + // If we are out of range, it is a programming error + _ASSERTE( 0 <= lParam && ulNumTokens > (ULONG) lParam ); + + // The returned Id is an index into our tokenId table, so create a token from the id + CComPtr< ISpObjectToken > pToken; + HRESULT hr = SpGetTokenFromId( ppszTokenIds[lParam], &pToken, FALSE); + if ( SUCCEEDED( hr ) ) + { + // Set our current voice from the returned token + hr = g_cpVoice->SetVoice( pToken ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Change our current voice index + ulCurToken = lParam; + } + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + } + return ( 0 ); +} + +/****************************************************************************** +* ManageEmployeesPaneCleanup * +*----------------------------* +* Description: +* Helper function to cleanup objects allocated while the ManageEmployees +* pane is running. +* +******************************************************************************/ +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens) +{ + ULONG ulIndex; + + // Free all allocated token ids + if ( ppszTokenIds ) + { + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + if ( NULL != ppszTokenIds[ulIndex] ) + { + CoTaskMemFree( ppszTokenIds[ulIndex] ); + } + } + + delete [] ppszTokenIds; + } + + if ( ppcDesciptionString ) + { + delete [] ppcDesciptionString; + } +} + +/****************************************************************************** +* ChangeNamePaneProc * +*--------------------* +* Description: +* Handles messages specifically for the change name pane. +* +******************************************************************************/ +LRESULT ChangeNamePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + HRESULT hr; + + switch ( message ) + { + case WM_GOTOOFFICE: + case WM_GOTOCOUNTER: + { + hr = g_cpCmdGrammar->SetRuleIdState( VID_Rename, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + if ( WM_GOTOOFFICE == message ) + { + g_fpCurrentPane = OfficePaneProc; + } + else if ( WM_GOTOCOUNTER == message ) + { + g_fpCurrentPane = CounterPaneProc; + } + + KillTimer( hWnd, 0 ); + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + InvalidateRect( hWnd, NULL, TRUE ); + + return ( 1 ); + } + + case WM_PAINT: + { + // Do the actual UI paint + ChangeNamePanePaint( hWnd, g_szCounterDisplay); + return ( 1 ); + } + + case WM_INITPANE: + { + // Set the initial display + LoadString( g_hInst, IDS_NAMEPROMPT, g_szCounterDisplay, MAX_LOADSTRING ); + + // Set the hear voice rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_Rename, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_RENAMEWINDOW: + { + KillTimer( hWnd, 0 ); + + if ( lParam ) + { + _tcscpy( g_szCounterDisplay, W2T((LPWSTR) lParam) ); + } + CoTaskMemFree( (LPWSTR) lParam ); + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + } + + case WM_TIMER: + KillTimer( hWnd, 0 ); + // Set the initial display + LoadString( g_hInst, IDS_NAMEPROMPT, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + return ( 1 ); + + + } + return ( 0 ); +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.h new file mode 100644 index 00000000..b3c07c26 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.h @@ -0,0 +1,51 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +TCHAR g_szShopName[NORMAL_LOADSTRING]; // Name of the Coffee Shop +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +CComPtr g_cpVoice; // Pointer to our tts voice +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpRecoResult *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens); +LRESULT ChangeNamePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd, LPCTSTR szName ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd, LPCTSTR szName ); +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken, UINT iEnumType ); +void ChangeNamePanePaint( HWND hWnd, LPCTSTR szCounterDisplay); + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.rc b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.rc new file mode 100644 index 00000000..2901a259 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.rc @@ -0,0 +1,139 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the %s coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the %s coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_MANAGEEMPLOYEES "Manage the Employees" + IDS_EMPLOYEEDUTY "Employee On Duty:" + IDS_VOICESPEAK "I will be the best employee you've ever had. Let me work." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HEARTHEM "Hear Them Speak!" + IDS_SHOW "Show:" + IDS_MALESONLY "Males Only" + IDS_FEMALESONLY "Females Only" + IDS_BOTHGENDERS "Both Genders" + IDS_MANAGENAME "Manage Store Name" + IDS_NAMEPROMPT "Say: Rename the coffee shop to "" """ + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." + IDS_SHOPNAME "SAPI" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.xml b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.xml new file mode 100644 index 00000000..199cc546 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.xml @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Rename the coffee shop to *+

+
+ + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+

...

+
+
+ a +

+ +

+ ... +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + Please +

Manage

+ the + +
+ +

Hear Them Speak

+
+ + +

?Show Males Only

+

?Show Females Only

+

?Show Both Genders

+
+
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + + + +

employees

+

-shop +name

+

-store +name

+
+
+
diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffees6.dsp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffees6.dsp new file mode 100644 index 00000000..6b25d9f9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffees6.dsp @@ -0,0 +1,190 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS6" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS6 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS6.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS6.mak" CFG="CoffeeS6 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS6 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS6 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS6 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS6 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS6 - Win32 Debug x86" +# Name "CoffeeS6 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.ICO +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "Xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS6 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\Coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS6 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/common.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/common.h new file mode 100644 index 00000000..988f65f9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/common.h @@ -0,0 +1,47 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Miximum size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define DICTGRAMMAR 164 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_CLEANUP WM_USER+201 // Notification to a pane to cleanup its residuals +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define WM_MANAGEEMPLOYEES WM_USER+212 // Notification to go to employee management pane +#define WM_HEARTHEVOICE WM_USER+213 // The User wants to hear the selected employee speak +#define WM_MISCCOMMAND WM_USER+214 // Notification that something described under "other commands" was recognized +#define WM_TTSVOICESEL WM_USER+215 // Notification that the user selected a voice +#define WM_FALSERECO WM_USER+217 // Notification of false recognition +#define WM_PHRASESTART WM_USER+218 // Notification words have been detected in incoming stream +#define WM_MANAGENAME WM_USER+219 // Notification user wants to see change name pane +#define WM_RENAMEWINDOW WM_USER+220 // Rename the window command +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order +#define DYN_TTSVOICERULE 1001 // ID for the dynamic tts voice rule +#define RECORD_TIMER 5 // Timer # for pronunciation timer +#define RECORD_TIMEOUT 5000 // # of seconds to wait for sound +#define THANKS_TIMER 6 // Timer # for thanks timeout timer +#define THANKS_TIMEOUT 10000 // # of seconds to wait for sound + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/display.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/display.cpp new file mode 100644 index 00000000..803c39c0 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/display.cpp @@ -0,0 +1,497 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sphelper.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd, LPCTSTR szName ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + TCHAR tLoadBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + + LoadString( g_hInst, IDS_WELCOME, tLoadBuf, MAX_LOADSTRING ); + _stprintf( tBuf, tLoadBuf, szName ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd, LPCTSTR szName ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + TCHAR tLoadBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tLoadBuf, MAX_LOADSTRING ); + _stprintf( tBuf, tLoadBuf, szName ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_MANAGENAME, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + iWidth = rc.right - rc.left; + rc.left = clientRC.left + 25; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* ManageEmployeesPanePaint * +*---------------------------* +* Description: +* Do the paint on the manage employees pane. +* +******************************************************************************/ +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken, UINT iEnumType ) +{ + USES_CONVERSION; + + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 200; + LoadString( g_hInst, IDS_EMPLOYEEDUTY, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + if ( 8 < ulNumTokens ) + { + ulNumTokens = 8; + } + ULONG ulIndex = 0; + rc.bottom +=5; + while( ulIndex < ulNumTokens ) + { + TCHAR * pszTitle = W2T( ppcDesciptionString[ulIndex] ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, pszTitle, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != ulCurToken ) + { + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + + ulIndex++; + + } + + LoadString( g_hInst, IDS_HEARTHEM, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = ( clientRC.bottom - iHeight ) - 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_SHOW, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 50; + rc.right += 50; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.bottom +=5; + for ( ulIndex = 0; ulIndex < 3; ulIndex++ ) + { + LoadString( g_hInst, IDS_MALESONLY+ulIndex, tBuf, MAX_LOADSTRING ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 75; + rc.right += 75; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != iEnumType ) + { + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + } + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* ChangeNamePanePaint * +*---------------------* +* Description: +* Do the paint on the change name pane. +* +******************************************************************************/ +void ChangeNamePanePaint( HWND hWnd, LPCTSTR szCounterDisplay) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/resource.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/resource.h new file mode 100644 index 00000000..be88fb76 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/resource.h @@ -0,0 +1,68 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_MANAGEEMPLOYEES 141 +#define IDS_EMPLOYEEDUTY 142 +#define IDS_VOICESPEAK 143 +#define IDS_HEARTHEM 144 +#define IDS_SHOW 145 +#define IDS_MALESONLY 146 +#define IDS_FEMALESONLY 147 +#define IDS_BOTHGENDERS 148 +#define IDS_MANAGENAME 155 +#define IDS_NAMEPROMPT 156 +#define IDS_FAILEDINIT 157 +#define IDS_SHOPNAME 158 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 134 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/small.ico b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.cpp b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.h b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.h new file mode 100644 index 00000000..5fc3f375 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.h @@ -0,0 +1,32 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/version.rc2 b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/version.rc2 new file mode 100644 index 00000000..cbc58987 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 6 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees6\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees6.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.cs b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.cs new file mode 100644 index 00000000..dc16bf7d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.cs @@ -0,0 +1,387 @@ +//============================================================================= +// +// Copyright (c) Microsoft Corporation All Rights Reserved. +// +//============================================================================= + +namespace SAPI51Samples +{ + using System; + using System.Collections; + using System.ComponentModel; + using System.Drawing; + using System.Data; + using System.Windows.Forms; + using System.Diagnostics; + using SpeechLib; + + /// + /// SpeechListBox is a speech enabled listbox control. It inherits + /// from the standard System.Windows.Forms.ListBox, and thus exposes + /// all the standard properties, methods and events. A few new methods + /// are added to provide speech specific functionalities. + /// + public class SpeechListBox : System.Windows.Forms.ListBox + { + private const int grammarId = 10; + private bool speechEnabled = false; + private bool speechInitialized = false; + private String PreCommandString = "Select"; + private SpeechLib.SpSharedRecoContext objRecoContext; + private SpeechLib.ISpeechRecoGrammar grammar; + private SpeechLib.ISpeechGrammarRule ruleTopLevel; + private SpeechLib.ISpeechGrammarRule ruleListItems; + + /// + /// AddItem is used to add a newitem to the list item collection. + /// It will automatically update the grammar. It's equivalent to + /// calling ListBox.Items.Add() followed by BuildGrammar(). + /// + /// + /// The new item to be added to the list. + /// + /// + /// The index of the newly added item. + /// + public int AddItem(object newItem) + { + // Since we can't add the same word to the same transition in + // the grammar, we don't allow same string to be added + // multiple times. So do nothing if Item is already in the list. + // Some level of error message may be helpful. The sample chooses + // to silently ignore to keep code simple. + + // The leading and trailing spaces are not needed, trim it before + // inserting. SAPI will return error in AddWordTransition if two + // phrases differ only in spaces. A program needs to handle this + // error if random phrase is added to a rule. + // Note: In this sample, we only trim leading and trailing spaces. + // Internal spaces will need to be handled as well. + + string strItem; + int index = -1; + + strItem = newItem.ToString().Trim(); + + // only add it if trimmed phrase is not empty + if( strItem.Length > 0 ) + { + index = this.FindString(strItem); + + if( index < 0 ) + { + // if it doesn't exist yet, add it to the list + index = this.Items.Add(strItem); + + // if speech is enabled, we need to update grammar with the change + if( speechEnabled ) RebuildGrammar(); + } + } + + return index; + } + + /// + /// RemoveItem will remove the item with the given index and then + /// call BuildGrammar() to update grammar. It's equivalent to + /// calling ListBox.Items.RemoveAt() followed by BuildGrammar(). + /// + /// + /// Index of the item to be removed from the list. + /// + public void RemoveItem(int index) + { + this.Items.RemoveAt(index); + if( speechEnabled ) RebuildGrammar(); + } + + /// + /// Property SpeechEnabled is read/write-able. When it's set to + /// true, speech recognition will be started. When it's set to + /// false, speech recognition will be stopped. + /// + public bool SpeechEnabled + { + get + { + return speechEnabled; + } + set + { + if( speechEnabled != value ) + { + speechEnabled = value ; + if(this.DesignMode) return; + + if (speechEnabled) + { + EnableSpeech(); + } + else + { + DisableSpeech(); + } + } + } + } + + /// + /// RecoContext_Hypothesis is the event handler function for + /// SpSharedRecoContext object's Hypothesis event. + /// + /// + /// + /// + /// + /// See EnableSpeech() for how to hook up this function with the + /// event. + /// + public void RecoContext_Hypothesis(int StreamNumber, + object StreamPosition, + ISpeechRecoResult Result) + { + Debug.WriteLine("Hypothesis: " + + Result.PhraseInfo.GetText(0, -1, true) + ", " + + StreamNumber + ", " + StreamPosition); + } + + /// + /// RecoContext_Hypothesis is the event handler function for + /// SpSharedRecoContext object's Recognition event. + /// + /// + /// + /// + /// + /// + /// See EnableSpeech() for how to hook up this function with the + /// event. + /// + public void RecoContext_Recognition(int StreamNumber, + object StreamPosition, + SpeechRecognitionType RecognitionType, + ISpeechRecoResult Result) + { + Debug.WriteLine("Recognition: " + + Result.PhraseInfo.GetText(0, -1, true) + ", " + + StreamNumber + ", " + StreamPosition); + + int index; + ISpeechPhraseProperty oItem; + + // oItem will be the property of the second part in the recognized + // phase. For example, if the top level rule matchs + // "select Seattle". Then the ListItemsRule matches "Seattle" part. + // The following code will get the property of the "Seattle" + // phrase, which is set when the word "Seattle" is added to the + // ruleListItems in RebuildGrammar. + oItem = Result.PhraseInfo.Properties.Item(0).Children.Item(0); + index = oItem.Id; + + if ((System.Decimal)Result.PhraseInfo.GrammarId == grammarId) + { + // Check to see if the item at the same position in the list + // still has the same text. + // This is to prevent the rare case that the user keeps + // talking while the list is being added or removed. By the + // time this event is fired and handled, the list box may have + // already changed. + if( oItem.Name.CompareTo(this.Items[index].ToString())==0 ) + { + this.SelectedIndex = index; + } + } + } + + /// + /// This function will create the main SpSharedRecoContext object + /// and other required objects like Grammar and rules. + /// In this sample, we are building grammar dynamically since + /// listbox content can change from time to time. + /// If your grammar is static, you can write your grammar file + /// and ask SAPI to load it during run time. This can reduce the + /// complexity of your code. + /// + private void InitializeSpeech() + { + Debug.WriteLine("Initializing SAPI objects..."); + + try + { + // First of all, let's create the main reco context object. + // In this sample, we are using shared reco context. Inproc reco + // context is also available. Please see the document to decide + // which is best for your application. + objRecoContext = new SpeechLib.SpSharedRecoContext(); + + // Then, let's set up the event handler. We only care about + // Hypothesis and Recognition events in this sample. + objRecoContext.Hypothesis += new + _ISpeechRecoContextEvents_HypothesisEventHandler( + RecoContext_Hypothesis); + + objRecoContext.Recognition += new + _ISpeechRecoContextEvents_RecognitionEventHandler( + RecoContext_Recognition); + + // Now let's build the grammar. + // The top level rule consists of two parts: "select ". + // So we first add a word transition for the "select" part, then + // a rule transition for the "" part, which is dynamically + // built as items are added or removed from the listbox. + grammar = objRecoContext.CreateGrammar(grammarId); + ruleTopLevel = grammar.Rules.Add("TopLevelRule", + SpeechRuleAttributes.SRATopLevel | SpeechRuleAttributes.SRADynamic, 1); + ruleListItems = grammar.Rules.Add("ListItemsRule", + SpeechRuleAttributes.SRADynamic, 2); + + SpeechLib.ISpeechGrammarRuleState stateAfterSelect; + stateAfterSelect = ruleTopLevel.AddState(); + + object PropValue = ""; + ruleTopLevel.InitialState.AddWordTransition(stateAfterSelect, + PreCommandString, " ", SpeechGrammarWordType.SGLexical, + "", 0, ref PropValue, 1.0F ); + + PropValue = ""; + stateAfterSelect.AddRuleTransition(null, ruleListItems, "", + 1, ref PropValue, 0F); + + // Now add existing list items to the ruleListItems + RebuildGrammar(); + + // Now we can activate the top level rule. In this sample, only + // the top level rule needs to activated. The ListItemsRule is + // referenced by the top level rule. + grammar.CmdSetRuleState("TopLevelRule", SpeechRuleState.SGDSActive); + speechInitialized = true; + } + catch(Exception e) + { + System.Windows.Forms.MessageBox.Show( + "Exception caught when initializing SAPI." + + " This application may not run correctly.\r\n\r\n" + + e.ToString(), + "Error"); + } + } + + /// + /// EnableSpeech will initialize all speech objects on first time, + /// then rebuild grammar and start speech recognition. + /// + /// + /// true if speech is enabled and grammar updated. + /// false otherwise, which happens if we are in design mode. + /// + /// + /// This is a private function. + /// + private bool EnableSpeech() + { + Debug.Assert(speechEnabled, "speechEnabled must be true in EnableSpeech"); + + if (this.DesignMode) return false; + + if (speechInitialized == false) + { + InitializeSpeech(); + } + else + { + RebuildGrammar(); + } + + objRecoContext.State = SpeechRecoContextState.SRCS_Enabled; + return true; + } + + /// + /// RebuildGrammar() will update grammar object with current list + /// items. It is called automatically by AddItem and RemoveItem. + /// + /// + /// true if grammar is updated. + /// false if grammar is not updated, which can happen if speech is + /// not enabled or if it's in design mode. + /// + /// + /// RebuildGrammar should be called every time after the list item + /// has changed. AddItem and RemoveItem methods are provided as a + /// way to update list item and the grammar object automatically. + /// Don't forget to call RebuildGrammar if the list is changed + /// through ListBox.Items collection. Otherwise speech engine will + /// continue to recognize old list items. + /// + public bool RebuildGrammar() + { + if( !speechEnabled || this.DesignMode ) + { + return false; + } + + // In this funtion, we are only rebuilding the ruleListItems, as + // this is the only part that's really changing dynamically in + // this sample. However, you still have to call + // Grammar.Rules.Commit to commit the grammar. + int i, count; + String word; + object propValue = ""; + + try + { + ruleListItems.Clear(); + count = this.Items.Count; + + for(i=0; i + /// This is a private function that stops speech recognition. + /// + /// + private bool DisableSpeech() + { + if (this.DesignMode) return false; + + Debug.Assert(speechInitialized, + "speech must be initialized in DisableSpeech"); + + if( speechInitialized ) + { + // Putting the recognition context to disabled state will + // stop speech recognition. Changing the state to enabled + // will start recognition again. + objRecoContext.State = SpeechRecoContextState.SRCS_Disabled; + } + + return true; + } + + } +} + diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.csproj b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.csproj new file mode 100644 index 00000000..1aa067db --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.csproj @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.resx b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.resx new file mode 100644 index 00000000..b4872563 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.resx @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + True + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader + + + System.Resources.ResXResourceWriter + + \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/assemblyinfo.cs b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/assemblyinfo.cs new file mode 100644 index 00000000..05da15ba --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/assemblyinfo.cs @@ -0,0 +1,51 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("C# ListBox control sample")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft® Windows(TM) Operating System")] +[assembly: AssemblyCopyright("Copyright (C) Microsoft Corporation. 1981-2001")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified - the assembly cannot be signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. +// (*) If the key file and a key name attributes are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP - that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the file is installed into the CSP and used. +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/small.ico b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CSharp/Listbox/control/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/AssemblyInfo.cs b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/AssemblyInfo.cs new file mode 100644 index 00000000..05da15ba --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/AssemblyInfo.cs @@ -0,0 +1,51 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("C# ListBox control sample")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft® Windows(TM) Operating System")] +[assembly: AssemblyCopyright("Copyright (C) Microsoft Corporation. 1981-2001")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified - the assembly cannot be signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. +// (*) If the key file and a key name attributes are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP - that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the file is installed into the CSP and used. +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.cs b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.cs new file mode 100644 index 00000000..63734dbf --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.cs @@ -0,0 +1,188 @@ +//============================================================================= +// +// Copyright (c) Microsoft Corporation All Rights Reserved. +// +//============================================================================= + +namespace TestApp +{ + using System; + using System.Drawing; + using System.Collections; + using System.ComponentModel; + using System.Windows.Forms; + using System.Data; + using SAPI51Samples; + + /// + /// This form is a simple test application for the user control + /// defined in the SpeechListBox project. + /// + public class MainForm : System.Windows.Forms.Form + { + private System.Windows.Forms.CheckBox chkSpeechEnabled; + private SAPI51Samples.SpeechListBox speechListBox1; + private System.Windows.Forms.Button btnAdd; + private System.Windows.Forms.TextBox txtNewItem; + private System.Windows.Forms.Button btnRemove; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.ComponentModel.IContainer components = null; + + public MainForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + this.chkSpeechEnabled.Checked = this.speechListBox1.SpeechEnabled; + } + + /// + /// Clean up any resources being used. + /// + public override void Dispose() + { + base.Dispose(); + if(components != null) + components.Dispose(); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtNewItem = new System.Windows.Forms.TextBox(); + this.btnAdd = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.btnRemove = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.chkSpeechEnabled = new System.Windows.Forms.CheckBox(); + this.speechListBox1 = new SAPI51Samples.SpeechListBox(); + this.SuspendLayout(); + // + // txtNewItem + // + this.txtNewItem.Location = new System.Drawing.Point(86, 225); + this.txtNewItem.Name = "txtNewItem"; + this.txtNewItem.Size = new System.Drawing.Size(152, 20); + this.txtNewItem.TabIndex = 5; + this.txtNewItem.Text = "Seattle"; + this.txtNewItem.TextChanged += new System.EventHandler(this.txtNewItem_TextChanged); + // + // btnAdd + // + this.btnAdd.Location = new System.Drawing.Point(256, 224); + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(70, 23); + this.btnAdd.TabIndex = 6; + this.btnAdd.Text = "&Add"; + this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); + // + // label2 + // + this.label2.Location = new System.Drawing.Point(8, 2); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(328, 40); + this.label2.TabIndex = 0; + this.label2.Text = "Update the speech enabled list box using the Add/Remove button. Then say \"select\"" + + " + phrase to select an item in the list, e.g. you can say \"select Seattle\" if Se" + + "attle appears in the list. "; + // + // btnRemove + // + this.btnRemove.Location = new System.Drawing.Point(256, 192); + this.btnRemove.Name = "btnRemove"; + this.btnRemove.Size = new System.Drawing.Size(70, 23); + this.btnRemove.TabIndex = 3; + this.btnRemove.Text = "&Remove"; + this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 227); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(78, 16); + this.label1.TabIndex = 4; + this.label1.Text = "&Phrase to add:"; + // + // chkSpeechEnabled + // + this.chkSpeechEnabled.Location = new System.Drawing.Point(8, 195); + this.chkSpeechEnabled.Name = "chkSpeechEnabled"; + this.chkSpeechEnabled.Size = new System.Drawing.Size(112, 16); + this.chkSpeechEnabled.TabIndex = 2; + this.chkSpeechEnabled.Text = "&Speech Enabled"; + this.chkSpeechEnabled.CheckedChanged += new System.EventHandler(this.chkSpeechEnabled_CheckedChanged); + // + // speechListBox1 + // + this.speechListBox1.Location = new System.Drawing.Point(8, 49); + this.speechListBox1.Name = "speechListBox1"; + this.speechListBox1.Size = new System.Drawing.Size(320, 134); + this.speechListBox1.SpeechEnabled = true; + this.speechListBox1.TabIndex = 1; + // + // MainForm + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(336, 253); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.label2, + this.label1, + this.btnRemove, + this.btnAdd, + this.txtNewItem, + this.chkSpeechEnabled, + this.speechListBox1}); + this.MaximizeBox = false; + this.Name = "MainForm"; + this.Text = "Speech Enabled ListBox"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new MainForm()); + } + + private void btnAdd_Click(object sender, System.EventArgs e) + { + // Add the new item. Internally to SpeechListBox, this will cause + // a rebuild of the dynamic grammar used by speech recognition + // engine. + speechListBox1.AddItem(txtNewItem.Text); + txtNewItem.Text = ""; + } + + private void btnRemove_Click(object sender, System.EventArgs e) + { + // Just remove the current selected item. Same as AddItem, removing + // an item causes a grammar rebuild as well. + if( speechListBox1.SelectedIndex >= 0 ) + { + speechListBox1.RemoveItem(speechListBox1.SelectedIndex); + } + } + + private void chkSpeechEnabled_CheckedChanged(object sender, System.EventArgs e) + { + speechListBox1.SpeechEnabled = chkSpeechEnabled.Checked; + } + + private void txtNewItem_TextChanged(object sender, System.EventArgs e) + { + // don't allow empty string to be added + btnAdd.Enabled = txtNewItem.Text != ""; + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.resx b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.resx new file mode 100644 index 00000000..e2c28a90 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.resx @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MainForm + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader + + + System.Resources.ResXResourceWriter + + \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/TestApp.csproj b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/TestApp.csproj new file mode 100644 index 00000000..d6cc6df1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/TestApp.csproj @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/small.ico b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/mp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/AssemblyInfo.cs b/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/AssemblyInfo.cs new file mode 100644 index 00000000..80099989 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/AssemblyInfo.cs @@ -0,0 +1,51 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("C# Simple TTS")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft® Windows(TM) Operating System")] +[assembly: AssemblyCopyright("Copyright (C) Microsoft Corporation. 1981-2001")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified - the assembly cannot be signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. +// (*) If the key file and a key name attributes are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP - that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the file is installed into the CSP and used. +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.cs b/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.cs new file mode 100644 index 00000000..72abf182 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.cs @@ -0,0 +1,145 @@ +//============================================================================= +// +// Copyright (c) Microsoft Corporation All Rights Reserved. +// +//============================================================================= + +namespace SimpleTTS +{ + using System; + using System.Windows.Forms; + using System.Threading; + using SpeechLib; + + /// + /// This form shows how TTS speak works. + /// + public class MainForm : System.Windows.Forms.Form + { + private System.Windows.Forms.CheckBox chkSaveToWavFile; + private System.Windows.Forms.Button btnSpeak; + private System.Windows.Forms.TextBox txtSpeakText; + private System.Windows.Forms.Button btnExit; + private System.ComponentModel.IContainer components; + + public MainForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + + /// + /// Clean up any resources being used. + /// + public override void Dispose() + { + base.Dispose(); + if(components != null) + components.Dispose(); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnSpeak = new System.Windows.Forms.Button(); + this.chkSaveToWavFile = new System.Windows.Forms.CheckBox(); + this.chkSaveToWavFile.Location = new System.Drawing.Point(8, 80); + this.chkSaveToWavFile.Size = new System.Drawing.Size(90, 24); + + this.btnExit = new System.Windows.Forms.Button(); + this.txtSpeakText = new System.Windows.Forms.TextBox(); + this.btnSpeak.Location = new System.Drawing.Point(108, 80); + this.btnSpeak.Size = new System.Drawing.Size(80, 24); + this.btnSpeak.TabIndex = 4; + this.btnSpeak.Text = "&Speak"; + this.btnSpeak.Click += new System.EventHandler(this.btnSpeak_Click); + this.btnExit.Location = new System.Drawing.Point(200, 80); + this.btnExit.Size = new System.Drawing.Size(80, 24); + this.btnExit.TabIndex = 2; + this.btnExit.Text = "&Exit"; + this.btnExit.Click += new System.EventHandler(this.btnExit_Click); + this.chkSaveToWavFile.Text = "Save to .wav"; + this.txtSpeakText.Location = new System.Drawing.Point(8, 8); + this.txtSpeakText.Size = new System.Drawing.Size(284, 60); + this.txtSpeakText.TabIndex = 3; + this.txtSpeakText.Multiline = true; + + this.txtSpeakText.Text = "This is Simple TTS application."; + this.txtSpeakText.WordWrap = true; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(299, 120); + this.Controls.AddRange(new System.Windows.Forms.Control[] {this.btnExit, + this.btnSpeak, + this.txtSpeakText, + this.chkSaveToWavFile}); + this.MaximizeBox = false; + this.Text = "SimpleTTS"; + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new MainForm()); + } + + private void btnSpeak_Click(object sender, System.EventArgs e) + { + //Create a TTS voice and speak. + try + { + SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync; + SpVoice Voice = new SpVoice(); + if (chkSaveToWavFile.Checked) + { + SaveFileDialog sfd = new SaveFileDialog(); + + sfd.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav"; + sfd.Title = "Save to a wave file"; + sfd.FilterIndex = 2; + sfd.RestoreDirectory = true; + + if (sfd.ShowDialog()== DialogResult.OK) + { + + SpeechStreamFileMode SpFileMode = SpeechStreamFileMode.SSFMCreateForWrite; + + SpFileStream SpFileStream = new SpFileStream(); + SpFileStream.Open(sfd.FileName, SpFileMode, false); + + Voice.AudioOutputStream = SpFileStream; + Voice.Speak(txtSpeakText.Text, SpFlags); + Voice.WaitUntilDone(Timeout.Infinite); + + SpFileStream.Close(); + + } + } + else + { + Voice.Speak(txtSpeakText.Text, SpFlags); + } + } + catch(Exception error) + { + MessageBox.Show("Speak error", "SimpleTTS", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void btnExit_Click(object sender, System.EventArgs e) + { + this.Dispose(); + } + } +} diff --git a/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.resx b/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.resx new file mode 100644 index 00000000..e69de29b diff --git a/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/SimpleTTS.csproj b/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/SimpleTTS.csproj new file mode 100644 index 00000000..4fe54ad9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/CSharp/SimpleTTS/SimpleTTS.csproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mp/src/utils/sapi51/Samples/Common/TTSXmlDemo.xml b/mp/src/utils/sapi51/Samples/Common/TTSXmlDemo.xml new file mode 100644 index 00000000..d8663997 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/Common/TTSXmlDemo.xml @@ -0,0 +1,30 @@ + + +This is a basic functionality test for SAPI5 XML markup within the TTS Engine. If you haven't done so already, please choose Microsoft Mary for your voice and check the box labeled "IsXML" before clicking on "Speak" in order to begin the tutorial. + + + +Hello, my name is Microsoft Mike. Hello, my name is Microsoft Mary. Hello, my name is Microsoft Sam. Together we make up Microsoft's SAPI5 Text-to-Speech engine. With the use of XML tags, we can avoid the normal, default way that we read words and speak in general. + +First of all, you canchoosewhich voiceyou wish to hear through the use of a voice tag.Either Sam, Mary or myself can spell out words for you too.For example, the company "Microsoft" is spelledMicrosoftand the word "Windows" is spelled windows. + +We can also change the rate at which we speak.I am currently speaking at three times my normal rate.and I am currently speaking at one third my normal rate.Our pitch can be easily manipulated as well.This is an example of a high pitchand this is an example of a low pitch + +Another way to adjust the prosody of our speech is through the use of a silence tag.With a silence tag, an end user can make one of us pause for up to 65,536 milliseconds.For example, Iampausing500millisecondsbetweeneachwordofthissentence. + +The volume of our individual voices can also be raised and lowered through the use of XML tags. This is the loudest I can speakand this is the softest I can speak. + +In order to make our voices sound more natural, an emphasis tag can be used to allow us to place emphasis on certain words in a sentence. Compare the following two phrases: The movie will be this friday. The movie will be this friday. Pretty neat, don't you think? + +Don't worry, that isn't all that we can do through the proper use of XML tags. An end user can also decide which part of speech to use for each word in a sentence. Using the part of speech tag, we can force a certain pronunciation of a word without relying on the context around it. For example, the nominal pronunciation of the word "compact" is compact and the verbal pronunciation of the word "compact" is compact. We can also force certain pronunciations for modifiers, functions , interjections and abbreviations. + +Another great use of XML tags within the TTS Engine is the creation of your own words. Perhaps you want the computer to say a word that is not in the lexicon, such as "extracalifragilisticexpiallidocious." As you just heard, we do not recognize this word and have to use letter to sound rules in order to try and guess at a proper pronunciation. The pronunciation tag may be used to force the correct pronunciation of the word, . Wow, now tell me, doesn't that sound better? + +Now let's insert a bookmark here. Your application should have received a bookmark event with a bookmark id of 8 when speech synthesis has passed this element in the input stream. Bookmark event is an easy way for an application to take action at a given point in the stream. + + + + +Thanks for participating in this tutorial. I hope you have a better understanding of the basic functionality of XML tag usage within the TTS Engine. Enjoy! + + \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/Common/sol.xml b/mp/src/utils/sapi51/Samples/Common/sol.xml new file mode 100644 index 00000000..ec65f76a --- /dev/null +++ b/mp/src/utils/sapi51/Samples/Common/sol.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + +

new +game

-please +
+ + please +

play the

+ ... + + please +
+ + please +

+ +

move

+

put

+ +

the

+

+ + + +

on

+

to

+
+

the

+ +
+ please +
+ + +

+ + red + black + + +

+

+ + +

of

+ + clubs + hearts + diamonds + spades + + +

+ + club + heart + diamond + spade + +
+
+ + + ace + two + three + four + five + six + seven + eight + nine + ten + jack + queen + king + lady + emperor + + +
diff --git a/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/SimpleTTS.html b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/SimpleTTS.html new file mode 100644 index 00000000..5c7f853d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/SimpleTTS.html @@ -0,0 +1,226 @@ + + + + +TTS Demo + + + + + + + + + + + + +

Simple TTS (DHTML)

+

        + 

+

+ +

+ +

+Rate  +  +       + +Volume  +  + +

+ +

+ +

Voice                                              + Audio Output 

+

+ + +            + + + + + + + + + +


+

+ + + diff --git a/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthclo.bmp b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthclo.bmp new file mode 100644 index 00000000..630e5f3f Binary files /dev/null and b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthclo.bmp differ diff --git a/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthmed.bmp b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthmed.bmp new file mode 100644 index 00000000..87fca9c3 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthmed.bmp differ diff --git a/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthnar.bmp b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthnar.bmp new file mode 100644 index 00000000..3f00d5c1 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthnar.bmp differ diff --git a/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop1.bmp b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop1.bmp new file mode 100644 index 00000000..315edf83 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop1.bmp differ diff --git a/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop2.bmp b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop2.bmp new file mode 100644 index 00000000..eabfea9c Binary files /dev/null and b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop2.bmp differ diff --git a/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop3.bmp b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop3.bmp new file mode 100644 index 00000000..a520cbb5 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop3.bmp differ diff --git a/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop4.bmp b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop4.bmp new file mode 100644 index 00000000..9c4d1d15 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop4.bmp differ diff --git a/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioApp.bas b/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioApp.bas new file mode 100644 index 00000000..430efb9e --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioApp.bas @@ -0,0 +1,4 @@ +Attribute VB_Name = "AudioApp" +Public Declare Function Sleep Lib "kernel32" _ +(ByVal dwMilliseconds As Long) As Long + diff --git a/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frm b/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frm new file mode 100644 index 00000000..02fcce47 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frm @@ -0,0 +1,238 @@ +VERSION 5.00 +Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" +Begin VB.Form AudioAppFrm + BorderStyle = 3 'Fixed Dialog + Caption = "AudioApp" + ClientHeight = 5310 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 3705 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 5310 + ScaleWidth = 3705 + ShowInTaskbar = 0 'False + StartUpPosition = 3 'Windows Default + Begin MSComctlLib.StatusBar AudioStatusBar + Align = 2 'Align Bottom + Height = 255 + Left = 0 + TabIndex = 4 + Top = 5055 + Width = 3705 + _ExtentX = 6535 + _ExtentY = 450 + Style = 1 + _Version = 393216 + BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} + NumPanels = 1 + BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} + EndProperty + EndProperty + End + Begin VB.TextBox SpeakTxt + Height = 1095 + Left = 240 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 0 + Text = "AudioAppFrm.frx":0000 + Top = 720 + Width = 3015 + End + Begin VB.CommandButton SpeakBtn + Caption = "Reco From TTS" + Default = -1 'True + Height = 375 + Left = 240 + TabIndex = 2 + Top = 4080 + Width = 1335 + End + Begin VB.CommandButton ExitBtn + Caption = "Exit" + Height = 375 + Left = 2040 + TabIndex = 1 + Top = 4080 + Width = 1215 + End + Begin VB.TextBox Recotxt + Height = 1095 + Left = 240 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 3 + Top = 2640 + Width = 3015 + End + Begin VB.Label Label2 + Caption = "Recognition Results:" + Height = 255 + Left = 240 + TabIndex = 6 + Top = 2280 + Width = 1935 + End + Begin VB.Label Label1 + Caption = "Enter text to recognize:" + Height = 255 + Left = 240 + TabIndex = 5 + Top = 360 + Width = 1815 + End +End +Attribute VB_Name = "AudioAppFrm" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' AudioAppFrm +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +'============================================================================= +Option Explicit + +Const AUDIOFORMAT = SAFT8kHz16BitMono + +'tts variables +Dim WithEvents Voice As SpVoice +Attribute Voice.VB_VarHelpID = -1 +Dim EndofStream As Boolean +Dim AudioPlugOut As SpAudioPlug + +'sr variables +Dim WithEvents RecoContext As SpInProcRecoContext +Attribute RecoContext.VB_VarHelpID = -1 +Dim Grammar As ISpeechRecoGrammar +Dim Recognizer As SpInprocRecognizer +Dim AudioPlugIn As SpAudioPlug + + +Private Sub ExitBtn_Click() + Grammar.DictationSetState SGDSInactive + Unload AudioAppFrm +End Sub + + + + + +Private Sub Form_Load() + + Set Voice = New SpVoice + EndofStream = False + + 'Set up the output audio object + Set AudioPlugOut = New SpAudioPlug + AudioPlugOut.Init True, AUDIOFORMAT + Set Voice.AudioOutputStream = AudioPlugOut + + + Debug.Print "Initializing SAPI reco context object..." + Set Recognizer = New SpInprocRecognizer + + 'Set up the input audio object + Set AudioPlugIn = New SpAudioPlug + AudioPlugIn.Init False, AUDIOFORMAT + Set Recognizer.AudioInputStream = AudioPlugIn + + + Set RecoContext = Recognizer.CreateRecoContext + Set Grammar = RecoContext.CreateGrammar(1) + Grammar.DictationLoad + + + + + +End Sub + +Public Sub PlayPlug() + + On Error GoTo Cancel + + Dim output As Variant + + Recotxt.Text = "" + Voice.Speak SpeakTxt.Text, SVSFlagsAsync + + EndofStream = False + + 'Update the status bar, before we start the feed the audio + AudioStatusBar.SimpleText = "Feeding TTS audio to SR..." + AudioStatusBar.Refresh + + Grammar.DictationSetState SGDSActive + + Do While (EndofStream = False) + + 'We need to process the message in the message queue + DoEvents + + 'Get the audio data from the audio object + output = AudioPlugOut.GetData + + + + 'Output the audio data to the input audio object + If (Len(output) * 2 <> 0) Then + AudioPlugIn.SetData (output) + End If + Sleep (500) + Loop + + 'Update the status bar after the we have feed all the audio data + AudioStatusBar.SimpleText = "SR Engine is doing dictation recognition..." + AudioStatusBar.Refresh + +Cancel: + Exit Sub + +End Sub + + + +Private Sub Form_Unload(Cancel As Integer) + Set AudioPlugIn = Nothing +End Sub + +Private Sub RecoContext_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal StreamReleased As Boolean) + + 'Update the status bar + AudioStatusBar.SimpleText = "Recognition done" + AudioStatusBar.Refresh + + 'User can start another recognition + SpeakBtn.Enabled = True + SpeakTxt.SetFocus + + + Grammar.DictationSetState SGDSInactive + +End Sub + +Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) +Recotxt.Text = Result.PhraseInfo.GetText & Recotxt.Text +End Sub + +Private Sub SpeakBtn_Click() + PlayPlug +End Sub + + +Private Sub Voice_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + EndofStream = True + +End Sub + + +Private Sub Voice_StartStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + SpeakBtn.Enabled = False + +End Sub diff --git a/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frx b/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frx new file mode 100644 index 00000000..c40d5036 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frx @@ -0,0 +1 @@ +Please enter the text here. \ No newline at end of file diff --git a/mp/src/utils/sapi51/Samples/VB/AudioApp/audioapp.vbp b/mp/src/utils/sapi51/Samples/VB/AudioApp/audioapp.vbp new file mode 100644 index 00000000..b810af64 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/AudioApp/audioapp.vbp @@ -0,0 +1,37 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#..\..\..\..\..\sdn_60\sapi\sapi\objd\i386\sapi.dll#Microsoft Speech Object Library +Reference=*\G{17709AA0-2512-4FFE-BB24-1F6C535DEBCA}#1.0#0#..\..\cpp\simpleaudio\objd\i386\simpleaudio.dll#simpleaudio 1.0 Type Library +Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; mscomctl.ocx +Form=AudioAppFrm.frm +Module=AudioApp; AudioApp.bas +Startup="AudioAppFrm" +ExeName32="audioapp.exe" +Command32="" +Name="Project1" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="MS" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListBoxSampleApp.frx b/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListBoxSampleApp.frx new file mode 100644 index 00000000..1e0b0f13 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListBoxSampleApp.frx differ diff --git a/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSample.vbg b/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSample.vbg new file mode 100644 index 00000000..3e6452f6 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSample.vbg @@ -0,0 +1,3 @@ +VBGROUP 5.0 +Project=SAPI51ListBox.vbp +StartupProject=SAPI51SampleApp.vbp diff --git a/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSampleApp.frm b/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSampleApp.frm new file mode 100644 index 00000000..17013004 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSampleApp.frm @@ -0,0 +1,131 @@ +VERSION 5.00 +Object = "*\ASAPI51ListBox.vbp" +Begin VB.Form MainForm + BorderStyle = 1 'Fixed Single + Caption = "Speech Enabled ListBox" + ClientHeight = 4215 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 4935 + Icon = "ListBoxSampleApp.frx":0000 + LinkTopic = "Form1" + MaxButton = 0 'False + ScaleHeight = 4215 + ScaleWidth = 4935 + StartUpPosition = 3 'Windows Default + Begin VB.CommandButton cmdRemove + Caption = "&Remove" + Height = 355 + Left = 3700 + TabIndex = 3 + Top = 3200 + Width = 1100 + End + Begin VB.CheckBox chkSpeechEnabled + Caption = "Speech &enabled" + Height = 255 + Left = 120 + TabIndex = 2 + Top = 3250 + Width = 1695 + End + Begin VB.CommandButton cmdAdd + Caption = "&Add" + Height = 355 + Left = 3700 + TabIndex = 6 + Top = 3720 + Width = 1100 + End + Begin VB.TextBox txtNewItem + Height = 315 + Left = 1320 + TabIndex = 5 + Text = "Seattle" + Top = 3740 + Width = 2175 + End + Begin SAPI51ListBox.Sample SpeechListBox + Height = 2205 + Left = 120 + TabIndex = 1 + Top = 840 + Width = 4680 + _ExtentX = 8255 + _ExtentY = 3889 + BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 400 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + End + Begin VB.Label Label2 + Caption = $"ListBoxSampleApp.frx":014A + Height = 615 + Left = 120 + TabIndex = 0 + Top = 120 + Width = 4680 + End + Begin VB.Label Label1 + Caption = "&Phrase to add:" + Height = 255 + Left = 120 + TabIndex = 4 + Top = 3770 + Width = 1040 + End +End +Attribute VB_Name = "MainForm" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This form is simple test application for the user control defined in sample.vbp. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +'============================================================================= + +Private Sub Form_Load() + If SpeechListBox.SpeechEnabled Then + chkSpeechEnabled = 1 + Else + chkSpeechEnabled = 0 + End If +End Sub + +Private Sub chkSpeechEnabled_Click() + SpeechListBox.SpeechEnabled = (chkSpeechEnabled = 1) +End Sub + +Private Sub cmdAdd_Click() + ' Add the new item. Internally to SpeechListBox, this will cause a rebuild + ' of the dynamic grammar used by speech recognition engine. + SpeechListBox.AddItem (txtNewItem) + txtNewItem = "" +End Sub + +Private Sub cmdRemove_Click() + ' Just remove the current selected item. Same as AddItem, removing an item + ' causes a grammar rebuild as well. + If SpeechListBox.ListIndex <> -1 Then + SpeechListBox.RemoveItem SpeechListBox.ListIndex + End If +End Sub + +Private Sub txtNewItem_Change() + ' Disallow empty item. + cmdAdd.Enabled = txtNewItem <> "" +End Sub + +Private Sub txtNewItem_GotFocus() + ' When user focuses on the new item box, make the Add button default + ' so that return key is same as clicking on Add button. + cmdAdd.Default = True +End Sub diff --git a/mp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51Listbox.vbp b/mp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51Listbox.vbp new file mode 100644 index 00000000..c1065414 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51Listbox.vbp @@ -0,0 +1,44 @@ +Type=Control +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{7C0FFAB0-CD84-11D0-949A-00A0C91110ED}#1.0#0#C:\winnt\System32\msdatsrc.tlb#Microsoft Data Source Interfaces +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll#Microsoft Speech Object Library +UserControl=Sample.ctl +Startup="(None)" +HelpFile="" +Title="SAPI51ListBox" +ExeName32="SAPI51ListBox.ocx" +Command32="" +Name="SAPI51ListBox" +HelpContextID="0" +Description="Speech enabled ListBox ActiveX control" +CompatibleMode="1" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corporation" +VersionFileDescription="SAPI51 VB ListBox sample control" +VersionLegalCopyright="Copyright (C) Microsoft Corporation. 1981-2001" +VersionProductName="Microsoft® Windows(TM) Operating System" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=1 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +ThreadingModel=1 +DebugStartupOption=1 +DebugStartupComponent=Sample + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51SampleApp.vbp b/mp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51SampleApp.vbp new file mode 100644 index 00000000..63740830 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51SampleApp.vbp @@ -0,0 +1,42 @@ +Type=Exe +Form=ListBoxSampleApp.frm +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Object=*\ASAPI51ListBox.vbp +IconForm="MainForm" +Startup="MainForm" +HelpFile="" +Title="SAPI51SampleApp" +ExeName32="SAPI51SampleApp.exe" +Command32="" +Name="SAPI51SampleApp" +HelpContextID="0" +Description="SAPI51 sample application for the speech enabled VB ListBox sample control" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corporation" +VersionFileDescription="SAPI51 VB ListBox sample application" +VersionLegalCopyright="Copyright (C) Microsoft Corporation. 1981-2001" +VersionProductName="Microsoft® Windows(TM) Operating System" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Samples/VB/ListboxVB/Sample.ctl b/mp/src/utils/sapi51/Samples/VB/ListboxVB/Sample.ctl new file mode 100644 index 00000000..e935edb2 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/ListboxVB/Sample.ctl @@ -0,0 +1,867 @@ +VERSION 5.00 +Begin VB.UserControl Sample + ClientHeight = 690 + ClientLeft = 0 + ClientTop = 0 + ClientWidth = 1815 + ScaleHeight = 690 + ScaleWidth = 1815 + Begin VB.ListBox InnerList + Height = 450 + Left = 0 + TabIndex = 0 + Top = 0 + Width = 1575 + End +End +Attribute VB_Name = "Sample" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = True +Attribute VB_PredeclaredId = False +Attribute VB_Exposed = True +Option Explicit + +' See UserControl_Resize() for how iLevelInResize is used. +' It's needed to make sure our control resizes correctly. +Dim iLevelInResize As Integer + +' declare all speech related variables +Const m_GrammarId = 10 +Dim bSpeechInitialized As Boolean +Dim WithEvents RecoContext As SpSharedRecoContext +Attribute RecoContext.VB_VarHelpID = -1 +Dim Grammar As ISpeechRecoGrammar +Dim TopRule As ISpeechGrammarRule +Dim ListItemsRule As ISpeechGrammarRule + +'Event Declarations: +Event ItemCheck(Item As Integer) 'MappingInfo=InnerList,InnerList,-1,ItemCheck +Attribute ItemCheck.VB_Description = "Occurs when a ListBox control's Style property is set to 1 (checkboxes) and an item's checkbox in the ListBox control is selected or cleared." +Event OLEStartDrag(Data As DataObject, AllowedEffects As Long) 'MappingInfo=InnerList,InnerList,-1,OLEStartDrag +Attribute OLEStartDrag.VB_Description = "Occurs when an OLE drag/drop operation is initiated either manually or automatically." +Event OLESetData(Data As DataObject, DataFormat As Integer) 'MappingInfo=InnerList,InnerList,-1,OLESetData +Attribute OLESetData.VB_Description = "Occurs at the OLE drag/drop source control when the drop target requests data that was not provided to the DataObject during the OLEDragStart event." +Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean) 'MappingInfo=InnerList,InnerList,-1,OLEGiveFeedback +Attribute OLEGiveFeedback.VB_Description = "Occurs at the source control of an OLE drag/drop operation when the mouse cursor needs to be changed." +Event OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer) 'MappingInfo=InnerList,InnerList,-1,OLEDragOver +Attribute OLEDragOver.VB_Description = "Occurs when the mouse is moved over the control during an OLE drag/drop operation, if its OLEDropMode property is set to manual." +Event OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=InnerList,InnerList,-1,OLEDragDrop +Attribute OLEDragDrop.VB_Description = "Occurs when data is dropped onto the control via an OLE drag/drop operation, and OLEDropMode is set to manual." +Event OLECompleteDrag(Effect As Long) 'MappingInfo=InnerList,InnerList,-1,OLECompleteDrag +Attribute OLECompleteDrag.VB_Description = "Occurs at the OLE drag/drop source control after a manual or automatic drag/drop has been completed or canceled." +Event Scroll() 'MappingInfo=InnerList,InnerList,-1,Scroll +Attribute Scroll.VB_Description = "Occurs when you reposition the scroll box on a control." +Event Validate(Cancel As Boolean) 'MappingInfo=InnerList,InnerList,-1,Validate +Attribute Validate.VB_Description = "Occurs when a control loses focus to a control that causes validation." +'Default Property Values: +Const m_def_PreCommandString = "Select" +Const m_def_SpeechEnabled = True +'Property Variables: +Dim m_PreCommandString As String +Dim m_SpeechEnabled As Boolean + + +Private Sub InitializeSpeech() + ' This function will create the main SpSharedRecoContext object and other + ' required objects like Grammar and rules. In this sample, we are building + ' grammar dynamically since listbox content can change from time to time. + ' If your grammar is static, you can write your grammar file and ask SAPI + ' to load it during run time. This can reduce the complexity of your code. + + On Error GoTo ErrorHandler + + If Not bSpeechInitialized Then + Debug.Print "Initializing speech" + + Dim AfterCmdState As ISpeechGrammarRuleState + Set RecoContext = New SpSharedRecoContext + Set Grammar = RecoContext.CreateGrammar(m_GrammarId) + + ' Add two rules. The top level rule will reference the items rule. + Set TopRule = Grammar.Rules.Add("TopLevelRule", SRATopLevel Or SRADynamic, 1) + Set ListItemsRule = Grammar.Rules.Add("ListItemsRule", SRADynamic, 2) + + Set AfterCmdState = TopRule.AddState + + ' The top level rule consists of two parts: "select ". So we first + ' add a word transition for the "select" part, then a rule transition + ' for the "" part, which is dynamically built as items are added + ' or removed from the listbox. + TopRule.InitialState.AddWordTransition AfterCmdState, _ + m_PreCommandString, " ", , "", 0, 0 + AfterCmdState.AddRuleTransition Nothing, ListItemsRule, "", 1, 1 + + ' Now add existing list items to the ListItemsRule + RebuildGrammar + + ' Now we can activate the top level rule. In this sample, only the top + ' level rule needs to activated. The ListItemsRule is referenced by + ' the top level rule. + Grammar.CmdSetRuleState "TopLevelRule", SGDSActive + + bSpeechInitialized = True + End If + + Exit Sub + +ErrorHandler: + MsgBox "SAPI failed to initialize. This application may not run correctly." +End Sub + +Friend Sub EnableSpeech() + Debug.Print "Enabling speech" + If Not bSpeechInitialized Then Call InitializeSpeech + + ' once all objects are initialized, we need to update grammar + RebuildGrammar + RecoContext.State = SRCS_Enabled +End Sub + +Friend Sub DisableSpeech() + Debug.Print "Disabling speech" + + ' Putting the recognition context to disabled state will stop speech + ' recognition. Changing the state to enabled will start recognition again. + If bSpeechInitialized Then RecoContext.State = SRCS_Disabled +End Sub + + +Private Sub RebuildGrammar() + ' In this funtion, we are only rebuilding the ListItemRule, as this is the + ' only part that's really changing dynamically in this sample. However, + ' you still have to call Grammar.Rules.Commit to commit the grammar. + + On Error GoTo ErrorHandler + + ' First, clear the rule + ListItemsRule.Clear + + ' Now, add all items to the rule + Dim i As Integer + For i = 0 To InnerList.ListCount - 1 + Dim text As String + text = InnerList.List(i) + + ' Note: if the same word is added more than once to the same rule state, + ' SAPI will return error. In this sample, we don't allow identical items + ' in the list box so no need for the checking, otherwise special checking + ' for identical words would have to be done here. + ListItemsRule.InitialState.AddWordTransition Nothing, text, " ", , text, i, i + Next + + Grammar.Rules.Commit + Exit Sub + +ErrorHandler: + MsgBox "Error when rebuiling dynamic list box grammar: " & Err.Number +End Sub + + +Private Sub RecoContext_Hypothesis(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal Result As ISpeechRecoResult _ + ) + + ' This event is fired when the recognizer thinks there's possible + ' recognitions. + Debug.Print "Hypothesis: " & Result.PhraseInfo.GetText & ", " & _ + StreamNumber & ", " & StreamPosition +End Sub + +Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal RecognitionType As SpeechRecognitionType, _ + ByVal Result As ISpeechRecoResult _ + ) + + ' This event is fired when something in the grammar is recognized. + Debug.Print "Recognition: " & Result.PhraseInfo.GetText & ", " & _ + StreamNumber & ", " & StreamPosition + + Dim index As Integer + Dim oItem As ISpeechPhraseProperty + + ' oItem will be the property of the second part in the recognized phase. + ' For example, if the top level rule matchs "select Seattle". Then the + ' ListItemsRule matches "Seattle" part. The following code will get the + ' property of the "Seattle" phrase, which is set when the word "Seattle" + ' is added to the ListItemsRule in RebuildGrammar. + Set oItem = Result.PhraseInfo.Properties(1).Children(0) + index = oItem.Id + + If Result.PhraseInfo.GrammarId = m_GrammarId Then + + ' Check to see if the item at the same position in the list still has the + ' same text. + ' This is to prevent the rare case that the user keeps talking while + ' the list is being added or removed. By the time this event is fired + ' and handled, the list box may have already changed. + If oItem.Name = InnerList.List(index) Then + InnerList.ListIndex = index + End If + End If +End Sub + + +Private Sub UserControl_Initialize() + iLevelInResize = 0 + bSpeechInitialized = False +End Sub + +Private Sub UserControl_Resize() + + ' When the user control is resized, the inner listbox has to be resized + ' so that it takes up all the area. + ' Since height of inner ListBox changes by the height of a line of text, + ' we have to adjust the user control's size, which may cause reentrance to + ' this Resize() function. iLevelInResize is used to prevent infinite loop. + iLevelInResize = iLevelInResize + 1 + + If iLevelInResize = 1 Then + InnerList.Move 0, 0, Width, Height + + ' The following lines will cause Resize events and thus re-entrance + ' to this function. Since iLevelInResize will not be 1 during + ' re-entrance, we prevented infinite loop. + Height = InnerList.Height + Width = InnerList.Width + End If + + iLevelInResize = iLevelInResize - 1 +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,AddItem +Public Sub AddItem(ByVal Item As String, Optional ByVal index As Variant) +Attribute AddItem.VB_Description = "Adds an item to a ListBox or ComboBox control or a row to a Grid control." + + ' Since we can't add the same word to the same transition in the grammar, + ' we don't allow same string to be added multiple times. + ' So do nothing if Item is already in the list. Some level of error + ' message may be helpful. The sample chooses to silently ignore to keep + ' code simple. + + ' The leading and trailing spaces are not needed, trim it before inserting. + ' SAPI will return error in AddWordTransition if two phrases differ only + ' in spaces. A program needs to handle this error if random phrase is + ' added to a rule. + ' Note: In this sample, we only trim leading and trailing spaces. Internal + ' spaces will need to be handled as well. + + Item = Trim(Item) + + If Item = "" Then + Exit Sub + End If + + If InnerList.ListCount > 0 Then + Dim i As Integer + For i = 0 To InnerList.ListCount - 1 + If StrComp(Item, InnerList.List(i), vbTextCompare) = 0 Then + Exit Sub + End If + Next + End If + + ' if it doesn't exist yet, add it to the list + InnerList.AddItem Item, index + + ' if speech is enabled, we need to update the grammar with new changes + If m_SpeechEnabled Then RebuildGrammar +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Appearance +Public Property Get Appearance() As Integer +Attribute Appearance.VB_Description = "Returns/sets whether or not an object is painted at run time with 3-D effects." +Attribute Appearance.VB_ProcData.VB_Invoke_Property = ";Appearance" +Attribute Appearance.VB_UserMemId = -520 + Appearance = InnerList.Appearance +End Property + +Public Property Let Appearance(ByVal New_Appearance As Integer) + InnerList.Appearance() = New_Appearance + PropertyChanged "Appearance" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,BackColor +Public Property Get BackColor() As OLE_COLOR +Attribute BackColor.VB_Description = "Returns/sets the background color used to display text and graphics in an object." +Attribute BackColor.VB_ProcData.VB_Invoke_Property = ";Appearance" + BackColor = InnerList.BackColor +End Property + +Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR) + InnerList.BackColor() = New_BackColor + PropertyChanged "BackColor" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,CausesValidation +Public Property Get CausesValidation() As Boolean +Attribute CausesValidation.VB_Description = "Returns/sets whether validation occurs on the control which lost focus." +Attribute CausesValidation.VB_ProcData.VB_Invoke_Property = ";Behavior" + CausesValidation = InnerList.CausesValidation +End Property + +Public Property Let CausesValidation(ByVal New_CausesValidation As Boolean) + InnerList.CausesValidation() = New_CausesValidation + PropertyChanged "CausesValidation" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Clear +Public Sub Clear() +Attribute Clear.VB_Description = "Clears the contents of a control or the system Clipboard." + InnerList.Clear +End Sub + + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Columns +Public Property Get Columns() As Integer +Attribute Columns.VB_Description = "Returns/sets a value that determines whether a ListBox scrolls vertically in a single column (value of 0) or horizontally in snaking columns (values greater than 0)." + Columns = InnerList.Columns +End Property + +Public Property Let Columns(ByVal New_Columns As Integer) + InnerList.Columns() = New_Columns + PropertyChanged "Columns" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,DataMember +Public Property Get DataMember() As String +Attribute DataMember.VB_Description = "Returns/sets a value that describes the DataMember for a data connection." +Attribute DataMember.VB_ProcData.VB_Invoke_Property = ";Data" + DataMember = InnerList.DataMember +End Property + +Public Property Let DataMember(ByVal New_DataMember As String) + InnerList.DataMember() = New_DataMember + PropertyChanged "DataMember" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,DataSource +Public Property Get DataSource() As DataSource +Attribute DataSource.VB_Description = "Sets a value that specifies the Data control through which the current control is bound to a database. " +Attribute DataSource.VB_ProcData.VB_Invoke_Property = ";Data" + Set DataSource = InnerList.DataSource +End Property + +Public Property Set DataSource(ByVal New_DataSource As DataSource) + Set InnerList.DataSource = New_DataSource + PropertyChanged "DataSource" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Enabled +Public Property Get Enabled() As Boolean +Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events." +Attribute Enabled.VB_ProcData.VB_Invoke_Property = ";Behavior" + Enabled = InnerList.Enabled +End Property + +Public Property Let Enabled(ByVal New_Enabled As Boolean) + InnerList.Enabled() = New_Enabled + PropertyChanged "Enabled" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontUnderline +Public Property Get FontUnderline() As Boolean +Attribute FontUnderline.VB_Description = "Returns/sets underline font styles." +Attribute FontUnderline.VB_MemberFlags = "400" + FontUnderline = InnerList.FontUnderline +End Property + +Public Property Let FontUnderline(ByVal New_FontUnderline As Boolean) + InnerList.FontUnderline() = New_FontUnderline +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontStrikethru +Public Property Get FontStrikethru() As Boolean +Attribute FontStrikethru.VB_Description = "Returns/sets strikethrough font styles." +Attribute FontStrikethru.VB_MemberFlags = "400" + FontStrikethru = InnerList.FontStrikethru +End Property + +Public Property Let FontStrikethru(ByVal New_FontStrikethru As Boolean) + InnerList.FontStrikethru() = New_FontStrikethru +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontSize +Public Property Get FontSize() As Single +Attribute FontSize.VB_Description = "Specifies the size (in points) of the font that appears in each row for the given level." +Attribute FontSize.VB_MemberFlags = "400" + FontSize = InnerList.FontSize +End Property + +Public Property Let FontSize(ByVal New_FontSize As Single) + InnerList.FontSize() = New_FontSize +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontName +Public Property Get FontName() As String +Attribute FontName.VB_Description = "Specifies the name of the font that appears in each row for the given level." +Attribute FontName.VB_MemberFlags = "400" + FontName = InnerList.FontName +End Property + +Public Property Let FontName(ByVal New_FontName As String) + InnerList.FontName() = New_FontName +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontItalic +Public Property Get FontItalic() As Boolean +Attribute FontItalic.VB_Description = "Returns/sets italic font styles." +Attribute FontItalic.VB_MemberFlags = "400" + FontItalic = InnerList.FontItalic +End Property + +Public Property Let FontItalic(ByVal New_FontItalic As Boolean) + InnerList.FontItalic() = New_FontItalic +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontBold +Public Property Get FontBold() As Boolean +Attribute FontBold.VB_Description = "Returns/sets bold font styles." +Attribute FontBold.VB_MemberFlags = "400" + FontBold = InnerList.FontBold +End Property + +Public Property Let FontBold(ByVal New_FontBold As Boolean) + InnerList.FontBold() = New_FontBold +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Font +Public Property Get Font() As Font +Attribute Font.VB_Description = "Returns a Font object." +Attribute Font.VB_ProcData.VB_Invoke_Property = ";Font" +Attribute Font.VB_UserMemId = -512 + Set Font = InnerList.Font +End Property + +Public Property Set Font(ByVal New_Font As Font) + Set InnerList.Font = New_Font + PropertyChanged "Font" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ForeColor +Public Property Get ForeColor() As OLE_COLOR +Attribute ForeColor.VB_Description = "Returns/sets the foreground color used to display text and graphics in an object." +Attribute ForeColor.VB_ProcData.VB_Invoke_Property = ";Appearance" + ForeColor = InnerList.ForeColor +End Property + +Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR) + InnerList.ForeColor() = New_ForeColor + PropertyChanged "ForeColor" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,hWnd +Public Property Get hWnd() As Long +Attribute hWnd.VB_Description = "Returns a handle (from Microsoft Windows) to an object's window." + hWnd = InnerList.hWnd +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,IntegralHeight +Public Property Get IntegralHeight() As Boolean +Attribute IntegralHeight.VB_Description = "Returns/Sets a value indicating whether the control displays partial items." +Attribute IntegralHeight.VB_ProcData.VB_Invoke_Property = ";List" + IntegralHeight = InnerList.IntegralHeight +End Property + +Private Sub InnerList_ItemCheck(Item As Integer) + RaiseEvent ItemCheck(Item) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ItemData +Public Property Get ItemData(ByVal index As Integer) As Long +Attribute ItemData.VB_Description = "Returns/sets a specific number for each item in a ComboBox or ListBox control." +Attribute ItemData.VB_ProcData.VB_Invoke_Property = ";List" + ItemData = InnerList.ItemData(index) +End Property + +Public Property Let ItemData(ByVal index As Integer, ByVal New_ItemData As Long) + InnerList.ItemData(index) = New_ItemData + PropertyChanged "ItemData" +End Property + + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ListIndex +Public Property Get ListIndex() As Integer +Attribute ListIndex.VB_Description = "Returns/sets the index of the currently selected item in the control." +Attribute ListIndex.VB_MemberFlags = "400" + ListIndex = InnerList.ListIndex +End Property + +Public Property Let ListIndex(ByVal New_ListIndex As Integer) + InnerList.ListIndex() = New_ListIndex +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ListCount +Public Property Get ListCount() As Integer +Attribute ListCount.VB_Description = "Returns the number of items in the list portion of a control." + ListCount = InnerList.ListCount +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,List +Public Property Get List(ByVal index As Integer) As String +Attribute List.VB_Description = "Returns/sets the items contained in a control's list portion." +Attribute List.VB_ProcData.VB_Invoke_Property = ";List" +Attribute List.VB_UserMemId = 0 + List = InnerList.List(index) +End Property + +Public Property Let List(ByVal index As Integer, ByVal New_List As String) + InnerList.List(index) = New_List + PropertyChanged "List" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,MousePointer +Public Property Get MousePointer() As Integer +Attribute MousePointer.VB_Description = "Returns/sets the type of mouse pointer displayed when over part of an object." + MousePointer = InnerList.MousePointer +End Property + +Public Property Let MousePointer(ByVal New_MousePointer As Integer) + InnerList.MousePointer() = New_MousePointer + PropertyChanged "MousePointer" +End Property + + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,MouseIcon +Public Property Get MouseIcon() As Picture +Attribute MouseIcon.VB_Description = "Sets a custom mouse icon." + Set MouseIcon = InnerList.MouseIcon +End Property + +Public Property Set MouseIcon(ByVal New_MouseIcon As Picture) + Set InnerList.MouseIcon = New_MouseIcon + PropertyChanged "MouseIcon" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,MultiSelect +Public Property Get MultiSelect() As Integer +Attribute MultiSelect.VB_Description = "Returns/sets a value that determines whether a user can make multiple selections in a control." + MultiSelect = InnerList.MultiSelect +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,NewIndex +Public Property Get NewIndex() As Integer +Attribute NewIndex.VB_Description = "Returns the index of the item most recently added to a control." + NewIndex = InnerList.NewIndex +End Property + +Private Sub InnerList_OLEStartDrag(Data As DataObject, AllowedEffects As Long) + RaiseEvent OLEStartDrag(Data, AllowedEffects) +End Sub + +Private Sub InnerList_OLESetData(Data As DataObject, DataFormat As Integer) + RaiseEvent OLESetData(Data, DataFormat) +End Sub + +Private Sub InnerList_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean) + RaiseEvent OLEGiveFeedback(Effect, DefaultCursors) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,OLEDropMode +Public Property Get OLEDropMode() As Integer +Attribute OLEDropMode.VB_Description = "Returns/Sets whether this object can act as an OLE drop target." +Attribute OLEDropMode.VB_ProcData.VB_Invoke_Property = ";Behavior" + OLEDropMode = InnerList.OLEDropMode +End Property + +Public Property Let OLEDropMode(ByVal New_OLEDropMode As Integer) + InnerList.OLEDropMode() = New_OLEDropMode + PropertyChanged "OLEDropMode" +End Property + +Private Sub InnerList_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer) + RaiseEvent OLEDragOver(Data, Effect, Button, Shift, X, Y, State) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,OLEDragMode +Public Property Get OLEDragMode() As Integer +Attribute OLEDragMode.VB_Description = "Returns/Sets whether this object can act as an OLE drag/drop source, and whether this process is started automatically or under programmatic control." +Attribute OLEDragMode.VB_ProcData.VB_Invoke_Property = ";Behavior" + OLEDragMode = InnerList.OLEDragMode +End Property + +Public Property Let OLEDragMode(ByVal New_OLEDragMode As Integer) + InnerList.OLEDragMode() = New_OLEDragMode + PropertyChanged "OLEDragMode" +End Property + +Private Sub InnerList_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single) + RaiseEvent OLEDragDrop(Data, Effect, Button, Shift, X, Y) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,OLEDrag +Public Sub OLEDrag() +Attribute OLEDrag.VB_Description = "Starts an OLE drag/drop event with the given control as the source." + InnerList.OLEDrag +End Sub + +Private Sub InnerList_OLECompleteDrag(Effect As Long) + RaiseEvent OLECompleteDrag(Effect) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,RemoveItem +Public Sub RemoveItem(ByVal index As Integer) +Attribute RemoveItem.VB_Description = "Removes an item from a ListBox or ComboBox control or a row from a Grid control." + InnerList.RemoveItem index + If m_SpeechEnabled Then RebuildGrammar +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Refresh +Public Sub Refresh() +Attribute Refresh.VB_Description = "Forces a complete repaint of a object." + InnerList.Refresh +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,RightToLeft +Public Property Get RightToLeft() As Boolean +Attribute RightToLeft.VB_Description = "Determines text display direction and control visual appearance on a bidirectional system." +Attribute RightToLeft.VB_ProcData.VB_Invoke_Property = ";Behavior" + RightToLeft = InnerList.RightToLeft +End Property + +Public Property Let RightToLeft(ByVal New_RightToLeft As Boolean) + InnerList.RightToLeft() = New_RightToLeft + PropertyChanged "RightToLeft" +End Property + +Private Sub InnerList_Scroll() + RaiseEvent Scroll +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Selected +Public Property Get Selected(ByVal index As Integer) As Boolean +Attribute Selected.VB_Description = "Returns/sets the selection status of an item in a control." + Selected = InnerList.Selected(index) +End Property + +Public Property Let Selected(ByVal index As Integer, ByVal New_Selected As Boolean) + InnerList.Selected(index) = New_Selected +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,SelCount +Public Property Get SelCount() As Integer +Attribute SelCount.VB_Description = "Returns the number of selected items in a ListBox control." + SelCount = InnerList.SelCount +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Style +Public Property Get Style() As Integer +Attribute Style.VB_Description = "Returns/sets a value that determines whether checkboxes are displayed inside a ListBox control." +Attribute Style.VB_ProcData.VB_Invoke_Property = ";Appearance" + Style = InnerList.Style +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Sorted +Public Property Get Sorted() As Boolean +Attribute Sorted.VB_Description = "Indicates whether the elements of a control are automatically sorted alphabetically." +Attribute Sorted.VB_ProcData.VB_Invoke_Property = ";Behavior" + Sorted = InnerList.Sorted +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Text +Public Property Get text() As String +Attribute text.VB_Description = "Returns/sets the text contained in the control." + text = InnerList.text +End Property + +Public Property Let text(ByVal New_Text As String) + InnerList.text() = New_Text + PropertyChanged "Text" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ToolTipText +Public Property Get ToolTipText() As String +Attribute ToolTipText.VB_Description = "Returns/sets the text displayed when the mouse is paused over the control." + ToolTipText = InnerList.ToolTipText +End Property + +Public Property Let ToolTipText(ByVal New_ToolTipText As String) + InnerList.ToolTipText() = New_ToolTipText + PropertyChanged "ToolTipText" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,TopIndex +Public Property Get TopIndex() As Integer +Attribute TopIndex.VB_Description = "Returns/sets which item in a control is displayed in the topmost position." + TopIndex = InnerList.TopIndex +End Property + +Public Property Let TopIndex(ByVal New_TopIndex As Integer) + InnerList.TopIndex() = New_TopIndex + PropertyChanged "TopIndex" +End Property + +Private Sub InnerList_Validate(Cancel As Boolean) + RaiseEvent Validate(Cancel) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,WhatsThisHelpID +Public Property Get WhatsThisHelpID() As Long +Attribute WhatsThisHelpID.VB_Description = "Returns/sets an associated context number for an object." + WhatsThisHelpID = InnerList.WhatsThisHelpID +End Property + +Public Property Let WhatsThisHelpID(ByVal New_WhatsThisHelpID As Long) + InnerList.WhatsThisHelpID() = New_WhatsThisHelpID + PropertyChanged "WhatsThisHelpID" +End Property + +'Load property values from storage +Private Sub UserControl_ReadProperties(PropBag As PropertyBag) + Dim index As Integer + Dim Count As Integer + + InnerList.Appearance = PropBag.ReadProperty("Appearance", 1) + InnerList.BackColor = PropBag.ReadProperty("BackColor", &H80000005) + InnerList.CausesValidation = PropBag.ReadProperty("CausesValidation", True) + If PropBag.ReadProperty("Columns", 0) <> 0 Then + InnerList.Columns = PropBag.ReadProperty("Columns", 0) + End If + InnerList.DataMember = PropBag.ReadProperty("DataMember", "") + Set DataSource = PropBag.ReadProperty("DataSource", Nothing) + InnerList.Enabled = PropBag.ReadProperty("Enabled", True) + Set InnerList.Font = PropBag.ReadProperty("Font", Ambient.Font) + InnerList.ForeColor = PropBag.ReadProperty("ForeColor", &H80000008) + + Count = PropBag.ReadProperty("ListCount", 0) + For index = 0 To Count - 1 + InnerList.ItemData(index) = PropBag.ReadProperty("ItemData" & index, 0) + InnerList.List(index) = PropBag.ReadProperty("List" & index, "") + Next + + InnerList.MousePointer = PropBag.ReadProperty("MousePointer", 0) + Set MouseIcon = PropBag.ReadProperty("MouseIcon", Nothing) + InnerList.OLEDropMode = PropBag.ReadProperty("OLEDropMode", 0) + InnerList.OLEDragMode = PropBag.ReadProperty("OLEDragMode", 0) + InnerList.RightToLeft = PropBag.ReadProperty("RightToLeft", False) + InnerList.text = PropBag.ReadProperty("Text", "") + InnerList.ToolTipText = PropBag.ReadProperty("ToolTipText", "") + InnerList.TopIndex = PropBag.ReadProperty("TopIndex", 0) + InnerList.WhatsThisHelpID = PropBag.ReadProperty("WhatsThisHelpID", 0) + m_PreCommandString = PropBag.ReadProperty("PreCommandString", m_def_PreCommandString) + Me.SpeechEnabled = PropBag.ReadProperty("SpeechEnabled", m_def_SpeechEnabled) +End Sub + +'Write property values to storage +Private Sub UserControl_WriteProperties(PropBag As PropertyBag) + Dim index As Integer + + Call PropBag.WriteProperty("Appearance", InnerList.Appearance, 1) + Call PropBag.WriteProperty("BackColor", InnerList.BackColor, &H80000005) + Call PropBag.WriteProperty("CausesValidation", InnerList.CausesValidation, True) + Call PropBag.WriteProperty("Columns", InnerList.Columns, 0) + Call PropBag.WriteProperty("DataMember", InnerList.DataMember, "") + Call PropBag.WriteProperty("DataSource", DataSource, Nothing) + Call PropBag.WriteProperty("Enabled", InnerList.Enabled, True) + Call PropBag.WriteProperty("Font", InnerList.Font, Ambient.Font) + Call PropBag.WriteProperty("ForeColor", InnerList.ForeColor, &H80000008) + + Call PropBag.WriteProperty("ListCount", InnerList.ListCount, 0) + For index = 0 To InnerList.ListCount - 1 + Call PropBag.WriteProperty("ItemData" & index, InnerList.ItemData(index), 0) + Call PropBag.WriteProperty("List" & index, InnerList.List(index), "") + Next + + Call PropBag.WriteProperty("MousePointer", InnerList.MousePointer, 0) + Call PropBag.WriteProperty("MouseIcon", MouseIcon, Nothing) + Call PropBag.WriteProperty("OLEDropMode", InnerList.OLEDropMode, 0) + Call PropBag.WriteProperty("OLEDragMode", InnerList.OLEDragMode, 0) + Call PropBag.WriteProperty("RightToLeft", InnerList.RightToLeft, False) + Call PropBag.WriteProperty("Text", InnerList.text, "") + Call PropBag.WriteProperty("ToolTipText", InnerList.ToolTipText, "") + Call PropBag.WriteProperty("TopIndex", InnerList.TopIndex, 0) + Call PropBag.WriteProperty("WhatsThisHelpID", InnerList.WhatsThisHelpID, 0) + Call PropBag.WriteProperty("SpeechEnabled", m_SpeechEnabled, m_def_SpeechEnabled) + Call PropBag.WriteProperty("PreCommandString", m_PreCommandString, m_def_PreCommandString) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MemberInfo=0,0,0,True +Public Property Get SpeechEnabled() As Boolean +Attribute SpeechEnabled.VB_Description = "Whether speech recognition is enabled or not." + SpeechEnabled = m_SpeechEnabled +End Property + +Public Property Let SpeechEnabled(ByVal New_SpeechEnabled As Boolean) + If m_SpeechEnabled <> New_SpeechEnabled Then + m_SpeechEnabled = New_SpeechEnabled + + If Ambient.UserMode Then + If m_SpeechEnabled = True Then + Call EnableSpeech + Else + Call DisableSpeech + End If + End If + + PropertyChanged "SpeechEnabled" + End If +End Property + +'Initialize Properties for User Control +Private Sub UserControl_InitProperties() + m_PreCommandString = m_def_PreCommandString + Me.SpeechEnabled = m_def_SpeechEnabled +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MemberInfo=13,1,0,Select +Public Property Get PreCommandString() As String +Attribute PreCommandString.VB_Description = "This property is used to determine what word or words a user needs to say to get the listbox to recognized individual list items." + PreCommandString = m_PreCommandString +End Property + +Public Property Let PreCommandString(ByVal New_PreCommandString As String) + + ' This property is not available during run time to simplify sample code. + ' To support it in run time, you will need to dynamically rebuild the top + ' level rule when this property changes. + + ' If a run time attempt is made to change this property, error is raised. + If Ambient.UserMode Then Err.Raise 382 + m_PreCommandString = New_PreCommandString + PropertyChanged "PreCommandString" +End Property + diff --git a/mp/src/utils/sapi51/Samples/VB/ListboxVB/small.ico b/mp/src/utils/sapi51/Samples/VB/ListboxVB/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/ListboxVB/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/VB/RecoVB/recovb.frm b/mp/src/utils/sapi51/Samples/VB/RecoVB/recovb.frm new file mode 100644 index 00000000..907d87bc --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/RecoVB/recovb.frm @@ -0,0 +1,1162 @@ +VERSION 5.00 +Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx" +Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" +Begin VB.Form Form1 + BorderStyle = 1 'Fixed Single + Caption = "Basic Speech Recognition" + ClientHeight = 9195 + ClientLeft = 150 + ClientTop = 720 + ClientWidth = 9435 + ForeColor = &H000000FF& + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 613 + ScaleMode = 3 'Pixel + ScaleWidth = 629 + StartUpPosition = 3 'Windows Default + Begin VB.CommandButton PlayAudio + Caption = "Play Audio" + Height = 375 + Left = 4320 + TabIndex = 39 + Top = 8760 + Width = 1815 + End + Begin VB.CheckBox RetainAudio + Caption = "Retain Audio" + Height = 255 + Left = 6240 + TabIndex = 38 + Top = 8880 + Width = 1215 + End + Begin VB.Frame Frame4 + Caption = "Engine Creation" + Height = 975 + Left = 6240 + TabIndex = 36 + Top = 1920 + Width = 3135 + Begin VB.OptionButton SharedRC + Caption = "Shared" + Height = 255 + Left = 120 + TabIndex = 3 + Top = 240 + Value = -1 'True + Width = 1455 + End + Begin VB.OptionButton Inproc + Caption = "Inproc" + Height = 255 + Left = 120 + TabIndex = 37 + Top = 600 + Width = 1455 + End + End + Begin VB.CheckBox ActivateMic + Caption = "Activate Mic" + Height = 255 + Left = 6240 + TabIndex = 35 + Top = 480 + Value = 1 'Checked + Width = 1335 + End + Begin VB.CommandButton ClearTree + Caption = "Clear Tree View" + Height = 375 + Left = 2220 + TabIndex = 27 + Top = 8760 + Width = 1815 + End + Begin VB.ComboBox SREngines + Enabled = 0 'False + Height = 315 + Left = 6240 + TabIndex = 4 + Text = "SREngines" + Top = 3120 + Width = 3135 + End + Begin MSComctlLib.TreeView TreeView1 + Height = 6375 + Left = 120 + TabIndex = 34 + Top = 0 + Width = 6015 + _ExtentX = 10610 + _ExtentY = 11245 + _Version = 393217 + LineStyle = 1 + Style = 7 + Appearance = 1 + End + Begin VB.CommandButton ExitBtn + Caption = "Exit" + Height = 375 + Left = 7560 + TabIndex = 28 + Top = 8760 + Width = 1815 + End + Begin VB.CommandButton ClearEvents + Caption = "Clear Event List" + Height = 375 + Left = 120 + TabIndex = 26 + Top = 8760 + Width = 1815 + End + Begin VB.Frame Frame3 + Caption = "Event Interests" + Height = 2895 + Left = 6240 + TabIndex = 33 + Top = 5760 + Width = 3135 + Begin VB.CheckBox StreamStart + Caption = "Stream Start" + Height = 255 + Left = 1560 + TabIndex = 24 + Top = 2520 + Width = 1215 + End + Begin VB.CheckBox StreamEnd + Caption = "Stream End" + Height = 255 + Left = 1560 + TabIndex = 23 + Top = 2280 + Width = 1215 + End + Begin VB.CheckBox StateChange + Caption = "State Change" + Height = 255 + Left = 1560 + TabIndex = 22 + Top = 2040 + Width = 1455 + End + Begin VB.CheckBox SoundStart + Caption = "Sound Start" + Height = 255 + Left = 1560 + TabIndex = 21 + Top = 1800 + Width = 1215 + End + Begin VB.CheckBox SoundEnd + Caption = "Sound End" + Height = 255 + Left = 1560 + TabIndex = 20 + Top = 1560 + Width = 1215 + End + Begin VB.CheckBox RequestUI + Caption = "Request UI" + Height = 255 + Left = 1560 + TabIndex = 19 + Top = 1320 + Width = 1215 + End + Begin VB.CheckBox Reco + Caption = "Recognition" + Height = 255 + Left = 1560 + TabIndex = 17 + Top = 720 + Width = 1215 + End + Begin VB.CheckBox PropertyStringChange + Caption = "Property String Change" + Height = 375 + Left = 1560 + TabIndex = 16 + Top = 360 + Width = 1335 + End + Begin VB.CheckBox PhraseStart + Caption = "Phrase Start" + Height = 255 + Left = 120 + TabIndex = 13 + Top = 1920 + Width = 1215 + End + Begin VB.CheckBox Interference + Caption = "Interference" + Height = 255 + Left = 120 + TabIndex = 12 + Top = 1680 + Width = 1215 + End + Begin VB.CheckBox FalseReco + Caption = "False Recognition" + Height = 375 + Left = 120 + TabIndex = 10 + Top = 1080 + Width = 1335 + End + Begin VB.CheckBox Bookmark + Caption = "Bookmark" + Height = 255 + Left = 120 + TabIndex = 9 + Top = 840 + Width = 1215 + End + Begin VB.CheckBox Adaption + Caption = "Adaptation" + Height = 255 + Left = 120 + TabIndex = 7 + Top = 360 + Width = 1215 + End + Begin VB.CheckBox RecoOther + Caption = "Reco Other Context" + Height = 375 + Left = 1560 + TabIndex = 18 + Top = 960 + Width = 1215 + End + Begin VB.CheckBox PropertyNumChange + Caption = "Property Num Change" + Height = 375 + Left = 120 + TabIndex = 15 + Top = 2400 + Width = 1335 + End + Begin VB.CheckBox Hypothesis + Caption = "Hypothesis" + Height = 255 + Left = 120 + TabIndex = 11 + Top = 1440 + Width = 1335 + End + Begin VB.CheckBox PrivateEng + Caption = "Private" + Height = 255 + Left = 120 + TabIndex = 14 + Top = 2160 + Width = 1215 + End + Begin VB.CheckBox AudioLevel + Caption = "Audio Level" + Height = 255 + Left = 120 + TabIndex = 8 + Top = 600 + Width = 1695 + End + End + Begin MSComDlg.CommonDialog ComDlg + Left = 8880 + Top = 5280 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.CheckBox ShowStreamInfo + Caption = "Show Stream Info" + Height = 255 + Left = 7800 + TabIndex = 25 + Top = 480 + Value = 1 'Checked + Width = 1815 + End + Begin VB.Frame Frame2 + Caption = "Recognition Type" + Height = 975 + Left = 6240 + TabIndex = 30 + Top = 840 + Width = 3135 + Begin VB.OptionButton Dict + Caption = "Dictation" + Height = 255 + Left = 120 + TabIndex = 29 + Top = 600 + Width = 1455 + End + Begin VB.OptionButton CandC + Caption = "C&&C" + Height = 255 + Left = 120 + TabIndex = 2 + Top = 240 + Value = -1 'True + Width = 1455 + End + End + Begin VB.CommandButton Recognition + Caption = "Start Recognition" + Height = 375 + Left = 6240 + TabIndex = 1 + Top = 0 + Width = 3135 + End + Begin VB.Frame Frame1 + Caption = "Emulate Recognition" + Height = 1575 + Left = 6240 + TabIndex = 31 + Top = 3600 + Width = 3135 + Begin VB.TextBox EmulateRecoTxt + Height = 855 + Left = 120 + MultiLine = -1 'True + TabIndex = 5 + Top = 240 + Width = 2895 + End + Begin VB.CommandButton Emulate + Caption = "Emulate" + Height = 255 + Left = 120 + TabIndex = 6 + Top = 1200 + Width = 2895 + End + End + Begin VB.TextBox EventTextField + Height = 2175 + Left = 120 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 3 'Both + TabIndex = 0 + Top = 6480 + Width = 6015 + End + Begin VB.Label CCLabel + Caption = "Current C&C Grammar:" + Height = 375 + Left = 6240 + TabIndex = 32 + Top = 5400 + Width = 3135 + End + Begin VB.Menu File + Caption = "&File" + Begin VB.Menu Exit + Caption = "E&xit" + End + End + Begin VB.Menu MenuRecognition + Caption = "&Recognition" + Begin VB.Menu LoadGrammar + Caption = "&Load Grammar..." + End + End + Begin VB.Menu Help + Caption = "&Help" + Begin VB.Menu About + Caption = "&About" + End + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This RecoVB App sample demonstrates most of the SR functionalities +' supported in SAPI 5.1. The main object used here for the RecoContext is RC. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +' +'============================================================================= + +Option Explicit + +Public WithEvents RC As SpSharedRecoContext 'The main shared Recognizer Context +Attribute RC.VB_VarHelpID = -1 +Public Grammar As ISpeechRecoGrammar 'Command and Control interface +Dim indent As Integer 'Sets indent level for small output window +Dim fRecoEnabled As Boolean 'Is recognition enabled +Dim fGrammarLoaded As Boolean 'Is a grammar loaded +Dim RecoResult As ISpeechRecoResult 'Recognition result interface + +Private Sub Form_Load() +' Set up error handler + On Error GoTo Err_SAPILoad + +' Initialize globals + indent = 0 + fRecoEnabled = False + fGrammarLoaded = False + +' Create the Shared Reco Context by default + Set RC = New SpSharedRecoContext + +' Load the SR Engines combo box + Dim Token As ISpeechObjectToken + For Each Token In RC.Recognizer.GetRecognizers + SREngines.AddItem Token.GetDescription() + Next + SREngines.ListIndex = 0 + +' Disable combo box for Shared Engine. Also disable other UI that's not initially needed. + SREngines.Enabled = False + ActivateMic.Enabled = False + PlayAudio.Enabled = False + +' Call the InitEventInterestCheckBoxes subroutine which uses the SR engine +' default event interests to initialize the event interest checkboxes. + InitEventInterestCheckBoxes + +' Create grammar objects + LoadGrammarObj + +' Attempt to load the default .xml file and set the RuleId State to Inactive until +' the user starts recognition. + LoadDefaultCnCGrammar + + Exit Sub + +Err_SAPILoad: + MsgBox "Error loading SAPI objects! Please make sure SAPI5.1 is correctly installed.", vbCritical + Exit_Click + Exit Sub +End Sub + +' This subroutine creates the Grammar object and sets the states to inactive +' until the user is ready to begin recognition. +Private Sub LoadGrammarObj() + Set Grammar = RC.CreateGrammar(1) + +' Load Dictation but set it to Inactive until user selects "Dictation" radio +' button. + Grammar.DictationLoad "", SLOStatic + Grammar.DictationSetState SGDSInactive +End Sub + +' This subroutine attempts to load the default English .xml file. It will prompt the +' user to load a valid .xml file if it cannot find sol.xml in either of the 2 +' specified paths. +Private Sub LoadDefaultCnCGrammar() +' First load attempt + On Error Resume Next + Grammar.CmdLoadFromFile "..\\samples\\common\\sol.xml", SLODynamic + +' Second load attempt + If Err Then + On Error GoTo Err_CFGLoad + Grammar.CmdLoadFromFile "..\\..\\common\\sol.xml", SLODynamic + End If + +' Set rule state to inactive until user clicks Recognition button + Grammar.CmdSetRuleIdState 0, SGDSInactive + +' Set the Label to indictate which .xml file is loaded. + CCLabel.Caption = "Current C+C Grammar: sol.xml" + + fGrammarLoaded = True + + Exit Sub + +Err_CFGLoad: + fGrammarLoaded = False + CCLabel.Caption = "Current C+C Grammar: NULL" + Exit Sub +End Sub + +' This subroutine calls the Common File Dialog control which is inserted into +' the form to select a .xml grammar file. +Private Sub LoadGrammar_Click() + ComDlg.CancelError = True + On Error GoTo Cancel + ComDlg.Flags = cdlOFNOverwritePrompt + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn + ComDlg.DialogTitle = "Open XML File" + ComDlg.Filter = "All Files (*.*)|*.*|XML Files " & "(*.xml)|*.xml" + ComDlg.FilterIndex = 2 + ComDlg.ShowOpen + +' Inactivate the grammar and associate a new .xml file with the grammar. + On Error GoTo Err_XMLLoad + Grammar.CmdLoadFromFile ComDlg.FileName, SLODynamic + Grammar.CmdSetRuleIdState 0, SGDSInactive + +' Then reactivate the grammar if it was currently enabled + If fRecoEnabled Then + Grammar.CmdSetRuleIdState 0, SGDSActive + End If + +' Set the Label to indictate which .xml file is loaded + CCLabel.Caption = "Current C+C Grammar: " + ComDlg.FileTitle + + fGrammarLoaded = True + Exit Sub + +Err_XMLLoad: + fGrammarLoaded = False + MsgBox "Invalid .xml file. Please load a valid .xml grammar file.", vbOKOnly + Exit Sub + +Cancel: + Exit Sub +End Sub + +' Activates or Deactivates either Command and Control or Dictation based on the +' current state of the Recognition button. +Private Sub Recognition_Click() + ActivateMic.Value = Checked + + On Error GoTo ErrorHandle + +' First make sure a valid .xml file is loaded if the user is selecting C&C + If fGrammarLoaded Or Dict.Value = True Then + + ' If recognition is currently not enabled, enable it. + If Not fRecoEnabled Then + ' Determine if user wants to activate Dictation or Command and Control + If Dict.Value Then + Grammar.DictationSetState SGDSActive + Else + Grammar.CmdSetRuleIdState 0, SGDSActive + End If + fRecoEnabled = True + ' Update caption on button. + Recognition.Caption = "Stop Recognition" + ' Allow user to activate/deactivate mute + ActivateMic.Enabled = True + ' Disable radio buttons and engines combo while recognizing so user doesn't + ' switch modes during recognition. + CandC.Enabled = False + Dict.Enabled = False + SREngines.Enabled = False + SharedRC.Enabled = False + Inproc.Enabled = False + ' If recognition is currently enabled, disable it. + Else + ' Deactivate either Dictation or Command and Control. + If Dict.Value Then + Grammar.DictationSetState SGDSInactive + Else + Grammar.CmdSetRuleIdState 0, SGDSInactive + End If + fRecoEnabled = False + ' Update caption on button. + Recognition.Caption = "Start Recognition" + ' Disallow user to activate/deactivate mute + ActivateMic.Enabled = False + ' Reenable radio buttons while not recognizing so user can switch modes + CandC.Enabled = True + Dict.Enabled = True + + ' Allow engine selection if the inproc button is selected. + If Inproc.Value Then + SREngines.Enabled = True + End If + + SharedRC.Enabled = True + Inproc.Enabled = True + End If + End If + Exit Sub + +ErrorHandle: + MsgBox "Failed to activate the grammar. It is possible that your audio device is used by other application.", vbOKOnly +End Sub + +' This subroutine calls the EmulateRecognition method on the recognizer. +Private Sub Emulate_Click() + If fGrammarLoaded Then +' First make sure not to try retaining audio when emulating. + RetainAudio.Value = Unchecked + +' Temporarily enable recognition state if it's not currently enabled. + If Not fRecoEnabled Then + If Dict.Value Then + Grammar.DictationSetState SGDSActive + Else + Grammar.CmdSetRuleIdState 0, SGDSActive + End If + End If + +' Call the EmmulateRecognition method with the text from the textbox. + If Not EmulateRecoTxt.Text = "" Then + RC.Recognizer.EmulateRecognition EmulateRecoTxt.Text, 0 + End If + +' Reset the recognition states to original values + If Not fRecoEnabled Then + If Dict.Value Then + Grammar.DictationSetState SGDSInactive + Else + Grammar.CmdSetRuleIdState 0, SGDSInactive + End If + End If + End If +End Sub + +' This subroutine is called by the event handler subroutines to update +' the small edit window with the events that were received. +Private Sub UpdateEventList(StreamNum As Long, StreamPos As Variant, szEvent As String, szEventInfo As String) + Dim szIndent As String + Dim szStreamInfo As String + Dim i As Integer + + For i = 0 To indent - 1 + szIndent = szIndent & " " + Next + If ShowStreamInfo.Value = Checked Then + szStreamInfo = " (StreamNum=" & StreamNum & " StreamPos=" & StreamPos & ")" + End If + EventTextField.Text = EventTextField.Text & szIndent & szEvent & szStreamInfo & szEventInfo & vbCrLf + EventTextField.SelStart = Len(EventTextField) + EventTextField.SelLength = 0 +End Sub + +' The following subroutines are event handlers that get called when the SR engine +' fires events. + +' Adaption event handler +Private Sub RC_Adaption(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + UpdateEventList StreamNumber, StreamPosition, "Adaptation", "" +End Sub +' Audio Level event handler +Private Sub RC_AudioLevel(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal AudioLevel As Long) + UpdateEventList StreamNumber, StreamPosition, "AudioLevel", " [Level=" & AudioLevel & "]" +End Sub +' Bookmark event handler +Private Sub RC_Bookmark(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal EventData As Variant, ByVal Options As SpeechLib.SpeechBookmarkOptions) + UpdateEventList StreamNumber, StreamPosition, "Bookmark", " [Data=" & EventData & " Option=" & Options & "]" +End Sub +' End Stream event handler +Private Sub RC_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal StreamReleased As Boolean) + indent = 0 + UpdateEventList StreamNumber, StreamPosition, "EndStream", " [Stream Released=" & StreamReleased & "]" +End Sub +' Engine Private event handler +Private Sub RC_EnginePrivate(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal lParam As Variant) + UpdateEventList StreamNumber, StreamPosition, "EnginePrivate", "" +End Sub +' False Recognition event handler +Private Sub RC_FalseRecognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal Result As SpeechLib.ISpeechRecoResult) + UpdateEventList StreamNumber, StreamPosition, "FalseRecognition", " [Text=" & Result.PhraseInfo.GetText() & "]" + Set RecoResult = Result +End Sub +' Hypothesis event handler +Private Sub RC_Hypothesis(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal Result As SpeechLib.ISpeechRecoResult) + UpdateEventList StreamNumber, StreamPosition, "Hypothesis", " [Text=" & Result.PhraseInfo.GetText() & "]" +End Sub +' Interference event handler +Private Sub RC_Interference(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal Interference As SpeechLib.SpeechInterference) + UpdateEventList StreamNumber, StreamPosition, "Interference", " [Value=" & Interference & "]" +End Sub +' Phrase Start event handler +Private Sub RC_PhraseStart(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + UpdateEventList StreamNumber, StreamPosition, "PhraseStart", "" +End Sub +' Property Number Change event handler +Private Sub RC_PropertyNumberChange(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal PropertyName As String, ByVal NewNumberValue As Long) + UpdateEventList StreamNumber, StreamPosition, "PropertyNumberChange", " [Name=" & PropertyName & " Value=" & NewNumberValue & "]" +End Sub +' Property String Change event handler +Private Sub RC_PropertyStringChange(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal PropertyName As String, ByVal NewStringValue As String) + UpdateEventList StreamNumber, StreamPosition, "PropertyStringChange", " [Name=" & PropertyName & " Value=" & NewStringValue & "]" +End Sub +' Recognition event handler +Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) + Dim RecoNode As Node + Static i As Integer + +' Update Event List window first + UpdateEventList StreamNumber, StreamPosition, "Recognition", " [Text=" & Result.PhraseInfo.GetText() & ", RecoType=" & RecognitionType & "]" + +' Increment unique value for RecoNode's key name. + i = i + 1 + +' Add top level node + Set RecoNode = TreeView1.Nodes.Add(, , "Reco" & i, "Recognition (" & Result.PhraseInfo.GetText() & ")") + +' Call the BuildResultTree subroutine to build up the Result tree + BuildResultTree Result.PhraseInfo, Result.Alternates(5), RecoNode + +' Save the recognition Result to the global RecoResult + Set RecoResult = Result +End Sub +' Recognition For Other Context event handler +Private Sub RC_RecognitionForOtherContext(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + UpdateEventList StreamNumber, StreamPosition, "RecognitionForOtherContext", "" +End Sub +' Recognizer State Change event handler +Private Sub RC_RecognizerStateChange(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal NewState As SpeechLib.SpeechRecognizerState) + UpdateEventList StreamNumber, StreamPosition, "RecognitionStateChange", " [NewState=" & NewState & "]" +End Sub +' Request UI event handler +Private Sub RC_RequestUI(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal UIType As String) + UpdateEventList StreamNumber, StreamPosition, "RequestUI", " [Type=" & UIType & "]" +End Sub +' Sound End event handler +Private Sub RC_SoundEnd(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + indent = 1 + UpdateEventList StreamNumber, StreamPosition, "SoundEnd", "" +End Sub +' Sound Start event handler +Private Sub RC_SoundStart(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + indent = 1 + UpdateEventList StreamNumber, StreamPosition, "SoundStart", "" + indent = 2 +End Sub +' Stream Start event handler +Private Sub RC_StartStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + indent = 0 + UpdateEventList StreamNumber, StreamPosition, "StartStream", "" + indent = 1 +End Sub + +' The following subroutine enables the event interest check boxes based on the +' SR engine's default event interests. +Private Sub InitEventInterestCheckBoxes() + If RC.EventInterests And SREAdaptation Then + Adaption.Value = Checked + End If + + If RC.EventInterests And SREAudioLevel Then + AudioLevel.Value = Checked + End If + + If RC.EventInterests And SREBookmark Then + Bookmark.Value = Checked + End If + + If RC.EventInterests And SREFalseRecognition Then + FalseReco.Value = Checked + End If + + If RC.EventInterests And SREHypothesis Then + Hypothesis.Value = Checked + End If + + If RC.EventInterests And SREInterference Then + Interference.Value = Checked + End If + + If RC.EventInterests And SREPhraseStart Then + PhraseStart.Value = Checked + End If + + If RC.EventInterests And SREPrivate Then + PrivateEng.Value = Checked + End If + + If RC.EventInterests And SREPropertyNumChange Then + PropertyNumChange.Value = Checked + End If + + If RC.EventInterests And SREPropertyStringChange Then + PropertyStringChange.Value = Checked + End If + + If RC.EventInterests And SRERecognition Then + Reco.Value = Checked + End If + + If RC.EventInterests And SRERecoOtherContext Then + RecoOther.Value = Checked + End If + + If RC.EventInterests And SRERequestUI Then + RequestUI.Value = Checked + End If + + If RC.EventInterests And SRESoundEnd Then + SoundEnd.Value = Checked + End If + + If RC.EventInterests And SRESoundStart Then + SoundStart.Value = Checked + End If + + If RC.EventInterests And SREStateChange Then + StateChange.Value = Checked + End If + + If RC.EventInterests And SREStreamEnd Then + StreamEnd.Value = Checked + End If + + If RC.EventInterests And SREStreamStart Then + StreamStart.Value = Checked + End If +End Sub + +' The following subroutines handle turning on/off the event interests when +' The user checks/unchecks them. + +Private Sub SetEventInterest(EventInterest As SpeechRecoEvents, EventCheckBox As CheckBox) + If EventCheckBox.Value = Checked Then + RC.EventInterests = RC.EventInterests Or EventInterest + Else + RC.EventInterests = RC.EventInterests And Not EventInterest + End If +End Sub + +' Adaption event interest +Private Sub Adaption_Click() + SetEventInterest SREAdaptation, Adaption +End Sub +' Audio Level event interest +Private Sub AudioLevel_Click() + SetEventInterest SREAudioLevel, AudioLevel +End Sub +' Bookmark event interest +Private Sub Bookmark_Click() + SetEventInterest SREBookmark, Bookmark +End Sub +' False Recognition event interest +Private Sub FalseReco_Click() + SetEventInterest SREFalseRecognition, FalseReco +End Sub +' Hypothesis event interest +Private Sub Hypothesis_Click() + SetEventInterest SREHypothesis, Hypothesis +End Sub +' Interference event interest +Private Sub Interference_Click() + SetEventInterest SREInterference, Interference +End Sub +' Phrase Start event interest +Private Sub PhraseStart_Click() + SetEventInterest SREPhraseStart, PhraseStart +End Sub +' Engine Private event interest +Private Sub PrivateEng_Click() + SetEventInterest SREPrivate, PrivateEng +End Sub +' Property Number Change event interest +Private Sub PropertyNumChange_Click() + SetEventInterest SREPropertyNumChange, PropertyNumChange +End Sub +' Property String Change event interest +Private Sub PropertyStringChange_Click() + SetEventInterest SREPropertyStringChange, PropertyStringChange +End Sub +' Recognition event interest +Private Sub Reco_Click() + SetEventInterest SRERecognition, Reco +End Sub +' Recognition on Other Context event interest +Private Sub RecoOther_Click() + SetEventInterest SRERecoOtherContext, RecoOther +End Sub +' Request UI event interest +Private Sub RequestUI_Click() + SetEventInterest SRERequestUI, RequestUI +End Sub +' Sound End event interest +Private Sub SoundEnd_Click() + SetEventInterest SRESoundEnd, SoundEnd +End Sub +' Sound Start event interest +Private Sub SoundStart_Click() + SetEventInterest SRESoundStart, SoundStart +End Sub +' State Change event interest +Private Sub StateChange_Click() + SetEventInterest SREStateChange, StateChange +End Sub +' Stream Start event interest +Private Sub StreamStart_Click() + SetEventInterest SREStreamStart, StreamStart +End Sub +' Stream End event interest +Private Sub StreamEnd_Click() + SetEventInterest SREStreamEnd, StreamEnd +End Sub + +' The following subroutines use the Recognition Result object to build up the +' TreeView display in the main window. + +' This subroutine builds up the result tree in the main treeview window. It uses +' the main ISpeechRecoResult object to build up this information. Additionally it +' also shows the alternates from the recognition. +Private Sub BuildResultTree(ByVal ResultPhraseInfo As ISpeechPhraseInfo, ByVal Alternates As ISpeechPhraseAlternates, ParentNode As Node, Optional DontDoAlternates As Boolean = False) + Dim id As Integer + id = TreeView1.Nodes.Count + Dim PhraseInfoNode As Node + Dim PropertiesNode As Node + +' Add the top level nodes for the result tree + Set PhraseInfoNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "PhraseInfo" & id, "Phrase Info") + Set PropertiesNode = TreeView1.Nodes.Add(PhraseInfoNode.Key, tvwChild, "Properties" & id, "Properties") + +' Call subroutines to build up lower level nodes for the Result rules, Result properties, +' and Result elements. + BuildPhraseRuleTree ResultPhraseInfo.Rule, PhraseInfoNode + BuildPhrasePropertyTree ResultPhraseInfo.Properties, PropertiesNode + BuildPhraseElementsTree ResultPhraseInfo.Elements, PhraseInfoNode, ResultPhraseInfo.LanguageId + +' Call subroutine to build up lower level nodes for the alternates. + If Not DontDoAlternates And Not Alternates Is Nothing Then + Dim AltNode As Node + Set AltNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "Alternates" & id, "Alternates") + BuildAlternatesTree Alternates, AltNode + End If +End Sub +' This subroutine is called by the BuildResultTree subroutine to build up the Result +' rules. +Private Sub BuildPhraseRuleTree(ByVal PhraseRule As ISpeechPhraseRule, ParentNode As Node, Optional i As Integer = 0) + Dim Rule As ISpeechPhraseRule + Dim RuleNode As Node + + Set RuleNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "RuleNode" & ParentNode.Key & i, "Rule (" & PhraseRule.Name & ")") + +' Call the subroutine recusively if you have child rules + If Not PhraseRule.Children Is Nothing Then + For Each Rule In PhraseRule.Children + i = i + 1 + BuildPhraseRuleTree Rule, RuleNode, i + Next + End If +End Sub +' This subroutine is called by the BuildResultTree subroutine to build up the Result +' properties. +Private Sub BuildPhrasePropertyTree(ByVal Properties As ISpeechPhraseProperties, ParentNode As Node) + Dim Property As ISpeechPhraseProperty + Dim i As Integer + i = 0 + + If Not Properties Is Nothing Then + If Properties.Count > 0 Then + For Each Property In Properties + Dim PropertyNode As Node + Dim DisplayString As String + i = i + 1 + + If Property.Value = Empty Then + DisplayString = "Property (" & Property.Name & ")" + Else + DisplayString = "Property (" & Property.Name & ") (" & Property.Value & ")" + End If + Set PropertyNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, ParentNode.Key & i, DisplayString) + +' Call the subroutine recusively if you have child properties + If Not Property.Children Is Nothing Then + BuildPhrasePropertyTree Property.Children, PropertyNode + End If + Next + End If + Else + ParentNode.Text = "Properties - No Properties" + End If +End Sub +' This subroutine is called by the BuildResultTree subroutine to build up the Result +' elements. +Private Sub BuildPhraseElementsTree(ByVal Elements As ISpeechPhraseElements, ParentNode As Node, LangId As Long) + Dim Element As ISpeechPhraseElement + Dim ElementsNode As Node + Dim i As Integer + i = 0 + + If Not Elements Is Nothing Then + If Elements.Count > 0 Then + Set ElementsNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "Elements" & ParentNode.Key, "Elements") + For Each Element In Elements + i = i + 1 + Dim ElementNode As Node + Set ElementNode = TreeView1.Nodes.Add(ElementsNode.Key, tvwChild, "Element" & ParentNode.Key & i, "Element (" & Element.DisplayText & ")") + If Not IsEmpty(Element.Pronunciation) Then + BuildPronunciationTree Element.Pronunciation, ElementNode, LangId + End If + Next + End If + Else + Set ElementNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "Elements" & ParentNode.Key, "Elements - No Elements") + End If +End Sub +' This subroutine is called by the BuildPhraseElementsTree subroutine to build up the +' Result pronunciations for each of the Result elements. +Private Sub BuildPronunciationTree(ByVal Pronunciation As Variant, ParentNode As Node, LangId As Long) + Dim PronunciationNode As Node + Dim PC As New SpPhoneConverter + Dim i As Integer + i = 0 + +' Initialize the Phone Converter + PC.LanguageId = LangId + + Set PronunciationNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "Pronunciations" & ParentNode.Key, "Pronunciations") + + For i = 0 To UBound(Pronunciation) + Dim Phone As String + Phone = PC.IdToPhone(Pronunciation(i)) + Call TreeView1.Nodes.Add(PronunciationNode.Key, tvwChild, "Pronunciation" & ParentNode.Key & i, "Pronunciation (" & Phone & ")") + Next +End Sub + +' This subroutine is called by the BuildResultTree subroutine to build up the +' Result alternates if there are any. +Private Sub BuildAlternatesTree(ByVal Alternates As ISpeechPhraseAlternates, ParentNode As Node) + Dim alt As ISpeechPhraseAlternate + Dim i As Integer + i = 0 + + For Each alt In Alternates + i = i + 1 + Dim AltNode As Node + Set AltNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, ParentNode.Key & i, "Alternate" & i) + BuildResultTree alt.PhraseInfo, Nothing, AltNode, True + Next +End Sub + +' The following 2 subroutines destroy/create Inproc and Shared RecoContext's depending +' on what the user has checked. + +' This subroutine destroys the Inproc RecoContext and creates and Shared RecoContext +Private Sub SharedRC_Click() +' Destroy the Inproc RecoContext + Set RC = Nothing + +' Create the Shared RecoContext + Set RC = New SpSharedRecoContext + +' Call the InitEventInterestCheckBoxes subroutine which uses the SR engine +' default event interests to initialize the event interest checkboxes. + InitEventInterestCheckBoxes + +' Create grammar objects + LoadGrammarObj + +' Attempt to load the default .xml file and set the RuleId State to Inactive until +' the user starts recognition. + LoadDefaultCnCGrammar + +' Disable the engine selection drop down box and reset to the default shared engine. + SREngines.ListIndex = 0 + SREngines.Enabled = False +End Sub +' This subroutine destroys the Shared RecoContext and creates and Inproc RecoContext +Private Sub Inproc_Click() + Dim Recognizer As ISpeechRecognizer + +' Destroy Shared RecoContext + Set RC = Nothing + +' Create Inproc Recognizer which we will use to create the Inproc RecoContext. + Set Recognizer = New SpInprocRecognizer + +' To create an Inproc RecoContext we must set an Audio Input. To do this we create +' an SpObjectTokenCategory object with the category of AudioIn. This object enumerates +' the registry to see what types of audio input devices are available. + Dim ObjectTokenCat As ISpeechObjectTokenCategory + Set ObjectTokenCat = New SpObjectTokenCategory + ObjectTokenCat.SetId SpeechCategoryAudioIn + +' Set the default AudioInput device which is typically the first item and is usually +' the microphone. + Set Recognizer.AudioInput = ObjectTokenCat.EnumerateTokens.Item(0) + +' Set the Recognizer to the one selected in the drop down box. + Set Recognizer.Recognizer = Recognizer.GetRecognizers().Item(SREngines.ListIndex) + +' Now go ahead and actually create the Inproc RecoContext. +' Note - in VB even though the global "RC" object is declaired as a +' SpSharedRecoContext, it is still possible to set it to a SpInprocRecoContext. + Set RC = Recognizer.CreateRecoContext + +' Call the InitEventInterestCheckBoxes subroutine which uses the SR engine +' default event interests to initialize the event interest checkboxes. + InitEventInterestCheckBoxes + +' Create grammar objects + LoadGrammarObj + +' Attempt to load the default .xml file and set the RuleId State to Inactive until +' the user starts recognition. + LoadDefaultCnCGrammar + +' Enable the engine selection drop down box + SREngines.Enabled = True +End Sub + +' The remaining subroutines handle simple UI and exiting. + +' This subroutine activates/deactivates the microphone. +Private Sub ActivateMic_Click() + If ActivateMic.Value = Checked Then + If Dict.Value Then + Grammar.DictationSetState SGDSActive + Else + Grammar.CmdSetRuleIdState 0, SGDSActive + End If + Else + If Dict.Value Then + Grammar.DictationSetState SGDSInactive + Else + Grammar.CmdSetRuleIdState 0, SGDSInactive + End If + End If +End Sub +' This subroutine clears the event text box +Private Sub ClearEvents_Click() + EventTextField.Text = "" +End Sub +' This subroutine clears the TreeView window +Private Sub ClearTree_Click() + TreeView1.Nodes.Clear +End Sub +' This subroutine changes the SR Engine to the selected one +Private Sub SREngines_Click() +' This subroutine can be called when you update the listindex of SREngines in the form load subroutine + If Inproc.Value Then + Inproc_Click + End If +End Sub +' Set the 'Emulate' button to be the default when the user is typing text into +' the EmulateRecoTxt text box. +Private Sub EmulateRecoTxt_Change() + Emulate.Default = True +End Sub +' Retain the audio +Private Sub RetainAudio_Click() + If RetainAudio.Value = Checked Then + RC.RetainedAudio = SRAORetainAudio + PlayAudio.Enabled = True + Else + RC.RetainedAudio = SRAONone + PlayAudio.Enabled = False + End If + +' Clear out any old recognition results + Set RecoResult = Nothing +End Sub +' Play the Retained Audio +Private Sub PlayAudio_Click() + If Not RecoResult Is Nothing Then + RecoResult.SpeakAudio + End If +End Sub +' About box +Private Sub About_Click() + MsgBox "(c) 2001 Microsoft Corporation. All rights reserved.", vbInformation, "About RecoVB" +End Sub +Private Sub ExitBtn_Click() + Unload Form1 +End Sub +Private Sub Exit_Click() + Unload Form1 +End Sub diff --git a/mp/src/utils/sapi51/Samples/VB/RecoVB/recovb.vbp b/mp/src/utils/sapi51/Samples/VB/RecoVB/recovb.vbp new file mode 100644 index 00000000..d6415fbf --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/RecoVB/recovb.vbp @@ -0,0 +1,42 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#s:\binaries.x86fre\sapi.dll#Microsoft Speech Object Library +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX +Form=RecoVB.frm +Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; mscomctl.ocx +Object={86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0; mscomct2.ocx +Object={38911DA0-E448-11D0-84A3-00DD01104159}#1.1#0; comct332.ocx +IconForm="Form1" +Startup="Form1" +HelpFile="" +Title="recovb" +ExeName32="RecoVB.exe" +Command32="" +Name="RecoVb" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frm b/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frm new file mode 100644 index 00000000..92595ae9 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frm @@ -0,0 +1,126 @@ +VERSION 5.00 +Begin VB.Form SimpleDict + BorderStyle = 1 'Fixed Single + Caption = "Simple Dictation" + ClientHeight = 3780 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 4680 + Icon = "SimpleDict.frx":0000 + LinkTopic = "SimpleDict" + MaxButton = 0 'False + ScaleHeight = 3780 + ScaleWidth = 4680 + StartUpPosition = 3 'Windows Default + Begin VB.CommandButton btnStart + Caption = "St&art" + Height = 375 + Left = 840 + TabIndex = 1 + Top = 3240 + Width = 1215 + End + Begin VB.CommandButton btnStop + Caption = "St&op" + Height = 375 + Left = 2520 + TabIndex = 2 + Top = 3240 + Width = 1215 + End + Begin VB.TextBox txtSpeech + Height = 2895 + Left = 120 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 0 + Top = 120 + Width = 4455 + End +End +Attribute VB_Name = "SimpleDict" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' This sample demonstrates how to do simple dictation in VB with SAPI 5.1. +' +' It uses shared reco context object, uses the default audio input, loads in +' dictation grammar, sets up event handlers, and shows the recognized text in +' the dialog text box. +' +' Note: since the text box is using system locale, it may not correctly show +' characters in other languages. For example, if you use Chinese Speech +' Recognition engine as the default engine on your English OS, the text box +' may show garbage even though the engine recognizes Chinese. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +' +'============================================================================= + +Option Explicit + +Dim WithEvents RecoContext As SpSharedRecoContext +Attribute RecoContext.VB_VarHelpID = -1 +Dim Grammar As ISpeechRecoGrammar + +Dim m_bRecoRunning As Boolean +Dim m_cChars As Integer + + +Private Sub Form_Load() + SetState False + m_cChars = 0 +End Sub + +Private Sub btnStart_Click() + Debug.Assert Not m_bRecoRunning + + ' Initialize recognition context object and grammar object, then + ' start dictation + If (RecoContext Is Nothing) Then + Debug.Print "Initializing SAPI reco context object..." + Set RecoContext = New SpSharedRecoContext + Set Grammar = RecoContext.CreateGrammar(1) + Grammar.DictationLoad + End If + + Grammar.DictationSetState SGDSActive + SetState True +End Sub + +Private Sub btnStop_Click() + Debug.Assert m_bRecoRunning + Grammar.DictationSetState SGDSInactive + SetState False +End Sub + +' This function handles Recognition event from the reco context object. +' Recognition event is fired when the speech recognition engines recognizes +' a sequences of words. +Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal RecognitionType As SpeechRecognitionType, _ + ByVal Result As ISpeechRecoResult _ + ) + Dim strText As String + strText = Result.PhraseInfo.GetText + Debug.Print "Recognition: " & strText & ", " & _ + StreamNumber & ", " & StreamPosition + + ' Append the new text to the text box, and add a space at the end of the + ' text so that it looks better + txtSpeech.SelStart = m_cChars + txtSpeech.SelText = strText & " " + m_cChars = m_cChars + 1 + Len(strText) +End Sub + +' This function handles the state of Start and Stop buttons according to +' whether dictation is running. +Private Sub SetState(ByVal bNewState As Boolean) + m_bRecoRunning = bNewState + btnStart.Enabled = Not m_bRecoRunning + btnStop.Enabled = m_bRecoRunning +End Sub diff --git a/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frx b/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frx new file mode 100644 index 00000000..302344ae Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frx differ diff --git a/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDictVB.vbp b/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDictVB.vbp new file mode 100644 index 00000000..c82aa9be --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDictVB.vbp @@ -0,0 +1,42 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll#Microsoft Speech Object Library +Form=SimpleDict.frm +IconForm="SimpleDict" +Startup="SimpleDict" +HelpFile="" +Title="SimpleDictVB" +ExeName32="SimpleDictVB.exe" +Command32="" +Name="SimpleDictVB" +HelpContextID="0" +Description="SAPI SDK VB SimpleDict sample" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corporation" +VersionFileDescription="SimpleDictVB sample" +VersionLegalCopyright="Copyright (C) Microsoft Corporation. 1981-2001" +VersionProductName="Microsoft® Windows(TM) Operating System" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Samples/VB/SimpleDict/small.ico b/mp/src/utils/sapi51/Samples/VB/SimpleDict/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/SimpleDict/small.ico differ diff --git a/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frm b/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frm new file mode 100644 index 00000000..a9801de6 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frm @@ -0,0 +1,155 @@ +VERSION 5.00 +Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" +Begin VB.Form Form1 + BorderStyle = 1 'Fixed Single + Caption = "Simple TTS" + ClientHeight = 1800 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 4125 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 120 + ScaleMode = 3 'Pixel + ScaleWidth = 275 + StartUpPosition = 3 'Windows Default + Begin MSComDlg.CommonDialog ComDlg + Left = 1800 + Top = 600 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.CommandButton SpeakItBtn + Caption = "Speak It" + Default = -1 'True + Height = 375 + Left = 1560 + TabIndex = 3 + Top = 1200 + Width = 1095 + End + Begin VB.CheckBox SaveToWavCheckBox + Caption = "Save to .wav" + Height = 255 + Left = 120 + TabIndex = 2 + ToolTipText = "The text is a file name" + Top = 1260 + Width = 1335 + End + Begin VB.CommandButton ExitBtn + Caption = "Exit" + Height = 375 + Left = 2880 + TabIndex = 1 + Top = 1200 + Width = 1095 + End + Begin VB.TextBox TextField + Height = 765 + Left = 0 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 0 + Text = "SimpleTTS.frx":0000 + Top = 120 + Width = 4095 + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This SimpleTTS sample application demonstrates how to create a SpVoice object +' and how to use it to speak text and save it to a .wav file. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +'============================================================================= + +Option Explicit + +'Declare the SpVoice object. +Dim Voice As SpVoice +'Note - Applications that require handling of SAPI events should declair the +'SpVoice as follows: +'Dim WithEvents Voice As SpVoice + +Private Sub Form_Load() +' Initialize the voice object + Set Voice = New SpVoice +End Sub +Private Sub ExitBtn_Click() + Unload Form1 +End Sub + +Private Sub SpeakItBtn_Click() + On Error GoTo Speak_Error + +' If the 'Save to wav' checkbox is checked handle this special case by +' calling the SaveToWav() function. + If SaveToWavCheckBox Then + SaveToWav + Else +' Call the Speak method with the text from the text box. We use the +' SVSFlagsAsync flag to speak asynchronously and return immediately +' from this call. + If Not TextField.Text = "" Then + Voice.Speak TextField.Text, SVSFlagsAsync + End If + End If + +' Return focus to text box + TextField.SetFocus + Exit Sub + +Speak_Error: + MsgBox "Speak Error!", vbOKOnly +End Sub + +Private Sub SaveToWav() +' Create a wave stream + Dim cpFileStream As New SpFileStream + +' Set audio format + cpFileStream.Format.Type = SAFT22kHz16BitMono + +' Call the Common File Dialog control which is inserted into the form to +' select a name for the .wav file. + ComDlg.CancelError = True + On Error GoTo Cancel + ComDlg.Flags = cdlOFNOverwritePrompt + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn + ComDlg.DialogTitle = "Save to a Wave File" + ComDlg.Filter = "All Files (*.*)|*.*|Wave Files " & "(*.wav)|*.wav" + ComDlg.FilterIndex = 2 + ComDlg.ShowSave + +' Create a new .wav file for writing. False indicates that we're not +' interested in writing events into the .wav file. +' Note - this line of code will fail if the file exists and is currently open. + cpFileStream.Open ComDlg.FileName, SSFMCreateForWrite, False + +' Set the .wav file stream as the output for the Voice object + Set Voice.AudioOutputStream = cpFileStream + +' Calling the Speak method now will send the output to the "SimpTTS.wav" file. +' We use the SVSFDefault flag so this call does not return until the file is +' completely written. + Voice.Speak TextField.Text, SVSFDefault + +' Close the file + cpFileStream.Close + Set cpFileStream = Nothing + +' Reset the Voice object's output to 'Nothing'. This will force it to use +' the default audio output the next time. + Set Voice.AudioOutputStream = Nothing + +Cancel: + Exit Sub +End Sub + diff --git a/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frx b/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frx new file mode 100644 index 00000000..eda4d91c --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frx @@ -0,0 +1 @@ +Speak this text. diff --git a/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.vbp b/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.vbp new file mode 100644 index 00000000..13d0f596 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.vbp @@ -0,0 +1,38 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#..\..\..\..\sapi\sapi\objd\i386\sapi.dll#Microsoft Speech Object Library +Form=SimpleTTS.frm +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX +IconForm="Form1" +Startup="Form1" +HelpFile="" +Title="SimpleTTS" +ExeName32="SimpleTTS.exe" +Command32="" +Name="SimpleTTS" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="SPG" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frm b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frm new file mode 100644 index 00000000..0126b13d --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frm @@ -0,0 +1,1162 @@ +VERSION 5.00 +Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" +Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx" +Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx" +Begin VB.Form TTSAppMain + BorderStyle = 1 'Fixed Single + Caption = "SAPI5 TTSAPP" + ClientHeight = 6600 + ClientLeft = 3345 + ClientTop = 3645 + ClientWidth = 8085 + Icon = "TTSAppMain.frx":0000 + LinkTopic = "Form1" + MaxButton = 0 'False + NegotiateMenus = 0 'False + ScaleHeight = 6600 + ScaleWidth = 8085 + Begin VB.PictureBox VisemePicture + Height = 2175 + Left = 120 + ScaleHeight = 2115 + ScaleWidth = 1635 + TabIndex = 27 + TabStop = 0 'False + Top = 60 + Width = 1700 + End + Begin VB.CheckBox chkShowEvents + Caption = "Show Events" + Height = 195 + Left = 4560 + TabIndex = 25 + Top = 4200 + Width = 1335 + End + Begin VB.CommandButton StopBtn + Caption = "Stop" + Enabled = 0 'False + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 350 + Left = 6840 + TabIndex = 2 + Top = 500 + Width = 1125 + End + Begin VB.CheckBox chkSpFlagNLPSpeakPunc + Caption = "NLPSpeakPunc" + Height = 255 + Left = 6120 + TabIndex = 24 + Top = 3480 + Width = 1575 + End + Begin VB.CheckBox chkSpFlagPurgeBeforeSpeak + Caption = "PurgeBeforeSpeak" + Height = 255 + Left = 6120 + TabIndex = 22 + Top = 3120 + Width = 1695 + End + Begin VB.CheckBox chkSpFlagAync + Caption = "FlagsAsync" + Height = 255 + Left = 6120 + TabIndex = 20 + Top = 2760 + Width = 1575 + End + Begin VB.CheckBox chkSpFlagIsFilename + Caption = "IsFilename" + Height = 255 + Left = 4560 + TabIndex = 23 + Top = 3480 + Width = 1215 + End + Begin VB.CheckBox chkSpFlagPersistXML + Caption = "PersistXML" + Height = 255 + Left = 4560 + TabIndex = 21 + Top = 3120 + Width = 1215 + End + Begin VB.Frame Frame1 + Caption = "Speak Flags" + Height = 1575 + Left = 4320 + TabIndex = 18 + Top = 2400 + Width = 3615 + Begin VB.CheckBox chkSpFlagIsXML + Caption = "IsXML" + Height = 255 + Left = 240 + TabIndex = 19 + Top = 360 + Width = 855 + End + End + Begin VB.ComboBox AudioOutputCB + Height = 315 + ItemData = "TTSAppMain.frx":030A + Left = 840 + List = "TTSAppMain.frx":030C + Style = 2 'Dropdown List + TabIndex = 17 + Top = 4125 + Width = 3300 + End + Begin VB.TextBox MainTxtBox + Height = 2175 + HideSelection = 0 'False + Left = 1900 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 0 + Text = "TTSAppMain.frx":030E + Top = 60 + Width = 4575 + End + Begin VB.CommandButton ResetBtn + Caption = "Reset" + Height = 350 + Left = 6840 + TabIndex = 7 + Top = 1820 + Width = 1125 + End + Begin MSComctlLib.ImageList MouthImgList + Left = 6840 + Top = 3960 + _ExtentX = 1005 + _ExtentY = 1005 + BackColor = -2147483643 + MaskColor = 12632256 + _Version = 393216 + End + Begin VB.TextBox DebugTxtBox + BackColor = &H80000000& + Height = 1920 + Left = 120 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 3 'Both + TabIndex = 26 + Top = 4600 + Width = 7815 + End + Begin VB.CommandButton SkipBtn + Caption = "Skip" + Height = 350 + Left = 6840 + TabIndex = 4 + Top = 1380 + Width = 500 + End + Begin MSComCtl2.UpDown UpDown1 + Height = 350 + Left = 7725 + TabIndex = 6 + Top = 1380 + Width = 240 + _ExtentX = 423 + _ExtentY = 609 + _Version = 393216 + AutoBuddy = -1 'True + BuddyControl = "SkipTxtBox" + BuddyDispid = 196624 + OrigLeft = 7560 + OrigTop = 1800 + OrigRight = 7800 + OrigBottom = 2145 + Max = 50 + Min = -50 + SyncBuddy = -1 'True + BuddyProperty = 0 + Enabled = -1 'True + End + Begin VB.TextBox SkipTxtBox + Height = 350 + Left = 7320 + TabIndex = 5 + Text = "0" + Top = 1380 + Width = 400 + End + Begin MSComDlg.CommonDialog ComDlg + Left = 7560 + Top = 4080 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.ComboBox FormatCB + Height = 315 + Left = 840 + Style = 2 'Dropdown List + TabIndex = 15 + Top = 3705 + Width = 3300 + End + Begin MSComctlLib.Slider RateSldr + Height = 315 + Left = 840 + TabIndex = 11 + ToolTipText = "Changes voice playback rate" + Top = 2895 + Width = 3300 + _ExtentX = 5821 + _ExtentY = 556 + _Version = 393216 + LargeChange = 1 + Min = -10 + TickStyle = 3 + End + Begin VB.ComboBox VoiceCB + Height = 315 + Left = 840 + Style = 2 'Dropdown List + TabIndex = 9 + Top = 2475 + Width = 3300 + End + Begin VB.CommandButton PauseBtn + Caption = "Pause" + Enabled = 0 'False + Height = 350 + Left = 6840 + MaskColor = &H00808080& + TabIndex = 3 + Top = 940 + Width = 1125 + End + Begin VB.CommandButton SpeakBtn + Caption = "Speak" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 350 + Left = 6840 + TabIndex = 1 + Top = 60 + Width = 1125 + End + Begin MSComctlLib.Slider VolumeSldr + Height = 315 + Left = 840 + TabIndex = 13 + ToolTipText = "Changes voice playback volume" + Top = 3300 + Width = 3300 + _ExtentX = 5821 + _ExtentY = 556 + _Version = 393216 + Max = 100 + SelStart = 100 + TickStyle = 3 + Value = 100 + End + Begin VB.Label Label1 + Caption = "Audio Output" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 375 + Left = 120 + TabIndex = 16 + Top = 4095 + Width = 615 + End + Begin VB.Label Label5 + Caption = "Format" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 255 + Left = 120 + TabIndex = 14 + Top = 3735 + Width = 615 + End + Begin VB.Label Label4 + Caption = "Volume" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 255 + Left = 120 + TabIndex = 12 + Top = 3330 + Width = 735 + End + Begin VB.Label Label3 + Caption = "Rate" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 255 + Left = 120 + TabIndex = 10 + Top = 2925 + Width = 735 + End + Begin VB.Label Label2 + Caption = "Voice" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 255 + Left = 120 + TabIndex = 8 + Top = 2505 + Width = 495 + End + Begin VB.Menu menuFile + Caption = "File" + Begin VB.Menu menuFileOpenText + Caption = "Open Text File" + Shortcut = ^O + End + Begin VB.Menu menuFileSpeakWave + Caption = "Speak Wave File" + Shortcut = ^W + End + Begin VB.Menu menuFileSaveToWave + Caption = "Save To Wave File" + Shortcut = ^S + End + Begin VB.Menu menuSep + Caption = "-" + End + Begin VB.Menu menuFileExit + Caption = "Quit" + Shortcut = ^Q + End + End + Begin VB.Menu menuHelp + Caption = "Help" + Begin VB.Menu menuAbout + Caption = "About" + End + End +End +Attribute VB_Name = "TTSAppMain" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This VB TTS App sample demonstrates most of the TTS functionalities +' supported in SAPI 5.1. The main object used here is SpVoice. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +'============================================================================= + +Option Explicit + +' First, declare the main SAPI object we are using in this sample. It is +' created inside Form_Load and released inside Form_Unload. +Dim WithEvents Voice As SpVoice +Attribute Voice.VB_VarHelpID = -1 + +' Speak flags is a combination of bit flags. These individual bits correspond +' to check boxes on the UI. So m_speakFlags should always be kept in sync +' with the state of those check boxes. +Dim m_speakFlags As SpeechVoiceSpeakFlags + +' This is the default format we will use. +Const DefaultFmt = "SAFT22kHz16BitMono" + +' We will disable the output combo box and show this if there's no audio output. +Const NoAudioOutput = "No audio ouput object available" + +' We will enable/disable menu items and buttons based on current state +' m_speaking indicates whether a speak task is in progress +' m_paused indicates whether Voice.Pause is called +Private m_bSpeaking As Boolean +Private m_bPaused As Boolean + + +Private Sub Form_Load() + On Error GoTo ErrHandler + + ' Creates the voice object first + Set Voice = New SpVoice + + ' Load the voices combo box + Dim Token As ISpeechObjectToken + + For Each Token In Voice.GetVoices + VoiceCB.AddItem (Token.GetDescription()) + Next + VoiceCB.ListIndex = 0 + + 'load the format combo box + AddItemToFmtCB + + ' set rate and volume to the same as the Voice + RateSldr.Value = Voice.Rate + VolumeSldr.Value = Voice.Volume + + 'set the default format + FormatCB.Text = DefaultFmt + + ' Load the audio output combo box + If Voice.GetAudioOutputs.Count > 0 Then + For Each Token In Voice.GetAudioOutputs + AudioOutputCB.AddItem (Token.GetDescription) + Next + Else + AudioOutputCB.AddItem NoAudioOutput + AudioOutputCB.Enabled = False + End If + AudioOutputCB.ListIndex = 0 + + 'load image list + LoadMouthImages + + MouthImgList.MaskColor = vbMagenta + MouthImgList.BackColor = GetSysColor(COLOR_3DFACE) + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICFULL") + + ' init speak flags and sync flag check boxes + m_speakFlags = SVSFlagsAsync Or SVSFPurgeBeforeSpeak Or SVSFIsXML + chkSpFlagAync.Value = Checked + chkSpFlagPurgeBeforeSpeak.Value = Checked + chkSpFlagIsXML.Value = Checked + + SetSpeakingState False, False + Exit Sub + +ErrHandler: + MsgBox "Error in initialization: " & vbCrLf & vbCrLf & Err.Description & _ + vbCrLf & vbCrLf & "Shutting down.", vbOKOnly, "TTSApp" + Set Voice = Nothing + End +End Sub + +Private Sub Form_Unload(Cancel As Integer) + Set Voice = Nothing +End Sub + +Private Sub AudioOutputCB_Click() + On Error GoTo ErrHandler + + ' change the output to the selected one + Set Voice.AudioOutput = Voice.GetAudioOutputs().Item(AudioOutputCB.ListIndex) + + ' changing output may have also changed the format, so call function + ' FormatCB_Click to make sure we are using the format as selected + FormatCB_Click + Exit Sub + +ErrHandler: + AddDebugInfo "Set audio output error: ", Err.Description +End Sub + +Private Sub FormatCB_Click() + On Error GoTo ErrHandler + + ' Note: AllowAudioOutputFormatChangesOnNextSet is a hidden property, VB + ' object browser doesn't show it by default. To see it, you can go to + ' VB object viewer, right click and turn on the "show hidden members". + Voice.AllowAudioOutputFormatChangesOnNextSet = False + + ' The format Type is associated with the selected list item as a long. + Voice.AudioOutputStream.Format.Type = FormatCB.ItemData(FormatCB.ListIndex) + + ' Currently you have to call this so that SAPI picks up the new format. + Set Voice.AudioOutputStream = Voice.AudioOutputStream + + Exit Sub + +ErrHandler: + AddDebugInfo "Set format error: ", Err.Description +End Sub + +Private Sub menuAbout_Click() + MsgBox "TTSApp" & vbCrLf & vbCrLf & "Copyright (c) 2001 Microsoft Corporation. All rights reserved.", _ + vbOKOnly Or vbInformation, "About TTSApp" +End Sub + +Private Sub menuFileExit_Click() + Unload TTSAppMain + End +End Sub + +Private Sub menuFileOpenText_Click() + + Dim sLocation As String + + ' Set CancelError is True + ComDlg.CancelError = True + On Error GoTo ErrHandler + + ' Set flags + ComDlg.Flags = cdlOFNFileMustExist Or cdlOFNPathMustExist + ' Set Dialog title + ComDlg.DialogTitle = "Open a Text File" + ' Set open directory + sLocation = GetDirectory() + If Len(sLocation) <> 0 Then + ComDlg.InitDir = sLocation + End If + + ' Set filters + ComDlg.Filter = "All Files (*.*)|*.*|Text, XML Files " & "(*.txt;*.xml)|*.txt;*.xml" + + ' Specify default filter + ComDlg.FilterIndex = 2 + ' Display the Open dialog box + ComDlg.ShowOpen + + ' Now open the text file and open it in the text box. + ' We only support text files encoded with the system code page as the + ' binary to unicode conversion in VB is using system code page. + Open ComDlg.FileName For Binary Access Read As 1 + MainTxtBox.Text = StrConv(InputB$(LOF(1), 1), vbUnicode) + Close #1 + + Exit Sub + +ErrHandler: + 'User pressed the Cancel button, do not show error + If Not (Err.Number = 32755) Then + AddDebugInfo "Open file: ", Err.Description + End If +End Sub + +Private Sub menuFileSaveToWave_Click() + ' Set CancelError is True + ComDlg.CancelError = True + On Error GoTo ErrHandler + + ' Set flags + ComDlg.Flags = cdlOFNOverwritePrompt Or cdlOFNPathMustExist Or cdlOFNNoReadOnlyReturn + ' Set Dialog title + ComDlg.DialogTitle = "Save to a Wave File" + ' Set filters + ComDlg.Filter = "All Files (*.*)|*.*|Wave Files " & "(*.wav)|*.wav" + ' Specify default filter + ComDlg.FilterIndex = 2 + ' Display the Open dialog box + ComDlg.ShowSave + + ' create a wave stream + Dim cpFileStream As New SpFileStream + + ' Set output format to selected format + cpFileStream.Format.Type = FormatCB.ItemData(FormatCB.ListIndex) + + ' Open the file for write + cpFileStream.Open ComDlg.FileName, SSFMCreateForWrite, False + + ' Set output stream to the file stream + Voice.AllowAudioOutputFormatChangesOnNextSet = False + Set Voice.AudioOutputStream = cpFileStream + + ' show action + AddDebugInfo "Save to .wav file" + + ' speak the given text with given flags + Voice.Speak MainTxtBox.Text, m_speakFlags + + ' wait until it's done speaking with a really really long timeout. + ' the tiemout value is in unit of millisecond. -1 means forever. + Voice.WaitUntilDone -1 + + ' Since the output stream was set to the file stream, we need to + ' set back to the selected audio output by calling AudioOutputCB_Click + ' as if user just changed it through UI + AudioOutputCB_Click + + ' close the file stream + cpFileStream.Close + Set cpFileStream = Nothing + + MsgBox "WAV file successfully written!", vbOKOnly, "File Saved" + Exit Sub + +ErrHandler: + 'User pressed the Cancel button, do not show error + If Not (Err.Number = 32755) Then + AddDebugInfo "Save to Wave file Error: ", Err.Description + End If + + If Not cpFileStream Is Nothing Then + Set cpFileStream = Nothing + End If +End Sub + +Private Sub menuFileSpeakWave_Click() + ' Set CancelError is True + ComDlg.CancelError = True + On Error GoTo ErrHandler + ' Set flags + ComDlg.Flags = cdlOFNFileMustExist Or cdlOFNPathMustExist + ' Set Dialog title + ComDlg.DialogTitle = "Speak a Wave File" + ' Set filters + ComDlg.Filter = "All Files (*.*)|*.*|Wave Files " & "(*.wav)|*.wav" + ' Specify default filter + ComDlg.FilterIndex = 2 + ' Display the Open dialog box + ComDlg.ShowOpen + + AddDebugInfo "Speak .wav file" + + ' Speak the contents of the wavefile. Notice here we are passing in the + ' file name so the filename flag is set. + MainTxtBox.Text = ComDlg.FileName + chkSpFlagIsFilename.Value = Checked + SpeakBtn_Click + + Exit Sub + +ErrHandler: + 'User pressed the Cancel button, do not show error + If Not (Err.Number = 32755) Then + AddDebugInfo "Speak Wave Error: ", Err.Description + End If + + SetSpeakingState False, m_bPaused + Exit Sub +End Sub + +Private Sub PauseBtn_Click() + Select Case PauseBtn.Caption + Case "Pause" + AddDebugInfo "Pause" + Voice.Pause + SetSpeakingState m_bSpeaking, True + + Case "Resume" + AddDebugInfo "Resume" + Voice.Resume + SetSpeakingState m_bSpeaking, False + End Select +End Sub + +Private Sub RateSldr_Scroll() + Voice.Rate = RateSldr.Value +End Sub + +Private Sub ResetBtn_Click() + 'set output to default + AudioOutputCB.ListIndex = 0 + Set Voice.AudioOutput = Nothing + + 'use default voice + VoiceCB.ListIndex = 0 + + 'Format to default + FormatCB.Text = DefaultFmt + + 'reset main text field + MainTxtBox.Text = "Enter text you wish spoken here." + + 'reset volume and rate + VolumeSldr.Value = 100 + VolumeSldr_Scroll + + RateSldr.Value = 0 + RateSldr_Scroll + + ' reset speak flags + m_speakFlags = SVSFlagsAsync Or SVSFPurgeBeforeSpeak Or SVSFIsXML + chkSpFlagAync.Value = Checked + chkSpFlagPurgeBeforeSpeak.Value = Checked + chkSpFlagIsXML.Value = Checked + chkSpFlagIsFilename.Value = Unchecked + chkSpFlagNLPSpeakPunc.Value = Unchecked + chkSpFlagPersistXML.Value = Unchecked + + 'reset DebugTxtbox text + DebugTxtBox.Text = Empty + + 'reset skip text box + SkipTxtBox.Text = "0" + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICFULL") + + ' if it's paused, call Resume to reset state + If m_bPaused Then Voice.Resume + + SetSpeakingState False, False +End Sub + +Private Sub SkipBtn_Click() + On Error GoTo ErrHandler + Dim SkipType As String + Dim SkipNum As Integer + + AddDebugInfo "Skip" + + ' skip by the number specified + SkipNum = SkipTxtBox.Text + SkipType = "Sentence" + + Voice.Skip SkipType, SkipNum + Exit Sub + +ErrHandler: + 'MsgBox Err.Description & ":" & Err.Number, vbOKOnly, "Skip Error" + AddDebugInfo "Skip Error: ", Err.Description + Exit Sub +End Sub + +Private Sub SpeakBtn_Click() + On Error GoTo ErrHandler + AddDebugInfo ("Speak") + + ' exit if there's nothing to speak + If MainTxtBox.Text = "" Then + Exit Sub + End If + + ' If it's paused and some text still remains to be spoken, Speak button + ' acts the same as Resume button. However a programmer can choose to + ' speak from the beginning again or any other behavior. + ' In other cases, we speak the text with given flags. + If Not (m_bPaused And m_bSpeaking) Then + ' just speak the text with the given flags + Voice.Speak MainTxtBox.Text, m_speakFlags + End If + + ' Resume if Voice is paused + If m_bPaused Then Voice.Resume + + ' set the state of menu items and buttons + SetSpeakingState True, False + Exit Sub + +ErrHandler: + AddDebugInfo "Speak Error: ", Err.Description + SetSpeakingState False, m_bPaused +End Sub + +Private Sub StopBtn_Click() + On Error GoTo ErrHandler + AddDebugInfo ("Stop") + + ' when string to speak is NULL and dwFlags is set to SPF_PURGEBEFORESPEAK + ' it indicates to SAPI that any remaining data to be synthesized should + ' be discarded. + Voice.Speak vbNullString, SVSFPurgeBeforeSpeak + If m_bPaused Then Voice.Resume + + SetSpeakingState False, False + Exit Sub + +ErrHandler: + AddDebugInfo "Speak Error: ", Err.Description +End Sub + +Private Sub Voice_AudioLevel(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal AudioLevel As Long) + ShowEvent "AudioLevel", "StreamNumber=" & StreamNumber, _ + "StreamPosition=" & StreamPosition, "AudioLevel=" & AudioLevel +End Sub + +Private Sub Voice_Bookmark(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal Bookmark As String, _ + ByVal BookmarkId As Long) + ShowEvent "BookMark", "StreamNumber=" & StreamNumber, _ + "StreamPosition=" & StreamPosition, "Bookmark=" & Bookmark, _ + "BookmarkId=" & BookmarkId +End Sub + +Private Sub Voice_EndStream(ByVal StreamNum As Long, ByVal StreamPos As Variant) + ShowEvent "EndStream", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos + + ' select all text to indicate that we are done + HighLightSpokenWords 0, Len(MainTxtBox.Text) + + ' reset the mouth + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICFULL") + + ' reset the state of buttons, checkboxes and menu items + SetSpeakingState False, m_bPaused +End Sub + +Private Sub Voice_EnginePrivate(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Long, _ + ByVal lParam As Variant) + ShowEvent "EnginePrivate", "StreamNumber=" & StreamNumber, _ + "StreamPosition=" & StreamPosition, "lParam=" & lParam +End Sub + +Private Sub Voice_Phoneme(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal Duration As Long, _ + ByVal NextPhoneId As Integer, _ + ByVal Feature As SpeechLib.SpeechVisemeFeature, _ + ByVal CurrentPhoneId As Integer) + ShowEvent "Phoneme", "StreamNumber=" & StreamNumber, _ + "StreamPosition=" & StreamPosition, "NextPhoneId=" & NextPhoneId, _ + "Feature=" & Feature, "CurrentPhoneId=" & CurrentPhoneId +End Sub + +Private Sub Voice_Sentence(ByVal StreamNum As Long, _ + ByVal StreamPos As Variant, _ + ByVal Pos As Long, _ + ByVal Length As Long) + ShowEvent "Sentence", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos, _ + "Pos=" & Pos, "Length=" & Length +End Sub + +Private Sub Voice_StartStream(ByVal StreamNum As Long, ByVal StreamPos As Variant) + ShowEvent "StartStream", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos + + ' reset the state of buttons, checkboxes and menu items + SetSpeakingState True, m_bPaused +End Sub + +Private Sub Voice_Viseme(ByVal StreamNum As Long, _ + ByVal StreamPos As Variant, _ + ByVal Duration As Long, _ + ByVal VisemeType As SpeechVisemeType, _ + ByVal Feature As SpeechVisemeFeature, _ + ByVal VisemeId As Long) + + ShowEvent "Viseme", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos, _ + "Duration=" & Duration, "VisemeType=" & VisemeType, _ + "Feature=" & Feature, "VisemeId=" & VisemeId + + ' Here we are going to show different mouth positions according to the viseme. + ' The picture we show doesn't necessarily match the real mouth position. + ' Just trying to make it more interesting. + If VisemeId = 0 Then + VisemeId = VisemeId + 1 + End If + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", VisemeId) + If (VisemeId Mod 6 = 2) Then + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICEYECLOSED") + Else + If (VisemeId Mod 6 = 5) Then + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICEYENARROW") + End If + End If +End Sub + +Private Sub Voice_VoiceChange(ByVal StreamNum As Long, _ + ByVal StreamPos As Variant, _ + ByVal Token As SpeechLib.ISpeechObjectToken) + + ShowEvent "VoiceChange", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos, _ + "Token=" & Token.GetDescription + + ' Let's sync up the combo box with the new value + Dim i As Long + For i = 0 To VoiceCB.ListCount - 1 + If VoiceCB.List(i) = Token.GetDescription() Then + VoiceCB.ListIndex = i + Exit For + End If + Next +End Sub + +Private Sub Voice_Word(ByVal StreamNum As Long, _ + ByVal StreamPos As Variant, _ + ByVal Pos As Long, _ + ByVal Length As Long) + + ShowEvent "Word", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos, _ + "Pos=" & Pos, "Length=" & Length + + Debug.Print Pos, Length, MainTxtBox.SelStart, MainTxtBox.SelLength + + ' Select the word that's currently being spoken. + HighLightSpokenWords Pos, Length +End Sub + +Private Sub VoiceCB_Click() + ' change the voice to the selected one + Set Voice.Voice = Voice.GetVoices().Item(VoiceCB.ListIndex) +End Sub + +Private Sub VolumeSldr_Scroll() + Voice.Volume = VolumeSldr.Value +End Sub + +' The following functions are simply to sync up the speak flags. +' When the check box is checked, the corresponding bit is set in the flags. +Private Sub chkSpFlagAync_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagAync.Value, m_speakFlags, SVSFlagsAsync) +End Sub + +Private Sub chkSpFlagIsFilename_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagIsFilename.Value, m_speakFlags, SVSFIsFilename) +End Sub + +Private Sub chkSpFlagIsXML_Click() + ' Note: special case here. There are two flags,SVSFIsXML and SVSFIsNotXML. + ' When neither is set, SAPI will guess by peeking at beginning characters. + ' In this sample, we explicitly set one of them. + + If chkSpFlagIsXML.Value = 0 Then + ' clear SVSFIsXML bit and set SVSFIsNotXML bit + m_speakFlags = m_speakFlags And Not SVSFIsXML + m_speakFlags = m_speakFlags Or SVSFIsNotXML + Else + ' clear SVSFIsNotXML bit and set SVSFIsXML bit + m_speakFlags = m_speakFlags And Not SVSFIsNotXML + m_speakFlags = m_speakFlags Or SVSFIsXML + End If +End Sub + +Private Sub chkSpFlagNLPSpeakPunc_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagNLPSpeakPunc.Value, m_speakFlags, SVSFNLPSpeakPunc) +End Sub + +Private Sub chkSpFlagPersistXML_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagPersistXML.Value, m_speakFlags, SVSFPersistXML) +End Sub + +Private Sub chkSpFlagPurgeBeforeSpeak_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagPurgeBeforeSpeak.Value, m_speakFlags, SVSFPurgeBeforeSpeak) +End Sub + + +Private Sub AddFmts(ByRef name As String, ByVal fmt As SpeechAudioFormatType) + Dim index As String + + ' get the count of existing list so that we are adding to the bottom of the list + index = FormatCB.ListCount + + ' add the name to the list box and associate the format type with the item + FormatCB.AddItem name, index + FormatCB.ItemData(index) = fmt +End Sub + +Private Sub AddItemToFmtCB() + AddFmts "SAFT8kHz8BitMono", SAFT8kHz16BitMono + AddFmts "SAFT8kHz8BitStereo", SAFT8kHz8BitStereo + AddFmts "SAFT8kHz16BitMono", SAFT8kHz16BitMono + AddFmts "SAFT8kHz16BitStereo", SAFT8kHz16BitStereo + + AddFmts "SAFT11kHz8BitMono", SAFT11kHz8BitMono + AddFmts "SAFT11kHz8BitStereo", SAFT11kHz8BitStereo + AddFmts "SAFT11kHz16BitMono", SAFT11kHz16BitMono + AddFmts "SAFT11kHz16BitStereo", SAFT11kHz16BitStereo + + AddFmts "SAFT12kHz8BitMono", SAFT12kHz8BitMono + AddFmts "SAFT12kHz8BitStereo", SAFT12kHz8BitStereo + AddFmts "SAFT12kHz16BitMono", SAFT12kHz16BitMono + AddFmts "SAFT12kHz16BitStereo", SAFT12kHz16BitStereo + + AddFmts "SAFT16kHz8BitMono", SAFT16kHz8BitMono + AddFmts "SAFT16kHz8BitStereo", SAFT16kHz8BitStereo + AddFmts "SAFT16kHz16BitMono", SAFT16kHz16BitMono + AddFmts "SAFT16kHz16BitStereo", SAFT16kHz16BitStereo + + AddFmts "SAFT22kHz8BitMono", SAFT22kHz8BitMono + AddFmts "SAFT22kHz8BitStereo", SAFT22kHz8BitStereo + AddFmts "SAFT22kHz16BitMono", SAFT22kHz16BitMono + AddFmts "SAFT22kHz16BitStereo", SAFT22kHz16BitStereo + + AddFmts "SAFT24kHz8BitMono", SAFT24kHz8BitMono + AddFmts "SAFT24kHz8BitStereo", SAFT24kHz8BitStereo + AddFmts "SAFT24kHz16BitMono", SAFT24kHz16BitMono + AddFmts "SAFT24kHz16BitStereo", SAFT24kHz16BitStereo + + AddFmts "SAFT32kHz8BitMono", SAFT32kHz8BitMono + AddFmts "SAFT32kHz8BitStereo", SAFT32kHz8BitStereo + AddFmts "SAFT32kHz16BitMono", SAFT32kHz16BitMono + AddFmts "SAFT32kHz16BitStereo", SAFT32kHz16BitStereo + + AddFmts "SAFT44kHz8BitMono", SAFT44kHz8BitMono + AddFmts "SAFT44kHz8BitStereo", SAFT44kHz8BitStereo + AddFmts "SAFT44kHz16BitMono", SAFT44kHz16BitMono + AddFmts "SAFT44kHz16BitStereo", SAFT44kHz16BitStereo + + AddFmts "SAFT48kHz8BitMono", SAFT48kHz8BitMono + AddFmts "SAFT48kHz8BitStereo", SAFT48kHz8BitStereo + AddFmts "SAFT48kHz16BitMono", SAFT48kHz16BitMono + AddFmts "SAFT48kHz16BitStereo", SAFT48kHz16BitStereo +End Sub +Private Sub LoadMouthImages() + On Error GoTo ErrHandler + + MouthImgList.ListImages.Add 1, "MICFULL", LoadResPicture("MICFULL", vbResBitmap) + MouthImgList.ListImages.Add 2, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 3, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 4, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 5, , LoadResPicture("MIC10", vbResBitmap) + MouthImgList.ListImages.Add 6, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 7, , LoadResPicture("MIC9", vbResBitmap) + MouthImgList.ListImages.Add 8, , LoadResPicture("MIC2", vbResBitmap) + MouthImgList.ListImages.Add 9, , LoadResPicture("MIC13", vbResBitmap) + MouthImgList.ListImages.Add 10, , LoadResPicture("MIC9", vbResBitmap) + MouthImgList.ListImages.Add 11, , LoadResPicture("MIC12", vbResBitmap) + MouthImgList.ListImages.Add 12, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 13, , LoadResPicture("MIC9", vbResBitmap) + MouthImgList.ListImages.Add 14, , LoadResPicture("MIC3", vbResBitmap) + MouthImgList.ListImages.Add 15, , LoadResPicture("MIC6", vbResBitmap) + MouthImgList.ListImages.Add 16, , LoadResPicture("MIC7", vbResBitmap) + MouthImgList.ListImages.Add 17, , LoadResPicture("MIC8", vbResBitmap) + MouthImgList.ListImages.Add 18, , LoadResPicture("MIC5", vbResBitmap) + MouthImgList.ListImages.Add 19, , LoadResPicture("MIC4", vbResBitmap) + MouthImgList.ListImages.Add 20, , LoadResPicture("MIC7", vbResBitmap) + MouthImgList.ListImages.Add 21, , LoadResPicture("MIC9", vbResBitmap) + MouthImgList.ListImages.Add 22, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 23, "MICEYECLOSED", LoadResPicture("MICEYECLOSED", vbResBitmap) + MouthImgList.ListImages.Add 24, "MICEYENARROW", LoadResPicture("MICEYENARROW", vbResBitmap) + + Exit Sub +ErrHandler: + MsgBox Err.Description & ":" & Err.Number, vbOKOnly, "Load Images Error" +End Sub + +Private Sub AddDebugInfo(DebugStr As String, Optional Error As String = Empty) + ' This function adds debug string to the info window. + + ' First of all, let's delete a few charaters if the text box is about to + ' overflow. In this sample we are using the default limit of charaters. + If Len(DebugTxtBox.Text) > 64000 Then + Debug.Print "Too much stuff in the debug window. Remove first 10K chars" + DebugTxtBox.SelStart = 0 + DebugTxtBox.SelLength = 10240 + DebugTxtBox.SelText = "" + End If + + ' append the string to the DebugTxtBox text box and add a newline + DebugTxtBox.SelStart = Len(DebugTxtBox.Text) + DebugTxtBox.SelText = DebugStr & Error & vbCrLf +End Sub + +Private Sub ShowEvent(ParamArray strArray()) + ' we will only show the events if the ShowEvents box is checked + If chkShowEvents.Value = Checked Then + Dim strText As String + strText = Join(strArray, ", ") + AddDebugInfo " Event: " & strText + End If +End Sub + +Private Sub HighLightSpokenWords(ByVal Pos As Long, ByVal Length As Long) + On Error GoTo ErrHandler + + ' Only high light when the MainTxtBox is actually showing the spoken text, + ' instead of file name + If chkSpFlagIsFilename.Value = Unchecked Then + MainTxtBox.SelStart = Pos + MainTxtBox.SelLength = Length + End If + + Exit Sub + +ErrHandler: + AddDebugInfo "Failed to high light words. This may be caused by too many charaters in the main text box." +End Sub + +' This following helper function will set or clear a bit (flag) in the given +' integer (base) according to the condition (cond). If cond is 0, the bit +' is cleared. Otherwise, the bit is set. The resulting integer is returned. +Private Function SetOrClearFlag(ByVal cond As Long, _ + ByVal base As Long, _ + ByVal flag As Long) As Long + + If cond = 0 Then + ' the condition is false, clear the flag + SetOrClearFlag = base And Not flag + Else + ' the condition is false, set the flag + SetOrClearFlag = base Or flag + End If +End Function + +Private Sub SetSpeakingState(ByVal bSpeaking As Boolean, ByVal bPaused As Boolean) + ' change state of menu items and buttons accordingly + menuFileOpenText.Enabled = Not bSpeaking + menuFileSpeakWave.Enabled = Not bSpeaking + menuFileSaveToWave.Enabled = Not bSpeaking + + SpeakBtn.Enabled = True + + StopBtn.Enabled = bSpeaking + SkipBtn.Enabled = (bSpeaking And Not bPaused) + PauseBtn.Enabled = bSpeaking + + If bPaused Then + PauseBtn.Caption = "Resume" + Else + PauseBtn.Caption = "Pause" + End If + + m_bSpeaking = bSpeaking + m_bPaused = bPaused +End Sub + +Public Function GetDirectory() As String + + Err.Clear + + On Error GoTo ErrHandler + + Dim DataKey As ISpeechDataKey + Dim Category As New SpObjectTokenCategory + + 'Get the sdk installation location from the registry + 'The value is under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech". The string name is SDKPath" + Category.SetId SpeechRegistryLocalMachineRoot + Set DataKey = Category.GetDataKey + GetDirectory = DataKey.GetStringValue("SDKPath") + GetDirectory = GetDirectory + "samples\common" + + + +ErrHandler: + If Err.Number <> 0 Then + GetDirectory = "" + End If +End Function diff --git a/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frx b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frx new file mode 100644 index 00000000..b74a9cf0 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frx differ diff --git a/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMod.bas b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMod.bas new file mode 100644 index 00000000..a32d11ee --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMod.bas @@ -0,0 +1,8 @@ +Attribute VB_Name = "TTSAppMod" +Option Explicit + +Declare Function GetSysColor Lib "user32" (ByVal index As Long) As Long + +Public Const COLOR_BTNFACE = 15 +Public Const COLOR_3DFACE = COLOR_BTNFACE + diff --git a/mp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.RES b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.RES new file mode 100644 index 00000000..dbe5c670 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.RES differ diff --git a/mp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.vbp b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.vbp new file mode 100644 index 00000000..7aef3591 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.vbp @@ -0,0 +1,47 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll#Microsoft Speech Object Library +Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX +Object={86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCT2.OCX +Form=TTSAppMain.frm +Module=TTSAppMod; TTSAppMod.bas +ResFile32="ttsapp.RES" +IconForm="TTSAppMain" +Startup="TTSAppMain" +HelpFile="" +Title="TTSAppVB" +ExeName32="TTSAppVB.exe" +Command32="" +Name="TTSApp" +HelpContextID="0" +Description="SAPI SDK VB TTS App sample" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corporation" +VersionFileDescription="TTSAppVB" +VersionLegalCopyright="Copyright (C) Microsoft Corporation. 1981-2001" +VersionProductName="Microsoft® Windows(TM) Operating System" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.RES b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.RES new file mode 100644 index 00000000..21b65aae Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.RES differ diff --git a/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.vbp b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.vbp new file mode 100644 index 00000000..e20b2268 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.vbp @@ -0,0 +1,37 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\..\..\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{21D6D480-A88B-11D0-83DD-00AA003CCABD}#1.0#0#..\..\..\..\..\..\..\..\WINNT\System32\tapi3.dll#Microsoft TAPI 3.0 Type Library +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#..\..\..\..\..\sapi\sapi\objd\i386\sapi.dll#Microsoft Speech Object Library +Reference=*\G{EDAEECD8-0D75-499E-9B69-187ACACF2C05}#1.0#0#..\..\..\cpp\tapicustomstream\objd\i386\STCustomStream.dll#STCustomStream 1.0 Type Library +Form=VBOutgoingcall.frm +ResFile32="VBOutGoingCall.RES" +Startup="Form1" +ExeName32="VBOutGoingCall.exe" +Command32="" +Name="VBOutGoingCall" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corp." +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frm b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frm new file mode 100644 index 00000000..69ef1bdc --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frm @@ -0,0 +1,469 @@ +VERSION 5.00 +Begin VB.Form Form1 + BorderStyle = 1 'Fixed Single + Caption = "VB Outgoing Call" + ClientHeight = 3555 + ClientLeft = 150 + ClientTop = 720 + ClientWidth = 6105 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 3555 + ScaleWidth = 6105 + StartUpPosition = 3 'Windows Default + Begin VB.TextBox Text1 + Height = 1815 + Left = 240 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 1 + Text = "VBOutgoingcall.frx":0000 + Top = 840 + Width = 4455 + End + Begin VB.ComboBox DestAddressCombo + Height = 315 + Left = 1320 + TabIndex = 0 + Top = 240 + Width = 3375 + End + Begin VB.CommandButton DisconnectBtn + Caption = "Disconnect" + Height = 450 + Left = 4920 + TabIndex = 4 + Top = 1320 + Width = 1000 + End + Begin VB.CommandButton CallBtn + Caption = "Dial" + Height = 450 + Left = 4920 + TabIndex = 2 + Top = 240 + Width = 1000 + End + Begin VB.Label Label1 + Caption = "Internet Call" + Height = 255 + Left = 240 + TabIndex = 6 + Top = 240 + Width = 975 + End + Begin VB.Label TitleLbl + Caption = "Call Status:" + Height = 255 + Left = 120 + TabIndex = 5 + Top = 3000 + Width = 855 + End + Begin VB.Label StatusLbl + Height = 375 + Left = 1080 + TabIndex = 3 + Top = 3000 + Width = 3495 + End + Begin VB.Menu menuFile + Caption = "File" + Begin VB.Menu menuFileExit + Caption = "Exit" + End + End + Begin VB.Menu menuHelp + Caption = "Help" + Begin VB.Menu menuAbout + Caption = "About" + End + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This VB Speech Telephony App sample demonstrates how to use SAPI TTS +' functionalities to speech enable the TAPI apps. The main objects used +' here are SAPI SpVoice, TAPI object, and custom real time audio object +' STCUSTOMSTREAMLib.TTSStream +' +'============================================================================= +Option Explicit + +Dim WithEvents gObjTapiWithEvents As TAPI +Attribute gObjTapiWithEvents.VB_VarHelpID = -1 +Dim WithEvents gObjVoice As SpVoice +Attribute gObjVoice.VB_VarHelpID = -1 +Dim gObjTapi As TAPI +Dim gobjAddress As ITAddress +Dim objCallControl As ITBasicCallControl +Dim AddressTypeSelected As Long +Dim MemStream As SpMemoryStream +Dim bConnectionStatus As Boolean +Const VFW_E_NOT_COMMITTED = &H80040211 'DirectShow Error :Cannot allocate a sample when the allocator is not active + +Const TAPI3_ALL_TAPI_EVENTS = _ + TE_ACDGROUP Or _ + TE_ADDRESS Or _ + TE_AGENT Or _ + TE_AGENTHANDLER Or _ + TE_AGENTSESSION Or _ + TE_CALLHUB Or _ + TE_CALLINFOCHANGE Or _ + TE_CALLMEDIA Or _ + TE_CALLNOTIFICATION Or _ + TE_CALLSTATE Or _ + TE_DIGITEVENT Or _ + TE_GENERATEEVENT Or _ + TE_PRIVATE Or _ + TE_QOSEVENT Or _ + TE_QUEUE Or _ + TE_REQUEST Or _ + TE_TAPIOBJECT +Private Sub menuAbout_Click() + MsgBox "VB Outgoing Call App" & vbCrLf & vbCrLf & "Copyright (c) 2001 Microsoft Corporation. All rights reserved.", _ + vbOKOnly Or vbInformation, "VB Outgoing Call" +End Sub + +Private Sub menuFileExit_Click() + Unload Me +End Sub + +Private Sub CallBtn_Click() + StatusLbl.Caption = _ + "Dial ..." + StatusLbl.Refresh + DisconnectBtn.Enabled = True + Call MakeTheCall +End Sub + +Private Sub DisconnectBtn_Click() + + Dim strMsg As String + + If objCallControl Is Nothing Then + strMsg = "Already disconnected." + StatusLbl.Caption = strMsg + StatusLbl.Refresh + Else + objCallControl.Disconnect (DC_NORMAL) + + 'Since the call has been disconnected, disable the Disconnect button + DisconnectBtn.Enabled = False + End If + +End Sub + +Private Sub Form_Load() + Dim strMsg As String + Dim objcollAddress As ITCollection + Dim nAddressIndex As Long + + 'Initialize Sapi + Set gObjVoice = New SpVoice + + 'Create a Tapi object + Set gObjTapi = New TAPI + + 'Initialize TAPI. this must be called before + 'any other tapi functions are called. + Call gObjTapi.Initialize + + 'set the EventFilter to accept all defined tapi events + gObjTapi.EventFilter = TAPI3_ALL_TAPI_EVENTS + + Set gObjTapiWithEvents = gObjTapi + + Call IpAddressOpt + + 'Load a good bye wave file and write it to the SpMemoryStream + Dim WaveData As Variant + WaveData = LoadResData("WAVEFILE", "CUSTOM") + + Set MemStream = New SpMemoryStream + MemStream.SetData WaveData + + 'Disable the button right now. It will be enabled after the connection + DisconnectBtn.Enabled = False + + 'There is no connection right now + bConnectionStatus = False +End Sub + +Private Sub Form_Unload(Cancel As Integer) + + If bConnectionStatus Then + MsgBox "The application is busy. Cannot exit now. Please try to disconnect first" + 'do not exit the app + Cancel = True + Else + 'shut down tapi and release global objects + If Not (gObjTapi Is Nothing) Then + gObjTapi.Shutdown + End If + Set objCallControl = Nothing + Set gobjAddress = Nothing + Set gObjTapi = Nothing + Set MemStream = Nothing + End If +End Sub + +Private Sub FindAnAddress(AddressTypeSelected As Long) + Dim Address As ITAddress + Dim AddressCaps As ITAddressCapabilities + Dim lType As Long + Dim MediaSupport As ITMediaSupport + + For Each Address In gObjTapi.Addresses + + 'query for ITAddressCapabilities + Set AddressCaps = Address + lType = AddressCaps.AddressCapability(AC_ADDRESSTYPES) + Set AddressCaps = Nothing + + 'is the type we are looking for? + If lType And AddressTypeSelected Then + If AddressSupportsMediaType(Address, TAPIMEDIATYPE_AUDIO) Then + If Len(Address.AddressName) <> 0 Then + 'save to global variable + Set gobjAddress = Address + Exit For + End If + End If + End If + + Set Address = Nothing + + Next + +End Sub + +Private Function AddressSupportsMediaType(Address As ITAddress, lType As Long) As Boolean + + Dim bType As Boolean + Dim pMediaSupport As ITMediaSupport + bType = False + + 'Check whether the service provider associated with the current address + 'supports the media type, lType + + Set pMediaSupport = Address + If pMediaSupport Is Nothing Then + bType = False + Else + bType = pMediaSupport.QueryMediaType(lType) + End If + + Set pMediaSupport = Nothing + AddressSupportsMediaType = bType +End Function + +Private Sub SelectTerminalsOnCall() + Dim objStreamControl As ITStreamControl + Set objStreamControl = objCallControl + + If Not (objStreamControl Is Nothing) Then + Dim objITCollStreams As ITCollection + Dim nIndex As Long, objCrtStream As ITStream + Dim objTerminalSupport As ITTerminalSupport + + Set objITCollStreams = objStreamControl.Streams + Set objTerminalSupport = gobjAddress + + 'Create a media streaming terminal and select the capture stream for the SAPI/TTS + 'audio output + Dim objTerminal As ITTerminal + Dim MediaStreamTerminalClsid As String + MediaStreamTerminalClsid = "{E2F7AEF7-4971-11D1-A671-006097C9A2E8}" + + For nIndex = 1 To objITCollStreams.Count + Set objCrtStream = objITCollStreams.Item(nIndex) + + + If (objCrtStream.Direction = TD_CAPTURE) Then + Set objTerminal = objTerminalSupport.CreateTerminal( _ + MediaStreamTerminalClsid, objCrtStream.MediaType, objCrtStream.Direction) + + Call objCrtStream.SelectTerminal(objTerminal) + End If + Set objCrtStream = Nothing + Next nIndex + + '''''''''''''' + ''USE SAPI TTS + '''''''''''''' + Dim CustomStream As New SpCustomStream + Dim SapiTapiTTSStream As STCUSTOMSTREAMLib.TTSStream + + 'Create the TTSStream object + Set SapiTapiTTSStream = New STCUSTOMSTREAMLib.TTSStream + + 'Initialize the TTSStream object + SapiTapiTTSStream.InitTTSCaptureStream objTerminal + + 'Set the TTSStream object as a BaseStream in the SAPI CustomStream object + Set CustomStream.BaseStream = SapiTapiTTSStream + + 'Use the current format and prevent the SAPI object from changing it + gObjVoice.AllowAudioOutputFormatChangesOnNextSet = False + + 'Set the audio output to the SAPI CustomStream + Set gObjVoice.AudioOutputStream = CustomStream + + 'release not needed objects + Set SapiTapiTTSStream = Nothing + Set CustomStream = Nothing + Set objTerminalSupport = Nothing + Set objITCollStreams = Nothing + Set objStreamControl = Nothing + End If +End Sub + +Private Sub MakeTheCall() + Dim lMediaType As Long + + If (AddressSupportsMediaType(gobjAddress, TAPIMEDIATYPE_AUDIO)) Then + + lMediaType = TAPIMEDIATYPE_AUDIO + lMediaType + End If + + Set objCallControl = gobjAddress.CreateCall(DestAddressCombo.Text, _ + AddressTypeSelected, lMediaType) + + + Call SelectTerminalsOnCall + + + 'connect + On Error GoTo ErrHandler + objCallControl.Connect False + On Error GoTo 0 + +ErrHandler: + If Err.Number = -2147221492 Then + MsgBox "Connection failed. Is the domain name or the IP Address correct?" + StatusLbl.Caption = "Connection failed." + DisconnectBtn.Enabled = False + End If +End Sub + +Private Sub gobjTapiWithEvents_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) + + Dim strMsg + + Select Case TapiEvent + Case TE_CALLNOTIFICATION + + Case TE_CALLSTATE + + 'for this type of event, the object pEvent must be + 'queried for its ITCallStateEvent interface + Dim objCallStateEvent As ITCallStateEvent + Set objCallStateEvent = pEvent + + Dim State As CALL_STATE + State = objCallStateEvent.State + + DisplayCallState (State) + Set objCallStateEvent = Nothing + + Case TE_CALLMEDIA + Dim MediaEvent As ITCallMediaEvent + Set MediaEvent = pEvent + + Select Case MediaEvent.Event + Case CME_STREAM_ACTIVE + + On Error GoTo ErrorHandler + 'prompt greetings + If (Text1.Text = "") Then + gObjVoice.Speak "Hello" + gObjVoice.Speak "Welcome to the Speech and Telephony API app. Have a nice day! Bye now", SVSFlagsAsync + + Else + gObjVoice.Speak Text1.Text, SVSFlagsAsync + End If + + 'Wait until the speak completes + Do + DoEvents + Loop Until gObjVoice.WaitUntilDone(1) = True + + + MemStream.Seek 0, SSSPTRelativeToStart + gObjVoice.SpeakStream MemStream + + DisconnectBtn_Click + End Select + End Select + Exit Sub + +ErrorHandler: + If Err.Number = VFW_E_NOT_COMMITTED Then + StatusLbl.Caption = "The connection was lost. Disconnecting ..." + StatusLbl.Refresh + DisconnectBtn_Click + Else + MsgBox "Error occurs: " & Err.Description & Err.Number + End If +End Sub + +Private Sub DisplayCallState(State As CALL_STATE) + Dim strMsg As String + + 'Display the current call status + Select Case State + Case CS_CONNECTED + 'The app is connected so we set the connection status to true + bConnectionStatus = True + StatusLbl.Caption = "CS_CONNECTED" + + Case CS_DISCONNECTED + DisconnectBtn_Click + 'The app is disconnected so we set the connection status to false + bConnectionStatus = False + StatusLbl.Caption = "CS_DISCONNECTED" + + Case CS_HOLD + StatusLbl.Caption = " CS_HOLD" + + Case CS_IDLE + StatusLbl.Caption = "CS_IDLE" + + Case CS_INPROGRESS + StatusLbl.Caption = "CS_INPROGRESS" + + Case CS_OFFERING + StatusLbl.Caption = "CS_OFFERING" + + Case CS_QUEUED + StatusLbl.Caption = "CS_QUEUED" + + Case Else + StatusLbl.Caption = "Unknown!!" + End Select + + StatusLbl.Refresh +End Sub + +Private Sub IpAddressOpt() + AddressTypeSelected = LINEADDRESSTYPE_DOMAINNAME + FindAnAddress AddressTypeSelected + + 'The app only supports the Internet call. You can add your interest IP + 'addresses or machine names here programmatically or simply add them in the + 'Properties of the DestAddressCombo ComBobox. + + DestAddressCombo.Text = " or IP address" + If Not (gobjAddress Is Nothing) Then + StatusLbl.Caption = "Using " & gobjAddress.AddressName + End If + StatusLbl.Refresh +End Sub + diff --git a/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frx b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frx new file mode 100644 index 00000000..b8566052 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frx @@ -0,0 +1 @@ +GWelcome to the Speech and Telephony API app. Have a nice day! Bye now diff --git a/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.RES b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.RES new file mode 100644 index 00000000..d9257876 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.RES differ diff --git a/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frm b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frm new file mode 100644 index 00000000..ec908aa1 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frm @@ -0,0 +1,1081 @@ +VERSION 5.00 +Begin VB.Form Form1 + BackColor = &H8000000B& + BorderStyle = 1 'Fixed Single + Caption = "SAPI TAPI App" + ClientHeight = 4725 + ClientLeft = 150 + ClientTop = 720 + ClientWidth = 4605 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 4725 + ScaleWidth = 4605 + StartUpPosition = 3 'Windows Default + Begin VB.TextBox StatusBox + Height = 2655 + Left = 0 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 3 + Top = 2040 + Width = 4575 + End + Begin VB.CommandButton AnswerBtn + Caption = "Answer" + Height = 495 + Left = 840 + TabIndex = 1 + Top = 720 + Width = 2895 + End + Begin VB.ComboBox AddressTypesComBox + Height = 315 + Left = 840 + TabIndex = 0 + Text = "Combo1" + Top = 120 + Width = 2895 + End + Begin VB.CommandButton DisconnectBtn + Caption = "Disconnect" + Height = 495 + Left = 840 + TabIndex = 2 + Top = 1440 + Width = 2895 + End + Begin VB.Menu FileMenu + Caption = "File" + Begin VB.Menu ExitMenu + Caption = "Exit" + End + End + Begin VB.Menu AboutMenu + Caption = "About" + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This VB Speech Telephony App sample demonstrates how to use SAPI TTS and SR +' functionalities to speech enable the TAPI applications. The main objects used +' here are SAPI SpVoice, SpInprocRecognizer, SpMemoryStream TAPI object, and +' custom real time audio object STCUSTOMSTREAMLib.TTSStream and +' STCUSTOMSTREAMLib.ASRStream. The STCUSTOMSTREAMLib object is included in SAPI SDK. +' This object allows users to have the Internet calls between two computers and +' standard phone calls via the voice modem. This SAPI TAPI app uses the Internet call. +' However, users can enhance it to support the phone call by supporting +' LINEADDRESSTYPE_PHONENUMBER in FindAddressIndex() subroutine and add +' LINEADDRESSTYPE_PHONENUMBER to the AddressTypesComBox ComboBox. For the detail +' information about how to add the support for phone calls via the voice modem, +' please refer to TAPI SDK. +' +'============================================================================= + +Option Explicit + +Dim WithEvents gObjVoice As SpVoice +Attribute gObjVoice.VB_VarHelpID = -1 +Dim gObjRecognizer As SpInprocRecognizer +Dim WithEvents gObjRecoContext As SpInProcRecoContext +Attribute gObjRecoContext.VB_VarHelpID = -1 +Dim RecoDictationGrammar As ISpeechRecoGrammar +Dim RecoCCGrammar As ISpeechRecoGrammar +Dim TopRule As ISpeechGrammarRule +Dim CmdRule As ISpeechGrammarRule + +Dim WithEvents gObjTapiWithEvents As TAPI +Attribute gObjTapiWithEvents.VB_VarHelpID = -1 +Dim gObjTapi As TAPI +Attribute gObjTapi.VB_VarHelpID = -1 +Dim gobjAddress As ITAddress +Dim glRegistrationToken As Long +Dim gobjReceivedCallInfo As ITCallInfo +Dim gbSupportedCall As Boolean +Dim gobjCallControl As ITBasicCallControl + +Dim TimeOut As Long +Dim gMemStream As SpMemoryStream +Dim gByeWave As New SpMemoryStream +Dim gChimeWaveStream As New SpMemoryStream + +Dim gWriteSize As Long +Dim StreamSaveArray() As Long +Dim gIndex As Long + +Dim objSRTerminal As ITTerminal +Dim objTTSTerminal As ITTerminal +Dim gNextCall As Boolean +Dim bNeedWaitForEndStreamEvent As Boolean +Dim bConnectionStatus As Boolean + +Enum GRAMMARIDS + GID_DICTATION = 1 'ID for the dictation grammar + GID_CC = 3 'ID for the C&C grammar that's active when dictation is not +End Enum + +Const TAPI3_ALL_TAPI_EVENTS = _ + TE_ACDGROUP Or _ + TE_ADDRESS Or _ + TE_AGENT Or _ + TE_AGENTHANDLER Or _ + TE_AGENTSESSION Or _ + TE_CALLHUB Or _ + TE_CALLINFOCHANGE Or _ + TE_CALLMEDIA Or _ + TE_CALLNOTIFICATION Or _ + TE_CALLSTATE Or _ + TE_DIGITEVENT Or _ + TE_GENERATEEVENT Or _ + TE_PRIVATE Or _ + TE_QOSEVENT Or _ + TE_QUEUE Or _ + TE_REQUEST Or _ + TE_TAPIOBJECT +Const OPTTIMEOUT = &HFFFFF +Const LEAVEMESSAGEOPTION = &H1 +Const CHECKMESSAGEOPTION = &H2 +Const DISCONNECTED = &H4 +Const EVENTENDSTREAM = &H5 +Const VFW_E_NOT_COMMITTED = &H80040211 'DirectShow Error :Cannot allocate a sample when the allocator is not active + +Function TimeIt(PauseTime, Key, ExKey, Optional altExKey = OPTTIMEOUT) As Boolean + Dim Start, Finish, TotalTime + + Start = Timer ' Get start time. + Do While (Timer < Start + PauseTime) And (Key <> ExKey) And (Key <> altExKey) + DoEvents ' Yield to other processes. + Loop + + If Key = ExKey Then + TimeIt = True + Else + If Key = altExKey Then + TimeIt = True + Else + TimeIt = False ' time out + End If + End If +End Function + +Private Sub AboutMenu_Click() + MsgBox "Copyright (c) 2001 Microsoft Corporation", vbOKOnly + vbInformation, "SAPI TAPI App" +End Sub + +Private Sub AddressTypesComBox_Change() + AddressTypesComBox.ListIndex = 0 + RegisterForReceiveCall +End Sub + +Private Sub AddressTypesComBox_Click() + AddressTypesComBox.ListIndex = 0 + RegisterForReceiveCall +End Sub + +Private Sub LeaveMessage() + + Dim strMsg + + 'Reset the indices + gWriteSize = 0 + gIndex = 0 + ReDim StreamSaveArray(50) + + 'Create a new stream + Set gMemStream = New SpMemoryStream + + 'Assume that the maxinum time is 20 seconds for leaving a message + TimeOut = 0 + TimeIt 20, TimeOut, EVENTENDSTREAM, DISCONNECTED + +End Sub + +Private Sub AnswerBtn_Click() + + Dim strMsg + + 'Disable the answer button + AnswerBtn.Enabled = False + gNextCall = True + + If gobjReceivedCallInfo Is Nothing Then + strMsg = "There is no call to be answered!" + StatusBox.SelText = vbCrLf & strMsg + + Exit Sub + End If + + If Not (gobjReceivedCallInfo.CallState = CS_OFFERING) Then + strMsg = "Cannot answer call that doesn't have offering state." + StatusBox.SelText = vbCrLf & strMsg + + Exit Sub + End If + + ' + 'Not all addresses support ITTerminalSupport and ITStreamControl + 'therefore we need to be prepared for exceptions. + ' + On Error Resume Next + + + 'Query ITBasicCallControl, the call control interface + Set gobjCallControl = gobjReceivedCallInfo + + ' + 'Createa two media streaming terminals: One for TTS and another for SR + ' + 'query ITTerminalSupport from Address object + Dim objTerminalSupport As ITTerminalSupport + Set objTerminalSupport = gobjAddress + + If Not (objTerminalSupport Is Nothing) Then + + Dim MediaStreamTerminalClsid As String + + MediaStreamTerminalClsid = "{E2F7AEF7-4971-11D1-A671-006097C9A2E8}" + Set objTTSTerminal = objTerminalSupport.CreateTerminal( _ + MediaStreamTerminalClsid, TAPIMEDIATYPE_AUDIO, TD_CAPTURE) + Set objSRTerminal = objTerminalSupport.CreateTerminal( _ + MediaStreamTerminalClsid, TAPIMEDIATYPE_AUDIO, TD_RENDER) + + + 'Release not needed objects + Set objTerminalSupport = Nothing + + ' + 'Select the terminals before answering - select them one by one; + 'we'll need the ITStreamControl interface for doing this. + 'Select each terminal on the corresponding stream. + ' + + 'Note, if you are using a half-duplex voice modem, you only can select one + 'terminal at a time. Here, the app is designed for the Internet communications + 'so that the both terminals are selected + + + Dim objStreamControl As ITStreamControl + Set objStreamControl = gobjCallControl + + If Not (objStreamControl Is Nothing) Then + Dim objITCollStreams As ITCollection + + Set objITCollStreams = objStreamControl.Streams + + Dim nIndex As Long, objCrtStream As ITStream + + For nIndex = 1 To objITCollStreams.Count + Set objCrtStream = objITCollStreams.Item(nIndex) + + If objCrtStream.MediaType = TAPIMEDIATYPE_AUDIO Then + If objCrtStream.Direction = TD_CAPTURE Then + If Not (objTTSTerminal Is Nothing) Then + Call objCrtStream.SelectTerminal(objTTSTerminal) + End If + End If + If objCrtStream.Direction = TD_RENDER Then + If Not (objSRTerminal Is Nothing) Then + Call objCrtStream.SelectTerminal(objSRTerminal) + End If + End If + End If + + Set objCrtStream = Nothing + Next nIndex + + Set objITCollStreams = Nothing + Set objStreamControl = Nothing + End If + + End If + + On Error GoTo 0 + + 'Answer the call + gobjCallControl.Answer + + ' + 'Set the recognition state to active to get ready for recognition + 'Note: In SAPI 5.1, sapi turns off the recognition while the Read opration gets + 'any errors. + gObjRecognizer.State = SRSActive + + +End Sub + +Private Sub DisconnectBtn_Click() + + 'Set the disconnect flag + TimeOut = DISCONNECTED + + If gobjReceivedCallInfo Is Nothing Then + Dim strMsg As String + strMsg = "There is no call to be disconnected." + StatusBox.SelText = vbCrLf & strMsg + + Exit Sub + End If + + If Not (gobjCallControl Is Nothing) Then + gobjCallControl.Disconnect (DC_NORMAL) + + 'release the call control interface + Set gobjCallControl = Nothing + End If + + + 'Deactive grammars + RecoDictationGrammar.DictationSetState SGDSInactive + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSInactive + + 'Release terminals + If Not (objTTSTerminal Is Nothing) Then + Set objTTSTerminal = Nothing + End If + + If Not (objSRTerminal Is Nothing) Then + Set objSRTerminal = Nothing + End If + + If bNeedWaitForEndStreamEvent Then + 'Wait about 30 seconds for the endstream event + TimeIt 30, TimeOut, EVENTENDSTREAM + End If + + 'Disable the Disconnect and Answer button + DisconnectBtn.Enabled = False + AnswerBtn.Enabled = False +End Sub + +Private Sub ExitMenu_Click() + + 'Unload the form + Unload Me + +End Sub + +Private Sub Form_Load() + + 'Initialize Sapi + Set gObjRecognizer = New SpInprocRecognizer + Set gObjRecoContext = gObjRecognizer.CreateRecoContext + + 'Obtain the voice from Reco Context + Set gObjVoice = gObjRecoContext.Voice + + 'Set interest events. Assume that we are only interested in the following four + 'SAPI SR events. + gObjRecoContext.EventInterests = SRERecognition + SRESoundEnd + SREStreamEnd + _ + SREStreamStart + SRESoundEnd + + 'Retain the audio so that we can Speak the audio later + gObjRecoContext.RetainedAudio = SRAORetainAudio + + 'Create and Load the grammars + Set RecoDictationGrammar = gObjRecoContext.CreateGrammar(GID_DICTATION) + Set RecoCCGrammar = gObjRecoContext.CreateGrammar(GID_CC) + + RecoDictationGrammar.DictationLoad vbNullString, SLOStatic + + 'Build a dynamic Command and Control grammar + Dim CommandState As ISpeechGrammarRuleState + + ' Add two rules. The top level rule will reference the command rule. + ' User can choose the following commands: leave message, check message, leave, and check. + Set TopRule = RecoCCGrammar.Rules.Add("TopLevelRule", SRATopLevel Or SRADynamic, 1) + Set CmdRule = RecoCCGrammar.Rules.Add("CmdRule", SRADynamic, 2) + + Set CommandState = TopRule.AddState + + TopRule.InitialState.AddRuleTransition CommandState, CmdRule, 0, 0 + + CmdRule.InitialState.AddWordTransition Nothing, "leave", " ", , "", 0, "", 0 + CmdRule.InitialState.AddWordTransition Nothing, "check", " ", , "", 1, 1, 1 + + CommandState.AddWordTransition Nothing, "message", " ", , "", 1, "", 1 + + RecoCCGrammar.Rules.Commit + + 'Disable the Answer button. It will be enabled after a call is placed. + AnswerBtn.Enabled = False + + 'Disable the Disconnect button + DisconnectBtn.Enabled = False + + 'This application only supports the Internet call between two computers. You can use + 'AddressTypesComBox, to add more types of the connections, such as LINEADDRESSTYPE_PHONENUMBER + 'For example, if you want to support the phone calls, you need to add more code in + 'FindAddressIndex(). In addition, if you only have a half-duplex voice modem, then you + 'have to make some changes to ensure that you select one terminal at any time. + + AddressTypesComBox.AddItem ("H323 Calls") + AddressTypesComBox.ItemData(AddressTypesComBox.NewIndex) = LINEADDRESSTYPE_DOMAINNAME + + AddressTypesComBox.ListIndex = 0 + + 'Load the tone wave file to the SpMemoryStream + Dim WaveData As Variant + WaveData = LoadResData("CHIMES", "CUSTOM") + gChimeWaveStream.SetData WaveData + + 'Load the good bye wave file + Dim ByeWave As Variant + ByeWave = LoadResData("BYEWAVE", "CUSTOM") + gByeWave.SetData ByeWave + + 'Init the flag. The flag will be set to true when a start stream event is received + bNeedWaitForEndStreamEvent = False + + 'There is no connection + bConnectionStatus = False + +End Sub + +Private Sub RegisterForReceiveCall() + Dim strMsg As String + + 'Don't let the user do this in the middle of a call + If Not (gobjReceivedCallInfo Is Nothing) Then + StatusBox.SelText = vbCrLf & "Don't do this in the middle of a call." + Exit Sub + End If + + 'Initialize Tapi + Set gObjTapi = New TAPI + + 'Initialize before calling any other tapi function + Call gObjTapi.Initialize + + 'Set the EventFilter to accept all defined tapi events + gObjTapi.EventFilter = TAPI3_ALL_TAPI_EVENTS + + Set gObjTapiWithEvents = gObjTapi + + 'Pick up the collection of addresses + ' + Dim objcollAddress As ITCollection + Set objcollAddress = gObjTapi.Addresses + + If (objcollAddress Is Nothing) Then + StatusBox.SelText = vbCrLf & "Failed in query ITCollection" + Exit Sub + End If + + 'Search address that supports the desired address type and media type + ' + Dim nAddressIndex + nAddressIndex = FindAddressIndex(objcollAddress) + + If nAddressIndex < 1 Or nAddressIndex > objcollAddress.Count Then + + strMsg = "Could not find an appropriate address for this address type!" + StatusBox.SelText = vbCrLf & strMsg + + 'Release the object + Set objcollAddress = Nothing + Exit Sub + End If + + 'If RegisterCallNotifications had been previously called, + 'unregister here, before registering for the new address + 'This is not a required step, a TAPI3 app can register for + 'receiving call notifications on more than one address in + 'the same time, but the app must be able to handle multiple + 'calls on multiple addresses. + 'This sample prefers to register on only one address at a time. + If glRegistrationToken <> 0 Then + Call gObjTapi.UnregisterNotifications(glRegistrationToken) + glRegistrationToken = 0 + End If + + 'pick up the "N"-th address - the address on which + 'you want to register for receiving calls + Set gobjAddress = objcollAddress.Item(nAddressIndex) + Set objcollAddress = Nothing 'no more needed, release + + 'Register (specify) media types for which you want to receive calls; + 'only calls that have this media type will be offered to the app. + 'The media types must be passed to RegisterCallNotifications + 'bits in a "dword", which in VB is actually a "long". + ' + Dim fOwner As Boolean, fMonitor As Boolean + Dim lMediaTypes As Long, lCallbackInstance As Long + + 'fOwner = True ensures that app receives incoming calls + 'and their call state events + fOwner = True + fMonitor = False + lMediaTypes = TAPIMEDIATYPE_AUDIO + lCallbackInstance = 1 + + On Error Resume Next + glRegistrationToken = gObjTapi.RegisterCallNotifications( _ + gobjAddress, fMonitor, fOwner, lMediaTypes, lCallbackInstance) + If Err.Number <> 0 Then + strMsg = "Registering for receiving calls failed." & vbCrLf & _ + "If you have a data modem, replace it with a voice modem. " & _ + "Quit the app and try again." + + StatusBox.SelText = vbCrLf & strMsg + + Exit Sub + End If + + 'From now on the app is able to receive calls made on the + 'specified address, with the specified media type + + StatusBox.SelText = vbCrLf & "Registration for calls succeeded. " & vbCrLf & "Waiting for a call..." + + Exit Sub +End Sub + +'Search through all addresses that support "audio". +'Return 0 if no address found. Otherwise return its index, which will be +'between 1 and Addresses.Count +Private Function FindAddressIndex(objCollAddresses As ITCollection) As Long + + Dim nSelectedType As Long + Dim indexAddr As Long + Dim objCrtAddress As ITAddress + Dim lAddrTypes As Long + Dim objMediaSupport As ITMediaSupport + Dim objAddressCaps As ITAddressCapabilities + Dim lMediaTypes As Long + Dim bFound As Boolean + + ' + 'Retrieve from combo box the type of the selected address type + ' + nSelectedType = AddressTypesComBox.ItemData(AddressTypesComBox.ListIndex) + + ' + 'search through all addresses the first one that matches this type + 'and also supports the media type "audio" + ' + bFound = False + + For indexAddr = 1 To objCollAddresses.Count + + Set objCrtAddress = objCollAddresses.Item(indexAddr) + + Set objMediaSupport = objCrtAddress + Set objAddressCaps = objCrtAddress + + lMediaTypes = objMediaSupport.MediaTypes + + ' + 'Note: objMediaSupport.MediaTypes is a long that has + 'a bit set for each supported media type; + 'check if the bit for "audio" is set. + ' + If lMediaTypes And TAPIMEDIATYPE_AUDIO Then + + lAddrTypes = objAddressCaps.AddressCapability(AC_ADDRESSTYPES) + + If nSelectedType = LINEADDRESSTYPE_DOMAINNAME Then + 'the user selected "h323 calls" + 'we must expect such an address to support + 'LINEADDRESSTYPE_DOMAINNAME; it's enough to check only + 'for this flag. + If lAddrTypes And LINEADDRESSTYPE_DOMAINNAME Then + bFound = True + End If + End If + + End If + + Set objAddressCaps = Nothing + Set objMediaSupport = Nothing + Set objCrtAddress = Nothing + + If bFound = True Then Exit For + Next indexAddr + + ' + 'Return the index of the found address, or 0 if no address found + ' + If bFound = True Then + FindAddressIndex = indexAddr + Else + FindAddressIndex = 0 + End If + Exit Function +End Function + +Private Sub Form_Terminate() + 'Release all global objects + + Set gobjReceivedCallInfo = Nothing + Set gobjAddress = Nothing + Set gObjTapiWithEvents = Nothing + If Not (gObjTapi Is Nothing) Then + gObjTapi.Shutdown + End If + Set gObjTapi = Nothing + + 'Deactivate the grammars and release them + RecoDictationGrammar.DictationSetState SGDSInactive + RecoCCGrammar.CmdSetRuleState vbNullString, SGDSInactive + + TopRule.Clear + CmdRule.Clear + + Set RecoCCGrammar = Nothing + Set RecoDictationGrammar = Nothing + Set gObjRecoContext = Nothing + Set gObjRecognizer = Nothing + + 'Release the stream objects + Set gMemStream = Nothing + Set gByeWave = Nothing + Set gChimeWaveStream = Nothing + +End Sub + +Private Sub Form_Unload(Cancel As Integer) + + If bConnectionStatus Then + MsgBox "The application is busy. Cannot exit now. Please try to disconnect first" + Cancel = True + End If + +End Sub + +Private Sub gObjRecoContext_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) + + StatusBox.SelText = vbCrLf & "SR Recognition" + Dim text As String + + Select Case Result.PhraseInfo.GrammarId + + Case GID_DICTATION + ' Dictation events + text = Result.PhraseInfo.GetText + Dim SerializeResult As Variant + Dim WriteSize As Long + + + StatusBox.SelText = vbCrLf & text + SerializeResult = Result.SaveToMemory + WriteSize = gMemStream.Write(SerializeResult) + + If (gIndex > UBound(StreamSaveArray)) Then + ReDim Preserve StreamSaveArray((UBound(StreamSaveArray) + 50)) + End If + + StreamSaveArray(gIndex) = WriteSize + gWriteSize = gWriteSize + WriteSize + gIndex = gIndex + 1 + + Case GID_CC + ' Command and Control events + text = Result.PhraseInfo.GetText + StatusBox.SelText = vbCrLf & text + Select Case text + + Case "leave message", "leave" + TimeOut = LEAVEMESSAGEOPTION + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSInactive + + Case "check message", "check" + TimeOut = CHECKMESSAGEOPTION + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSInactive + End Select + End Select + +End Sub + +Private Sub gObjRecoContext_SoundEnd(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + + StatusBox.SelText = vbCrLf & "SR SoundEnd" +End Sub + +Private Sub gObjRecoContext_SoundStart(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + + StatusBox.SelText = vbCrLf & "SR SoundStart" +End Sub + +Private Sub gObjRecoContext_StartStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + bNeedWaitForEndStreamEvent = True + StatusBox.SelText = vbCrLf & "SR StartStream" +End Sub + +Private Sub gObjRecoContext_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal StreamReleased As Boolean) + TimeOut = EVENTENDSTREAM + bNeedWaitForEndStreamEvent = False + StatusBox.SelText = vbCrLf & "SR EndStream" +End Sub + +Private Sub gobjTapiWithEvents_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) + + Dim strMsg + + If TapiEvent = TE_CALLNOTIFICATION Then + + StatusBox.SelText = vbCrLf & "TAPI: TE_CALLNOTIFICATION" + + 'In the case of TE_CALLNOTIFICATION, pEvent contains an ITCallNotficationEvent + 'interface, so query for the interface + + Dim objCallNotificationEvent As ITCallNotificationEvent + Set objCallNotificationEvent = pEvent + + 'Decide if we can take this call: this app only + 'supports one call at a time, so if it already has a call, + 'it will reject any other call that arrives in the same time. + ' + gbSupportedCall = True + + If Not (gobjReceivedCallInfo Is Nothing) Then + + gbSupportedCall = False + + strMsg = "This app doesn't support a second call. " + strMsg = strMsg & "Unsupported second call will be rejected!" + + StatusBox.SelText = vbCrLf & strMsg + + 'Note: objCallNotificationEvent.Call actually contains an + 'ITCallInfo interface, but by assigning it to an ITBasicCallControl + 'interface, we actually query for the interface "ITBasicCallControl" + Dim objReceivedCallControl As ITBasicCallControl + Set objReceivedCallControl = objCallNotificationEvent.Call + + 'Reject the not supported call by calling Disconnect + 'Note: this second call will arrive only if the tsp (tapi service provider) + 'supports more than 1 call per address. + Dim code As DISCONNECT_CODE + code = DC_REJECTED + objReceivedCallControl.Disconnect (code) + + 'release all objects that are not needed any longer + Set objReceivedCallControl = Nothing + Set objCallNotificationEvent = Nothing + + Exit Sub + + End If + + 'Query ITCallInfo interface for the new call, and store it + Set gobjReceivedCallInfo = objCallNotificationEvent.Call + + 'Reenable the button + AnswerBtn.Enabled = True + + Set objCallNotificationEvent = Nothing + + Exit Sub + End If + + If TapiEvent = TE_CALLSTATE Then + + StatusBox.SelText = vbCrLf & "TAPI: TE_CALLSTATE" + + 'For this type of event, the object pEvent must be + 'queried for its ITCallStateEvent interface + Dim objCallStateEvent As ITCallStateEvent + Set objCallStateEvent = pEvent + + Dim State As CALL_STATE + Dim objEventCallInfo As ITCallInfo + + 'Extract the call object from pEvent (from its + 'ITCallStateEvent interface) + Set objEventCallInfo = objCallStateEvent.Call + State = objCallStateEvent.State + + If objEventCallInfo Is gobjReceivedCallInfo Then + + 'Display the all status + DisplayCallState (State) + + If State = CS_DISCONNECTED Then + 'After call is disconnected, release the object + Set gobjReceivedCallInfo = Nothing + End If + + End If + + Set objEventCallInfo = Nothing + Set objCallStateEvent = Nothing + + Exit Sub + End If + + If TapiEvent = TE_CALLMEDIA Then + 'Handle the call + HandleTheCall pEvent + + End If + + Exit Sub +End Sub + +Private Sub HandleTheCall(pEvent As Object) + Dim MediaEvent As ITCallMediaEvent + + Set MediaEvent = pEvent + + 'Handle one call at a time when the connection is established and + ' the media stream is active + If (CME_STREAM_ACTIVE = MediaEvent.Event) And (gNextCall) And (bConnectionStatus) Then + + gNextCall = False + Dim CustomStream As New SpCustomStream + Dim SapiTapiTTSStream As STCUSTOMSTREAMLib.TTSStream + Dim SapiTapiSRStream As STCUSTOMSTREAMLib.ASRStream + + + '''''''''''''' + ''TTS + '''''''''''''' + 'Create the audio stream object + Set SapiTapiTTSStream = New STCUSTOMSTREAMLib.TTSStream + + 'Initialize the stream object + SapiTapiTTSStream.InitTTSCaptureStream objTTSTerminal + + 'Set the audio stream object as the BaseStream + Set CustomStream.BaseStream = SapiTapiTTSStream + + 'Prevent the format from being changes + gObjVoice.AllowAudioOutputFormatChangesOnNextSet = False + + 'Set up the audio output + Set gObjVoice.AudioOutputStream = CustomStream + + 'Release the objects + Set SapiTapiTTSStream = Nothing + Set CustomStream = Nothing + + '''''''''''''' + ''SR + '''''''''''''' + 'Create a SAPI CustomStream object + Set CustomStream = New SpCustomStream + + 'Create the audio stream object + Set SapiTapiSRStream = New STCUSTOMSTREAMLib.ASRStream + + 'Initialize the stream object + SapiTapiSRStream.InitSRRenderStream objSRTerminal + + 'Set the audio stream object as the BaseStream + Set CustomStream.BaseStream = SapiTapiSRStream + + 'Prevent the format from being changes + gObjRecognizer.AllowAudioInputFormatChangesOnNextSet = False + + 'Set up the audio input + Set gObjRecognizer.AudioInputStream = CustomStream + + 'Release the object + Set CustomStream = Nothing + + 'Wait 3 seconds for the media streaming to be active. In most cases, this + 'is unnecessary. Somehow on some machines, the media stream is still + 'inactive although we have CME_STREAM_ACTIVE event. + + StatusBox.SelText = vbCrLf & "Waiting for the media streaming to be active ..." + Dim j + TimeOut = 0 + For j = 0 To 3 + TimeIt 1, TimeOut, 1, DISCONNECTED + StatusBox.SelText = "." + Next j + + 'If users click the disconnect button, exit the app + If (TimeOut = DISCONNECTED) Then + Set SapiTapiSRStream = Nothing + Exit Sub + End If + + + On Error GoTo ErrorHandler + 'greetings + gObjVoice.Speak "Welcome to the Speech and Telephony API app." + gObjVoice.Speak "Please select the following two options: Leave message or Check message", SVSFIsXML + + 'use Command and Control for the option menu + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSActive + + 'the maxinum time for selecting a menu is 10 seconds + TimeOut = 0 + TimeIt 10, TimeOut, LEAVEMESSAGEOPTION, CHECKMESSAGEOPTION + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSInactive + + If (TimeOut = LEAVEMESSAGEOPTION) Then + 'User selects "leave a message menu" + 'Reset the timeout flag + TimeOut = 0 + + 'Wait for the endstream event + TimeIt 30, TimeOut, EVENTENDSTREAM, DISCONNECTED + + gObjVoice.Speak "Please leave the message after the tone" + gChimeWaveStream.Seek 0, SSSPTRelativeToStart + gObjVoice.SpeakStream gChimeWaveStream + + RecoDictationGrammar.DictationSetState SGDSActive + LeaveMessage + RecoDictationGrammar.DictationSetState SGDSInactive + + 'Release the object + Set SapiTapiSRStream = Nothing + + 'Wait for the endstream event + TimeIt 30, TimeOut, EVENTENDSTREAM, DISCONNECTED + + 'Play back the audio if any + If (gWriteSize <> 0) Then + StatusBox.SelText = vbCrLf & "Playing the message" + gMemStream.Seek 0, SSSPTRelativeToStart + Dim resultGet As Variant, length As Long + Dim RecoResultGet As ISpeechRecoResult + + gObjVoice.Speak "Following is your message" + + Dim i + For i = 0 To gIndex - 1 + + length = gMemStream.Read(resultGet, StreamSaveArray(i)) + Set RecoResultGet = gObjRecoContext.CreateResultFromMemory(resultGet) + DoEvents + RecoResultGet.SpeakAudio + Set RecoResultGet = Nothing + Next i + gObjVoice.Speak "end of your message" + + End If + + Else + If (TimeOut = CHECKMESSAGEOPTION) Then + StatusBox.SelText = vbCrLf & "Playing the message" + 'Reset the timeout flag + TimeOut = 0 + + 'Wait for the endstream event + TimeIt 30, TimeOut, EVENTENDSTREAM, DISCONNECTED + + If (gWriteSize <> 0) Then + gMemStream.Seek 0, SSSPTRelativeToStart + gObjVoice.Speak "The following is your message" + + For i = 0 To gIndex - 1 + + length = gMemStream.Read(resultGet, StreamSaveArray(i)) + Set RecoResultGet = gObjRecoContext.CreateResultFromMemory(resultGet) + DoEvents + RecoResultGet.SpeakAudio + Set RecoResultGet = Nothing + Next i + gObjVoice.Speak "end of your message" + Else + gObjVoice.Speak "You do not have any messages" + + End If + Else + gObjVoice.Speak "You did not select anything" + + End If ' check message + End If 'leave message + gObjVoice.Speak "good bye!" + gByeWave.Seek 0, SSSPTRelativeToStart + gObjVoice.SpeakStream gByeWave + + 'Release the object + If Not (SapiTapiSRStream Is Nothing) Then + Set SapiTapiSRStream = Nothing + End If + + DisconnectBtn_Click + + End If ' media stream active + Exit Sub + +ErrorHandler: + If Err.Number = VFW_E_NOT_COMMITTED Then + StatusBox.SelText = vbCrLf & "The connection was lost. Disconnecting ..." + DisconnectBtn_Click + Else + MsgBox "Error occurs in HandleTheCall: " & Err.Description & vbCrLf & " " & Err.Number + Resume Next + End If + 'Release the object + If Not (SapiTapiSRStream Is Nothing) Then + Set SapiTapiSRStream = Nothing + End If +End Sub + +Private Sub DisplayCallState(State As CALL_STATE) + Dim strMsg As String + + Select Case State + Case CS_CONNECTED + bConnectionStatus = True + strMsg = "call state: CS_CONNECTED" + StatusBox.SelText = vbCrLf & strMsg + + 'Enable the Disconnect button + DisconnectBtn.Enabled = True + Case CS_DISCONNECTED + DisconnectBtn_Click + bConnectionStatus = False + strMsg = "call state: CS_DISCONNECTED" & vbCrLf + strMsg = strMsg & "New incoming calls will be accepted. " + + StatusBox.SelText = vbCrLf & strMsg + Case CS_HOLD + + StatusBox.SelText = vbCrLf & "call state: CS_HOLD" + Case CS_IDLE + + StatusBox.SelText = vbCrLf & "call state: CS_IDLE" + + Case CS_INPROGRESS + + StatusBox.SelText = vbCrLf & "call state: CS_INPROGRESS" + + Case CS_OFFERING + If gbSupportedCall = True Then + strMsg = "call state: CS_OFFERING" + Dim RemoteMachine As String + + '.CallInfoString fails sometimes on some networks, so we ignore the error in + 'getting the remote machine name + On Error Resume Next + 'get caller's machine name + RemoteMachine = gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNAME) + On Error GoTo 0 + + strMsg = strMsg & vbCrLf & "A call " + If Not (RemoteMachine = "") Then + 'Some machine names contain the line feed. So we remove it here + strMsg = strMsg & "from ' " + Dim str + For Each str In Split(RemoteMachine, vbLf) + strMsg = strMsg & str & " " + Next str + strMsg = strMsg & "' " + End If + strMsg = strMsg & "has been received. You can answer it by clicking the Answer button." + StatusBox.SelText = vbCrLf & strMsg + End If + + Case CS_QUEUED + StatusBox.SelText = vbCrLf & "call state: CS_QUEUED" + + Case Else + StatusBox.SelText = vbCrLf & "call state: unknown!!" + + End Select + +End Sub + diff --git a/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frx b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frx new file mode 100644 index 00000000..8ebef8e2 Binary files /dev/null and b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frx differ diff --git a/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.vbp b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.vbp new file mode 100644 index 00000000..d430bac5 --- /dev/null +++ b/mp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.vbp @@ -0,0 +1,40 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\..\..\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#..\..\..\..\..\sapi\sapi\objd\i386\sapi.dll#Microsoft Speech Object Library +Reference=*\G{21D6D480-A88B-11D0-83DD-00AA003CCABD}#1.0#0#..\..\..\..\..\..\..\..\WINNT\System32\tapi3.dll#Microsoft TAPI 3.0 Type Library +Reference=*\G{EDAEECD8-0D75-499E-9B69-187ACACF2C05}#1.0#0#..\..\..\cpp\tapicustomstream\objd\i386\STCustomStream.dll#STCustomStream 1.0 Type Library +Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0; RICHTX32.OCX +Form=SapiTapi.frm +ResFile32="SapiTapi.RES" +Startup="Form1" +HelpFile="" +ExeName32="SapiTapi.exe" +Command32="" +Name="SapiTapi" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corp." +CompilationType=0 +OptimizationType=2 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=-1 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/mp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.bat b/mp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.bat new file mode 100644 index 00000000..aea38d1d --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.bat @@ -0,0 +1 @@ +spcomp.exe "srcompopt.pro" -r \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.pro b/mp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.pro new file mode 100644 index 00000000..f2c40baa --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.pro @@ -0,0 +1,42 @@ +[SAPI Engine Compliance Tool Version 1.0] +LogFile.Log File=srcompopt.log +Cmd.Size=1 +Cmd.Hex0000=00 +Position=83, 82, 894, 613 +Options=386 +RunCount=1 +Search= +LogWindowLevel=1 +LogLog FileLevel=1 +FontName=FixedSys +FontAttr=-19 400 128 16908545 +TUX Dll=srcomp.dll +NumTests=14 +testcase0008=Optional\Grammar\Use correct grammar with unambiguous rules +tcdata0008=0 0 +testcase0007=Optional\Grammar\Tags\WILDCARD Tag +tcdata0007=0 0 +testcase0006=Optional\Grammar\Tags\CFGTextBuffer +tcdata0006=0 0 +testcase0005=Optional\Dictation\Dictation Alternates +tcdata0005=0 0 +testcase0004=Optional\Dictation\DICTATION Tag +tcdata0004=0 0 +testcase0003=Optional\Dictation\User Lexicon\Synchronize Dictation grammar after loading engine +tcdata0003=0 0 +testcase0002=Optional\Dictation\User Lexicon\Synchronize before loading dictation grammar +tcdata0002=0 0 +testcase0001=Optional\Events\Get: Interference +tcdata0001=0 0 +testcase0000=Optional\Events\Get: Hypothesis +tcdata0000=0 0 +testcase0010=Optional\Other\Recognition with Inverse Text Normalization +tcdata0010=0 0 +testcase0009=Optional\Grammar\Use most recently activated grammar with ambiguous rules +tcdata0009=0 0 +testcase0013=Optional\Other\Command&Control Alternates +tcdata0013=0 0 +testcase0012=Optional\Other\Engine Text Properties +tcdata0012=0 0 +testcase0011=Optional\Other\Engine Numeric Properties +tcdata0011=0 0 diff --git a/mp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.bat b/mp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.bat new file mode 100644 index 00000000..243ab158 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.bat @@ -0,0 +1 @@ +spcomp.exe "srcompreq.pro" -r \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.pro b/mp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.pro new file mode 100644 index 00000000..ffeb6b32 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.pro @@ -0,0 +1,66 @@ +[SAPI Engine Compliance Tool Version 1.0] +LogFile.Log File=srcompreq.log +Cmd.Size=1 +Cmd.Hex0000=00 +Position=83, 82, 894, 613 +Options=386 +RunCount=1 +Search= +LogWindowLevel=1 +LogLog FileLevel=1 +FontName=FixedSys +FontAttr=-19 400 128 16908545 +TUX Dll=srcomp.dll +NumTests=26 +testcase0023=Required\Other\Invalidate non-top level rule +tcdata0023=0 0 +testcase0022=Required\Other\Invalidate top level rule +tcdata0022=0 0 +testcase0021=Required\Other\Automatically pause engine on recognition +tcdata0021=0 0 +testcase0020=Required\Other\SpPhraseElements +tcdata0020=0 0 +testcase0019=Required\Grammar\Case sensitive grammar +tcdata0019=0 0 +testcase0018=Required\Grammar\/Disp/lex/pron +tcdata0018=0 0 +testcase0017=Required\Grammar\RULE and RULEREF tags +tcdata0017=0 0 +testcase0016=Required\Grammar\O[ptional] tag +tcdata0016=0 0 +testcase0015=Required\Grammar\P[hrase] tag +tcdata0015=0 0 +testcase0014=Required\Grammar\Expected Rule +tcdata0014=0 0 +testcase0013=Required\Grammar\L tag +tcdata0013=0 0 +testcase0012=Required\Lexicon\Case sensitive lexicon +tcdata0012=0 0 +testcase0011=Required\Lexicon\Uses user lexicon before application lexicon for Command & Control +tcdata0011=0 0 +testcase0010=Required\Lexicon\Application Lexicon for Command & Control +tcdata0010=0 0 +testcase0009=Required\Lexicon\User Lexicon\Synchronize Command & Control grammar after loading engine +tcdata0009=0 0 +testcase0008=Required\Lexicon\User Lexicon\Synchronize before loading Command & Control grammar +tcdata0008=0 0 +testcase0007=Required\Events\Multi Events\Events Offset +tcdata0007=0 0 +testcase0006=Required\Events\Multi Events\PhraseStart -> Recognition order +tcdata0006=0 0 +testcase0005=Required\Events\Multi Events\SoundStart -> SoundEnd order +tcdata0005=0 0 +testcase0004=Required\Events\Single Event\Recognition +tcdata0004=0 0 +testcase0003=Required\Events\Single Event\PhraseStart +tcdata0003=0 0 +testcase0002=Required\Events\Single Event\FalseRecognition +tcdata0002=0 0 +testcase0001=Required\Events\Single Event\SoundEnd +tcdata0001=0 0 +testcase0000=Required\Events\Single Event\SoundStart +tcdata0000=0 0 +testcase0025=Required\Other\Multiple application contexts [ISpRecoContext] +tcdata0025=0 0 +testcase0024=Required\Other\Multi instances +tcdata0024=0 0 diff --git a/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.bat b/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.bat new file mode 100644 index 00000000..e106d497 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.bat @@ -0,0 +1 @@ +spcomp.exe "ttscompopt.pro" -r \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.pro b/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.pro new file mode 100644 index 00000000..b5c6746c --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.pro @@ -0,0 +1,20 @@ +[SAPI Engine Compliance Tool Version 1.0] +LogFile.Log File=spcomp.log +Cmd.Size=1 +Cmd.Hex0000=00 +Position=164, 232, 933, 808 +Options=386 +RunCount=1 +Search=fail +LogWindowLevel=1 +LogLog FileLevel=1 +FontName=FixedSys +FontAttr=-13 400 128 16908545 +TUX Dll=ttscomp.dll +NumTests=3 +testcase0002=Features\PartOfSp +tcdata0002=0 0 +testcase0001=Features\Phoneme & Viseme Events +tcdata0001=0 0 +testcase0000=Features\Emph +tcdata0000=0 0 diff --git a/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.bat b/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.bat new file mode 100644 index 00000000..b2a2564d --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.bat @@ -0,0 +1 @@ +spcomp.exe "ttscompreq.pro" -r \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.pro b/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.pro new file mode 100644 index 00000000..827c0f49 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.pro @@ -0,0 +1,58 @@ +[SAPI Engine Compliance Tool Version 1.0] +LogFile.Log File=spcomp.log +Cmd.Size=1 +Cmd.Hex0000=00 +Position=164, 232, 933, 808 +Options=386 +RunCount=1 +Search=fail +LogWindowLevel=1 +LogLog FileLevel=1 +FontName=FixedSys +FontAttr=-13 400 128 16908545 +TUX Dll=ttscomp.dll +NumTests=22 +testcase0021=TTS Compliance Test\Multiple Instance Test\Multiple-Instance Test +tcdata0021=0 0 +testcase0020=TTS Compliance Test\Lexicon Tests\App Lexicon Test +tcdata0020=0 0 +testcase0019=TTS Compliance Test\Lexicon Tests\User Lexicon Test +tcdata0019=0 0 +testcase0018=TTS Compliance Test\Audio State Tests\Speak Destroy +tcdata0018=0 0 +testcase0017=TTS Compliance Test\Audio State Tests\Speak Stop +tcdata0017=0 0 +testcase0016=TTS Compliance Test\Real Time Rate/Vol Tests\Real time volume change +tcdata0016=0 0 +testcase0015=TTS Compliance Test\Real Time Rate/Vol Tests\Real time rate change +tcdata0015=0 0 +testcase0014=TTS Compliance Test\TTS XML Markup\Context +tcdata0014=0 0 +testcase0013=TTS Compliance Test\TTS XML Markup\Non-SAPI tags +tcdata0013=0 0 +testcase0012=TTS Compliance Test\TTS XML Markup\Pitch +tcdata0012=0 0 +testcase0011=TTS Compliance Test\TTS XML Markup\Volume +tcdata0011=0 0 +testcase0010=TTS Compliance Test\TTS XML Markup\Rate +tcdata0010=0 0 +testcase0009=TTS Compliance Test\TTS XML Markup\Pronounce +tcdata0009=0 0 +testcase0008=TTS Compliance Test\TTS XML Markup\Spell +tcdata0008=0 0 +testcase0007=TTS Compliance Test\TTS XML Markup\Silence +tcdata0007=0 0 +testcase0006=TTS Compliance Test\TTS XML Markup\Bookmark +tcdata0006=0 0 +testcase0005=TTS Compliance Test\Eventing\Check SAPI required Events +tcdata0005=0 0 +testcase0004=TTS Compliance Test\ISpTTSEngine\SetVolume +tcdata0004=0 0 +testcase0003=TTS Compliance Test\ISpTTSEngine\SetRate +tcdata0003=0 0 +testcase0002=TTS Compliance Test\ISpTTSEngine\GetOutputFormat +tcdata0002=0 0 +testcase0001=TTS Compliance Test\ISpTTSEngine\Skip +tcdata0001=0 0 +testcase0000=TTS Compliance Test\ISpTTSEngine\Speak +tcdata0000=0 0 diff --git a/mp/src/utils/sapi51/Tools/Comp/Common/CPP/tuxdll.cpp b/mp/src/utils/sapi51/Tools/Comp/Common/CPP/tuxdll.cpp new file mode 100644 index 00000000..3ae51453 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Common/CPP/tuxdll.cpp @@ -0,0 +1,386 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// tuxdll.cpp +// +//****************************************************************************** + +//****************************************************************************** +//***** Make sure _WIN32_WCE is set when building for Windows CE +//****************************************************************************** + + +#if defined(PEGASUS) && !defined(_WIN32_WCE) +#define _WIN32_WCE +#endif + +#if defined(UNDER_CE) && !defined(_WIN32_WCE) +#define _WIN32_WCE +#endif + + +//****************************************************************************** +//***** Includes +//****************************************************************************** + +#ifndef _WIN32_DCOM + #define _WIN32_DCOM 1 +#endif +#include + +#include +#include +#include +#include +#include + +#ifndef _WIN32_WCE +#include +#endif + +//****************************************************************************** +//***** Global Constants +//****************************************************************************** + +#define LOG_EXCEPTION 0 +#define LOG_FAIL 2 +#define LOG_ABORT 4 +#define LOG_SKIP 6 +#define LOG_NOT_IMPLEMENTED 8 +#define LOG_PASS 10 +#define LOG_DETAIL 12 +#define LOG_COMMENT 14 + + +//****************************************************************************** +//***** Global Variables +//****************************************************************************** + +// Global CKato logging object. Set while processing SPM_LOAD_DLL message. +CKato *g_pKato = NULL; + +// Global shell info structure. Set while processing SPM_SHELL_INFO message. +SPS_SHELL_INFO *g_pShellInfo; + +// Global critical section to be used by threaded tests if necessary. +CRITICAL_SECTION g_csProcess; + +//****************************************************************************** +//***** Test functions +//****************************************************************************** + +extern void CleanupTest( void ); +extern HRESULT PreTestSetup( void ); +extern HRESULT PostTestCleanup( void ); + +//****************************************************************************** +//***** Windows CE specific code +//****************************************************************************** + +#ifdef _WIN32_WCE + +#ifndef STARTF_USESIZE +#define STARTF_USESIZE 0x00000002 +#endif + +#ifndef STARTF_USEPOSITION +#define STARTF_USEPOSITION 0x00000004 +#endif + +#ifndef ZeroMemory +#define ZeroMemory(Destination,Length) memset(Destination, 0, Length) +#endif + +#ifndef _vsntprintf +#define _vsntprintf(d,c,f,a) wvsprintf(d,f,a) +#endif + +BOOL WINAPI DllMain(HANDLE hInstance, ULONG dwReason, LPVOID lpReserved) { + return TRUE; +} +#endif + + + +//****************************************************************************** +//***** Internal Macros +//****************************************************************************** +#ifndef countof +#define countof(a) (sizeof(a)/sizeof(*(a))) +#endif + + + +//****************************************************************************** +//***** Our Debug Output Function +//****************************************************************************** + +void TRACE(LPCTSTR szFormat, ...) { + TCHAR szBuffer[1024] = TEXT("TUXDLL: "); + + va_list pArgs; + va_start(pArgs, szFormat); + _vsntprintf(szBuffer + 9, countof(szBuffer) - 11, szFormat, pArgs); + va_end(pArgs); + + _tcscat(szBuffer, TEXT("\r\n")); + + OutputDebugString(szBuffer); +} + + + +//****************************************************************************** +//***** ShellProc() +//****************************************************************************** + +SHELLPROCAPI ShellProc(UINT uMsg, SPPARAM spParam) { + + switch (uMsg) { + + //------------------------------------------------------------------------ + // Message: SPM_LOAD_DLL + // + // Sent once to the DLL immediately after it is loaded. The spParam + // parameter will contain a pointer to a SPS_LOAD_DLL structure. The DLL + // should set the fUnicode member of this structre to TRUE if the DLL is + // built with the UNICODE flag set. By setting this flag, Tux will ensure + // that all strings passed to your DLL will be in UNICODE format, and all + // strings within your function table will be processed by Tux as UNICODE. + // The DLL may return SPR_FAIL to prevent the DLL from continuing to load. + //------------------------------------------------------------------------ + + case SPM_LOAD_DLL: { + TRACE(TEXT("ShellProc(SPM_LOAD_DLL, ...) called")); + + // If we are UNICODE, then tell Tux this by setting the following flag. + #ifdef UNICODE + ((LPSPS_LOAD_DLL)spParam)->fUnicode = TRUE; + #else + ((LPSPS_LOAD_DLL)spParam)->fUnicode = FALSE; + #endif + + // Get/Create our global logging object. + g_pKato = (CKato*)KatoGetDefaultObject(); + + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + // Initialize our global critical section. + InitializeCriticalSection(&g_csProcess); + + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_UNLOAD_DLL + // + // Sent once to the DLL immediately before it is unloaded. + //------------------------------------------------------------------------ + + case SPM_UNLOAD_DLL: { + TRACE(TEXT("ShellProc(SPM_UNLOAD_DLL, ...) called")); + + // This is a good place to destroy our global critical section. + DeleteCriticalSection(&g_csProcess); + + //cleanup test + CleanupTest(); + + // counitialize + CoUninitialize(); + + + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_SHELL_INFO + // + // Sent once to the DLL immediately after SPM_LOAD_DLL to give the DLL + // some useful information about its parent shell and environment. The + // spParam parameter will contain a pointer to a SPS_SHELL_INFO structure. + // The pointer to the structure may be stored for later use as it will + // remain valid for the life of this Tux Dll. The DLL may return SPR_FAIL + // to prevent the DLL from continuing to load. + //------------------------------------------------------------------------ + + case SPM_SHELL_INFO: { + TRACE(TEXT("ShellProc(SPM_SHELL_INFO, ...) called")); + + // Store a pointer to our shell info for later use. + g_pShellInfo = (LPSPS_SHELL_INFO)spParam; + + // Display our Dlls command line if we have one. + if (g_pShellInfo->szDllCmdLine && *g_pShellInfo->szDllCmdLine) { + MessageBox(g_pShellInfo->hWnd, g_pShellInfo->szDllCmdLine, + TEXT("TUXDLL.DLL Command Line Arguments"), MB_OK); + } + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_REGISTER + // + // This is the only ShellProc() message that a DLL is required to handle + // (except for SPM_LOAD_DLL if you are UNICODE). This message is sent + // once to the DLL immediately after the SPM_SHELL_INFO message to query + // the DLL for it’s function table. The spParam will contain a pointer to + // a SPS_REGISTER structure. The DLL should store its function table in + // the lpFunctionTable member of the SPS_REGISTER structure. The DLL may + // return SPR_FAIL to prevent the DLL from continuing to load. + //------------------------------------------------------------------------ + + case SPM_REGISTER: { + TRACE(TEXT("ShellProc(SPM_REGISTER, ...) called")); + ((LPSPS_REGISTER)spParam)->lpFunctionTable = g_lpFTE; + #ifdef UNICODE + return SPR_HANDLED | SPF_UNICODE; + #else + return SPR_HANDLED; + #endif + } + + //------------------------------------------------------------------------ + // Message: SPM_START_SCRIPT + // + // Sent to the DLL immediately before a script is started. It is sent to + // all Tux DLLs, including loaded Tux DLLs that are not in the script. + // All DLLs will receive this message before the first TestProc() in the + // script is called. + //------------------------------------------------------------------------ + + case SPM_START_SCRIPT: { + TRACE(TEXT("ShellProc(SPM_START_SCRIPT, ...) called")); + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_STOP_SCRIPT + // + // Sent to the DLL when the script has stopped. This message is sent when + // the script reaches its end, or because the user pressed stopped prior + // to the end of the script. This message is sent to all Tux DLLs, + // including loaded Tux DLLs that are not in the script. + //------------------------------------------------------------------------ + + case SPM_STOP_SCRIPT: { + TRACE(TEXT("ShellProc(SPM_STOP_SCRIPT, ...) called")); + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_BEGIN_GROUP + // + // Sent to the DLL before a group of tests from that DLL is about to be + // executed. This gives the DLL a time to initialize or allocate data for + // the tests to follow. Only the DLL that is next to run receives this + // message. The prior DLL, if any, will first receive a SPM_END_GROUP + // message. For global initialization and de-initialization, the DLL + // should probably use SPM_START_SCRIPT and SPM_STOP_SCRIPT, or even + // SPM_LOAD_DLL and SPM_UNLOAD_DLL. + //------------------------------------------------------------------------ + + case SPM_BEGIN_GROUP: { + TRACE(TEXT("ShellProc(SPM_BEGIN_GROUP, ...) called")); + g_pKato->BeginLevel(0, TEXT("BEGIN GROUP: TUXDLL.DLL")); + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_END_GROUP + // + // Sent to the DLL after a group of tests from that DLL has completed + // running. This gives the DLL a time to cleanup after it has been run. + // This message does not mean that the DLL will not be called again to run + // tests; it just means that the next test to run belongs to a different + // DLL. SPM_BEGIN_GROUP and SPM_END_GROUP allow the DLL to track when it + // is active and when it is not active. + //------------------------------------------------------------------------ + + case SPM_END_GROUP: { + TRACE(TEXT("ShellProc(SPM_END_GROUP, ...) called")); + g_pKato->EndLevel(TEXT("END GROUP: TUXDLL.DLL")); + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_BEGIN_TEST + // + // Sent to the DLL immediately before a test executes. This gives the DLL + // a chance to perform any common action that occurs at the beginning of + // each test, such as entering a new logging level. The spParam parameter + // will contain a pointer to a SPS_BEGIN_TEST structure, which contains + // the function table entry and some other useful information for the next + // test to execute. If the ShellProc function returns SPR_SKIP, then the + // test case will not execute. + //------------------------------------------------------------------------ + + case SPM_BEGIN_TEST: { + TRACE(TEXT("ShellProc(SPM_BEGIN_TEST, ...) called")); + + // Start our logging level. + LPSPS_BEGIN_TEST pBT = (LPSPS_BEGIN_TEST)spParam; + g_pKato->BeginLevel(pBT->lpFTE->dwUniqueID, + TEXT("BEGIN TEST: \"%s\", Threads=%u, Seed=%u"), + pBT->lpFTE->lpDescription, pBT->dwThreadCount, + pBT->dwRandomSeed); + + if (S_OK != PreTestSetup() ) { + g_pKato->Log(LOG_SKIP, TEXT("Pre-Test Setup failed - Skipping test")); + return SPR_SKIP; + } + + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_END_TEST + // + // Sent to the DLL after a single test executes from the DLL. This gives + // the DLL a time perform any common action that occurs at the completion + // of each test, such as exiting the current logging level. The spParam + // parameter will contain a pointer to a SPS_END_TEST structure, which + // contains the function table entry and some other useful information for + // the test that just completed. + //------------------------------------------------------------------------ + + case SPM_END_TEST: { + TRACE(TEXT("ShellProc(SPM_END_TEST, ...) called")); + + PostTestCleanup(); + + // End our logging level. + LPSPS_END_TEST pET = (LPSPS_END_TEST)spParam; + g_pKato->EndLevel(TEXT("END TEST: \"%s\", %s, Time=%u.%03u"), + pET->lpFTE->lpDescription, + pET->dwResult == TPR_SKIP ? TEXT("SKIPPED") : + pET->dwResult == TPR_PASS ? TEXT("PASSED") : + pET->dwResult == TPR_FAIL ? TEXT("FAILED") : + pET->dwResult == TPR_SUPPORTED ? TEXT("SUPPORTED") : + pET->dwResult == TPR_UNSUPPORTED ? TEXT("UNSUPPORTED") : TEXT("ABORTED"), + pET->dwExecutionTime / 1000, pET->dwExecutionTime % 1000); + + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_EXCEPTION + // + // Sent to the DLL whenever code execution in the DLL causes and exception + // fault. By default, Tux traps all exceptions that occur while executing + // code inside a Tux DLL. + //------------------------------------------------------------------------ + + case SPM_EXCEPTION: { + TRACE(TEXT("ShellProc(SPM_EXCEPTION, ...) called")); + g_pKato->Log(LOG_EXCEPTION, TEXT("Exception occurred!")); + return SPR_HANDLED; + } + } + + return SPR_NOT_HANDLED; +} + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** + diff --git a/mp/src/utils/sapi51/Tools/Comp/Common/Def/srcomp.def b/mp/src/utils/sapi51/Tools/Comp/Common/Def/srcomp.def new file mode 100644 index 00000000..51caf2c1 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Common/Def/srcomp.def @@ -0,0 +1,3 @@ +EXPORTS + ShellProc + diff --git a/mp/src/utils/sapi51/Tools/Comp/Common/Def/ttscomp.def b/mp/src/utils/sapi51/Tools/Comp/Common/Def/ttscomp.def new file mode 100644 index 00000000..b25e196e --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Common/Def/ttscomp.def @@ -0,0 +1,2 @@ +EXPORTS + ShellProc diff --git a/mp/src/utils/sapi51/Tools/Comp/Common/Include/kato.h b/mp/src/utils/sapi51/Tools/Comp/Common/Include/kato.h new file mode 100644 index 00000000..189805ea --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Common/Include/kato.h @@ -0,0 +1,235 @@ +//****************************************************************************** +// +// KATO.H +// +// Definition module for the Kato constants and CKato interface +// +// Date Name Description +// -------- -------- ----------------------------------------------------------- +// 02/13/95 SteveMil Created +// +//****************************************************************************** + +#ifndef __KATO_H__ +#define __KATO_H__ + +//****************************************************************************** +// Define functions as import when building kato, and as export when this file +// is included by all other applications. We only use KATOAPI on C++ classes. +// For straight C functions, our DEF file will take care of exporting them. +//****************************************************************************** + +#ifndef KATOAPI + #define KATOAPI __declspec(dllimport) +#endif + +//****************************************************************************** +// Define EXTERN_C so that the flat API's will not get mangled by C++ +//****************************************************************************** + +#ifndef EXTERN_C + #ifdef __cplusplus + #define EXTERN_C extern "C" + #else + #define EXTERN_C + #endif +#endif + +//****************************************************************************** +// Specify 32 bit pack size to ensure everyone creates the correct size objects +//****************************************************************************** + +#pragma pack(4) + +//****************************************************************************** +// Constants +//****************************************************************************** + +#define KATO_MAX_LEVEL 31 +#define KATO_MAX_VERBOSITY 15 +#define KATO_MAX_STRING_LENGTH 1023 +#define KATO_MAX_DATA_SIZE 1024 + +//****************************************************************************** +// Types +//****************************************************************************** + +typedef HANDLE HKATO; + +typedef struct _KATOCALLBACKSTRUCTW { + LPARAM lParam; + HKATO hKato; + DWORD dwThreadID; + DWORD dwTickCount; + DWORD dwLevel; + DWORD dwLevelID; + DWORD dwVerbosity; + LPCWSTR wszLog; +} KATOCALLBACKSTRUCTW, *LPKATOCALLBACKSTRUCTW; + +typedef struct _KATOCALLBACKSTRUCTA { + LPARAM lParam; + HKATO hKato; + DWORD dwThreadID; + DWORD dwTickCount; + DWORD dwLevel; + DWORD dwLevelID; + DWORD dwVerbosity; + LPCSTR szLog; +} KATOCALLBACKSTRUCTA, *LPKATOCALLBACKSTRUCTA; + +typedef BOOL (CALLBACK *LPKATOCALLBACKW)(LPKATOCALLBACKSTRUCTW); +typedef BOOL (CALLBACK *LPKATOCALLBACKA)(LPKATOCALLBACKSTRUCTA); + +typedef enum _KATO_FLUSH_TYPE { + KATO_FLUSH_ON, + KATO_FLUSH_OFF, + KATO_FLUSH_NOW, +} KATO_FLUSH_TYPE, *LPKATO_FLUSH_TYPE; + +//****************************************************************************** +// Common APIs for C and C++ interfaces +//****************************************************************************** + +EXTERN_C BOOL WINAPI KatoSetServerW(LPCWSTR wszServer); +EXTERN_C BOOL WINAPI KatoSetServerA(LPCSTR szServer); +EXTERN_C BOOL WINAPI KatoGetServerW(LPWSTR wszServer, INT nCount); +EXTERN_C BOOL WINAPI KatoGetServerA(LPSTR szServer, INT nCount); +EXTERN_C BOOL WINAPI KatoSetCallbackW(LPKATOCALLBACKW lpCallbackW, LPARAM lParam); +EXTERN_C BOOL WINAPI KatoSetCallbackA(LPKATOCALLBACKA lpCallbackA, LPARAM lParam); +EXTERN_C BOOL WINAPI KatoFlush(KATO_FLUSH_TYPE flushType); +EXTERN_C BOOL WINAPI KatoDebug(BOOL fEnabled, DWORD dwMaxLogVersbosity, + DWORD dwMaxCommentVersbosity, DWORD dwMaxLevel); + +EXTERN_C HKATO WINAPI KatoGetDefaultObject(VOID); + +//****************************************************************************** +// APIs for C interface (C++ applications should use the CKato class) +//****************************************************************************** + +// Construction and destruction +EXTERN_C HKATO WINAPI KatoCreateW(LPCWSTR wszName); +EXTERN_C HKATO WINAPI KatoCreateA(LPCSTR szName); +EXTERN_C BOOL WINAPI KatoDestroy(HKATO hKato); + +// Unicode functions +EXTERN_C INT WINAPIV KatoBeginLevelW(HKATO hKato, DWORD dwLevelID, LPCWSTR wszFormat, ...); +EXTERN_C INT WINAPIV KatoBeginLevelVW(HKATO hKato, DWORD dwLevelID, LPCWSTR wszFormat, va_list pArgs); +EXTERN_C INT WINAPIV KatoEndLevelW(HKATO hKato, LPCWSTR wszFormat, ...); +EXTERN_C INT WINAPIV KatoEndLevelVW(HKATO hKato, LPCWSTR wszFormat, va_list pArgs); +EXTERN_C BOOL WINAPIV KatoLogW(HKATO hKato, DWORD dwVerbosity, LPCWSTR wszFormat, ...); +EXTERN_C BOOL WINAPIV KatoLogVW(HKATO hKato, DWORD dwVerbosity, LPCWSTR wszFormat, va_list pArgs); +EXTERN_C BOOL WINAPIV KatoCommentW(HKATO hKato, DWORD dwVerbosity, LPCWSTR wszFormat, ...); +EXTERN_C BOOL WINAPIV KatoCommentVW(HKATO hKato, DWORD dwVerbosity, LPCWSTR wszFormat, va_list pArgs); + +// ASCII functions +EXTERN_C INT WINAPIV KatoBeginLevelA(HKATO hKato, DWORD dwLevelID, LPCSTR szFormat, ...); +EXTERN_C INT WINAPIV KatoBeginLevelVA(HKATO hKato, DWORD dwLevelID, LPCSTR szFormat, va_list pArgs); +EXTERN_C INT WINAPIV KatoEndLevelA(HKATO hKato, LPCSTR szFormat, ...); +EXTERN_C INT WINAPIV KatoEndLevelVA(HKATO hKato, LPCSTR szFormat, va_list pArgs); +EXTERN_C BOOL WINAPIV KatoLogA(HKATO hKato, DWORD dwVerbosity, LPCSTR szFormat, ...); +EXTERN_C BOOL WINAPIV KatoLogVA(HKATO hKato, DWORD dwVerbosity, LPCSTR szFormat, va_list pArgs); +EXTERN_C BOOL WINAPIV KatoCommentA(HKATO hKato, DWORD dwVerbosity, LPCSTR szFormat, ...); +EXTERN_C BOOL WINAPIV KatoCommentVA(HKATO hKato, DWORD dwVerbosity, LPCSTR szFormat, va_list pArgs); + +// Non-string functions +EXTERN_C BOOL WINAPI KatoSetItemData(HKATO hKato, DWORD dwItemData); +EXTERN_C DWORD WINAPI KatoGetItemData(HKATO hKato); +EXTERN_C BOOL WINAPI KatoSendSystemData(HKATO hKato, DWORD dwSystemID, LPCVOID lpcvBuffer, DWORD dwSize); +EXTERN_C DWORD WINAPI KatoGetCurrentLevel(HKATO hKato); +EXTERN_C INT WINAPI KatoGetVerbosityCount(HKATO hKato, DWORD dwVerbosity, DWORD dwLevel); + +//****************************************************************************** +// Map function names to the correct APIs based on the UNICODE flag +//****************************************************************************** + +#ifdef UNICODE + #define KATOCALLBACKSTRUCT KATOCALLBACKSTRUCTW + #define LPKATOCALLBACKSTRUCT LPKATOCALLBACKSTRUCTW + #define LPKATOCALLBACK LPKATOCALLBACKW + #define KatoCreate KatoCreateW + #define KatoSetCallback KatoSetCallbackW + #define KatoSetServer KatoSetServerW + #define KatoGetServer KatoGetServerW + #define KatoBeginLevel KatoBeginLevelW + #define KatoBeginLevelV KatoBeginLevelVW + #define KatoEndLevel KatoEndLevelW + #define KatoEndLevelV KatoEndLevelVW + #define KatoLog KatoLogW + #define KatoLogV KatoLogVW + #define KatoComment KatoCommentW + #define KatoCommentV KatoCommentVW +#else + #define KATOCALLBACKSTRUCT KATOCALLBACKSTRUCTA + #define LPKATOCALLBACKSTRUCT LPKATOCALLBACKSTRUCTA + #define LPKATOCALLBACK LPKATOCALLBACKA + #define KatoCreate KatoCreateA + #define KatoSetCallback KatoSetCallbackA + #define KatoSetServer KatoSetServerA + #define KatoGetServer KatoGetServerA + #define KatoBeginLevel KatoBeginLevelA + #define KatoBeginLevelV KatoBeginLevelVA + #define KatoEndLevel KatoEndLevelA + #define KatoEndLevelV KatoEndLevelVA + #define KatoLog KatoLogA + #define KatoLogV KatoLogVA + #define KatoComment KatoCommentA + #define KatoCommentV KatoCommentVA +#endif + +//****************************************************************************** +// CKato - Interface for C++ applications +//****************************************************************************** + +#ifdef __cplusplus + +class KATOAPI CKato { +public: + // Overlaod new and delete to prevent mismatched heaps (KB:Q122675) + void* __cdecl operator new(size_t stAllocate); + void __cdecl operator delete(void *pvMemory); + + // Construction and destruction + CKato(LPCWSTR wszName = NULL); + CKato(LPCSTR szName); + virtual ~CKato(VOID); + + // Unicode functions + INT WINAPIV BeginLevel (DWORD dwLevelID, LPCWSTR wszFormat, ...); + INT WINAPI BeginLevelV(DWORD dwLevelID, LPCWSTR wszFormat, va_list pArgs); + INT WINAPIV EndLevel (LPCWSTR wszFormat, ...); + INT WINAPI EndLevelV(LPCWSTR wszFormat, va_list pArgs); + BOOL WINAPIV Log (DWORD dwVerbosity, LPCWSTR wszFormat, ...); + BOOL WINAPI LogV(DWORD dwVerbosity, LPCWSTR wszFormat, va_list pArgs); + BOOL WINAPIV Comment (DWORD dwVerbosity, LPCWSTR wszFormat, ...); + BOOL WINAPI CommentV(DWORD dwVerbosity, LPCWSTR wszFormat, va_list pArgs); + + // ASCII functions + INT WINAPIV BeginLevel (DWORD dwLevelID, LPCSTR szFormat, ...); + INT WINAPI BeginLevelV(DWORD dwLevelID, LPCSTR szFormat, va_list pArgs); + INT WINAPIV EndLevel (LPCSTR szFormat, ...); + INT WINAPI EndLevelV(LPCSTR szFormat, va_list pArgs); + BOOL WINAPIV Log (DWORD dwVerbosity, LPCSTR szFormat, ...); + BOOL WINAPI LogV(DWORD dwVerbosity, LPCSTR szFormat, va_list pArgs); + BOOL WINAPIV Comment (DWORD dwVerbosity, LPCSTR szFormat, ...); + BOOL WINAPI CommentV(DWORD dwVerbosity, LPCSTR szFormat, va_list pArgs); + + // Non-string functions + BOOL WINAPI SetItemData(DWORD dwItemData); + DWORD WINAPI GetItemData(VOID); + BOOL WINAPI SendSystemData(DWORD dwSystemID, LPCVOID lpcvBuffer, DWORD dwSize); + DWORD WINAPI GetCurrentLevel(VOID); + INT WINAPI GetVerbosityCount(DWORD dwVerbosity, DWORD dwLevel = -1); + + // Internal functions and data +protected: + friend VOID WINAPI Internal(CKato*, DWORD, LPARAM); + VOID WINAPI Internal(DWORD, LPARAM); + LPVOID m_lpvKatoData; +}; + +#endif // __cplusplus + +#pragma pack() // restore packing size to previous state + +#endif // __KATO_H__ diff --git a/mp/src/utils/sapi51/Tools/Comp/Common/Include/tux.h b/mp/src/utils/sapi51/Tools/Comp/Common/Include/tux.h new file mode 100644 index 00000000..011f2520 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Common/Include/tux.h @@ -0,0 +1,191 @@ +/*++ +THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +PARTICULAR PURPOSE. + +Copyright 1997 Microsoft Corporation. All Rights Reserved. + +Module Name: + + tux.h + +Abstract: +Functions: +Notes: +--*/ +//****************************************************************************** +// +// TUX.H +// +// Definitions of Tux types, structures, and messages. +// +// Date Name Description +// -------- -------- ----------------------------------------------------------- +// 02/14/95 SteveMil Created +// +//****************************************************************************** + +#ifndef __TUX_H__ +#define __TUX_H__ + +//****************************************************************************** +//***** Function Types +//****************************************************************************** + +// Forward declaration of LPFUNCTION_TABLE_ENTRY +typedef struct _FUNCTION_TABLE_ENTRY *LPFUNCTION_TABLE_ENTRY; + +// Define our ShellProc Param and TestProc Param types +typedef LPARAM SPPARAM; +typedef LPDWORD TPPARAM; + +// Shell and Test message handling procs +typedef INT (WINAPI *SHELLPROC)(UINT uMsg, SPPARAM spParam); +typedef INT (WINAPI *TESTPROC )(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE); + +// SHELLPROCAPI and TESTPROCAPI +#ifdef __cplusplus +#define SHELLPROCAPI extern "C" INT __declspec(dllexport) WINAPI +#else +#define SHELLPROCAPI INT __declspec(dllexport) WINAPI +#endif +#define TESTPROCAPI INT WINAPI + +//****************************************************************************** +//***** Function Table Entry Structure +//****************************************************************************** + +typedef struct _FUNCTION_TABLE_ENTRY { + LPCTSTR lpDescription; // description of test + UINT uDepth; // depth of item in tree hierarchy + LPVOID dwUserData; // user defined data that will be passed to TestProc at runtime + DWORD dwUniqueID; // uniquely identifies the test - used in loading/saving scripts + TESTPROC lpTestProc; // pointer to TestProc function to be called for this test +} FUNCTION_TABLE_ENTRY, *LPFUNCTION_TABLE_ENTRY; + +extern FUNCTION_TABLE_ENTRY g_lpFTE[]; + +//****************************************************************************** +//***** ShellProc() Message values +//****************************************************************************** + +#define SPM_LOAD_DLL 1 +#define SPM_UNLOAD_DLL 2 +#define SPM_START_SCRIPT 3 +#define SPM_STOP_SCRIPT 4 +#define SPM_BEGIN_GROUP 5 +#define SPM_END_GROUP 6 +#define SPM_SHELL_INFO 7 +#define SPM_REGISTER 8 +#define SPM_EXCEPTION 9 +#define SPM_BEGIN_TEST 10 +#define SPM_END_TEST 11 + +//****************************************************************************** +//***** ShellProc() Return values +//****************************************************************************** + +#define SPR_NOT_HANDLED 0 +#define SPR_HANDLED 1 +#define SPR_SKIP 2 +#define SPR_FAIL 3 + +//****************************************************************************** +//***** TestProc() Message values +//****************************************************************************** + +#define TPM_EXECUTE 101 +#define TPM_QUERY_THREAD_COUNT 102 + +//****************************************************************************** +//***** TestProc() Return values +//****************************************************************************** + +#define TPR_SKIP 2 +#define TPR_PASS 3 +#define TPR_FAIL 4 +#define TPR_ABORT 5 +#define TPR_SUPPORTED 6 +#define TPR_UNSUPPORTED 7 + +//****************************************************************************** +//***** ShellProc() Structures +//****************************************************************************** + +// ShellProc() Structure for SPM_LOAD_DLL message +typedef struct _SPS_LOAD_DLL { + BOOL fUnicode; // Set to true if your Dll is UNICODE +} SPS_LOAD_DLL, *LPSPS_LOAD_DLL; + +// ShellProc() Structure for SPM_SHELL_INFO message +typedef struct _SPS_SHELL_INFO { + HINSTANCE hInstance; // Instance handle of shell. + HWND hWnd; // Main window handle of shell (currently set to NULL). + HINSTANCE hLib; // Test Dll instance handle. + HANDLE hevmTerminate; // Manual event that is set by Tux to inform all + // tests to shutdown (currently not used). + BOOL fUsingServer; // Set if Tux is connected to Tux Server. + LPCTSTR szDllCmdLine; // Command line arguments for test DLL. +} SPS_SHELL_INFO, *LPSPS_SHELL_INFO; + +// ShellProc() Structure for SPM_REGISTER message +typedef struct _SPS_REGISTER { + LPFUNCTION_TABLE_ENTRY lpFunctionTable; +} SPS_REGISTER, *LPSPS_REGISTER; + +// ShellProc() Structure for SPM_BEGIN_TEST message +typedef struct _SPS_BEGIN_TEST { + LPFUNCTION_TABLE_ENTRY lpFTE; + DWORD dwRandomSeed; + DWORD dwThreadCount; +} SPS_BEGIN_TEST, *LPSPS_BEGIN_TEST; + +// ShellProc() Structure for SPM_END_TEST message +typedef struct _SPS_END_TEST { + LPFUNCTION_TABLE_ENTRY lpFTE; + DWORD dwResult; + DWORD dwRandomSeed; + DWORD dwThreadCount; + DWORD dwExecutionTime; +} SPS_END_TEST, *LPSPS_END_TEST; + +// ShellProc() Structure for SPM_EXCEPTION message +typedef struct _SPS_EXCEPTION { + LPFUNCTION_TABLE_ENTRY lpFTE; + DWORD dwExceptionCode; + EXCEPTION_POINTERS *lpExceptionPointers; + DWORD dwExceptionFilter; + UINT uMsg; +} SPS_EXCEPTION, *LPSPS_EXCEPTION; + + +//****************************************************************************** +//***** TestProc() Structures +//****************************************************************************** + +// TestProc() Structure for TPM_EXECUTE message +typedef struct _TPS_EXECUTE { + DWORD dwRandomSeed; + DWORD dwThreadCount; + DWORD dwThreadNumber; +} TPS_EXECUTE, *LPTPS_EXECUTE; + +// TestProc() Structure for TPM_QUERY_THREAD_COUNT message +typedef struct _TPS_QUERY_THREAD_COUNT { + DWORD dwThreadCount; +} TPS_QUERY_THREAD_COUNT, *LPTPS_QUERY_THREAD_COUNT; + +//****************************************************************************** +//***** Old constants defined for compatibility - DO NOT USE THESE CONSTANTS!!! +//****************************************************************************** + +#define TPR_NOT_HANDLED 0 +#define TPR_HANDLED 1 +#define SPM_START_TESTS SPM_BEGIN_GROUP +#define SPM_STOP_TESTS SPM_END_GROUP +#define SHELLINFO SPS_SHELL_INFO +#define LPSHELLINFO LPSPS_SHELL_INFO +#define SPF_UNICODE 0x00010000 + +#endif //__TUX_H__ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/applex.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/applex.wav new file mode 100644 index 00000000..8f83e4a8 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/applex.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/audioformats.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/audioformats.wav new file mode 100644 index 00000000..21c1d42e Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/audioformats.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/autopause.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/autopause.wav new file mode 100644 index 00000000..53aee816 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/autopause.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/black.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/black.wav new file mode 100644 index 00000000..e366847e Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/black.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/checkevents.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/checkevents.wav new file mode 100644 index 00000000..6e8878fc Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/checkevents.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/invalidaterule_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/invalidaterule_j.wav new file mode 100644 index 00000000..262d37cf Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/invalidaterule_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/lexicon.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/lexicon.wav new file mode 100644 index 00000000..8f83e4a8 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/lexicon.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/lexicon_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/lexicon_j.wav new file mode 100644 index 00000000..3d672a28 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/lexicon_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/multireco.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/multireco.wav new file mode 100644 index 00000000..2dd2cb4c Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/multireco.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/multireco_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/multireco_j.wav new file mode 100644 index 00000000..8dd12e98 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/multireco_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/oboe.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/oboe.wav new file mode 100644 index 00000000..6b9d1991 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/oboe.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/play.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/play.wav new file mode 100644 index 00000000..d8b85c31 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/play.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/playblack.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/playblack.wav new file mode 100644 index 00000000..2b6009c9 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/playblack.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/please.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/please.wav new file mode 100644 index 00000000..3cd7c0be Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/please.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/pleasewalk.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/pleasewalk.wav new file mode 100644 index 00000000..7c0b5b99 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/pleasewalk.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/put.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/put.wav new file mode 100644 index 00000000..e413223c Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/put.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/red.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/red.wav new file mode 100644 index 00000000..1103a388 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/red.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/selcity.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/selcity.wav new file mode 100644 index 00000000..59ed62de Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/selcity.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/selcity.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/selcity.xml new file mode 100644 index 00000000..3da69c62 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Resources/selcity.xml @@ -0,0 +1,10 @@ + + +

The weather of

+ +

Nice

+

Rainy

+
+
+
+ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/seven.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/seven.wav new file mode 100644 index 00000000..95385112 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/seven.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/silence.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/silence.wav new file mode 100644 index 00000000..5001a3d9 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/silence.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/snork.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/snork.wav new file mode 100644 index 00000000..8f83e4a8 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/snork.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/snork.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/snork.xml new file mode 100644 index 00000000..f7ba7fa3 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Resources/snork.xml @@ -0,0 +1,5 @@ + + +

skooky

+
+
diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/snork_j.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/snork_j.xml new file mode 100644 index 00000000..0de1f586 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/snork_j.xml differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.wav new file mode 100644 index 00000000..1b887517 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.xml new file mode 100644 index 00000000..729b6aa3 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.xml @@ -0,0 +1,18 @@ + + +

play the

+ + please +
+ +

play the

+ + please +
+ + +

oboe

+

trombone

+
+
+
diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.wav new file mode 100644 index 00000000..c85345fe Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.xml new file mode 100644 index 00000000..6ead7cb0 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.xml differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l.wav new file mode 100644 index 00000000..796d2378 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l.xml new file mode 100644 index 00000000..e3d61431 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l.xml @@ -0,0 +1,9 @@ + + + +

move

+

put

+

get

+
+
+
diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.wav new file mode 100644 index 00000000..18d0c1c9 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.xml new file mode 100644 index 00000000..ab9c5e15 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.xml differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o.xml new file mode 100644 index 00000000..7400ed9d --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o.xml @@ -0,0 +1,7 @@ + + + please +

walk

+ slowly +
+
diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o1.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o1.wav new file mode 100644 index 00000000..e6c6912c Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o1.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o1_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o1_j.wav new file mode 100644 index 00000000..91e16800 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o1_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o2.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o2.wav new file mode 100644 index 00000000..fbc58c34 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o2.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o2_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o2_j.wav new file mode 100644 index 00000000..af4d48cd Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o2_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o3.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o3.wav new file mode 100644 index 00000000..6fc6c287 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o3.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o3_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o3_j.wav new file mode 100644 index 00000000..e3a410ee Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o3_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o_j.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o_j.xml new file mode 100644 index 00000000..02668344 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_o_j.xml differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p.wav new file mode 100644 index 00000000..3c8db8e9 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p1.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p1.xml new file mode 100644 index 00000000..79232c77 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p1.xml @@ -0,0 +1,5 @@ + + +

white

+
+
diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p1_j.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p1_j.xml new file mode 100644 index 00000000..010ff9fa Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p1_j.xml differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p2.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p2.xml new file mode 100644 index 00000000..4e100fc2 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p2.xml @@ -0,0 +1,5 @@ + + +

black

+
+
diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p2_j.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p2_j.xml new file mode 100644 index 00000000..db14052d Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p2_j.xml differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p_j.wav new file mode 100644 index 00000000..8dd12e98 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_p_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.wav new file mode 100644 index 00000000..3e8abb00 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.xml new file mode 100644 index 00000000..ab56c65b --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.xml @@ -0,0 +1,27 @@ + + + please +

play the

+ + please +
+ + +

ace

+

two

+

three

+

four

+

five

+

six

+

seven

+

eight

+

nine

+

ten

+

jack

+

queen

+

king

+

lady

+

emperor

+
+
+
diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.wav new file mode 100644 index 00000000..01025ca5 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.xml b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.xml new file mode 100644 index 00000000..886793a0 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.xml differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/test.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/test.wav new file mode 100644 index 00000000..21c1d42e Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/test.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/walk.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/walk.wav new file mode 100644 index 00000000..ff897950 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/walk.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/walkslowly.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/walkslowly.wav new file mode 100644 index 00000000..e69738eb Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/walkslowly.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/Resources/white.wav b/mp/src/utils/sapi51/Tools/Comp/Resources/white.wav new file mode 100644 index 00000000..667826b0 Binary files /dev/null and b/mp/src/utils/sapi51/Tools/Comp/Resources/white.wav differ diff --git a/mp/src/utils/sapi51/Tools/Comp/SR/resource.h b/mp/src/utils/sapi51/Tools/Comp/SR/resource.h new file mode 100644 index 00000000..448c4213 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/SR/resource.h @@ -0,0 +1,160 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by srcomp.rc +// +#define IDD_DIALOG_LOADOPTIONS 101 +#define IDR_RULE_GRAMMAR 102 +#define IDR_L_GRAMMAR 103 +#define IDR_LNPN_GRAMMAR 104 +#define IDR_O_GRAMMAR 105 +#define IDR_P1_GRAMMAR 106 +#define IDR_P2_GRAMMAR 107 +#define IDR_EXPRULE_GRAMMAR 108 +#define IDR_SNORK_GRAMMAR 109 +#define IDC_COMBO_SRENGINES 1000 +#define IDC_COMBO_TTSDRIVERS 1001 +#define IDC_CHECK1 1002 +#define IDC_CHECK2 1003 +#define IDS_WAV_AUDIO_FORMATS 1004 +#define IDS_WAV_SOUNDSTART 1005 +#define IDS_WAV_SOUNDEND 1006 +#define IDS_WAV_SOUNDSTARTEND 1007 +#define IDS_WAV_PHRASESTART 1008 +#define IDS_WAV_RECOGNITION_1 1009 +#define IDS_WAV_RECOGNITION_2 1010 +#define IDS_WAV_HYPOTHESIS 1011 +#define IDS_WAV_PHRASE_RECO_HYP 1012 +#define IDS_WAV_SYNCH_BEFORE_LOAD 1013 +#define IDS_WAV_SYNCH_AFTER_DICT 1014 +#define IDS_WAV_SYNCH_AFTER_GRAM 1015 +#define IDS_WAV_L_TAG 1016 +#define IDS_WAV_MULT_RECO 1017 +#define IDS_WAV_EXPRULE_TAG 1018 +#define IDS_WAV_P_TAG 1019 +#define IDS_WAV_O_TAG_1 1020 +#define IDS_WAV_O_TAG_2 1021 +#define IDS_WAV_O_TAG_3 1022 +#define IDS_WAV_RULE_TAG 1023 +#define IDS_WAV_LN_TAG 1024 +#define IDS_RECO_SYNCH_BEFORE_LOAD 1025 +#define IDS_RECO_SYNCH_AFTER_DICT 1026 +#define IDS_RECO_SYNCH_AFTER_GRAM 1027 +#define IDS_RECO_L_TAG 1028 +#define IDS_RECO_EXPRULE_TAG_1 1029 +#define IDS_RECO_EXPRULE_TAG_2 1030 +#define IDS_RECO_P_TAG 1031 +#define IDS_RECO_O_TAG_1 1032 +#define IDS_RECO_O_TAG_2 1033 +#define IDS_RECO_O_TAG_3 1034 +#define IDS_RECO_RULE_TAG 1035 +#define IDS_RECO_LN_TAG 1036 +#define IDS_RESOURCE_LOCATION1 1037 +#define IDS_RESOURCE_LOCATION2 1038 +#define IDS_UNEXPECTED_ERR 1039 +#define IDS_UNEXPECTED_EVENT 1040 +#define IDS_ERR_AUDIOFORMAT_TOMANY 1041 +#define IDS_ERR_AUDIOFORMAT_UNSUPPORTED 1042 +#define IDS_ERR_AUDIOFORMAT_NOTENOUGH 1043 +#define IDS_ERR_SOUNDSTART_NOEVENT 1044 +#define IDS_ERR_STREAMEND_NOEVENT 1045 +#define IDS_ERR_SOUNDEND_NOEVENT 1046 +#define IDS_ERR_SOUNDSTART_BADPOSITION1 1047 +#define IDS_ERR_SOUNDSTART_BADPOSITION2 1048 +#define IDS_ERR_SOUNDEND_BADPOSITION1 1049 +#define IDS_ERR_SOUNDEND_BADPOSITION2 1050 +#define IDS_ERR_SOUNDSTARTEND_NOEVENT 1051 +#define IDS_ERR_SOUNDSTARTEND_WRONGORDER 1052 +#define IDS_ERR_PHRASESTART_NOEVENT 1053 +#define IDS_ERR_RECOGNITION_NOEVENT 1054 +#define IDS_ERR_RECOGNITION_EVENTONSILENCE 1055 +#define IDS_ERR_RECOGNITION_WRONGORDER 1056 +#define IDS_ERR_HYPOTHESIS_NOEVENT 1057 +#define IDS_ERR_HYPOTHESIS_WRONGORDER 1058 +#define IDS_ERR_RESULT_WRONGWORD 1059 +#define IDS_ERR_LEX_REMOVEUSER 1060 +#define IDS_ERR_LEX_EXPECTNOWORD 1061 +#define IDS_RECO_NEWWORD_PRON 1062 +#define IDS_ERR_FALSERECOGNITION_NOEVENT 1063 +#define IDS_AUTOPAUSE_DYNAMICWORD1 1064 +#define IDS_AUTOPAUSE_DYNAMICWORD2 1065 +#define IDS_AUTOPAUSE_DYNAMICRULE1 1066 +#define IDS_AUTOPAUSE_DYNAMICRULE2 1067 +#define IDS_WAV_AUTOPAUSE 1068 +#define IDS_INVALIDATETOPLEVEL_DYNAMICWORDS 1069 +#define IDS_INVALIDATETOPLEVEL_DYNAMICRULE 1070 +#define IDS_WAV_INVALIDATETOPLEVEL_OLD 1071 +#define IDS_INVALIDATETOPLEVEL_DYNAMICNEWWORDS 1072 +#define IDS_ERR_INVALIDATETOPLEVEL 1073 +#define IDS_WAV_INVALIDATETOPLEVEL_NEW 1074 +#define IDS_INVALIDATENONTOPLEVEL_RULE1 1075 +#define IDS_INVALIDATENONTOPLEVEL_RULE2 1076 +#define IDS_INVALIDATENONTOPLEVEL_TOPLEVELRULE 1077 +#define IDS_INVALIDATENONTOPLEVEL_WORD1 1078 +#define IDS_INVALIDATENONTOPLEVEL_OLDWORD1 1078 +#define IDS_INVALIDATENONTOPLEVEL_OLDWORD2 1079 +#define IDS_INVALIDATENONTOPLEVEL_NEWWORD2 1080 +#define IDS_INVALIDATENONTOPLEVEL_TOPLEVELWORDS 1081 +#define IDS_WAV_INVALIDATENONTOPLEVEL_OLD 1082 +#define IDS_WAV_INVALIDATENONTOPLEVEL_NEW 1083 +#define IDS_WAV_CFGTEXTBUFFER 1084 +#define IDS_CFGTEXTBUFFER_WORDS 1085 +#define IDS_CFGTEXTBUFFER_BUFFERWORD 1086 +#define IDS_CFGTEXTBUFFER_RULE 1087 +#define IDS_WAV_ALTERMATESCFG 1088 +#define IDS_ALTERNATESCFG_BESTWORD 1089 +#define IDS_ALTERNATESCFG_ALTERNATE1 1090 +#define IDS_ALTERNATESCFG_ALTERNATE2 1091 +#define IDS_ALTERNATESCFG_WORDS 1092 +#define IDS_ALTERNATESCFG_RULE 1093 +#define IDS_ERR_INTERFERENCE_NOEVENT 1094 +#define IDS_WAV_INTERFERENCE 1095 +#define IDS_WAV_GETITNRESULT 1096 +#define IDS_RECO_GETITNRESULT 1097 +#define IDS_CUSTOMPROP_NEWWORD_PRON 1098 +#define IDS_CUSTOMPROP_RULE 1099 +#define IDS_WAV_CUSTOMPROP 1100 +#define IDS_CUSTOMPROP_NEWWORD_DISP 1101 +#define IDS_CUSTOMPROP_NEWWORD_LEX 1102 +#define IDS_DICTATIONTAG_WORDS 1103 +#define IDS_DICTATIONTAG_RULE 1104 +#define IDS_WAV_DICTATIONTAG 1105 +#define IDS_WILDCARD_WORDS 1106 +#define IDS_WILDCARD_RULE 1107 +#define IDS_WAV_WILDCARD 1108 +#define IDS_APPLEX_WORD 1109 +#define IDS_APPLEX_PROP 1110 +#define IDS_USERLEXBEFOREAPPLEX_WORD 1111 +#define IDS_USERLEXBEFOREAPPLEX_USERPROP 1112 +#define IDS_USERLEXBEFOREAPPLEX_APPPROP 1113 +#define IDS_WAV_APPLEX 1114 +#define IDS_WAV_USERLEXBEFOREAPPLEX 1115 +#define IDS_INVALIDATENONTOPLEVEL_NEWWORD1 1116 +#define IDS_RESOURCE_LOCATION3 1117 +#define IDS_RECO_EXPRULE_FIRSTRULE 1118 +#define IDS_RECO_EXPRULE_SECONDRULE 1119 +#define IDS_CASESENSITIVEGRAMMAR_RULENAME 1120 +#define IDS_CASESENSITIVEGRAMMAR_LEX1 1121 +#define IDS_CASESENSITIVEGRAMMAR_PRON1 1122 +#define IDS_CASESENSITIVEGRAMMAR_LEX2 1123 +#define IDS_CASESENSITIVEGRAMMAR_PRON2 1124 +#define IDS_CASESENSITIVEGRAMMAR_WAVE 1126 +#define IDS_CASESENSITIVEGRAMMAR_DISP1 1127 +#define IDS_CASESENSITIVEGRAMMAR_DISP2 1128 +#define IDS_CASESENSITIVELEXICON_WORD1 1129 +#define IDS_CASESENSITIVELEXICON_SYMBOL1 1130 +#define IDS_CASESENSITIVELEXICON_WORD2 1131 +#define IDS_CASESENSITIVELEXICON_SYMBOL2 1132 +#define IDS_CASESENSITIVELEXICON_WAVE 1133 +#define IDS_CASESENSITIVELEXICON_RULENAME 1134 +#define IDS_CFGTEXTBUFFER_NOTINTERESTEDWORDS 1135 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 116 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1062 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mp/src/utils/sapi51/Tools/Comp/SR/sr.dsp b/mp/src/utils/sapi51/Tools/Comp/SR/sr.dsp new file mode 100644 index 00000000..f2e60b17 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/SR/sr.dsp @@ -0,0 +1,576 @@ +# Microsoft Developer Studio Project File - Name="SRCOMP" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=SRCOMP - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sr.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sr.mak" CFG="SRCOMP - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "SRCOMP - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "SRCOMP - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRCOMP_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\sdk\include" /I "..\..\..\..\ddk\include" /I "..\..\source\common\include" /I "..\..\source\sr" /I "..\common\include" /I "..\..\..\include" /I "..\common\cpp" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRCOMP_EXPORTS" /D _WIN32_WINNT=0x0500 /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kato.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"Debug/srcomp.pdb" /machine:I386 /out:"Release/SRCOMP.dll" /implib:"Debug/srcomp.lib" /pdbtype:sept /libpath:"..\..\..\..\sdk\lib" /libpath:"..\..\..\..\sdk\lib\i386" /libpath:"..\..\source\common\lib" /libpath:"..\common\lib" /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none /incremental:yes /debug + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRCOMP_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\common\cpp" /I "..\..\..\..\sdk\include" /I "..\..\..\..\ddk\include" /I "..\..\source\common\include" /I "..\..\source\sr" /I "..\common\include" /I "..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRCOMP_EXPORTS" /D _WIN32_WINNT=0x0500 /FR /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /I "..\..\..\sdk\idl" /D "_DEBUG" /win32 +# SUBTRACT MTL /mktyplib203 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kato.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/SRCOMP.dll" /pdbtype:sept /libpath:"..\..\..\..\sdk\lib\i386" /libpath:"..\..\source\common\lib" /libpath:"..\common\lib" /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "SRCOMP - Win32 Release" +# Name "SRCOMP - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "Test Module" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\srenginecompliance.cpp +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "*.xml" +# Begin Source File + +SOURCE=..\resources\snork.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\snork.xml + +"..\resources\snork.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\snork.xml + +"..\resources\snork.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\snork_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\snork_j.xml + +"..\resources\snork_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\snork_j.xml + +"..\resources\snork_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_exprule.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_exprule.xml + +"..\resources\tag_exprule.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_exprule.xml + +"..\resources\tag_exprule.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_exprule_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_exprule_j.xml + +"..\resources\tag_exprule_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_exprule_j.xml + +"..\resources\tag_exprule_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_l.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_l.xml + +"..\resources\tag_l.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_l.xml + +"..\resources\tag_l.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_l_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_l_j.xml + +"..\resources\tag_l_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_l_j.xml + +"..\resources\tag_l_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_o.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_o.xml + +"..\resources\tag_o.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_o.xml + +"..\resources\tag_o.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_o_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_o_j.xml + +"..\resources\tag_o_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_o_j.xml + +"..\resources\tag_o_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p1.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_p1.xml + +"..\resources\tag_p1.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_p1.xml + +"..\resources\tag_p1.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p1_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_p1_j.xml + +"..\resources\tag_p1_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_p1_j.xml + +"..\resources\tag_p1_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p2.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_p2.xml + +"..\resources\tag_p2.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_p2.xml + +"..\resources\tag_p2.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p2_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_p2_j.xml + +"..\resources\tag_p2_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_p2_j.xml + +"..\resources\tag_p2_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_rule.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_rule.xml + +"..\resources\tag_rule.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_rule.xml + +"..\resources\tag_rule.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_rule_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_rule_j.xml + +"..\resources\tag_rule_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_rule_j.xml + +"..\resources\tag_rule_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\SRCOMP.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\def\srcomp.def +# End Source File +# Begin Source File + +SOURCE=.\SRCOMP.rc +# End Source File +# Begin Source File + +SOURCE=..\Common\cpp\TUXDLL.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\srenginecompliance.h +# End Source File +# Begin Source File + +SOURCE=.\srtests1.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=..\resources\snork.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_EXPRULE.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_exprule_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_L.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_l_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_O.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_o_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p1.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p1_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p2.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p2_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_RULE.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_rule_j.cfg +# End Source File +# End Group +# Begin Source File + +SOURCE=..\resources\snork_j.cfg +# End Source File +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Tools/Comp/SR/srcomp.cpp b/mp/src/utils/sapi51/Tools/Comp/SR/srcomp.cpp new file mode 100644 index 00000000..4159f459 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/SR/srcomp.cpp @@ -0,0 +1,111 @@ +#include "SRTests1.h" + +// BASE is a unique value assigned to a given tester or component. This value, +// when combined with each of the following test's unique IDs, allows every +// test case within the entire team to be uniquely identified. + +#define BASE_REQUIRED 0x00010000 +#define BASE_OPTIONAL 0x00020000 + +TCHAR ptszCustomizedDirectory[MAX_PATH] = _T(""); + +// Our function table that we pass to Tux +FUNCTION_TABLE_ENTRY g_lpFTE[] = { + TEXT("Required" ), 0, 0, 0, NULL, + TEXT("Events" ), 1, 0, 0, NULL, + TEXT("Single Event" ), 2, 0, 0, NULL, + TEXT( "SoundStart" ), 3, 0, BASE_REQUIRED + 0x0101, t_CheckEvent_SoundStart, + TEXT( "SoundEnd" ), 3, 0, BASE_REQUIRED + 0x0102, t_CheckEvent_SoundEnd, + TEXT( "FalseRecognition" ), 3, 0, BASE_REQUIRED + 0x0103, t_CheckEvent_FalseRecognition, + TEXT( "PhraseStart" ), 3, 0, BASE_REQUIRED + 0x0104, t_CheckEvent_PhraseStart, + TEXT( "Recognition" ), 3, 0, BASE_REQUIRED + 0x0105, t_CheckEvent_Recognition, + TEXT("Multi Events" ), 2, 0, 0, NULL, + TEXT( "SoundStart -> SoundEnd order" ), 3, 0, BASE_REQUIRED + 0x0106, t_CheckEvent_SoundStartEnd, + TEXT( "PhraseStart -> Recognition order" ), 3, 0, BASE_REQUIRED + 0x0107, t_CheckEvent_PhraseStartRecognitionOrder, + TEXT( "Events Offset" ), 3, 0, BASE_REQUIRED + 0x0108, t_CheckEvent_EventsSequences, + + TEXT("Lexicon" ), 1, 0, 0, NULL, + TEXT("User Lexicon" ), 2, 0, 0, NULL, + TEXT( "Synchronize before loading Command & Control grammar" ), 3, 0, BASE_REQUIRED + 0x0201, t_UserLexSynchBeforeCfgLoad, + TEXT( "Synchronize Command & Control grammar after loading engine" ), 3, 0, BASE_REQUIRED + 0x0202, t_UserLexSynchAfterGrammarLoad, + TEXT( "Application Lexicon for Command & Control" ), 2, 0, BASE_REQUIRED + 0x0203, t_AppLex, + TEXT( "Uses user lexicon before application lexicon for Command & Control" ), 2, 0, BASE_REQUIRED + 0x0204, t_UserLexBeforeAppLex, + TEXT( "Case sensitive lexicon" ), 2, 0, BASE_REQUIRED + 0x0205, t_CaseSensitiveLexicon, + + TEXT("Grammar" ), 1, 0, 0, NULL, + TEXT( "L tag" ), 2, 0, BASE_REQUIRED + 0x0301, t_GrammarListTag, + TEXT( "Expected Rule" ), 2, 0, BASE_REQUIRED + 0x0302, t_GrammarExpRuleTag, + TEXT( "P[hrase] tag" ), 2, 0, BASE_REQUIRED + 0x0303, t_GrammarPTag, + TEXT( "O[ptional] tag" ), 2, 0, BASE_REQUIRED + 0x0304, t_GrammarOTag, + TEXT( "RULE and RULEREF tags" ), 2, 0, BASE_REQUIRED + 0x0305, t_GrammarRuleTag, + TEXT( "/Disp/lex/pron" ), 2, 0, BASE_REQUIRED + 0x0306, t_CustomPron, + TEXT( "Case sensitive grammar" ), 2, 0, BASE_REQUIRED + 0x0307, t_CaseSensitiveGrammar, + + TEXT("Other" ), 1, 0, 0, NULL, + TEXT( "SpPhraseElements" ), 2, 0, BASE_REQUIRED + 0x0401, t_SpPhraseElements, + TEXT( "Automatically pause engine on recognition" ), 2, 0, BASE_REQUIRED + 0x0402, t_AutoPause, + TEXT( "Invalidate top level rule" ), 2, 0, BASE_REQUIRED + 0x0403, t_InvalidateToplevelRule, + TEXT( "Invalidate non-top level rule" ), 2, 0, BASE_REQUIRED + 0x0404, t_InvalidateNonToplevelRule, + TEXT( "Multi instances" ), 2, 0, BASE_REQUIRED + 0x0405, t_MultiInstances, + TEXT( "Multiple application contexts [ISpRecoContext]" ), 2, 0, BASE_REQUIRED + 0x0406, t_MultipleRecoContext, + + + TEXT("Optional" ), 0, 0, 0, NULL, + TEXT("Events" ), 1, 0, 0, NULL, + TEXT( "Get: Hypothesis" ), 2, 0, BASE_OPTIONAL + 0x1100, t_CheckEvent_Hypothesis, + TEXT( "Get: Interference" ), 2, 0, BASE_OPTIONAL + 0x1101, t_CheckEvent_Interference, + + TEXT("Dictation" ), 1, 0, 0, NULL, + TEXT("User Lexicon" ), 2, 0, 0, NULL, + TEXT( "Synchronize before loading dictation grammar" ), 3, 0, BASE_OPTIONAL + 0x1200, t_UserLexSynchBeforeDicLoad, + TEXT( "Synchronize Dictation grammar after loading engine" ), 3, 0, BASE_OPTIONAL + 0x1201, t_UserLexSynchAfterDictationLoad, + TEXT( "DICTATION Tag" ), 2, 0, BASE_OPTIONAL + 0x1202, t_DictationTag, + TEXT( "Dictation Alternates" ), 2, 0, BASE_OPTIONAL + 0x001203, t_Alternates_Dictation, + + TEXT("Grammar" ), 1, 0, 0, NULL, + TEXT("Tags" ), 2, 0, 0, NULL, + TEXT( "CFGTextBuffer" ), 3, 0, BASE_OPTIONAL + 0x1301, t_CFGTextBuffer, + TEXT( "WILDCARD Tag" ), 3, 0, BASE_OPTIONAL + 0x1303, t_Wildcard, + TEXT( "Use correct grammar with unambiguous rules" ), 2, 0, BASE_OPTIONAL + 0x1304, t_PickGrammar, + TEXT( "Use most recently activated grammar with ambiguous rules" ), 2, 0, BASE_OPTIONAL + 0x1305, t_UseLastActivatedGrammar, + + + TEXT("Other" ), 1, 0, 0, NULL, + TEXT( "Recognition with Inverse Text Normalization" ), 2, 0, BASE_OPTIONAL + 0x1500, t_GetITNResult, + TEXT( "Engine Numeric Properties" ), 2, 0, BASE_OPTIONAL + 0x1501, t_RequiredPropertyNum, + TEXT( "Engine Text Properties" ), 2, 0, BASE_OPTIONAL + 0x1502, t_RequiredPropertyString, + TEXT( "Command&Control Alternates" ), 2, 0, BASE_OPTIONAL + 0x1503, t_Alternates_Cfg, + + + + NULL , 0, 0, 0, NULL // marks end of list +}; + +HRESULT SetCurrentDirToDllDir() +{ + TCHAR tszPath[MAX_PATH]; + HRESULT hr = E_FAIL; + if (::GetModuleFileName(g_pShellInfo->hLib, tszPath, MAX_PATH)) + { + TCHAR *psLast = ::_tcsrchr(tszPath, '\\'); + if (psLast) + *psLast = _T('\0'); + + if (::SetCurrentDirectory(tszPath)) + { + + hr = S_OK; + } + } + + return hr; + +} + +HRESULT PreTestSetup(void) { + return SetCurrentDirToDllDir(); +} + +HRESULT PostTestCleanup(void) { + return S_OK; +} diff --git a/mp/src/utils/sapi51/Tools/Comp/SR/srcomp.rc b/mp/src/utils/sapi51/Tools/Comp/SR/srcomp.rc new file mode 100644 index 00000000..357bb805 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/SR/srcomp.rc @@ -0,0 +1,562 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_RULE_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_rule_j.cfg" +IDR_L_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_l_j.cfg" +IDR_O_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_o_j.cfg" +IDR_P1_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_p1_j.cfg" +IDR_P2_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_p2_j.cfg" +IDR_EXPRULE_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_exprule_j.cfg" +IDR_SNORK_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\snork_j.cfg" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft\0" + VALUE "FileDescription", "SRCOMP\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SRCOMP\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "SRCOMP.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft SRCOMP\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_RECO_SYNCH_BEFORE_LOAD L"\x3059\x304f\x3046\x304d" + IDS_RECO_SYNCH_AFTER_DICT L"\x3059\x304f\x3046\x304d" + IDS_RECO_SYNCH_AFTER_GRAM L"\x3059\x304f\x3046\x304d" + IDS_RECO_L_TAG L"\x7f6e\x304f" + IDS_RECO_P_TAG L"\x767d" + IDS_RECO_O_TAG_1 L"\x4e0b\x3055\x3044" + IDS_RECO_O_TAG_2 L"\x6b69\x3044\x3066" + IDS_RECO_O_TAG_3 L"\x3086\x3063\x304f\x308a" + IDS_RECO_RULE_TAG L"\x4e03\x3092\x52d5\x304b\x3057\x3066" + IDS_RESOURCE_LOCATION1 "..\\resources\\" + IDS_RESOURCE_LOCATION2 "..\\..\\..\\resources\\" + IDS_UNEXPECTED_ERR "recieved an unexpected error" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_UNEXPECTED_EVENT "recieved an unexpected event" + IDS_ERR_AUDIOFORMAT_TOMANY "Too many audio formats" + IDS_ERR_AUDIOFORMAT_UNSUPPORTED "unsupported audio format returned" + IDS_ERR_AUDIOFORMAT_NOTENOUGH "no formats returned" + IDS_ERR_SOUNDSTART_NOEVENT "failed to recieve sound_start event" + IDS_ERR_STREAMEND_NOEVENT "failed to recieve stream_end event" + IDS_ERR_SOUNDEND_NOEVENT "failed to recieve sound_end event" + IDS_ERR_SOUNDSTART_BADPOSITION1 "sound_start postion after sound_end" + IDS_ERR_SOUNDSTART_BADPOSITION2 "sound_start not in last third of audio" + IDS_ERR_SOUNDEND_BADPOSITION1 "sound_end postion after stream_end" + IDS_ERR_SOUNDEND_BADPOSITION2 "sound_end not in first third of audio" + IDS_ERR_SOUNDSTARTEND_NOEVENT + "failed to recieve both sound_start and sound_end events" + IDS_ERR_SOUNDSTARTEND_WRONGORDER + "sound_start and sound_end events recieved in wrong order" + IDS_ERR_PHRASESTART_NOEVENT "failed to recieve phrase_start event" + IDS_ERR_RECOGNITION_NOEVENT "failed to recieve recognition event" + IDS_ERR_RECOGNITION_EVENTONSILENCE + "received a Recognition event for silence" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERR_RECOGNITION_WRONGORDER + "recoginition event recieved in wrong order" + IDS_ERR_HYPOTHESIS_NOEVENT "failed to recieve hypothesis event" + IDS_ERR_HYPOTHESIS_WRONGORDER "hypothesis event recieved in wrong order" + IDS_ERR_RESULT_WRONGWORD "failed to recieve expected result" + IDS_ERR_LEX_REMOVEUSER "failed to remove user" + IDS_ERR_LEX_EXPECTNOWORD "should not get word from empty user lexicon" + IDS_RECO_NEWWORD_PRON L"\x30b9\x30ce\x30fc\x30af" + IDS_ERR_FALSERECOGNITION_NOEVENT + "failed to recieve false recognition event" + IDS_AUTOPAUSE_DYNAMICWORD1 L"\x3057\x308d" + IDS_AUTOPAUSE_DYNAMICWORD2 L"\x304f\x308d" + IDS_AUTOPAUSE_DYNAMICRULE1 "action" + IDS_AUTOPAUSE_DYNAMICRULE2 "color" + IDS_WAV_AUTOPAUSE "multireco_j.wav" + IDS_INVALIDATETOPLEVEL_DYNAMICWORDS L"\x30aa\x30fc\x30dc\x30a8\x3092\x6f14\x594f\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_INVALIDATETOPLEVEL_DYNAMICRULE "play" + IDS_WAV_INVALIDATETOPLEVEL_OLD "tag_exprule_j.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_SOUNDSTART "tag_l_j.wav" + IDS_WAV_SOUNDEND "tag_l_j.wav" + IDS_WAV_SOUNDSTARTEND "tag_l_j.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_PHRASESTART "tag_l_j.wav" + IDS_WAV_RECOGNITION_1 "tag_l_j.wav" + IDS_WAV_HYPOTHESIS "tag_exprule_j.wav" + IDS_WAV_SYNCH_BEFORE_LOAD "lexicon_j.wav" + IDS_WAV_SYNCH_AFTER_DICT "lexicon_j.wav" + IDS_WAV_SYNCH_AFTER_GRAM "lexicon_j.wav" + IDS_WAV_L_TAG "tag_l_j.wav" + IDS_WAV_MULT_RECO "multireco_j.wav" + IDS_WAV_EXPRULE_TAG "tag_exprule_j.wav" + IDS_WAV_P_TAG "multireco_j.wav" + IDS_WAV_O_TAG_1 "tag_o1_j.wav" + IDS_WAV_O_TAG_2 "tag_o2_j.wav" + IDS_WAV_O_TAG_3 "tag_o3_j.wav" + IDS_WAV_RULE_TAG "tag_rule_j.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INVALIDATETOPLEVEL_DYNAMICNEWWORDS L"\x4e03\x3092\x52d5\x304b\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_ERR_INVALIDATETOPLEVEL + "Engine failed to invalidate the toplevel rule." + IDS_WAV_INVALIDATETOPLEVEL_NEW "tag_rule_j.wav" + IDS_INVALIDATENONTOPLEVEL_RULE1 "option" + IDS_INVALIDATENONTOPLEVEL_RULE2 "thing" + IDS_INVALIDATENONTOPLEVEL_TOPLEVELRULE "play" + IDS_INVALIDATENONTOPLEVEL_OLDWORD1 L"\x30aa\x30fc\x30dc\x30a8" + IDS_INVALIDATENONTOPLEVEL_OLDWORD2 L"\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_INVALIDATENONTOPLEVEL_NEWWORD2 " " + IDS_INVALIDATENONTOPLEVEL_TOPLEVELWORDS L"\x3092\x6f14\x594f" + IDS_WAV_INVALIDATENONTOPLEVEL_OLD "tag_exprule_j.wav" + IDS_WAV_INVALIDATENONTOPLEVEL_NEW "invalidaterule_j.wav" + IDS_WAV_CFGTEXTBUFFER "tag_exprule_j.wav" + IDS_CFGTEXTBUFFER_WORDS L"\x30aa\x30fc\x30dc\x30a8" + IDS_CFGTEXTBUFFER_BUFFERWORD L"\x3092\x6f14\x594f\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_CFGTEXTBUFFER_RULE "play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DICTATIONTAG_RULE "play" + IDS_WAV_DICTATIONTAG "tag_exprule_j.wav" + IDS_WILDCARD_WORDS L"\x30aa\x30fc\x30dc\x30a8" + IDS_WILDCARD_RULE "play" + IDS_WAV_WILDCARD "tag_exprule_j.wav" + IDS_APPLEX_WORD L"\x3059\x304f\x3046\x304d" + IDS_APPLEX_PROP L"\x30b9\x30ce\x30fc\x30af" + IDS_USERLEXBEFOREAPPLEX_WORD L"\x3059\x304f\x3046\x304d" + IDS_USERLEXBEFOREAPPLEX_USERPROP L"\x30b9\x30ce\x30fc\x30af" + IDS_USERLEXBEFOREAPPLEX_APPPROP L"\x30c6\x30ec\x30d3" + IDS_WAV_APPLEX "lexicon_j.wav" + IDS_WAV_USERLEXBEFOREAPPLEX "lexicon_j.wav" + IDS_INVALIDATENONTOPLEVEL_NEWWORD1 L"\x30d4\x30a2\x30ce" + IDS_RESOURCE_LOCATION3 "..\\..\\resources\\" + IDS_RECO_EXPRULE_FIRSTRULE "firstrule" + IDS_RECO_EXPRULE_SECONDRULE "secondrule" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_ALTERMATESCFG "tag_rule_j.wav" + IDS_ALTERNATESCFG_BESTWORD L"\x4e03" + IDS_ALTERNATESCFG_ALTERNATE1 L"\x751f" + IDS_ALTERNATESCFG_ALTERNATE2 L"\x5948\x826f" + IDS_ALTERNATESCFG_WORDS L"\x3092\x52d5\x304b\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_ALTERNATESCFG_RULE "play" + IDS_ERR_INTERFERENCE_NOEVENT "failed to receive the interference event" + IDS_WAV_INTERFERENCE "tag_l_j.wav" + IDS_WAV_GETITNRESULT "tag_rule_j.wav" + IDS_RECO_GETITNRESULT L"7\x3092\x52d5\x304b\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_CUSTOMPROP_NEWWORD_PRON L"\x30b9\x30ce\x30fc\x30af" + IDS_CUSTOMPROP_RULE "play" + IDS_WAV_CUSTOMPROP "lexicon_j.wav" + IDS_CUSTOMPROP_NEWWORD_DISP L"\x6f14\x594f" + IDS_CUSTOMPROP_NEWWORD_LEX L"\x3048\x3093\x305d\x3046" + IDS_DICTATIONTAG_WORDS L"\x30aa\x30fc\x30dc\x30a8\x3092\x6f14\x594f" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CASESENSITIVEGRAMMAR_RULENAME " " + IDS_CASESENSITIVEGRAMMAR_LEX1 " " + IDS_CASESENSITIVEGRAMMAR_PRON1 " " + IDS_CASESENSITIVEGRAMMAR_LEX2 " " + IDS_CASESENSITIVEGRAMMAR_PRON2 " " + IDS_CASESENSITIVEGRAMMAR_WAVE " " + IDS_CASESENSITIVEGRAMMAR_DISP1 " " + IDS_CASESENSITIVEGRAMMAR_DISP2 " " + IDS_CASESENSITIVELEXICON_WORD1 " " + IDS_CASESENSITIVELEXICON_SYMBOL1 " " + IDS_CASESENSITIVELEXICON_WORD2 " " + IDS_CASESENSITIVELEXICON_SYMBOL2 " " + IDS_CASESENSITIVELEXICON_WAVE " " + IDS_CASESENSITIVELEXICON_RULENAME " " + IDS_CFGTEXTBUFFER_NOTINTERESTEDWORDS L"\x304a\x9858\x3044\x3057\x307e\x3059" +END + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_RULE_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_rule.cfg" +IDR_L_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_l.cfg" +IDR_O_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_o.cfg" +IDR_P1_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_p1.cfg" +IDR_P2_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_p2.cfg" +IDR_EXPRULE_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_exprule.cfg" +IDR_SNORK_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\snork.cfg" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft\0" + VALUE "FileDescription", "SRCOMP\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SRCOMP\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "SRCOMP.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft SRCOMP\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_RECO_SYNCH_BEFORE_LOAD "skooky" + IDS_RECO_SYNCH_AFTER_DICT "skooky" + IDS_RECO_SYNCH_AFTER_GRAM "skooky" + IDS_RECO_L_TAG "put" + IDS_RECO_P_TAG "white" + IDS_RECO_O_TAG_1 "please" + IDS_RECO_O_TAG_2 "walk" + IDS_RECO_O_TAG_3 "slowly" + IDS_RECO_RULE_TAG "seven" + IDS_RESOURCE_LOCATION1 "..\\resources\\" + IDS_RESOURCE_LOCATION2 "..\\..\\..\\resources\\" + IDS_UNEXPECTED_ERR "recieved an unexpected error" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_UNEXPECTED_EVENT "recieved an unexpected event" + IDS_ERR_AUDIOFORMAT_TOMANY "Too many audio formats" + IDS_ERR_AUDIOFORMAT_UNSUPPORTED "unsupported audio format returned" + IDS_ERR_AUDIOFORMAT_NOTENOUGH "no formats returned" + IDS_ERR_SOUNDSTART_NOEVENT "failed to recieve sound_start event" + IDS_ERR_STREAMEND_NOEVENT "failed to recieve stream_end event" + IDS_ERR_SOUNDEND_NOEVENT "failed to recieve sound_end event" + IDS_ERR_SOUNDSTART_BADPOSITION1 "sound_start postion after sound_end" + IDS_ERR_SOUNDSTART_BADPOSITION2 "sound_start not in last third of audio" + IDS_ERR_SOUNDEND_BADPOSITION1 "sound_end postion after stream_end" + IDS_ERR_SOUNDEND_BADPOSITION2 "sound_end not in first third of audio" + IDS_ERR_SOUNDSTARTEND_NOEVENT + "failed to recieve both sound_start and sound_end events" + IDS_ERR_SOUNDSTARTEND_WRONGORDER + "sound_start and sound_end events recieved in wrong order" + IDS_ERR_PHRASESTART_NOEVENT "failed to recieve phrase_start event" + IDS_ERR_RECOGNITION_NOEVENT "failed to recieve recognition event" + IDS_ERR_RECOGNITION_EVENTONSILENCE + "received a Recognition event for silence" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERR_RECOGNITION_WRONGORDER + "recoginition event recieved in wrong order" + IDS_ERR_HYPOTHESIS_NOEVENT "failed to recieve hypothesis event" + IDS_ERR_HYPOTHESIS_WRONGORDER "hypothesis event recieved in wrong order" + IDS_ERR_RESULT_WRONGWORD "failed to recieve expected result" + IDS_ERR_LEX_REMOVEUSER "failed to remove user" + IDS_ERR_LEX_EXPECTNOWORD "should not get word from empty user lexicon" + IDS_RECO_NEWWORD_PRON "s n ao 1 r k" + IDS_ERR_FALSERECOGNITION_NOEVENT + "failed to recieve false recognition event" + IDS_AUTOPAUSE_DYNAMICWORD1 "put" + IDS_AUTOPAUSE_DYNAMICWORD2 "red" + IDS_AUTOPAUSE_DYNAMICRULE1 "action" + IDS_AUTOPAUSE_DYNAMICRULE2 "color" + IDS_WAV_AUTOPAUSE "autopause.wav" + IDS_INVALIDATETOPLEVEL_DYNAMICWORDS "play the oboe" + IDS_INVALIDATETOPLEVEL_DYNAMICRULE "play" + IDS_WAV_INVALIDATETOPLEVEL_OLD "tag_exprule.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_SOUNDSTART "tag_l.wav" + IDS_WAV_SOUNDEND "tag_l.wav" + IDS_WAV_SOUNDSTARTEND "tag_l.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_PHRASESTART "tag_l.wav" + IDS_WAV_RECOGNITION_1 "tag_l.wav" + IDS_WAV_HYPOTHESIS "tag_exprule.wav" + IDS_WAV_SYNCH_BEFORE_LOAD "lexicon.wav" + IDS_WAV_SYNCH_AFTER_DICT "lexicon.wav" + IDS_WAV_SYNCH_AFTER_GRAM "lexicon.wav" + IDS_WAV_L_TAG "tag_l.wav" + IDS_WAV_MULT_RECO "multireco.wav" + IDS_WAV_EXPRULE_TAG "tag_exprule.wav" + IDS_WAV_P_TAG "tag_p.wav" + IDS_WAV_O_TAG_1 "tag_o1.wav" + IDS_WAV_O_TAG_2 "tag_o2.wav" + IDS_WAV_O_TAG_3 "tag_o3.wav" + IDS_WAV_RULE_TAG "tag_rule.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INVALIDATETOPLEVEL_DYNAMICNEWWORDS "please play the seven" + IDS_ERR_INVALIDATETOPLEVEL + "Engine failed to invalidate the toplevel rule." + IDS_WAV_INVALIDATETOPLEVEL_NEW "tag_rule.wav" + IDS_INVALIDATENONTOPLEVEL_RULE1 "option" + IDS_INVALIDATENONTOPLEVEL_RULE2 "thing" + IDS_INVALIDATENONTOPLEVEL_TOPLEVELRULE "play" + IDS_INVALIDATENONTOPLEVEL_OLDWORD1 " " + IDS_INVALIDATENONTOPLEVEL_OLDWORD2 "oboe" + IDS_INVALIDATENONTOPLEVEL_NEWWORD2 "seven" + IDS_INVALIDATENONTOPLEVEL_TOPLEVELWORDS "play the " + IDS_WAV_INVALIDATENONTOPLEVEL_OLD "tag_exprule.wav" + IDS_WAV_INVALIDATENONTOPLEVEL_NEW "tag_rule.wav" + IDS_WAV_CFGTEXTBUFFER "tag_exprule.wav" + IDS_CFGTEXTBUFFER_WORDS "play the " + IDS_CFGTEXTBUFFER_BUFFERWORD "oboe" + IDS_CFGTEXTBUFFER_RULE "play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_ALTERMATESCFG "tag_exprule.wav" + IDS_ALTERNATESCFG_BESTWORD "play" + IDS_ALTERNATESCFG_ALTERNATE1 "played" + IDS_ALTERNATESCFG_ALTERNATE2 "pay" + IDS_ALTERNATESCFG_WORDS "the oboe" + IDS_ALTERNATESCFG_RULE "play" + IDS_ERR_INTERFERENCE_NOEVENT "failed to receive the interference event" + IDS_WAV_INTERFERENCE "tag_l.wav" + IDS_WAV_GETITNRESULT "tag_rule.wav" + IDS_RECO_GETITNRESULT "please play the 7" + IDS_CUSTOMPROP_NEWWORD_PRON "s n ao 1 r k" + IDS_CUSTOMPROP_RULE "play" + IDS_WAV_CUSTOMPROP "lexicon.wav" + IDS_CUSTOMPROP_NEWWORD_DISP "abc" + IDS_CUSTOMPROP_NEWWORD_LEX "play" + IDS_DICTATIONTAG_WORDS "play the" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DICTATIONTAG_RULE "play" + IDS_WAV_DICTATIONTAG "tag_exprule.wav" + IDS_WILDCARD_WORDS "please play" + IDS_WILDCARD_RULE "play" + IDS_WAV_WILDCARD "tag_rule.wav" + IDS_APPLEX_WORD "skooky" + IDS_APPLEX_PROP "s n ao 1 r k" + IDS_USERLEXBEFOREAPPLEX_WORD "skooky" + IDS_USERLEXBEFOREAPPLEX_USERPROP "s n ao 1 r k" + IDS_USERLEXBEFOREAPPLEX_APPPROP "p l ey" + IDS_WAV_APPLEX "lexicon.wav" + IDS_WAV_USERLEXBEFOREAPPLEX "lexicon.wav" + IDS_INVALIDATENONTOPLEVEL_NEWWORD1 "please " + IDS_RESOURCE_LOCATION3 "..\\..\\resources\\" + IDS_RECO_EXPRULE_FIRSTRULE "firstrule" + IDS_RECO_EXPRULE_SECONDRULE "secondrule" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CASESENSITIVEGRAMMAR_RULENAME "rule" + IDS_CASESENSITIVEGRAMMAR_LEX1 "skooky" + IDS_CASESENSITIVEGRAMMAR_PRON1 "p uh t" + IDS_CASESENSITIVEGRAMMAR_LEX2 "SKOOKY" + IDS_CASESENSITIVEGRAMMAR_PRON2 "w ay t" + IDS_CASESENSITIVEGRAMMAR_WAVE "tag_p.wav" + IDS_CASESENSITIVEGRAMMAR_DISP1 "skooky" + IDS_CASESENSITIVEGRAMMAR_DISP2 "SKOOKY" + IDS_CASESENSITIVELEXICON_WORD1 "skooky" + IDS_CASESENSITIVELEXICON_SYMBOL1 "p uh t" + IDS_CASESENSITIVELEXICON_WORD2 "SKOOKY" + IDS_CASESENSITIVELEXICON_SYMBOL2 "w ay t" + IDS_CASESENSITIVELEXICON_WAVE "tag_p.wav" + IDS_CASESENSITIVELEXICON_RULENAME "rule" + IDS_CFGTEXTBUFFER_NOTINTERESTEDWORDS "please " +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.cpp b/mp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.cpp new file mode 100644 index 00000000..68c035f2 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.cpp @@ -0,0 +1,5470 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// srenginecompliance.cpp +// +// Test module for srenginecompliance +//****************************************************************************** +#include "SRTests1.h" +#include "resource.h" +#include "srenginecompliance.h" +#include "sphelper.h" +#include "sapiddk.h" +#include +#include +#include +#include + +//****************************************************************************** +//***** Globals +//****************************************************************************** +extern SPS_SHELL_INFO *g_pShellInfo; +extern CRITICAL_SECTION g_csProcess; + + +//****************************************************************************** +//***** Internal Functions and helper classes +//****************************************************************************** + +// called before dll is unloaded +void CleanupTest(void) +{ + // nothing to do at this time +}; + + + + + + + + + +// get string from resource +void GetWStrFromRes(UINT id, WCHAR* szwStr) +{ + EnterCriticalSection (&g_csProcess); + + HRSRC hResInfo = NULL; + HANDLE hStringSeg = NULL; + LPWSTR lpsz = NULL; + int cch = 0; + int cchBufferMax = MAX_PATH; + + // String Tables are broken up into 16 string segments. Find the segment + // containing the string we are interested in. + if (hResInfo = FindResourceEx(g_pShellInfo->hLib, (LPCTSTR)RT_STRING, + (LPCTSTR)((LONG)(((USHORT)id >> 4) + 1)), + ::GetDefaultEnginePrimaryLangId())) + { + // Load that segment. + hStringSeg = LoadResource(g_pShellInfo->hLib, hResInfo); + + // Lock the resource. + if (hStringSeg && (lpsz = (LPWSTR)LockResource(hStringSeg)) != NULL) + { + // Move past the other strings in this segment. + // (16 strings in a segment -> & 0x0F) + id &= 0x0F; + while (TRUE) + { + cch = *((WORD *)lpsz++); // PASCAL like string count + // first UTCHAR is count if TCHARs + if (id-- == 0) break; + lpsz += cch; // Step to start if next string + } + + // Account for the NULL + cchBufferMax--; + + // Don't copy more than the max allowed. + if (cch > cchBufferMax) + cch = cchBufferMax-1; + + // Copy the string into the buffer. + CopyMemory(szwStr, lpsz, cch*sizeof(WCHAR)); + + // Attach Null terminator. + szwStr[cch] = 0; + } + } + + LeaveCriticalSection (&g_csProcess); + +} + +inline WCHAR* GetDefaultPronunciation(const WCHAR* szSymbol = NULL, LANGID LangID = ::GetDefaultEnginePrimaryLangId()) +{ + + + HRESULT hr = S_OK; + + WCHAR szPronSymbol[MAX_PATH] = L""; + CComPtr cpPhoneConverter; + static SPPHONEID pphoneId[MAX_PATH] = L""; + + if (szSymbol) + { + wcscpy(szPronSymbol, szSymbol); + } + else + { + GetWStrFromRes(IDS_RECO_NEWWORD_PRON, szPronSymbol); + } + + + hr = SpCreatePhoneConverter(LangID, NULL, NULL, &cpPhoneConverter); + + if (SUCCEEDED(hr)) + { + hr = cpPhoneConverter->PhoneToId(CSpDynamicString(szPronSymbol), pphoneId); + } + + + return pphoneId; + +} + + + +HRESULT GetFullPath(WCHAR* wszFileName, WCHAR* wszPathName) +{ + WCHAR wszLocation[MAX_PATH] = L""; + + if (wszFileName && _waccess(wszFileName, 0) == 0) // file exists + { + wcscpy(wszPathName, wszFileName); + return S_OK; + } + else + { + GetWStrFromRes(IDS_RESOURCE_LOCATION1, wszLocation); + wcscat(wszLocation, wszFileName); + if (wszLocation && _waccess(wszLocation, 0) == 0) + { + wcscpy(wszPathName, wszLocation); + return S_OK; + } + else + { + GetWStrFromRes(IDS_RESOURCE_LOCATION2, wszLocation); + wcscat(wszLocation, wszFileName); + if (wszLocation && _waccess(wszLocation, 0) == 0) + { + wcscpy(wszPathName, wszLocation); + return S_OK; + } + } + } + + return E_FAIL; + +} + +// open wav file +HRESULT OpenWavFile(UINT uID, ISpStream ** ppStream, ULONGLONG ullEventInterest = SPFEI_ALL_EVENTS) +{ + EnterCriticalSection (&g_csProcess); + + HRESULT hr = S_OK; + WCHAR wszLocation[MAX_PATH] = L""; + WCHAR wszWavFile[MAX_PATH] = L""; + + GetWStrFromRes(uID, wszWavFile); + + // check location of process + + //check the customized location first + if (_tcslen(ptszCustomizedDirectory)) + { + wcscpy(wszLocation, CSpDynamicString(ptszCustomizedDirectory)); + wcscat(wszLocation, wszWavFile); + hr = SPBindToFile(wszLocation, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + else + { + hr = SPERR_NOT_FOUND; + } + + if (FAILED(hr)) + { + hr = SPBindToFile(wszWavFile, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + + // check other resource locations + if (FAILED(hr)) + { + GetWStrFromRes(IDS_RESOURCE_LOCATION1, wszLocation); + wcscat(wszLocation, wszWavFile); + hr = SPBindToFile(wszLocation, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + + // check second location + if (FAILED(hr)) + { + GetWStrFromRes(IDS_RESOURCE_LOCATION2, wszLocation); + wcscat(wszLocation, wszWavFile); + hr = SPBindToFile(wszLocation, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + + // check third location + if (FAILED(hr)) + { + GetWStrFromRes(IDS_RESOURCE_LOCATION3, wszLocation); + wcscat(wszLocation, wszWavFile); + hr = SPBindToFile(wszLocation, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + + if (FAILED(hr)) + { + TCHAR tszFileName[MAX_PATH] = _T(""); + TCHAR tszFilterName[MAX_PATH] = _T(""); + TCHAR* tszTem = NULL; + OPENFILENAME ofn; + CSpTString SpTString(wszWavFile); + ZeroMemory(&ofn, sizeof(ofn)); + + + ofn.lStructSize = sizeof(OPENFILENAME); + ofn. hwndOwner = g_pShellInfo->hWnd; + ofn.hInstance = g_pShellInfo->hInstance; + + //construct the filter, like "Compliance Wave Input (tag_l.wav)\0tag_l.wav\0\0" + _tcscpy(tszFilterName, _T("Compliance Wave Input (")); + _tcscat(tszFilterName, SpTString); + _tcscat(tszFilterName, _T(")")); + tszTem = _tcscpy(tszFilterName + _tcslen(tszFilterName) + 1, SpTString); + _tcscpy(tszTem + _tcslen(tszTem) + 1, _T("")); + + ofn.lpstrFilter = tszFilterName; + + _tcscpy(tszFileName, SpTString); + ofn.lpstrFile = tszFileName; + ofn.nMaxFile = MAX_PATH; + + if (_tcslen(ptszCustomizedDirectory)) + ofn.lpstrInitialDir = ptszCustomizedDirectory; + else + ofn.lpstrInitialDir = NULL; + + ofn.lpstrTitle = _T("Please choose the resource directory"); + ofn.Flags = OFN_FILEMUSTEXIST | OFN_READONLY; + + BOOL fSuccess = GetOpenFileName(&ofn); + if (fSuccess) + { + _tcscpy(ptszCustomizedDirectory, ofn.lpstrFile); + hr = SPBindToFile(CSpDynamicString(ptszCustomizedDirectory), SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + + TCHAR* tszTem = _tcsrchr(ptszCustomizedDirectory, _T('\\')); + *(tszTem+1) = NULL; + } + else + { + //the user cancels the dialog box + } + } + + LeaveCriticalSection (&g_csProcess); + + return hr; +}; + +void Comment(UINT uID) +{ + USES_CONVERSION; + EnterCriticalSection (&g_csProcess); + + // for string from resource and comment + static WCHAR wszMessage[MAX_PATH] = L""; + + GetWStrFromRes(uID, wszMessage); + + g_pKato->Comment(5, W2A(wszMessage)); + + LeaveCriticalSection (&g_csProcess); + +}; + +void Comment(WCHAR* wszMessage) +{ + USES_CONVERSION; + EnterCriticalSection (&g_csProcess); + + // for string from resource and comment + + if (wszMessage) + g_pKato->Comment(5, W2A(wszMessage)); + + LeaveCriticalSection (&g_csProcess); + +}; + +BOOL IsMatchingAttribute(WCHAR* pwszAttribute, WCHAR* pwszValue = NULL) +{ + CComPtr cpResMgr; + CComPtr cpObjectToken; + BOOL IsMatching = FALSE; + + HRESULT hr = S_OK; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOGNIZERS, &cpObjectToken, FALSE); + if (hr == S_OK) + { + CComPtr cpAttributeKey; + hr = cpObjectToken->OpenKey(L"Attributes", &cpAttributeKey); + if (hr == S_OK) + { + CSpDynamicString dsValue; + hr = cpAttributeKey->GetStringValue(pwszAttribute, &dsValue); + if (hr == S_OK) + { + if (pwszValue) + { + const WCHAR pwszTem[] = L" ;"; + const WCHAR* pwszTemToken = wcstok(dsValue, pwszTem); + while (pwszTemToken && (!IsMatching)) + { + if (!wcscmp(pwszTemToken, pwszValue)) + { + IsMatching = TRUE; + } + else + { + pwszTemToken = wcstok(NULL, pwszTem); + } + } + } + else + //If pwszValue == NULL, it means we don't care about the value. We are just interested in the attribute. + { + IsMatching = TRUE; + } + } + } + } + + return IsMatching; + +} + +LANGID GetDefaultEnginePrimaryLangId() +{ + LANGID LangId = 0; + CComPtr cpRecognizer; + HRESULT hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + if (SUCCEEDED(hr)) + { + SPRECOGNIZERSTATUS SpRecognizerStatus; + ZeroMemory(&SpRecognizerStatus, sizeof(SpRecognizerStatus)); + hr = cpRecognizer->GetStatus(&SpRecognizerStatus); + if (SUCCEEDED(hr) && SpRecognizerStatus.cLangIDs) + { + LangId = SpRecognizerStatus.aLangID[0]; + } + } + return LangId; +} + +SPWORDPRONUNCIATIONLIST spPronList; +SPWORDPRONUNCIATION* psppron = NULL; + +// internal helper function for the Lexicon test cases +HRESULT HlpAddCustomWord(CComPtr &cpLexicon, WCHAR *wszCustomWord, WCHAR *wszPron = NULL) +{ + HRESULT hr; + WCHAR szPronunciation[MAX_PATH] = L""; + LANGID LangID = ::GetDefaultEnginePrimaryLangId(); + + // first, delete the word if it exists + ZeroMemory(&spPronList, sizeof(spPronList)); + hr = cpLexicon->GetPronunciations(wszCustomWord, LangID, eLEXTYPE_USER, &spPronList); + + if (hr == SPERR_NOT_IN_LEX || hr == SP_WORD_EXISTS_WITHOUT_PRONUNCIATION) + { + hr = S_OK; + } + else if (SUCCEEDED(hr)) + { + //Comment(IDS_ERR_LEX_EXPECTNOWORD); + hr = cpLexicon->RemovePronunciation(wszCustomWord, LangID, SPPS_Unknown, NULL); + } + + + // next, get pronunciation from resource string and make it official + wcscpy(szPronunciation, GetDefaultPronunciation(wszPron)); + + if ( wcslen(szPronunciation) ) + { + hr = cpLexicon->AddPronunciation(wszCustomWord, LangID, SPPS_Noun, szPronunciation); + } + + + + return hr; +} + +// internal helper function for the Lexicon test cases +HRESULT HlpRemoveCustomWord(CComPtr &cpLexicon, WCHAR *wszCustomWord) +{ + HRESULT hr; + WCHAR szPronunciation[MAX_PATH] = L""; + LANGID LangID = ::GetDefaultEnginePrimaryLangId(); + + // first, delete the word if it exists + hr = cpLexicon->RemovePronunciation(wszCustomWord, LangID, SPPS_Unknown, NULL); + + + //Comment(IDS_ERR_LEX_EXPECTNOWORD); + for(psppron = spPronList.pFirstWordPronunciation; psppron && SUCCEEDED(hr) && (hr != SP_ALREADY_IN_LEX); psppron = psppron->pNextWordPronunciation) + { + hr = cpLexicon->RemovePronunciation(wszCustomWord, psppron->LangID, psppron->ePartOfSpeech, psppron->szPronunciation); + } + + if (spPronList.pvBuffer) ::CoTaskMemFree(spPronList.pvBuffer); + + return hr; +} + + + +HRESULT HlpCheckResult(RESULTVECTOR& vector_RecoResult, WCHAR* pszText) +{ + HRESULT hr = E_FAIL; + int count = vector_RecoResult.size(); + bool bFound = false; + + for (int i=0; iGetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &wpszTem, NULL); + if (SUCCEEDED(hr) && wcsstr(wpszTem, pszText)) + { + bFound = true; + break; + } + } + + (bFound) ? hr = S_OK : hr = S_FALSE; + + + return hr; +} + +// HlpGetRecoResult() - called by several of the test functions that follow; +// it activates a given grammar and waits for the recognition results to +// come in and generate the recoreusult vector. +HRESULT HlpGetRecoResult( + CComPtr & cpRecoCtxt, + RESULTVECTOR& vector_RecoResult + ) +{ + USES_CONVERSION; + HRESULT hr = S_OK; + + // Clear out the list of results from any previous test + vector_RecoResult.clear(); + + bool bDone = false; + // get and check result + while (!bDone && (cpRecoCtxt->WaitForNotifyEvent(TESTEVENT_TIMEOUT)) == S_OK) + { + CSpEvent event; + + while (event.GetFrom(cpRecoCtxt) == S_OK) + { + + if (event.eEventId == SPEI_END_SR_STREAM) + bDone = true; + else if (event.eEventId == SPEI_RECOGNITION) + { + vector_RecoResult.push_back(event.RecoResult()); + } // else if (event.eEventId == SPEI_RECO) + } // while + + } + + if ( !vector_RecoResult.size()) + hr = E_FAIL; + + return hr; +} + + + + +/* +CEventList is a class used to record the events generated by a speech +recognition pass over a wave file. It uses the CEventRecord class for +its nodes; it records the event type, the stream offset, and the rule +name in case of recognition events. + +These two classes are used by the HlpGatherEvents function. +*/ +class CEventRecord +{ +public: + SPEVENTENUM m_eEventId; + ULONGLONG m_ullOffset; + CSpDynamicString m_dstrRuleName; + CSpDynamicString m_dstrRecoResult; + CEventRecord * m_pNext; + + CEventRecord() { m_pNext = NULL; } + ~CEventRecord() { m_dstrRuleName.Clear(); } + CEventRecord(CSpEvent &e) + { + m_eEventId = e.eEventId; + m_ullOffset = e.ullAudioStreamOffset; + if (m_eEventId == SPEI_RECOGNITION) + { + SPPHRASE *pPhrase = NULL; + e.RecoResult()->GetPhrase(&pPhrase); + m_dstrRuleName = pPhrase->Rule.pszName; + if (pPhrase) CoTaskMemFree(pPhrase); + e.RecoResult()->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &m_dstrRecoResult, NULL); + } + m_pNext = NULL; + } +}; + +class CEventList +{ +public: + CEventRecord *m_pHead; + CEventList() { m_pHead = NULL; } + void Append(CSpEvent &e) + { + CEventRecord **p = &m_pHead; + while (*p) + p = &((*p)->m_pNext); + *p = new CEventRecord(e); + } + void Release() + { + CEventRecord *q, *p = m_pHead; + while (q = p) + { + p = q->m_pNext; + delete(q); + } + m_pHead = NULL; + } + ~CEventList() { Release(); } +}; + +const char *HlpEventToString(SPEVENTENUM eId) +{ + switch (eId) + { + case SPEI_UNDEFINED : return "?"; + case SPEI_END_SR_STREAM : return "EndStrm"; + case SPEI_SOUND_START : return "SndSt"; + case SPEI_SOUND_END : return "SndEnd"; + case SPEI_PHRASE_START : return "PhrSt"; + case SPEI_RECOGNITION : return "Reco"; + case SPEI_HYPOTHESIS : return "Hyp"; + case SPEI_FALSE_RECOGNITION : return "FReco"; + case SPEI_INTERFERENCE : return "Intf"; + default : return "Misc"; + } +} + +HRESULT HlpGatherEvents(ULONGLONG Events, ULONGLONG QueuedEvents, + UINT uWaveFileId, CEventList &EventList, UINT idGrammar = 0) +{ + HRESULT hr = S_OK; + + // speech + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + Events | SPFEI(SPEI_END_SR_STREAM), + QueuedEvents | SPFEI(SPEI_END_SR_STREAM)); + + + // open wav file for sound start test + if (SUCCEEDED(hr)) + hr = OpenWavFile(uWaveFileId, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return E_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load and activate the default grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if (!idGrammar) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadDictation(/* topic name */ NULL, SPLO_STATIC); + + if (SUCCEEDED(hr)) + hr = cpGrammar->SetDictationState(SPRS_ACTIVE); + } + else + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(idGrammar), + L"SRGRAMMAR", GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + + + + + bool bDone = false; + DWORD dwWait = 0; + + while ( !bDone && (hr = cpRecoCtxt->WaitForNotifyEvent(WAIT_TIME)) == S_OK ) + { + CSpEvent event; + int numEvents = 0; + + while (event.GetFrom(cpRecoCtxt) == S_OK) + { + numEvents++; + if (event.eEventId == SPEI_END_SR_STREAM) + bDone = true; + EventList.Append(event); + } // while GetEvents + } + + + return hr; +} + + +TESTPROCAPI t_CheckEvent_SoundStart(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_SOUND_START), SPFEI(SPEI_SOUND_START), + IDS_WAV_SOUNDSTART, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *peSoundStart = NULL; + CEventRecord *peStreamEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_SOUND_START: + if (!peSoundStart) + peSoundStart = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + case SPEI_RECOGNITION: + //recognition is set as a default event by SAPI + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peSoundStart) + { + Comment(IDS_ERR_SOUNDSTART_NOEVENT); + tpr = TPR_FAIL; + } + + if (!peStreamEnd) + { + Comment(IDS_ERR_STREAMEND_NOEVENT); + tpr = TPR_FAIL; + } + + // check ullAudioStreamOffset for position + if (peSoundStart && peStreamEnd) + { + // check that sound start comes before stream end + if (peSoundStart->m_ullOffset > peStreamEnd->m_ullOffset) + { + Comment(IDS_ERR_SOUNDSTART_BADPOSITION1); + tpr = TPR_FAIL; + } + } + } + else + // cleanup + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + +TESTPROCAPI t_CheckEvent_Interference(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CEventList eventList; + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_INTERFERENCE), SPFEI(SPEI_INTERFERENCE), + IDS_WAV_INTERFERENCE, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *peInterference = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_INTERFERENCE: + if (!peInterference) + peInterference = p; + break; + case SPEI_END_SR_STREAM: + case SPEI_RECOGNITION: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_UNSUPPORTED; + } + } + + if (!peInterference) + { + Comment(IDS_ERR_INTERFERENCE_NOEVENT); + tpr = TPR_UNSUPPORTED; + } + + } + else + // cleanup + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_UNSUPPORTED; + } + + return tpr; +} + +TESTPROCAPI t_GetITNResult(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CEventList eventList; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + RESULTVECTOR vector_RecoResult; + WCHAR pwszText[MAX_PATH] = L""; + + + + GetWStrFromRes(IDS_RECO_GETITNRESULT, pwszText); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_GETITNRESULT, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_RULE_GRAMMAR), + L"SRGRAMMAR", GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (vector_RecoResult.size()) + { + CSpDynamicString dsText; + hr = vector_RecoResult[0]->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dsText, NULL); + if (SUCCEEDED(hr) &&!wcscmp(dsText, pwszText)) + { + } + else + { + tpr = TPR_UNSUPPORTED; + } + } + else + { + tpr = TPR_UNSUPPORTED; + } + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_SoundEnd(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_SOUND_END), SPFEI(SPEI_SOUND_END), + IDS_WAV_SOUNDEND, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *peSoundEnd = NULL; + CEventRecord *peStreamEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_SOUND_END: + peSoundEnd = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peSoundEnd) + { + Comment(IDS_ERR_SOUNDEND_NOEVENT); + tpr = TPR_FAIL; + } + + if (!peStreamEnd) + { + Comment(IDS_ERR_STREAMEND_NOEVENT); + tpr = TPR_FAIL; + } + + // check ullAudioStreamOffset for position + if (peSoundEnd && peStreamEnd) + { + // check that sound start comes before stream end + if (peSoundEnd->m_ullOffset > peStreamEnd->m_ullOffset) + { + Comment(IDS_ERR_SOUNDEND_BADPOSITION1); + tpr = TPR_FAIL; + } + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_SoundStartEnd(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END), + SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END), + IDS_WAV_SOUNDSTARTEND, eventList, IDR_L_GRAMMAR); + + //stream positions + BOOL fInSound = FALSE; + CEventRecord *peSoundStart = NULL; + CEventRecord *peSoundEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_SOUND_START: + { + if (!fInSound) + { + peSoundStart = p; + fInSound = TRUE; + } + else + { + tpr = TPR_FAIL; + peSoundStart = NULL; + } + } + break; + case SPEI_SOUND_END: + { + if (fInSound) + { + fInSound = FALSE; + peSoundEnd = p; + } + else + { + tpr = TPR_FAIL; + peSoundEnd = NULL; + } + } + break; + case SPEI_END_SR_STREAM: + case SPEI_RECOGNITION: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + //We need to make sure that sound start and sound end are pairs of events + if (!(peSoundStart && peSoundEnd && (!fInSound))) + { + Comment(IDS_ERR_SOUNDSTARTEND_WRONGORDER); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_PhraseStart(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_PHRASE_START), SPFEI(SPEI_PHRASE_START), + IDS_WAV_PHRASESTART, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *pePhraseStart = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_PHRASE_START: + pePhraseStart = p; + break; + case SPEI_END_SR_STREAM: + case SPEI_RECOGNITION: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!pePhraseStart) + { + Comment(IDS_ERR_PHRASESTART_NOEVENT); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_Recognition(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION), + IDS_WAV_RECOGNITION_1, eventList, IDR_L_GRAMMAR); + + CEventRecord *peRecognition = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_RECOGNITION: + peRecognition = p; + break; + case SPEI_END_SR_STREAM: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peRecognition) + { + Comment(IDS_ERR_RECOGNITION_NOEVENT); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + // repeat with wav file with silence and insure that no recognition occurs. + eventList.Release(); + + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_PhraseStartRecognitionOrder(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_FALSE_RECOGNITION), + IDS_WAV_RECOGNITION_1, eventList, IDR_L_GRAMMAR); + + //stream positions + BOOL fInPhrase = FALSE; + CEventRecord *pePhraseStart = NULL; + CEventRecord *peRecognition = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_PHRASE_START: + { + if (!fInPhrase) + { + pePhraseStart = p; + fInPhrase = TRUE; + } + else + { + tpr = TPR_FAIL; + pePhraseStart = NULL; + } + } + break; + case SPEI_RECOGNITION: + case SPEI_FALSE_RECOGNITION: + { + if (fInPhrase) + { + fInPhrase = FALSE; + peRecognition = p; + } + else + { + tpr = TPR_FAIL; + peRecognition = NULL; + } + } + break; + case SPEI_END_SR_STREAM: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!(pePhraseStart && peRecognition && (!fInPhrase))) + { + Comment(L"incorrect phrasestart and recognition/false recognition event order"); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + // repeat with wav file with silence and insure that no recognition occurs. + eventList.Release(); + + + return tpr; +} + + + +TESTPROCAPI t_CheckEvent_FalseRecognition(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_FALSE_RECOGNITION), SPFEI(SPEI_FALSE_RECOGNITION), + IDS_WAV_RECOGNITION_1, eventList, IDR_RULE_GRAMMAR); + + //stream positions + CEventRecord *peFalseRecognition = NULL; + CEventRecord *peStreamEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_RECOGNITION: + Comment(L"Recognition event shouldn't be recieved"); + tpr = TPR_FAIL; + break; + case SPEI_FALSE_RECOGNITION: + peFalseRecognition = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peFalseRecognition) + { + Comment(IDS_ERR_FALSERECOGNITION_NOEVENT); + tpr = TPR_FAIL; + } + + if (!peStreamEnd) + { + Comment(IDS_ERR_STREAMEND_NOEVENT); + tpr = TPR_FAIL; + } + } + + // repeat with wav file with silence and insure that no recognition occurs. + eventList.Release(); + + + + + return tpr; +} + + + +TESTPROCAPI t_CheckEvent_EventsSequences(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | SPFEI(SPEI_PHRASE_START), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | SPFEI(SPEI_PHRASE_START), + IDS_WAV_RECOGNITION_1, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *peSoundStart = NULL; + CEventRecord *pePhraseStart = NULL; + CEventRecord *peRecognition = NULL; + CEventRecord *peSoundEnd = NULL; + CEventRecord *peStreamEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_SOUND_START: + peSoundStart = p; + break; + case SPEI_PHRASE_START: + pePhraseStart = p; + break; + case SPEI_RECOGNITION: + peRecognition = p; + break; + case SPEI_SOUND_END: + peSoundEnd = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (peSoundStart && pePhraseStart && peRecognition && peSoundEnd && peStreamEnd) + { + if (peSoundStart->m_ullOffset <= pePhraseStart->m_ullOffset && + pePhraseStart->m_ullOffset <= peRecognition->m_ullOffset && + peRecognition->m_ullOffset <= peSoundEnd->m_ullOffset && + peSoundEnd->m_ullOffset <= peStreamEnd->m_ullOffset) + { + } + else + { + Comment(L"incorrect event sequence"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"failed to receive some events."); + tpr = TPR_FAIL; + } + + } + else + // cleanup + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + + + + +TESTPROCAPI t_SpPhraseElements(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + // speech + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + CComPtr cpRecoResult; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION)); + + + // open wav file for sound start test + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_RULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load and activate the default grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(0, &cpGrammar); + + if (SUCCEEDED(hr)) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_RULE_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + } + + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + + + + + + bool bDone = false; + DWORD dwWait = 0; + + while ((hr = cpRecoCtxt->WaitForNotifyEvent(WAIT_TIME)) == S_OK) + { + CSpEvent event; + int numEvents = 0; + + while (event.GetFrom(cpRecoCtxt) == S_OK) + { + numEvents++; + if (event.eEventId == SPEI_RECOGNITION) + { + bDone = true; + break; + } + } // while GetEvents + + if (bDone) + { + cpRecoResult = event.RecoResult(); + if (cpRecoResult) + { + SPPHRASE* pPhrase; + hr = cpRecoResult->GetPhrase(&pPhrase); + if (SUCCEEDED(hr)) + { + for (ULONG i=0; iRule.ulCountOfElements-1; i++) + { + if (pPhrase->pElements[i].ulAudioStreamOffset >= pPhrase->pElements[i+1].ulAudioStreamOffset) + { + tpr = TPR_FAIL; + break; + } + } + } + } + break; + } + } + + + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_Hypothesis(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + if (!IsMatchingAttribute(L"Hypotheses")) + { + return TPR_UNSUPPORTED; + } + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_HYPOTHESIS), SPFEI(SPEI_HYPOTHESIS), + IDS_WAV_HYPOTHESIS, eventList, IDR_EXPRULE_GRAMMAR); + + //stream positions + CEventRecord *peHypothesis = NULL; + CEventRecord *peStreamEnd = NULL; + + if (SUCCEEDED(hr)) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_HYPOTHESIS: + peHypothesis = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_UNSUPPORTED; + } + } + + if (!peHypothesis) + { + Comment(IDS_ERR_HYPOTHESIS_NOEVENT); + tpr = TPR_UNSUPPORTED; + } + + if (!peStreamEnd) + { + Comment(IDS_ERR_STREAMEND_NOEVENT); + tpr = TPR_UNSUPPORTED; + } + } + + // cleanup + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_UNSUPPORTED; + } + + + return tpr; +} + + + +class CAppLexicon { +private: + SPWORDPRONUNCIATIONLIST spPronList; + HRESULT hr; + CComPtr cpConlexicon; + CSpDynamicString dsWord; + +public: + CAppLexicon (WCHAR* wszWord, WCHAR* wszAppSymbol, WCHAR* wszUserSymbol, HRESULT* phr) + { + CComPtr cpLexiconApp; + hr = S_OK; + dsWord = CSpDynamicString(wszWord); + LANGID LangID = ::GetDefaultEnginePrimaryLangId(); + + RemoveTestAppLexicon(L"SRCompliance;AppLexTest"); + + if (SUCCEEDED(hr)) + { + //Create a test app lexicon + hr = CreateAppLexicon( + L"App lex test", + LangID, + L"App Lex test", + L"SRCompliance;AppLexTest", + &cpLexiconApp); + } + + if (SUCCEEDED(hr)) + { + // add a new word pronunciation to the new created app lexicon + hr = cpLexiconApp->AddPronunciation(dsWord, LangID, SPPS_Noun, GetDefaultPronunciation(wszAppSymbol)); + } + + cpLexiconApp.Release(); + + + //the following is to erase the pronunciations of the new word in User's lexicon + memset(&spPronList, 0, sizeof(spPronList) ); + + if (SUCCEEDED(hr)) + hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon); + + if (SUCCEEDED(hr)) + { + //get the pronounciation of the new word from the User's lexicon + hr = cpConlexicon->GetPronunciations(dsWord, LangID, eLEXTYPE_USER, &spPronList); + if (SUCCEEDED(hr)) + { + //remove all the pronunciations of the new word in User lexicon + hr = cpConlexicon->RemovePronunciation(dsWord, LangID, SPPS_Unknown, NULL); + } + else if (hr == SPERR_NOT_IN_LEX || hr == SP_WORD_EXISTS_WITHOUT_PRONUNCIATION) + { + hr = S_OK; + } + } + + if (SUCCEEDED(hr) && wszUserSymbol) + { + hr = cpConlexicon->AddPronunciation(dsWord, LangID, SPPS_Noun, GetDefaultPronunciation(wszUserSymbol)); + } + + + *phr = hr; + } + + ~CAppLexicon() + { + SPWORDPRONUNCIATION *psppron = NULL; + + if (cpConlexicon) + { + //remove the pronounciation. We don't care about the HRESULT. + hr = cpConlexicon->RemovePronunciation(dsWord, ::GetDefaultEnginePrimaryLangId(), SPPS_Unknown, NULL); + } + + //restore the pronounciation of the new word to User's lexicon + for(psppron = spPronList.pFirstWordPronunciation; psppron && SUCCEEDED(hr) && (hr != SP_ALREADY_IN_LEX); psppron = psppron->pNextWordPronunciation) + { + hr = cpConlexicon -> AddPronunciation(dsWord, psppron->LangID, psppron->ePartOfSpeech, psppron->szPronunciation ); + } + ::CoTaskMemFree(spPronList.pvBuffer); + + cpConlexicon.Release(); + + hr = RemoveTestAppLexicon(L"SRCompliance;AppLexTest"); + + } +}; + +enum UserlexTestType +{ + ItUserLexSynchBeforeDictLoad, + ItUserLexSynchBeforeCfgLoad, + ItUserLexSynchAfterDictLoad, + ItUserLexSynchAfterCfgLoad, +}; + +int HlpLexiconTest(UserlexTestType lt) +{ + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + // it is assumed that this work is in no vendors lexicon and the pronunciation for it is unigue + WCHAR wszNewWord[MAX_PATH] = L""; + + CComPtr cpLexicon; + CComPtr cpGrammar; + CComPtr cpProfileToken; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + CComPtr cpStream; + UINT idWavFile; + RESULTVECTOR vector_RecoResult; + + // get the word from the resource file + switch (lt) + { + case ItUserLexSynchBeforeDictLoad : + case ItUserLexSynchBeforeCfgLoad: + GetWStrFromRes(IDS_RECO_SYNCH_BEFORE_LOAD, wszNewWord); + idWavFile = IDS_WAV_SYNCH_BEFORE_LOAD; + break; + case ItUserLexSynchAfterDictLoad : + GetWStrFromRes(IDS_RECO_SYNCH_AFTER_DICT, wszNewWord); + idWavFile = IDS_WAV_SYNCH_AFTER_DICT; + break; + case ItUserLexSynchAfterCfgLoad : + GetWStrFromRes(IDS_RECO_SYNCH_AFTER_GRAM, wszNewWord); + idWavFile = IDS_WAV_SYNCH_AFTER_GRAM; + break; + } + + + // create a new token object + if (SUCCEEDED(hr)) + hr = SpCreateNewToken(SPCAT_RECOPROFILES, L"LexProfile", &cpProfileToken); + + // create a random user name + if (SUCCEEDED(hr)) + { + WCHAR wszName[MAX_PATH] = L""; + srand(GetCurrentThreadId() + GetTickCount()); + UINT uiRandom = rand(); + swprintf(wszName, L"TestName:%d", uiRandom); + + // set token to this new user + SpSetDescription(cpProfileToken, wszName); + } + + // add word to lexicon + if (lt == ItUserLexSynchBeforeDictLoad || lt == ItUserLexSynchBeforeCfgLoad) + { + // Get the lexicon + if (SUCCEEDED(hr)) + hr = cpLexicon.CoCreateInstance(CLSID_SpLexicon); + + if (SUCCEEDED(hr)) + hr = HlpAddCustomWord(cpLexicon, wszNewWord); + } + + // load the engine and make sure new word is recognized + // create engine + if (SUCCEEDED(hr)) + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // point to our user + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetRecoProfile(cpProfileToken); + + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(idWavFile, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load and activate the default grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if ((lt == ItUserLexSynchBeforeDictLoad) || (lt == ItUserLexSynchAfterDictLoad)) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadDictation(NULL, SPLO_STATIC); + } + else + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_SNORK_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + } + + // add word to lexicon + if ((lt == ItUserLexSynchAfterDictLoad) || (lt == ItUserLexSynchAfterCfgLoad)) + { + // Get the lexicon + hr = cpLexicon.CoCreateInstance(CLSID_SpLexicon); + + if (SUCCEEDED(hr)) + hr = HlpAddCustomWord(cpLexicon, wszNewWord); + } + + // activate dictation or cfg grammar + if ((lt == ItUserLexSynchBeforeDictLoad) || (lt == ItUserLexSynchAfterDictLoad)) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->SetDictationState(SPRS_ACTIVE); + } + else + { + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + // perform SR; get results and see if our word is inside the result string + CSpDynamicString dstrText; + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszNewWord) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + hr = HlpRemoveCustomWord(cpLexicon, wszNewWord); + + // remove the random user that was created for this test + if (cpProfileToken && SUCCEEDED(hr)) + { + hr = cpProfileToken->Remove(NULL); + if (hr == SPERR_TOKEN_IN_USE) + { + //we can't remove the token because SR Engine is using the token + //we try to set the original default token to be the current token + CComPtr cpDefaultProfileToken; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOPROFILES, &cpDefaultProfileToken); + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetRecoProfile(cpDefaultProfileToken); + } + + if (SUCCEEDED(hr)) + { + hr = cpProfileToken->Remove(NULL); + } + } + else if (FAILED(hr)) + { + Comment(IDS_ERR_LEX_REMOVEUSER); + } + } + + if (lt == ItUserLexSynchBeforeDictLoad || lt == ItUserLexSynchAfterDictLoad) + { + tpr = (tpr == TPR_PASS) ? TPR_SUPPORTED: TPR_UNSUPPORTED; + } + + return tpr; +} + + +TESTPROCAPI t_UserLexSynchBeforeDicLoad(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + if (!IsMatchingAttribute(L"Dictation")) + { + return TPR_UNSUPPORTED; + } + + + + // run the test + int tpr = HlpLexiconTest(ItUserLexSynchBeforeDictLoad); + + + return tpr; +} + + +TESTPROCAPI t_UserLexSynchBeforeCfgLoad(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + // run the test + int tpr = HlpLexiconTest(ItUserLexSynchBeforeCfgLoad); + + return tpr; +} + +TESTPROCAPI t_UserLexSynchAfterDictationLoad(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + if (!IsMatchingAttribute(L"Dictation")) + { + return TPR_FAIL; + } + + + // run the test + int tpr = HlpLexiconTest(ItUserLexSynchAfterDictLoad); + + + return tpr; +} + + +TESTPROCAPI t_UserLexSynchAfterGrammarLoad(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + // run the test + int tpr = HlpLexiconTest(ItUserLexSynchAfterCfgLoad); + + + return tpr; +} + + +TESTPROCAPI t_AppLex(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + CEventList eventList; + + WCHAR wszWord[MAX_PATH] = L""; + WCHAR wszSymbol[MAX_PATH] = L""; + + GetWStrFromRes(IDS_APPLEX_WORD, wszWord); + GetWStrFromRes(IDS_APPLEX_PROP, wszSymbol); + + CAppLexicon LexObject(wszWord, wszSymbol, NULL, &hr); + + if (hr == SPERR_APPLEX_READ_ONLY) + { + Comment(L"app lexicon already exists as read only, can't add new word."); + return TPR_FAIL; + } + else if (FAILED(hr)) + { + Comment(L"other app lexicon setup failure."); + return TPR_FAIL; + } + + hr = HlpGatherEvents(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION), + IDS_WAV_APPLEX, eventList, IDR_SNORK_GRAMMAR); + + + CEventRecord *peRecognition = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_RECOGNITION: + peRecognition = p; + break; + case SPEI_END_SR_STREAM: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peRecognition) + { + Comment(IDS_ERR_RECOGNITION_NOEVENT); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + eventList.Release(); + + return tpr; +} + + +TESTPROCAPI t_UserLexBeforeAppLex(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + CEventList eventList; + + WCHAR wszWord[MAX_PATH] = L""; + WCHAR wszUserSymbol[MAX_PATH] = L""; + WCHAR wszAppSymbol[MAX_PATH] = L""; + + GetWStrFromRes(IDS_USERLEXBEFOREAPPLEX_WORD, wszWord); + GetWStrFromRes(IDS_USERLEXBEFOREAPPLEX_USERPROP, wszUserSymbol); + GetWStrFromRes(IDS_USERLEXBEFOREAPPLEX_APPPROP, wszAppSymbol); + + CAppLexicon LexObject(wszWord, wszAppSymbol, wszUserSymbol, &hr); + + if (FAILED(hr)) + { + Comment(L"app lexicon setup failed."); + return TPR_FAIL; + } + + hr = HlpGatherEvents(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION), + IDS_WAV_USERLEXBEFOREAPPLEX, eventList, IDR_SNORK_GRAMMAR); + + CEventRecord *peRecognition = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_RECOGNITION: + peRecognition = p; + break; + case SPEI_END_SR_STREAM: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peRecognition) + { + Comment(IDS_ERR_RECOGNITION_NOEVENT); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + + return tpr; +} + + +// This test uses the P tag data +TESTPROCAPI t_MultipleRecoContext(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + bool bSuccess1, bSuccess2; + + + // speech + CComPtr cpGrammar1; + CComPtr cpGrammar2; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt1; + CComPtr cpRecoCtxt2; + + WCHAR wszWord[MAX_PATH] = L""; + GetWStrFromRes(IDS_RECO_P_TAG, wszWord); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create first recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt1); + + // create second recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt2); + + // pointer the first reco context at our notify object + if (SUCCEEDED(hr)) + hr = cpRecoCtxt1->SetNotifyWin32Event(); + + // pointer the second reco context at our notify object + if (SUCCEEDED(hr)) + hr = cpRecoCtxt2->SetNotifyWin32Event(); + + // tell the first reco context that we're interested in getting + // recognition and eos notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt1->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // same as second + if (SUCCEEDED(hr)) + hr = cpRecoCtxt2->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_MULT_RECO, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load the first grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt1->CreateGrammar(GRAM_ID, &cpGrammar1); + + if (SUCCEEDED(hr)) + hr = cpGrammar1->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_P1_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // load the second grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt2->CreateGrammar(GRAM_ID, &cpGrammar2); + + if (SUCCEEDED(hr)) + hr = cpGrammar2->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_P2_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // activate the grammars + if (SUCCEEDED(hr)) + hr = cpGrammar1->SetRuleState(NULL, NULL, SPRS_ACTIVE); + if (SUCCEEDED(hr)) + hr = cpGrammar2->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + // wait for EOS + if (SUCCEEDED(hr)) + hr = cpRecoCtxt1->WaitForNotifyEvent(WAIT_TIME); + + if (SUCCEEDED(hr)) + hr = cpRecoCtxt2->WaitForNotifyEvent(WAIT_TIME); + + bSuccess1 = bSuccess2 = false; + + // process all recognized phrases for first context + bool bDone = false; + while (SUCCEEDED(hr) && !bDone) + { + CComPtr pResult; + CSpEvent event; + while(event.GetFrom(cpRecoCtxt1) == S_OK) + { + if (event.eEventId == SPEI_END_SR_STREAM) + bDone = true; + else if (pResult = event.RecoResult()) + { + CSpDynamicString dstrText; + if (SUCCEEDED(pResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, NULL))) + { + if (wcsstr(wszWord, dstrText)) + bSuccess1 = true; + } + pResult.Release(); + } + } + cpRecoCtxt1->WaitForNotifyEvent(WAIT_TIME); + } + + if (SUCCEEDED(hr) && !bSuccess1) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + // process all recognized phrases for second context + bDone = false; + while (SUCCEEDED(hr) && !bDone) + { + CComPtr pResult; + CSpEvent event; + while(event.GetFrom(cpRecoCtxt2) == S_OK) + { + if (event.eEventId == SPEI_END_SR_STREAM) + bDone = true; + else if (pResult = event.RecoResult()) + { + CSpDynamicString dstrText; + if (SUCCEEDED(pResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, NULL))) + { + bSuccess2 = true; + } + pResult.Release(); + } + } + cpRecoCtxt1->WaitForNotifyEvent(WAIT_TIME); + } + + if (SUCCEEDED(hr) && !bSuccess2) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + + +int HlpGrammarTest(UINT idWord, UINT idWavFile, UINT idGrammar, WCHAR* pszRuleName = NULL) +{ + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + SPSTATEHANDLE hState; + + WCHAR wszWord[MAX_PATH] = L""; + GetWStrFromRes(idWord, wszWord); + RESULTVECTOR vector_RecoResult; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(idWavFile, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load the first grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if (idGrammar) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(idGrammar), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + } + else + { + //Dynamic Grammar + if (SUCCEEDED(hr)) + hr = cpGrammar->ResetGrammar(::GetDefaultEnginePrimaryLangId()); + + if (SUCCEEDED( hr )) + { + if (pszRuleName) + { + hr = cpGrammar->GetRule(pszRuleName, 0, SPRAF_Dynamic, TRUE, &hState); + } + else + { + hr = cpGrammar->GetRule(L"color", 0, SPRAF_Dynamic, TRUE, &hState); + } + + } + + if (SUCCEEDED( hr )) + hr = cpGrammar->AddWordTransition(hState, NULL, wszWord, L" ", SPWT_LEXICAL, 1.0, NULL); + } + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(pszRuleName, NULL, SPRS_ACTIVE); + + CSpDynamicString dstrText; + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (SUCCEEDED(hr)) + { + if (HlpCheckResult(vector_RecoResult, wszWord) != S_OK) + { + // USES_CONVERSION; + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + return tpr; +} + + +TESTPROCAPI t_GrammarListTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = HlpGrammarTest(IDS_RECO_L_TAG, IDS_WAV_L_TAG, IDR_L_GRAMMAR); + + return tpr; +} + + +TESTPROCAPI t_GrammarExpRuleTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + // words in grammar expected to be recognized + WCHAR wszFirstRule[MAX_PATH] = L""; + WCHAR wszSecondRule[MAX_PATH] = L""; + + GetWStrFromRes(IDS_RECO_EXPRULE_FIRSTRULE, wszFirstRule); + GetWStrFromRes(IDS_RECO_EXPRULE_SECONDRULE, wszSecondRule); + + // speech + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + RESULTVECTOR vector_RecoResult; + BOOL bFirstRuleReco = FALSE; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_EXPRULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load the grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_EXPRULE_GRAMMAR), + L"SRGRAMMAR",::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // activate the grammar + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(wszFirstRule, NULL, SPRS_ACTIVE); + + // deactivate the second rule + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(wszSecondRule, NULL, SPRS_INACTIVE); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if( FAILED(hr) || !vector_RecoResult.size() ) + { + Comment(L"failed to get recognition"); + return TPR_FAIL; + } + else + { + SPPHRASE* pPhrase = NULL; + ULONG ulCount = 0; + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if (!wcscmp(pPhrase->Rule.pszName, wszFirstRule)) + bFirstRuleReco = TRUE; + } + + ::CoTaskMemFree(pPhrase); + } + + + if (SUCCEEDED(hr)) + { + // The first rule should be used. + // The second rule shouldn't be used. + if (!bFirstRuleReco) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + // deactivate the rule + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(wszFirstRule, NULL, SPRS_INACTIVE); + + // release the input wave file + if (SUCCEEDED(hr)) + cpStream.Release(); + + // use same wave file and make sure that words from first rule are not recognized + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_EXPRULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // activate the other rule + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(wszSecondRule, NULL, SPRS_ACTIVE); + + // wait for EOS + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->WaitForNotifyEvent(TESTEVENT_TIMEOUT); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if( FAILED(hr) || !vector_RecoResult.size() ) + { + Comment(L"failed to get recognition"); + return TPR_FAIL; + } + else + { + SPPHRASE* pPhrase = NULL; + ULONG ulCount = 0; + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if (!wcscmp(pPhrase->Rule.pszName, wszSecondRule)) + bFirstRuleReco = FALSE; + } + + ::CoTaskMemFree(pPhrase); + } + + if (SUCCEEDED(hr)) + { + // The first rule shouldn't be used. + // The second rule should be used. + if (bFirstRuleReco) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + return tpr; +} + + +TESTPROCAPI t_GrammarPTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + int tpr = HlpGrammarTest(IDS_RECO_P_TAG, IDS_WAV_P_TAG, IDR_P1_GRAMMAR); + + return tpr; +} + + +TESTPROCAPI t_GrammarOTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + USES_CONVERSION; + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + RESULTVECTOR vector_RecoResult; + + WCHAR wszFirstOptionalWord[MAX_PATH] = L""; + WCHAR wszWord[MAX_PATH] = L""; + WCHAR wszSecondOptionalWord[MAX_PATH] = L""; + + GetWStrFromRes(IDS_RECO_O_TAG_1, wszFirstOptionalWord); + GetWStrFromRes(IDS_RECO_O_TAG_2, wszWord); + GetWStrFromRes(IDS_RECO_O_TAG_3, wszSecondOptionalWord); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create first recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_O_TAG_1, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load the grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_O_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // perform SR; get results and compare to our word + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (SUCCEEDED(hr)) + if (HlpCheckResult(vector_RecoResult, wszFirstOptionalWord) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + // part 2: check that second optional word is recognized + if (SUCCEEDED(hr)) + cpStream.Release(); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_O_TAG_2, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // perform SR; get results and compare to our word + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (SUCCEEDED(hr)) + if (HlpCheckResult(vector_RecoResult, wszSecondOptionalWord) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + // part 3: check that only main word is recognized + if (SUCCEEDED(hr)) + cpStream.Release(); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_O_TAG_3, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // perform SR; get results and compare to our word + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (SUCCEEDED(hr)) + if (HlpCheckResult(vector_RecoResult, wszWord) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + // end test + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + return tpr; +} + + +TESTPROCAPI t_GrammarRuleTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + int tpr = HlpGrammarTest(IDS_RECO_RULE_TAG, IDS_WAV_RULE_TAG, IDR_RULE_GRAMMAR); + + return tpr; +} + + + + + + +TESTPROCAPI t_Alternates_Dictation(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"Alternates", L"Dictation")) + { + return TPR_UNSUPPORTED; + } + + + HRESULT hr; + int tpr = TPR_SUPPORTED; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + + CComPtr cpRecoResult; + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpPhraseAlt; + RESULTVECTOR vector_RecoResult; + + hr = cpRecognizer.CoCreateInstance( CLSID_SpInprocRecognizer ); + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + hr = OpenWavFile(IDS_WAV_EXPRULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_UNSUPPORTED; + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->LoadDictation(NULL, SPLO_STATIC); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoContext->SetInterest(SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoGrammar->SetDictationState(SPRS_ACTIVE); + } + + + + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if( FAILED(hr) || !vector_RecoResult.size() ) + { + Comment(L"failed to get recognition"); + return TPR_UNSUPPORTED; + } + else + { + SPPHRASE* pPhrase = NULL; + ULONG ulCount = 0; + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + hr = vector_RecoResult[0]->GetAlternates(pPhrase->Rule.ulFirstElement, + pPhrase->Rule.ulCountOfElements, + 1, + &cpPhraseAlt, + &ulCount); + if (hr== S_OK && cpPhraseAlt && ulCount ==1) + { + CSpDynamicString dsString; + hr = cpPhraseAlt->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dsString, NULL); + if (SUCCEEDED(hr)) + { + hr = cpPhraseAlt->Commit(); + } + } + ::CoTaskMemFree(pPhrase); + } + else + { + tpr = TPR_UNSUPPORTED; + } + } + + if (FAILED(hr)) + { + tpr = TPR_UNSUPPORTED; + } + + + return tpr; +} + +TESTPROCAPI t_Alternates_Cfg(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"Alternates", L"CC")) + { + return TPR_UNSUPPORTED; + } + + HRESULT hr; + int tpr = TPR_SUPPORTED; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + + CComPtr cpRecoResult; + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpPhraseAlt; + + WCHAR wszAlternates[3][MAX_PATH] = {L""}; + WCHAR wszWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + RESULTVECTOR vector_RecoResult; + + SPSTATEHANDLE hInit; + SPSTATEHANDLE hAfterAlternates; + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_ALTERNATESCFG_BESTWORD, wszAlternates[0]); + GetWStrFromRes(IDS_ALTERNATESCFG_ALTERNATE1, wszAlternates[1]); + GetWStrFromRes(IDS_ALTERNATESCFG_ALTERNATE2, wszAlternates[2]); + GetWStrFromRes(IDS_ALTERNATESCFG_WORDS, wszWords); + GetWStrFromRes(IDS_ALTERNATESCFG_RULE, wszRule); + + hr = cpRecognizer.CoCreateInstance( CLSID_SpInprocRecognizer ); + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + hr = OpenWavFile(IDS_WAV_ALTERMATESCFG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetMaxAlternates(1); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hInit); + if (FAILED(hr)) + { + Comment(L"create the first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hInit, &hAfterAlternates); + } + + for (ULONG ul=0; ulAddWordTransition(hInit, hAfterAlternates, wszAlternates[ul] , L" ", SPWT_LEXICAL, 1.0, NULL); + } + } + + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hAfterAlternates, NULL, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoContext->SetInterest(SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if( FAILED(hr) || !vector_RecoResult.size() ) + { + Comment(L"failed to get recognition"); + return TPR_UNSUPPORTED; + } + else + { + SPPHRASE* pPhrase = NULL; + ULONG ulCount = 0; + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + hr = vector_RecoResult[0]->GetAlternates(pPhrase->Rule.ulFirstElement, + pPhrase->Rule.ulCountOfElements, + 1, + &cpPhraseAlt, + &ulCount); + if (hr== S_OK && cpPhraseAlt && ulCount ==1) + { + CSpDynamicString dsString; + hr = cpPhraseAlt->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dsString, NULL); + if (SUCCEEDED(hr)) + hr = cpPhraseAlt->Commit(); + } + else + { + tpr = TPR_UNSUPPORTED; + } + ::CoTaskMemFree(pPhrase); + } + else + { + tpr = TPR_UNSUPPORTED; + } + } + + if (FAILED(hr)) + { + tpr = TPR_UNSUPPORTED; + Comment(L"Alternate failed."); + } + + + + + return tpr; +} + +TESTPROCAPI t_PickGrammar(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpFirstGrammar; + CComPtr cpSecondGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + + WCHAR wszWord[MAX_PATH] = L""; + GetWStrFromRes(IDS_RECO_RULE_TAG, wszWord); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoContext->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_RULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + + + // We pause so that we can load the grammar atomically. + if (SUCCEEDED(hr)) + hr = cpRecoContext->Pause(NULL); + + // load the first grammar + if (SUCCEEDED(hr)) + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpFirstGrammar); + + if (SUCCEEDED(hr)) + hr = cpFirstGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_L_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpFirstGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + // load the second grammar + if (SUCCEEDED(hr)) + hr = cpRecoContext->CreateGrammar(GRAM_ID+1, &cpSecondGrammar); + + if (SUCCEEDED(hr)) + hr = cpSecondGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_RULE_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpSecondGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + // We resume after we finish. + if (SUCCEEDED(hr)) + hr = cpRecoContext->Resume(NULL); + + + + + while ((hr = cpRecoContext->WaitForNotifyEvent(TESTEVENT_TIMEOUT)) == S_OK) + { + CSpEvent event; + while ((hr = event.GetFrom(cpRecoContext)) == S_OK) + { + if (event.eEventId == SPEI_RECOGNITION) + { + cpRecoResult = event.RecoResult(); + } + } + } + + if( !cpRecoResult ) + { + hr = E_FAIL; + } + else + { + CSpDynamicString dsString; + hr = cpRecoResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, + &dsString, NULL); + if (SUCCEEDED(hr) && wcsstr(dsString, wszWord)) + { + } + else + { + tpr = TPR_UNSUPPORTED; + Comment(L"The first word is not right."); + } + } + cpRecoResult.Release(); + + + return tpr; + +} + + + +TESTPROCAPI t_UseLastActivatedGrammar(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpGrammar[NUMOFRECOCONTEXTS]; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext[NUMOFRECOCONTEXTS]; + CComPtr cpRecoResult; + BOOL fSuccess[NUMOFRECOCONTEXTS]; + + WCHAR wszWord[MAX_PATH] = L""; + GetWStrFromRes(IDS_RECO_RULE_TAG, wszWord); + ULONG ul; + + + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // open wav file, it is correspondent to IDR_RULE_GRAMMAR. + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_RULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + + + + if (SUCCEEDED(hr)) + { + for (ul=0; ul < NUMOFRECOCONTEXTS; ul++) + { + fSuccess[ul] = TRUE; + // create recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoContext[ul]); + } + } + + // We pause so that we can load the grammar atomically. + if (SUCCEEDED(hr)) + hr = cpRecoContext[0]->Pause(NULL); + + if (SUCCEEDED(hr)) + { + for (ul=0; ul < NUMOFRECOCONTEXTS; ul++) + { + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoContext[ul]->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoContext[ul]->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // load the first grammar + if (SUCCEEDED(hr)) + hr = cpRecoContext[ul]->CreateGrammar(GRAM_ID+ul, &cpGrammar[ul]); + + if (SUCCEEDED(hr)) + hr = cpGrammar[ul]->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_RULE_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpGrammar[ul]->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + } + } + + // We resume after we finish. + if (SUCCEEDED(hr)) + hr = cpRecoContext[0]->Resume(NULL); + + + + if (SUCCEEDED(hr)) + { + for (ul = 0; ul < NUMOFRECOCONTEXTS; ul++) + { + + while ((hr = cpRecoContext[ul]->WaitForNotifyEvent(TESTEVENT_TIMEOUT)) == S_OK) + { + CSpEvent event; + while ((hr = event.GetFrom(cpRecoContext[ul])) == S_OK) + { + if (event.eEventId == SPEI_RECOGNITION) + { + if (ul != NUMOFRECOCONTEXTS - 1) + fSuccess[ul] = FALSE; + else + cpRecoResult = event.RecoResult(); + } + } + } + } + } + + if( !cpRecoResult ) + { + tpr = TPR_UNSUPPORTED; + } + else + { + CSpDynamicString dsString; + hr = cpRecoResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, + &dsString, NULL); + if (SUCCEEDED(hr) && wcsstr(dsString, wszWord)) + { + } + else + { + tpr = TPR_UNSUPPORTED; + Comment(L"The first word is not right."); + } + } + cpRecoResult.Release(); + + for (ul=0; ul cpRecognizer; + + WCHAR wszPropertyName[] = L"Non support property string"; //No engine is going to support this property. + WCHAR wszPropertyValue[] = L"Non support property value"; + + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + hr = cpRecognizer->SetPropertyString(wszPropertyName, wszPropertyValue); + if (hr == S_FALSE) + { + CSpDynamicString dsString; + hr = cpRecognizer->GetPropertyString(wszPropertyName, &dsString); + if (hr == S_FALSE) + { + tpr = TPR_SUPPORTED; + } + else + { + tpr = TPR_UNSUPPORTED; + } + } + else + { + tpr = TPR_UNSUPPORTED; + } + + return tpr; +} + +TESTPROCAPI t_RequiredPropertyNum(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpRecognizer; + + BOOL fSuccess = TRUE; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + for (ULONG ul =0; ul SetPropertyNum(PropertyNumTable[ul].pPropertyNumNames, lValueSet); + if (hr == S_OK) + { + LONG lReturnNum = 0; + WCHAR pwszResult[MAX_PATH] = L""; + hr = cpRecognizer->GetPropertyNum(PropertyNumTable[ul].pPropertyNumNames, &lReturnNum); + if (lReturnNum == lValueSet) + { + swprintf(pwszResult, L"SetPropertyNum for %s is successful", PropertyNumTable[ul].pPropertyNumNames); + Comment(pwszResult); + } + else + { + swprintf(pwszResult, L"SetPropertyNum for %s fails", PropertyNumTable[ul].pPropertyNumNames); + Comment(pwszResult); + fSuccess = FALSE; + } + } + } + + if (!fSuccess) + { + tpr = TPR_UNSUPPORTED; + } + + return tpr; +} + + +HRESULT HlpClearandAddTextBuffer(CComPtr& cpRecognizer, CComPtr& cpStream, CComPtr& cpRecoGrammar, SPSTATEHANDLE hInit, WCHAR* wszTextBuffer, ULONG ulSize, SPTEXTSELECTIONINFO* pts = NULL) +{ + HRESULT hr = S_OK; + + LARGE_INTEGER li; + li.QuadPart = 0; + hr = cpStream->Seek(li, STREAM_SEEK_SET, NULL); + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->ClearRule(hInit); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddRuleTransition(hInit, NULL, SPRULETRANS_TEXTBUFFER, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetWordSequenceData(wszTextBuffer, ulSize, pts); + } + + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + return hr; +} + +TESTPROCAPI t_CFGTextBuffer(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"WordSequences")) + { + return TPR_UNSUPPORTED; + } + + HRESULT hr; + int tpr = TPR_SUPPORTED; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + + CComPtr cpRecoResult; + CComPtr cpRecoGrammar; + CComPtr cpStream; + WCHAR wszExpectedResult[MAX_PATH] = L""; + WCHAR wszFirstPart[MAX_PATH] = L""; + WCHAR wszSecondPart[MAX_PATH] = L""; + WCHAR wszNotInterestedPart[MAX_PATH] = L""; + WCHAR wszLongWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + RESULTVECTOR vector_RecoResult; + + SPSTATEHANDLE hInit; + SPSTATEHANDLE hBeforeTextBuffer; + + SPTEXTSELECTIONINFO ts; + ZeroMemory(&ts, sizeof(ts)); + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_CFGTEXTBUFFER_WORDS, wszFirstPart); + GetWStrFromRes(IDS_CFGTEXTBUFFER_BUFFERWORD, wszSecondPart); + GetWStrFromRes(IDS_CFGTEXTBUFFER_RULE, wszRule); + GetWStrFromRes(IDS_CFGTEXTBUFFER_NOTINTERESTEDWORDS, wszNotInterestedPart); + + wcscpy(wszExpectedResult, wszFirstPart); + wcscat(wszExpectedResult, wszSecondPart); + + + hr = cpRecognizer.CoCreateInstance( CLSID_SpInprocRecognizer ); + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_CFGTEXTBUFFER, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + + //Scenario 1, whole buffer + Comment(L"Start scenario 1, whole buffer"); + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hInit); + if (FAILED(hr)) + { + Comment(L"create dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hInit, &hBeforeTextBuffer); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hInit, hBeforeTextBuffer, wszFirstPart , L" ", SPWT_LEXICAL, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddRuleTransition(hBeforeTextBuffer, NULL, SPRULETRANS_TEXTBUFFER, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetWordSequenceData(wszSecondPart, wcslen(wszSecondPart) + 2, NULL); + } + + if (SUCCEEDED(hr)) + hr = cpRecoContext->SetNotifyWin32Event(); + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK ) + { + if (HlpCheckResult(vector_RecoResult, wszExpectedResult) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_UNSUPPORTED; + } + else + { + Comment(L"pass"); + } + } + else + { + tpr = TPR_UNSUPPORTED; + Comment(L"No recognition"); + } + Comment(L"End scenario 1"); + + + + //Scenario 2, no recognition across different groups + Comment(L"Start scenario 2, no recognition across different groups"); + wcscpy(wszFirstPart + wcslen(wszFirstPart) + 1, wszSecondPart); + + hr = HlpClearandAddTextBuffer(cpRecognizer, cpStream, cpRecoGrammar, hInit, wszFirstPart, wcslen(wszFirstPart) + wcslen(wszSecondPart) + 3); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK && HlpCheckResult(vector_RecoResult, wszExpectedResult) == S_OK) + { + Comment(L"failed"); + tpr = TPR_UNSUPPORTED; + } + else + { + //no receiving any result is compliant + Comment(L"pass"); + hr = S_OK; + } + Comment(L"End start scenario 2"); + + + + //Scenario 3, the expected result is a subset of the second group in the text buffer + Comment(L"Start scenario 3, the expected result is a subset of the second group in the text buffer"); + wcscpy(wszLongWords, wszNotInterestedPart); + wcscat(wszLongWords, wszFirstPart); + wcscat(wszLongWords, wszSecondPart); + + wcscpy(wszNotInterestedPart + wcslen(wszNotInterestedPart) + 1, wszLongWords); + + hr = HlpClearandAddTextBuffer(cpRecognizer, cpStream, cpRecoGrammar, hInit, wszNotInterestedPart, wcslen(wszNotInterestedPart) + wcslen(wszLongWords) + 3); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszExpectedResult) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_UNSUPPORTED; + } + else + { + Comment(L"pass"); + } + } + else + { + tpr = TPR_UNSUPPORTED; + Comment(L"No recognition"); + } + Comment(L"End scenario 3"); + + + + //Scenario 4, no recognition for noncontinous words + Comment(L"Start scenario 4, no recognition for noncontinous words"); + wcscpy(wszLongWords, wszFirstPart); + wcscat(wszLongWords, wszNotInterestedPart); + wcscat(wszLongWords, wszSecondPart); + + hr = HlpClearandAddTextBuffer(cpRecognizer, cpStream, cpRecoGrammar, hInit, wszLongWords, wcslen(wszLongWords) + 2); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK && HlpCheckResult(vector_RecoResult, wszExpectedResult) == S_OK) + { + Comment(L"Noncontinous words shouldn't be recognized"); + tpr = TPR_UNSUPPORTED; + } + else + { + //no receiving any result is compliant + Comment(L"pass"); + hr = S_OK; + } + Comment(L"End scenario 4"); + + + //Scenario 5, only words in textselection are recognizable + Comment(L"Start scenario 5, only words in textselection are recognizable"); + wcscpy(wszLongWords, wszFirstPart); + wcscat(wszLongWords, wszSecondPart); + + + //only the second part is active + ts.ulStartActiveOffset = wcslen(wszFirstPart); + ts.cchActiveChars = wcslen(wszSecondPart); + + hr = HlpClearandAddTextBuffer(cpRecognizer, cpStream, cpRecoGrammar, hInit, wszLongWords, wcslen(wszLongWords) + 2, &ts); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK && HlpCheckResult(vector_RecoResult, wszExpectedResult) == S_OK) + { + Comment(L"Words not in the active textselection shouldn't be recognized"); + tpr = TPR_UNSUPPORTED; + } + else + { + //no receiving any result is compliant + Comment(L"pass"); + hr = S_OK; + } + Comment(L"End scenario 5"); + + + if (FAILED(hr)) + { + tpr = TPR_UNSUPPORTED; + } + + + + + + + + return tpr; +} + +void RunAndReport(TESTPROC pTest, WCHAR* pszLog, int* ptpr) +{ + + WCHAR pwszThreadId[MAX_PATH] = L""; + swprintf(pwszThreadId, L"Thread Id: %x ", ::GetCurrentThreadId()); + CSpDynamicString dsResult; + dsResult.Clear(); + dsResult.Append(pwszThreadId); + dsResult.Append(pszLog); + if (*ptpr != TPR_PASS && *ptpr != TPR_SKIP) + { + dsResult.Append(L" skipped as failure in the previous test"); + } + else + { + *ptpr = pTest(TPM_EXECUTE, NULL, NULL); + dsResult.Append((*ptpr == TPR_PASS) ? L" pass" : (*ptpr == TPR_SKIP) ? L" skip" : L" fail"); + } + Comment(dsResult); + +} + + + +TESTPROCAPI t_MultiInstances(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + int tpr = TPR_PASS; + HRESULT hr = S_OK; + CSpDynamicString dsResult; + + if (uMsg == TPM_QUERY_THREAD_COUNT) + { + ((TPS_QUERY_THREAD_COUNT*)tpParam)->dwThreadCount = 3; + return TPR_HANDLED; + } + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + else + { + srand(reinterpret_cast(tpParam)->dwRandomSeed); + } + + + UINT uiCaseWeight[] = { + 1, // t_CheckEvent_SoundStart + 1, // t_CheckEvent_SoundEnd + 1, // t_CheckEvent_PhraseStart + 1, // t_CheckEvent_Recognition + 1, // t_UserLexSynchBeforeCfgLoad + 1, // t_MultipleRecoContext + 1, // t_GrammarPTag + 1, // t_InvalidateToplevelRule + 0 // t_GrammarOTag + }; + + + + + // scale Weight array + for(UINT uiCount=0; uiCount<(sizeof(uiCaseWeight)/sizeof(uiCaseWeight[0]) - 1); uiCount++) + { + uiCaseWeight[uiCount+1] += uiCaseWeight[uiCount]; + } + + UINT uiRand; + for(uiCount=0; uiCount= uiCaseWeight[0] && uiRand < uiCaseWeight[1]) + { + RunAndReport(t_CheckEvent_SoundEnd, L"SoundEnd Test", &tpr); + } + + if (uiRand >= uiCaseWeight[1] && uiRand < uiCaseWeight[2]) + { + RunAndReport(t_CheckEvent_PhraseStart, L"PhraseStart Test", &tpr); + } + + if (uiRand >= uiCaseWeight[2] && uiRand < uiCaseWeight[3]) + { + RunAndReport(t_CheckEvent_Recognition, L"Recognition Test", &tpr); + } + + if (uiRand >= uiCaseWeight[3] && uiRand < uiCaseWeight[4]) + { +// RunAndReport(t_UserLexSynchBeforeCfgLoad, L"t_UserLexSynchBeforeCfgLoad Test", &tpr); + } + + if (uiRand >= uiCaseWeight[4] && uiRand < uiCaseWeight[5]) + { + RunAndReport(t_MultipleRecoContext, L"MultipleRecoContext Test", &tpr); + } + + if (uiRand >= uiCaseWeight[5] && uiRand < uiCaseWeight[6]) + { + RunAndReport(t_GrammarPTag, L"GrammarPTag Test", &tpr); + } + + if (uiRand >= uiCaseWeight[6] && uiRand < uiCaseWeight[7]) + { +// RunAndReport(t_InvalidateToplevelRule, L"InvalidateToplevelRule Test", &tpr); + } + + if (uiRand >= uiCaseWeight[7] && uiRand < uiCaseWeight[8]) + { + RunAndReport(t_GrammarOTag, L"GrammarOTag Test", &tpr); + } + + } + + return tpr; +} + + +TESTPROCAPI t_AutoPause(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + + WCHAR wszFirstWord[MAX_PATH] = L""; + WCHAR wszSecondWord[MAX_PATH] = L""; + WCHAR wszFirstRule[MAX_PATH] = L""; + WCHAR wszSecondRule[MAX_PATH] = L""; + + SPSTATEHANDLE hFirstInit; + SPSTATEHANDLE hSecondInit; + + BOOL fFirstReco = FALSE; + BOOL fSecondReco = FALSE; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_AUTOPAUSE_DYNAMICWORD1, wszFirstWord); + GetWStrFromRes(IDS_AUTOPAUSE_DYNAMICWORD2, wszSecondWord); + GetWStrFromRes(IDS_AUTOPAUSE_DYNAMICRULE1, wszFirstRule); + GetWStrFromRes(IDS_AUTOPAUSE_DYNAMICRULE2, wszSecondRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_AUTOPAUSE, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //first rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszFirstRule, 0, SPRAF_TopLevel, TRUE, &hFirstInit); + if (FAILED(hr)) + { + Comment(L"create the first dynamic rule failed"); + } + } + + + //second rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszSecondRule, 0, SPRAF_TopLevel, TRUE, &hSecondInit); + if (FAILED(hr)) + { + Comment(L"create the second dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, wszFirstWord , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition on first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, wszSecondWord , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L"AddWordTransition on the second dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(wszFirstRule, NULL, SPRS_ACTIVE_WITH_AUTO_PAUSE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + while((!fEndofStream)&&(hr = cpRecoContext->WaitForNotifyEvent(TESTEVENT_TIMEOUT)) == S_OK) + { + CSpEvent event; + while((hr = event.GetFrom(cpRecoContext)) == S_OK) + { + switch (event.eEventId) + { + case SPEI_RECOGNITION: + { + cpRecoResult = event.RecoResult(); + //We get the auto pause flag and call resume so that engine can continue to process the audio + + CComPtr cpRecoResult = event.RecoResult(); + if (cpRecoResult) + { + CSpDynamicString dsText; + cpRecoResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dsText, NULL); + if (!wcscmp(dsText, wszFirstWord)) + { + fFirstReco = TRUE; + } + else if (!wcscmp(dsText, wszSecondWord)) + { + fSecondReco = TRUE; + break; + } + } + if (event.IsPaused()) + { + hr = cpRecoGrammar->SetRuleState(wszFirstRule, NULL, SPRS_INACTIVE); + if (SUCCEEDED(hr)) + { + //activate the second rule + hr = cpRecoGrammar->SetRuleState( wszSecondRule, NULL, SPRS_ACTIVE); + if (SUCCEEDED(hr)) + hr = cpRecoContext->Resume(NULL); + } + } + break; + } + case SPEI_END_SR_STREAM: + fEndofStream = TRUE; + } + } + } + + if (!(fFirstReco && fSecondReco)) + { + tpr = TPR_FAIL; + } + + return tpr; + +} + + +TESTPROCAPI t_InvalidateToplevelRule(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + + SPSTATEHANDLE hToplevelInit; + + BOOL fFirstReco = FALSE; + BOOL fSecondReco = FALSE; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_INVALIDATETOPLEVEL_DYNAMICWORDS, wszWords); + GetWStrFromRes(IDS_INVALIDATETOPLEVEL_DYNAMICRULE, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_INVALIDATETOPLEVEL_OLD, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition on first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + + + /************************************************ + //It is the first rule and using the first wave file before we invalidate the rule by reloading the same rule with different words. + ************************************************/ + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszWords) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_INACTIVE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->ClearRule(hToplevelInit); + } + + if (SUCCEEDED(hr)) + { + GetWStrFromRes(IDS_INVALIDATETOPLEVEL_DYNAMICNEWWORDS, wszWords); + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + if (SUCCEEDED(hr)) + { + LARGE_INTEGER li; + li.QuadPart = 0; + hr = cpStream->Seek(li, STREAM_SEEK_SET, NULL); + } + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + + + /************************************************ + The wave file and the grammar are not matching. We shouldn't get recognition. + ************************************************/ + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + for (ULONG ul = 0; ul < vector_RecoResult.size(); ul++) + { + CSpDynamicString dsText; + hr = vector_RecoResult[ul]->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dsText, NULL); + if (SUCCEEDED(hr)) + { + dsText .Append(L" shouldn't be received"); + Comment(dsText); + } + } + Comment(IDS_ERR_INVALIDATETOPLEVEL); + return TPR_FAIL; + } + + + hr = S_OK; + + /************************************************ + Change to a matching wave file for the new grammar and we should receive the recognition event + ************************************************/ + cpStream.Release(); + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_INACTIVE); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_INVALIDATETOPLEVEL_NEW, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszWords) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + + return tpr; + +} + + + +TESTPROCAPI t_InvalidateNonToplevelRule(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszRule1[MAX_PATH] = L""; + WCHAR wszRule2[MAX_PATH] = L""; + WCHAR wszTopRule[MAX_PATH] = L""; + WCHAR wszWord1[MAX_PATH] = L""; + WCHAR wszWord2[MAX_PATH] = L""; + WCHAR wszTopWords[MAX_PATH] = L""; + WCHAR wszWords[MAX_PATH] = L""; + + SPSTATEHANDLE hFirstInit; + SPSTATEHANDLE hSecondInit; + SPSTATEHANDLE hToplevelInit; + SPSTATEHANDLE hToplevelAfterRule1; + SPSTATEHANDLE hToplevelBeforeRule2; + + BOOL fFirstReco = FALSE; + BOOL fSecondReco = FALSE; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_RULE1, wszRule1); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_RULE2, wszRule2); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_TOPLEVELRULE, wszTopRule); + + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_OLDWORD1, wszWord1); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_OLDWORD2, wszWord2); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_TOPLEVELWORDS, wszTopWords); + + wcscpy(wszWords, wszTopWords); + wcscat(wszWords, wszWord2); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_INVALIDATENONTOPLEVEL_OLD, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule1, 0, 0, TRUE, &hFirstInit); + if (FAILED(hr)) + { + Comment(L"create the first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule2, 0, 0, TRUE, &hSecondInit); + if (FAILED(hr)) + { + Comment(L"create the second dynamic rule failed"); + } + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszTopRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //create two new rule states + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hToplevelInit, &hToplevelAfterRule1); + if (FAILED(hr)) + { + Comment(L"add new rule state failed"); + } + else + { + hr = cpRecoGrammar->CreateNewState(hToplevelInit, &hToplevelBeforeRule2); + if (FAILED(hr)) + { + Comment(L"add new rule failed"); + } + } + } + + //add rulereference for the first rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddRuleTransition(hToplevelInit, hToplevelAfterRule1, hFirstInit, 1.0, NULL); + } + + //add words between two rules in the toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelAfterRule1, hToplevelBeforeRule2, wszTopWords , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition on the toplevel dynamic rule failed"); + } + } + + //add rulereference for the second rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddRuleTransition(hToplevelBeforeRule2, NULL, hSecondInit, 1.0, NULL); + } + + + //Fill in the first rule. + + if (SUCCEEDED(hr)) + { + //we add the word only when the word is empty + if (!wcslen(CSpDynamicString(wszWord1).LTrim())) + { + //When the word is empty, we need to add epsilon transition. + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, NULL , L" ", SPWT_LEXICAL, 1.0, NULL); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, wszWord1 , L" ", SPWT_LEXICAL, 1.0, NULL); + } + if (FAILED(hr)) + { + Comment(L" AddWordTransition on the toplevel dynamic rule failed"); + } + } + + + if (SUCCEEDED(hr)) + { + if (!wcslen(CSpDynamicString(wszWord2).LTrim())) + { + //When the word is empty, we need to add epsilon transition. + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, NULL , L" ", SPWT_LEXICAL, 1.0, NULL); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, wszWord2 , L" ", SPWT_LEXICAL, 1.0, NULL); + } + if (FAILED(hr)) + { + Comment(L" AddWordTransition failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + + + /************************************************ + //It is the first rule and using the first wave file before we invalidate the rule by reloading the same rule with different words. + ************************************************/ + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszWords) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } +/************************************ +************************************/ + + + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_INACTIVE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->ClearRule(hFirstInit); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_NEWWORD1, wszWord1); + if (!wcslen(CSpDynamicString(wszWord1).LTrim())) + { + //When the word is empty, we need to add epsilon transition. + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, NULL , L" ", SPWT_LEXICAL, 1.0, NULL); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, wszWord1, L" ", SPWT_LEXICAL, 1.0, NULL); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->ClearRule(hSecondInit); + if (SUCCEEDED(hr)) + { + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_NEWWORD2, wszWord2); + if (!wcslen(CSpDynamicString(wszWord2).LTrim())) + { + //When the word is empty, we need to add epsilon transition. + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, NULL , L" ", SPWT_LEXICAL, 1.0, NULL); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, wszWord2 , L" ", SPWT_LEXICAL, 1.0, NULL); + } + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + wcscpy(wszWords, wszWord1); + wcscat(wszWords, wszTopWords); + wcscat(wszWords, CSpDynamicString(wszWord2).RTrim()); + + if (SUCCEEDED(hr)) + { + LARGE_INTEGER li; + li.QuadPart = 0; + hr = cpStream->Seek(li, STREAM_SEEK_SET, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + + + /************************************************ + The wave file and the grammar are not matching. We shouldn't get recognition. + ************************************************/ + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + Comment(IDS_ERR_INVALIDATETOPLEVEL); + return TPR_FAIL; + } + + + + + /************************************************ + Change to a matching wave file for the new grammar and we should receive the recognition event + ************************************************/ + cpStream.Release(); + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_INACTIVE); + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_INVALIDATENONTOPLEVEL_NEW, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszWords) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + + return tpr; + +} + + + + +TESTPROCAPI t_DictationTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"DictationInCFG")) + { + return TPR_UNSUPPORTED; + } + + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + + SPSTATEHANDLE hToplevelInit; + SPSTATEHANDLE hBeforeDictation; + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_DICTATIONTAG_WORDS, wszWords); + GetWStrFromRes(IDS_DICTATIONTAG_RULE, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_DICTATIONTAG, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_UNSUPPORTED; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hToplevelInit, &hBeforeDictation); + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, hBeforeDictation, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + + if (SUCCEEDED(hr)) + { +// hr = cpRecoGrammar->AddWordTransition(hBeforeDictation, NULL, L"*" , L" ", SPWT_LEXICAL, 1.0, NULL); + hr = cpRecoGrammar->AddRuleTransition(hBeforeDictation, NULL, SPRULETRANS_DICTATION, 1.0, NULL); + } + + if (FAILED(hr)) + { + Comment(L" AddWordTransition failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_UNSUPPORTED; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + } + else + { + Comment(L"no recognition"); + tpr = TPR_UNSUPPORTED; + } + + + + return tpr; + +} + + +TESTPROCAPI t_Wildcard(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"WildcardInCFG")) + { + return TPR_UNSUPPORTED; + } + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + + SPSTATEHANDLE hToplevelInit; + SPSTATEHANDLE hBeforeWildcard; + + BOOL fWildCard = FALSE; + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_WILDCARD_WORDS, wszWords); + GetWStrFromRes(IDS_WILDCARD_RULE, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_WILDCARD, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hToplevelInit, &hBeforeWildcard); + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, hBeforeWildcard, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->AddRuleTransition(hBeforeWildcard, NULL, SPRULETRANS_WILDCARD, 1.0, NULL); + + if (FAILED(hr)) + { + Comment(L"AddWordTransition failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_UNSUPPORTED; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + SPPHRASE *pPhrase = NULL; + if (vector_RecoResult.size()) + { + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + for (ULONG ul = 0; ul < pPhrase->Rule.ulCountOfElements; ul++) + { + if (!wcscmp(pPhrase->pElements[ul].pszDisplayText, WILDCARDTEXT) && + !wcscmp(pPhrase->pElements[ul].pszLexicalForm, WILDCARDTEXT)) + { + fWildCard = TRUE; + break; + } + } + + if (!fWildCard) + { + tpr = TPR_UNSUPPORTED; + } + } + else + { + Comment(L"no phrase"); + tpr = TPR_UNSUPPORTED; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_UNSUPPORTED; + } + + } + else + { + Comment(L"no recognition"); + tpr = TPR_UNSUPPORTED; + } + + + + return tpr; + +} + + + +TESTPROCAPI t_CustomPron(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszSymbol[MAX_PATH] = L""; + WCHAR wszDisplay[MAX_PATH] = L""; + WCHAR wszLexicon[MAX_PATH] = L""; + WCHAR wszWord[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + + SPSTATEHANDLE hToplevelInit; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_CUSTOMPROP_NEWWORD_PRON, wszSymbol); + GetWStrFromRes(IDS_CUSTOMPROP_NEWWORD_DISP, wszDisplay); + GetWStrFromRes(IDS_CUSTOMPROP_NEWWORD_LEX, wszLexicon); + + wcscat(wszWord, L"/"); + wcscat(wszWord, wszDisplay); + wcscat(wszWord, L"/"); + wcscat(wszWord, wszLexicon); + wcscat(wszWord, L"/"); + wcscat(wszWord, wszSymbol); + wcscat(wszWord, L";"); + + GetWStrFromRes(IDS_CUSTOMPROP_RULE, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_CUSTOMPROP, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition on first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + SPPHRASE *pPhrase = NULL; + if (vector_RecoResult.size()) + { + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if (wcscmp(pPhrase->pElements[0].pszDisplayText, wszDisplay)) + { + Comment(L"The display form is incorrect"); + tpr = TPR_FAIL; + } + if ( wcscmp(pPhrase->pElements[0].pszLexicalForm, wszLexicon )) + { + Comment(L"The lexicon form is incorrect"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no phrase"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + + + + return tpr; + +} + + + +TESTPROCAPI t_CaseSensitiveGrammar(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + LANGID LangId; + + if ((LangId = GetDefaultEnginePrimaryLangId()) == 0x411 || LangId == 0x804) + { + return tpr; + } + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + RESULTVECTOR vector_RecoResult; + + WCHAR wszSymbol1[MAX_PATH] = L""; + WCHAR wszDisplay1[MAX_PATH] = L""; + WCHAR wszLexicon1[MAX_PATH] = L""; + WCHAR wszWord1[MAX_PATH] = L""; + + WCHAR wszSymbol2[MAX_PATH] = L""; + WCHAR wszDisplay2[MAX_PATH] = L""; + WCHAR wszLexicon2[MAX_PATH] = L""; + WCHAR wszWord2[MAX_PATH] = L""; + + WCHAR wszRule[MAX_PATH] = L""; + SPSTATEHANDLE hToplevelInit; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_PRON1, wszSymbol1); + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_DISP1, wszDisplay1); + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_LEX1, wszLexicon1); + + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_PRON2, wszSymbol2); + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_DISP2, wszDisplay2); + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_LEX2, wszLexicon2); + + wcscat(wszWord1, L"/"); + wcscat(wszWord1, wszDisplay1); + wcscat(wszWord1, L"/"); + wcscat(wszWord1, wszLexicon1); + wcscat(wszWord1, L"/"); + wcscat(wszWord1, wszSymbol1); + wcscat(wszWord1, L";"); + + wcscat(wszWord2, L"/"); + wcscat(wszWord2, wszDisplay2); + wcscat(wszWord2, L"/"); + wcscat(wszWord2, wszLexicon2); + wcscat(wszWord2, L"/"); + wcscat(wszWord2, wszSymbol2); + wcscat(wszWord2, L";"); + + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_RULENAME, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + //This wave file is for word2 + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_CASESENSITIVEGRAMMAR_WAVE, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord1 , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition failed"); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord2 , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L"AddWordTransition failed"); + } + } + } + + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + SPPHRASE *pPhrase = NULL; + if (vector_RecoResult.size()) + { + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if (wcscmp(pPhrase->pElements[0].pszDisplayText, wszDisplay2)) + { + Comment(L"The display form is incorrect"); + tpr = TPR_FAIL; + } + if ( wcscmp(pPhrase->pElements[0].pszLexicalForm, wszLexicon2 )) + { + Comment(L"The lexicon form is incorrect"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no phrase"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + + + return tpr; +} + + + +TESTPROCAPI t_CaseSensitiveLexicon(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + LANGID LangId; + + if ((LangId = GetDefaultEnginePrimaryLangId()) == 0x411 || LangId == 0x804) + { + return tpr; + } + + CComPtr cpLexicon; + CComPtr cpRecoGrammar; + CComPtr cpProfileToken; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpStream; + + WCHAR wszSymbol1[MAX_PATH] = L""; + WCHAR wszWord1[MAX_PATH] = L""; + WCHAR wszSymbol2[MAX_PATH] = L""; + WCHAR wszWord2[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + RESULTVECTOR vector_RecoResult; + SPSTATEHANDLE hToplevelInit; + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_CASESENSITIVELEXICON_SYMBOL1, wszSymbol1); + GetWStrFromRes(IDS_CASESENSITIVELEXICON_WORD1, wszWord1); + + GetWStrFromRes(IDS_CASESENSITIVELEXICON_SYMBOL2, wszSymbol2); + GetWStrFromRes(IDS_CASESENSITIVELEXICON_WORD2, wszWord2); + + + GetWStrFromRes(IDS_CASESENSITIVELEXICON_RULENAME, wszRule); + + + //Set up user lexicon + + // create a new token object + if (SUCCEEDED(hr)) + hr = SpCreateNewToken(SPCAT_RECOPROFILES, L"LexProfile", &cpProfileToken); + + // create a random user name + if (SUCCEEDED(hr)) + { + WCHAR wszName[MAX_PATH] = L""; + srand(GetCurrentThreadId() + GetTickCount()); + UINT uiRandom = rand(); + swprintf(wszName, L"TestName:%d", uiRandom); + + // set token to this new user + SpSetDescription(cpProfileToken, wszName); + } + + if (SUCCEEDED(hr)) + hr = cpLexicon.CoCreateInstance(CLSID_SpLexicon); + + if (SUCCEEDED(hr)) + hr = HlpAddCustomWord(cpLexicon, wszWord1, wszSymbol1); + + if (SUCCEEDED(hr)) + hr = HlpAddCustomWord(cpLexicon, wszWord2, wszSymbol2); + + + // create engine + if (SUCCEEDED(hr)) + { + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetRecoProfile(cpProfileToken); + } + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + //This wave file is for word2 + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_CASESENSITIVELEXICON_WAVE, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord1 , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L"AddWordTransition failed"); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord2 , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L"AddWordTransition failed"); + } + } + } + + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + SPPHRASE *pPhrase = NULL; + if (vector_RecoResult.size()) + { + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if ( wcscmp(pPhrase->pElements[0].pszLexicalForm, wszWord2 )) + { + Comment(L"The result is incorrect"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no phrase"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + + if (SUCCEEDED(hr)) + hr = HlpRemoveCustomWord(cpLexicon, wszWord1); + + if (SUCCEEDED(hr)) + HlpRemoveCustomWord(cpLexicon, wszWord2); + + // remove the random user that was created for this test + if (cpProfileToken && SUCCEEDED(hr)) + { + hr = cpProfileToken->Remove(NULL); + if (hr == SPERR_TOKEN_IN_USE) + { + //we can't remove the token because SR Engine is using the token + //we try to set the original default token to be the current token + CComPtr cpDefaultProfileToken; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOPROFILES, &cpDefaultProfileToken); + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetRecoProfile(cpDefaultProfileToken); + } + + if (SUCCEEDED(hr)) + { + hr = cpProfileToken->Remove(NULL); + } + } + else if (FAILED(hr)) + { + Comment(IDS_ERR_LEX_REMOVEUSER); + } + } + + + return tpr; +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.h b/mp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.h new file mode 100644 index 00000000..502a4162 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.h @@ -0,0 +1,154 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// srenginecompliance.h +// +//****************************************************************************** +#ifndef _srenginecompliance_h_ +#define _srenginecompliance_h_ +#include "sapi.h" + +#include +typedef std::vector > RESULTVECTOR; + +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif +#define _WIN32_WINNT 0x0400 + +#define WILDCARDTEXT L"..." +#define WAIT_TIME 25000 +#define TEST_CASES 20 +#define NUMOFRECOCONTEXTS 2 +#define INTERATIONS 1 +#define TESTEVENT_WAIT 250 + +template +class CSpTString +{ +#ifdef _UNICODE +private: + WCHAR m_wString[i]; +public: + CSpTString(const WCHAR * psz){ + wcscpy(m_wString, psz); + } + operator const WCHAR *() { return m_wString; } + WCHAR * operator =(const WCHAR * psz) { + wcscpy(m_wString, psz); + return m_wString; + } +#else +private: + char m_aString[i]; +public: + CSpTString(const WCHAR * psz) + { + ::WideCharToMultiByte(CP_ACP, 0, psz, -1, m_aString, i, NULL, NULL); + } + operator const char *() { return m_aString; } + const char * operator =(const WCHAR * psz) + { + ::WideCharToMultiByte(CP_ACP, 0, psz, -1, m_aString, i, NULL, NULL); + return m_aString; + } +#endif +}; + + +HRESULT RegRecursiveCopyKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, HKEY hkeyDest, LPCTSTR szSubKeyDest, BOOL fClearDest = FALSE); +HRESULT RegRecursiveDeleteKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, BOOL fKeepEmptyRoot = FALSE); + +LANGID GetDefaultEnginePrimaryLangId(); + +struct PropertyNum +{ + const WCHAR* pPropertyNumNames; + LONG ulLowLimit; + LONG ulHighLimit; +}; + +const PropertyNum PropertyNumTable[] = +{ + {SPPROP_RESOURCE_USAGE, 0, 100}, + {SPPROP_HIGH_CONFIDENCE_THRESHOLD, 0, 100}, + {SPPROP_NORMAL_CONFIDENCE_THRESHOLD, 0, 100}, + {SPPROP_LOW_CONFIDENCE_THRESHOLD, 0, 100}, + {SPPROP_RESPONSE_SPEED, 0, 10000}, + {SPPROP_COMPLEX_RESPONSE_SPEED, 0, 10000}, + {SPPROP_ADAPTATION_ON, 0, 1} +}; + + + +inline HRESULT CreateAppLexicon( + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + WCHAR* pwszAttributes, + ISpLexicon** ppLexicon) +{ + HRESULT hr = S_OK; + + CComPtr cpToken; + CComPtr cpDataKeyAttribs; + if(SUCCEEDED(hr)) + { + hr = SpCreateNewTokenEx(SPCAT_APPLEXICONS, pszLangIndependentName, &CLSID_SpUnCompressedLexicon, pszLangIndependentName, langid, pszLangDependentName, &cpToken, &cpDataKeyAttribs); + } + if(SUCCEEDED(hr)) + { + CSpDynamicString str(pwszAttributes); // make a copy of the pwszAttributes + WCHAR* p = wcstok(str, L";"); + while(SUCCEEDED(hr) && p) + { + if(WCHAR* pe = wcschr(p, L'=')) + { + *(pe++) = L'\0'; + hr = cpDataKeyAttribs->SetStringValue(p, pe); + } + else + { + hr = cpDataKeyAttribs->SetStringValue(p, L""); + } + p = wcstok(NULL, L";"); + } + } + if(SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(cpToken, ppLexicon); + } + + return hr; +} + + + +inline HRESULT RemoveTestAppLexicon(WCHAR* pwszAttributes) +{ + + HRESULT hr = S_OK; + CComPtr cpEnum; + + CComPtr cpSpObjectToken; + + + if( SUCCEEDED( hr ) ) + { + // Get tts test engine voice + hr = SpEnumTokens(SPCAT_APPLEXICONS, pwszAttributes, NULL, &cpEnum); + } + if( hr == S_OK ) + { + hr = cpEnum->Next(1, &cpSpObjectToken, NULL); + } + if( hr == S_OK ) + { + hr = cpSpObjectToken->Remove(NULL); + + } + + return hr; +} + + +#endif // _srenginecompliance_h_ \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/SR/srtests1.h b/mp/src/utils/sapi51/Tools/Comp/SR/srtests1.h new file mode 100644 index 00000000..a6f757c9 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/SR/srtests1.h @@ -0,0 +1,90 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// srtests1.h +// +//****************************************************************************** +#ifndef __SRTRESTS1_H__ +#define __SRTRESTS1_H__ + +#include +#include +#include +#include +#include +#include "sapi.h" +#include "sapiddk.h" +#include + +#define GRAM_ID 123 + +// Added for logging across .cpp files +extern CKato *g_pKato; + +extern TCHAR ptszCustomizedDirectory[]; + +// Engine compliance through SAPI API's +TESTPROCAPI t_CheckEvent_SoundStart (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_SoundEnd (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_SoundStartEnd (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_PhraseStart (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_Recognition (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_FalseRecognition (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_EventsSequences (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_PhraseStartRecognitionOrder (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +TESTPROCAPI t_CheckEvent_Hypothesis (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_Interference (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +//TESTPROCAPI t_CheckEvent_PhraseHypReco (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexSynchBeforeDicLoad (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexSynchBeforeCfgLoad (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexSynchAfterDictationLoad (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexSynchAfterGrammarLoad (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_AppLex (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexBeforeAppLex (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CaseSensitiveLexicon (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + + +TESTPROCAPI t_GrammarListTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GrammarExpRuleTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GrammarPTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GrammarOTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GrammarRuleTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CustomPron (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CaseSensitiveGrammar (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +TESTPROCAPI t_DictationTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_Wildcard (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CFGTextBuffer (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +TESTPROCAPI t_MultipleRecoContext (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GetITNResult (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_Alternates_Dictation (UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE); +TESTPROCAPI t_Alternates_Cfg (UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE); +TESTPROCAPI t_SpPhraseElements (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_AutoPause (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_PickGrammar (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UseLastActivatedGrammar (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_RequiredPropertyString (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_RequiredPropertyNum (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_InvalidateToplevelRule (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_InvalidateNonToplevelRule (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_MultiInstances (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + + + + + + + +#define TESTEVENT_TIMEOUT 20000 + +extern SPS_SHELL_INFO *g_pShellInfo; // need this to get handle to dll + + + + + + + +#endif // __SRTRESTS1_H__ \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/SR/version.rc2 b/mp/src/utils/sapi51/Tools/Comp/SR/version.rc2 new file mode 100644 index 00000000..7c64a121 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/SR/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Microsoft SRCOMP\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SRCOMP\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "srcomp.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/audiostate.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/audiostate.cpp new file mode 100644 index 00000000..2dcd5795 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/audiostate.cpp @@ -0,0 +1,275 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// audiostate.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** +inline HRESULT SpGetLanguageFromVoiceToken(ISpObjectToken * pToken, LANGID * plangid) +{ + + HRESULT hr = S_OK; + CComPtr cpDataKeyAttribs; + hr = pToken->OpenKey(L"Attributes", &cpDataKeyAttribs); + + CSpDynamicString dstrLanguage; + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->GetStringValue(L"Language", &dstrLanguage); + } + + + LANGID langid; + if (SUCCEEDED(hr)) + { + if (!swscanf(dstrLanguage, L"%hx", &langid)) + { + hr = E_UNEXPECTED; + } + } + + if (SUCCEEDED(hr)) + { + *plangid = langid; + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} /* SpGetLanguageFromVoiceToken */ + +HRESULT SpGetLanguageIdFromDefaultVoice(LANGID *plangid) +{ + HRESULT hr = S_OK; + + CComPtr cpVoiceToken; + LANGID langid; + // Find the best voice + if( SUCCEEDED( hr ) ) + { + hr = SpGetDefaultTokenFromCategoryId( SPCAT_VOICES, &cpVoiceToken ); + } + if( SUCCEEDED( hr ) ) + { + hr = SpGetLanguageFromVoiceToken(cpVoiceToken, &langid); + } + *plangid = langid; + + return hr; +} + +HRESULT GetWStrFromRes( UINT id, WCHAR* szwStr, int cchBufferMax ) +{ + HRSRC hResInfo = NULL; + HANDLE hStringSeg = NULL; + LPWSTR lpsz = NULL; + int cch = 0; + HRESULT hr = S_OK; + LANGID Language; + + hr = SpGetLanguageIdFromDefaultVoice(&Language); + if (FAILED (hr ) ) + return hr; + + // String Tables are broken up into 16 string segments. Find the segment + // containing the string we are interested in. + if (hResInfo = FindResourceExW( g_pShellInfo->hLib, (LPCWSTR)RT_STRING, + MAKEINTRESOURCEW(((USHORT)id >> 4) + 1), + Language) ) + { + // Load that segment. + hStringSeg = LoadResource( g_pShellInfo->hLib, hResInfo ); + + // Lock the resource. + if( lpsz = (LPWSTR)LockResource(hStringSeg) ) + { + // Move past the other strings in this segment. + // (16 strings in a segment -> & 0x0F) + id &= 0x0F; + while( TRUE ) + { + cch = *((WORD *)lpsz++); // PASCAL like string count + // first UTCHAR is count if TCHARs + if (id-- == 0) break; + lpsz += cch; // Step to start if next string + } + + // Account for the NULL + cchBufferMax--; + + // Don't copy more than the max allowed. + if (cch > cchBufferMax) + cch = cchBufferMax-1; + + // Copy the string into the buffer. + CopyMemory( szwStr, lpsz, cch*sizeof(WCHAR) ); + + // Attach Null terminator. + szwStr[cch] = 0; + } + } + + return cch ? S_OK : HRESULT_FROM_WIN32(ERROR_RESOURCE_NAME_NOT_FOUND); +} +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** +/*****************************************************************************/ + +//************************************************************************************* +TESTPROCAPI t_SpeakStop(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test uses the default audio object to speak pause and speak a stream. It checks +// to make sure a TTS engine is paying attention to these states by stopping the stream +// part way through and counting the number of word events ( these must be less than the +// total number in the string. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_SpeakStop_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_SpeakStop_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) + +{ + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + int cEventsReceived = 0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + CSpEvent Event; + + hr = cpVoice->SetOutput(NULL, TRUE); + CHECKHRGOTOId( hr, tpr, IDS_STRING60); + + //clean up the event queue. + while (Event.GetFrom(cpVoice) == S_OK); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + DOCHECKHRGOTO ( hr = cpVoice->SetInterest( SPFEI(SPEI_WORD_BOUNDARY), SPFEI(SPEI_WORD_BOUNDARY) ); ); + + DOCHECKHRGOTO ( hr = GetWStrFromRes( IDS_STRING1, szwSpeakStr );); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC, NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + //wait for the first word boundry event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, " t_SpeakStop_Test"); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, " t_SpeakStop_Test"); + } + + + Sleep (500); + + //purges all data, close the audio and set action flag to SPVES_ABORT + hr = cpVoice->Speak( NULL, SPF_PURGEBEFORESPEAK, 0 ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, " t_SpeakStop_Test"); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, " t_SpeakStop_Test"); + } + + while (S_OK == hr ) + { + hr = Event.GetFrom(cpVoice); + + if( hr == S_OK ) + { + // count how many word boundry events we got + cEventsReceived++; + } + + } + + //Make sure the entire first speak call did not finish + //Note - The sentence contains 20 words, so normally we can receive 20 word + //boundary events. + CHECKASSERTId(( cEventsReceived < 20 ), tpr, IDS_STRING5); + + // Logging info + CHECKHRId( hr, tpr, IDS_STRING5 ); + +EXIT: + return tpr; +} + +//************************************************************************************* +TESTPROCAPI t_SpeakDestroy(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test starts a long Speak call and destroys the stream before completion. It +// expects engines to clean-up correctly and not fault. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CComPtr cpVoice; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpVoice.CoCreateInstance( CLSID_SpVoice );); + + //get the bookmark string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING6, szwSpeakStr );); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC, NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + cpVoice.Release(); + + // Logging info + CHECKHRId( hr, tpr, IDS_STRING7 ); + +EXIT: + return tpr; +} + diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/compevents.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/compevents.cpp new file mode 100644 index 00000000..1b361403 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/compevents.cpp @@ -0,0 +1,281 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// compevents.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** + + +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + +TESTPROCAPI t_CheckEventsSAPI(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This is a SAPI5 required test. It checks if the bookmark, word, and sentence + // boundary events are fired by TTS engine. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_CheckEventsSAPI_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_CheckEventsSAPI_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + //This is a SAPI5 required test. It checks if the bookmark, word, and sentence + // boundary events are fired by TTS engine. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + ULONGLONG ullFlags = SPFEI(SPEI_WORD_BOUNDARY) | + SPFEI(SPEI_SENTENCE_BOUNDARY) | + SPFEI(SPEI_TTS_BOOKMARK); + BOOL bGetEvents = true; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwBMarkStr[MAX_PATH]=L""; + LONGLONG ullEventsRetrieved = 0; + LANGID LangID; + + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING20, szwSpeakStr );); + + //get the bookmark string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING21, szwBMarkStr );); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest( ullFlags, ullFlags ); ); + + //clean up the event queue + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + } + CHECKHRId( hr, tpr, IDS_STRING120 ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML , NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + hr = cpVoice->WaitUntilDone(TTS_WAITTIME); + CHECKASSERTGOTOId( (hr == S_OK), tpr, IDS_STRING61); + + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + + if( hr == S_OK ) + { + // save the events retrieved + ullEventsRetrieved |= SPFEI(Event.eEventId); + if ( Event.eEventId == SPEI_TTS_BOOKMARK) + { + //verify bookmark string (lparam and wparam) + CHECKASSERTId(( !wcscmp( (WCHAR*)Event.lParam, szwBMarkStr ) ), tpr, IDS_STRING9); + CHECKASSERTId(( Event.wParam == _wtol(szwBMarkStr) ), tpr, IDS_STRING9); + continue; + } + + switch (LangID) + { + case 2052: + if ( Event.eEventId == SPEI_WORD_BOUNDARY) + { + //position will be 1 (leading space), 3, 29, and 30 + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 3 ) \ + || ( Event.lParam == 29 ) || ( Event.lParam == 30 )), + tpr, IDS_STRING9); + //length of word will be 1, or 2 if "ceshi" as one word + CHECKASSERTId( ( Event.wParam == 1 ) || + ( Event.wParam == 2 ), tpr, IDS_STRING9); + } + else if ( Event.eEventId == SPEI_SENTENCE_BOUNDARY) + { + //position will 1 (leading space), 3, and 29 + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 3 ) \ + || ( Event.lParam == 29 )), tpr, IDS_STRING9); + //length of sentence will be either 2 including period, and + //3 if "ce shi" as a word. + CHECKASSERTId( ( Event.wParam == 2 ) || ( Event.wParam == 3 ), + tpr, IDS_STRING9); + + } + break; + + case 1041: + if ( Event.eEventId == SPEI_WORD_BOUNDARY) + { + //lparam position:1, 4, 32 + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 4 ) \ + || ( Event.lParam == 32 ) ), + tpr, IDS_STRING9); + //wparm length of word: 3 or 6 + CHECKASSERTId( ( Event.wParam == 3 ) || ( Event.wParam == 6 ) + , tpr, IDS_STRING9); + } + else if ( Event.eEventId == SPEI_SENTENCE_BOUNDARY) + { + //lparam position:1, 32, + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 32 )), + tpr, IDS_STRING9); + //wparm length: 7 and 4 + //Note: punctuation should be included + CHECKASSERTId( (( Event.wParam == 7 ) || ( Event.wParam == 4)), + tpr, IDS_STRING9); + } + + break; + + case 1033: + default: + + if ( Event.eEventId == SPEI_WORD_BOUNDARY) + { + //position will be 1 for book (leading space), 6 for mark, 36 for test1. + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 7 ) \ + || ( Event.lParam == 36 ) ), + tpr, IDS_STRING9); + + //lengths of word are either 4 ( book, mark) or 5 (test1) + CHECKASSERTId( ( Event.wParam == 5 ) || ( Event.wParam == 4 ), tpr, IDS_STRING9); + + } + else if ( Event.eEventId == SPEI_SENTENCE_BOUNDARY) + { + + //position will be 1 for book (leading spaces), 7 for mark), + //and 36 for test1 + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 7 ) + || ( Event.lParam == 36 )), tpr, IDS_STRING9); + + //length will be 5 for (book. and mark.) and 6 for (test1.) + CHECKASSERTId( (( Event.wParam == 5 ) || ( Event.wParam == 6)), + tpr, IDS_STRING9); + + } + + break; + } + } + } + + // Logging info + CHECKHRGOTOId( hr, tpr, IDS_STRING9 ); + + // Make sure correct events were retrieved + CHECKASSERTId(((ullEventsRetrieved & ullFlags) == ullFlags), tpr, IDS_STRING9 ); +EXIT: + return tpr; +} + +TESTPROCAPI t_CheckEventsNotRequire(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test creates an Event Sink and asks a TTS engine to forward Events to it. It checks +// to make sure that all the expected Events are fired. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CComPtr cpVoice; + + ULONGLONG ullFlags = SPFEI(SPEI_PHONEME) | + SPFEI(SPEI_VISEME); + BOOL bGetEvents = true; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + ULONGLONG ullEventsRetrieved = 0; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpVoice.CoCreateInstance( CLSID_SpVoice );); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING10, szwSpeakStr );); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest( ullFlags, ullFlags ); ); + + //clean up the event queue + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + } + CHECKHRId( hr, tpr, IDS_STRING120 ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML , NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME ); + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, "in t_CheckEventsSAPI"); + + + while( hr == S_OK ) + { + CSpEvent Event; + + hr = Event.GetFrom(cpVoice); + + if( hr == S_OK ) + { + // Record the events retrieved in dwFlagsRetrieved + ullEventsRetrieved |= SPFEI(Event.eEventId); + } + + } + + // Logging info + CHECKHRGOTOId( hr, tpr, IDS_STRING15 ); + + // Make sure correct events were retrieved + CHECKISSUPPORTEDId(( ullEventsRetrieved == ullFlags ), tpr, IDS_STRING15); + +EXIT: + return tpr; +} diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/f0.h b/mp/src/utils/sapi51/Tools/Comp/TTS/f0.h new file mode 100644 index 00000000..40f7d6a1 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/f0.h @@ -0,0 +1,44 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// f0.h +// +//****************************************************************************** + +#ifndef _F0_H_ +#define _F0_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct F0_Data* F0Data; + +typedef struct { + float f0; + float rms; + /* float voicing; + */ +} F0Out; + + +F0Data F0_NewF0Obj (void); + +void F0_DeleteF0Obj (F0Data* f0Obj); + +int F0_ParseParameter (F0Data f0Obj, const char* str); + +float F0_ParameterValue (F0Data f0Obj, const char* str); + +int F0_Init (F0Data f0Obj, double sampFreq, int* buffsize, int* buffStep); + +int F0_AddDataFrame (F0Data f0Obj, float* data, int nData); + +int F0_OutputLength (F0Data f0Obj); + +F0Out F0_GetOutputFrame (F0Data f0Obj, int idx); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/ispttsengine.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/ispttsengine.cpp new file mode 100644 index 00000000..79d68702 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/ispttsengine.cpp @@ -0,0 +1,825 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// ispttsengine.cpp +// +//****************************************************************************** + +#include "TTSComp.h" +#include + +//****************************************************************************** +//***** Globals +//****************************************************************************** + +//****************************************************************************** +//***** Internal Functions and helper classes +//****************************************************************************** + +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_Speak(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test tests the ISpTTSEngine::Speak through the ISpVoice::Speak method. +// It does simple, normal usage tests. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_ISpTTSEngine_Speak_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_Speak_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) + +{ + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CComPtr cpStream; + + ULONG ulStreamNum; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + WCHAR szwInitDebug[MAX_PATH]=L""; + WCHAR szwNonAscii[] = {0x65e5, 0x672c, 0}; // non-ascii text + CSpStreamFormat InFmt; + + + + if( SUCCEEDED( hr ) ) + { + hr = InFmt.AssignFormat(SPSF_22kHz16BitMono); + } + + if( SUCCEEDED( hr ) ) + { + hr = SPCreateStreamOnHGlobal( NULL, true, InFmt.FormatId(), InFmt.WaveFormatExPtr(), &cpStream ); + } + + // Set the output to memory so we don't hear every speak call + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetOutput( cpStream, FALSE); + } + + if( SUCCEEDED( hr ) ) + { + // Logging info + hr = GetWStrFromRes( IDS_STRING13, szwDebug ); + + } + + // Logging info + CHECKHRGOTOId( hr, tpr, IDS_STRING12 ); + + /******* Valid Cases *******/ + + // + // Test #1 - Normal usage + // + GetWStrFromRes( IDS_STRING10, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_DEFAULT, &ulStreamNum ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + // + // Test #2 - Speak empty string + // + hr = cpVoice->Speak( L"", NULL, 0 ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + // + // Test #3 - Speak a really long string + // + GetWStrFromRes( IDS_STRING11, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, NULL, 0 ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + // + // Test #5 - Speak asyncronously + // + GetWStrFromRes( IDS_STRING10, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC, &ulStreamNum ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME ); + + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, " in Test #5"); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, " in Test #5"); + } + + // + // Test #6 - Purge before speaking + // + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC, 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, " in Test #6, SPF_ASYNC"); + + hr = cpVoice->Speak( szwSpeakStr, SPF_PURGEBEFORESPEAK, 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, " in Test #6, SPF_PURGEBEFORESPEAK"); + + // + // Test #7 - Speak the xml tags + // + GetWStrFromRes( IDS_STRING8, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, 0 ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + // + // Test #9 - Speak punctuation + // + GetWStrFromRes( IDS_STRING8, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_NLP_SPEAK_PUNC, 0 ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + // + // Test#10 - Speak some non-ASCII text + // + hr = cpVoice->Speak( szwNonAscii, SPF_DEFAULT, NULL ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_Skip(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // This test tests the ISpTTSEngine::Skip through the ISpVoice::Skip method. + // 0 ulNumItems -> Start at the beginning of current sentence + // 1 ulNumItems -> Start at the next sentence + // -1 ulNumItems -> Start at the previous sentence + // Skip type: sentence + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + tpr = t_ISpTTSEngine_Skip_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_Skip_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + //this method is called by t_ISpTTSEngine_Skip() and Multiple Instance test. + //For Multiple Instance test, we do not check audio output. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + + CComPtr cpStream; + STATSTG Stat; + ULONG sample1 = 0, sample2 = 0, ulNoSkipSample = 0; + ULONG NumSkipped = 0; + const char * TEST_TOPIC = ""; + WCHAR szwSpeakStr[MAX_PATH]=L""; + + //select output format + CSpStreamFormat InFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId( hr, tpr, IDS_STRING84); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING63, szwSpeakStr );); + + + + //====================================================================== + TEST_TOPIC = "Test #1 - Skip forward"; + //====================================================================== + g_pKato->Comment(5, "Skip forward test - Thread Id: %x", GetCurrentThreadId()); + // Create a stream + hr = SPCreateStreamOnHGlobal( NULL, true, InFmt.FormatId(), InFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output to the stream + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + //initialization + sample1 = 0, sample2 = 0, ulNoSkipSample = 0; + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML, NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + //skip 7 sentences + hr = cpVoice->Skip( L"SENTENCE", 7, NULL); + CHECKHRId( hr, tpr, IDS_STRING59); + + hr = cpVoice->WaitUntilDone(TTS_WAITTIME); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + if (!bCalledByMulti ) + { + hr = cpStream->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + sample1 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + + //Speak + hr = t_SpeakTwoStreams(cpVoice, szwSpeakStr, szwSpeakStr, sample2, sample2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //save the sample for later comparision + ulNoSkipSample = sample2; + + //The test will abort if the outputs = 0 + CHECKASSERTGOTOIdEx( ( sample2 > 0 ), tpr, IDS_STRING59, TEST_TOPIC ); + CHECKASSERTGOTOIdEx( ( sample1 > 0 ), tpr, IDS_STRING59, TEST_TOPIC ); + + //compare the output streams. The output stream without Skip should be much + //longer than one with Skip ( 7 ) + + CHECKASSERTIdEx( ( ulNoSkipSample > sample1), tpr, IDS_STRING59, TEST_TOPIC ); + } + cpStream.Release(); + + //====================================================================== + TEST_TOPIC = "Test #2 - Skip backward"; + //====================================================================== + g_pKato->Comment(5, "Skip backward test - Thread Id: %x", GetCurrentThreadId()); + + //initialization + sample1 = 0, sample2 = 0; + + // Create stream + hr = SPCreateStreamOnHGlobal( NULL, true, InFmt.FormatId(), InFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest(SPFEI(SPEI_TTS_BOOKMARK), 0);); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML , NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //for multithreaded case, the event may not come + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //skip backward 7 sentences + hr = cpVoice->Skip( L"SENTENCE", -7, &NumSkipped); + CHECKHRIdEx( hr, tpr, IDS_STRING59, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone(TTS_WAITTIME); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + if (!bCalledByMulti ) + { + hr = cpStream->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + sample1 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + CHECKASSERTIdEx((sample1 != 0), tpr, IDS_STRING59, TEST_TOPIC ); + + //The test will abort if the outputs = 0 + CHECKASSERTGOTOIdEx( ( sample1 > 0 ), tpr, IDS_STRING59, TEST_TOPIC ); + + //compare the output streams. The output stream without Skip should be much + //short than one with Skip ( -7 ) + + CHECKASSERTIdEx( ( ulNoSkipSample < sample1), tpr, IDS_STRING59, TEST_TOPIC ); + } + + cpStream.Release(); + + //====================================================================== + TEST_TOPIC = "Test #3 - Skip 0"; + //====================================================================== + g_pKato->Comment(5, "Skip 0 test - Thread Id: %x", GetCurrentThreadId()); + + //initialization + sample1 = 0, sample2 = 0; + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Create stream + hr = SPCreateStreamOnHGlobal( NULL, true, InFmt.FormatId(), InFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML , NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //for multithreaded case, the event may not come + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + //skip 0 sentence + hr = cpVoice->Skip( L"SENTENCE", 0, &NumSkipped); + CHECKHRIdEx( hr, tpr, IDS_STRING59, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone(TTS_WAITTIME); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + + if (!bCalledByMulti ) + { + hr = cpStream->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + sample2 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + + //The test will abort if the outputs = 0 + CHECKASSERTIdEx( (sample2 >= ulNoSkipSample ), tpr, IDS_STRING59, TEST_TOPIC ); + } + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_GetOutputFormat(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // This test tests the ISpTTSEngine::GetOutputFormat method. + // GetOutputFormat() is tested directly and also via SAPI + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + tpr = t_ISpTTSEngine_GetOutputFormat_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_GetOutputFormat_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + WCHAR szwSpeakStr[MAX_PATH]=L""; + CSpStreamFormat OutputFmt; + CSpStreamFormat InputFmt; + WAVEFORMATEX Fmtex; + + const char * TEST_TOPIC = ""; + CComPtr cpStream; + + //Initialize the waveformat structure, this user's format is supported by SAPI5 + Fmtex.wFormatTag = WAVE_FORMAT_PCM; + Fmtex.nSamplesPerSec = 2000; // arbitrary number + Fmtex.wBitsPerSample = 8; + Fmtex.nChannels = 1; + Fmtex.nBlockAlign = 1; + Fmtex.nAvgBytesPerSec = 2000; // arbitrary number + Fmtex.cbSize = 0; + + CComPtr cpVoiceToken; + CComPtr cpTTSEngine; + + + DOCHECKHRGOTO(hr=SpGetDefaultTokenFromCategoryId( SPCAT_VOICES, &cpVoiceToken );); + + DOCHECKHRGOTO(hr = SpCreateObjectFromToken( cpVoiceToken, &cpTTSEngine );); + + DOCHECKHRGOTO (hr = InputFmt.AssignFormat(SPSF_22kHz16BitMono);); + + + //====================================================================== + TEST_TOPIC = "Test #1 - Pass in NULL"; + //====================================================================== + hr = cpTTSEngine->GetOutputFormat( + NULL, + NULL, + &OutputFmt.m_guidFormatId, + &OutputFmt.m_pCoMemWaveFormatEx ); + CHECKHRIdEx( hr, tpr, IDS_STRING14, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #2 - Text format"; + //====================================================================== + hr = cpTTSEngine->GetOutputFormat( + &SPDFID_Text, + NULL, + &OutputFmt.m_guidFormatId, + &OutputFmt.m_pCoMemWaveFormatEx ); + CHECKHRIdEx( hr, tpr, IDS_STRING14, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #3 - wave format"; + //====================================================================== + + hr = cpTTSEngine->GetOutputFormat( + &SPDFID_WaveFormatEx, + &Fmtex, + &OutputFmt.m_guidFormatId, + &OutputFmt.m_pCoMemWaveFormatEx ); + CHECKHRIdEx( hr, tpr, IDS_STRING14, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #4 - Normal usage"; + //====================================================================== + + hr = cpTTSEngine->GetOutputFormat( &InputFmt.m_guidFormatId, + InputFmt.m_pCoMemWaveFormatEx , + &OutputFmt.m_guidFormatId, + &OutputFmt.m_pCoMemWaveFormatEx ); + CHECKHRIdEx( hr, tpr, IDS_STRING14, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #5 - test GetOutputFormat through SetOutPut"; + //====================================================================== + hr = cpVoice->SetOutput( NULL, TRUE); + CHECKHRIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #6 - test GetOutputFormat through Speak"; + //====================================================================== + GetWStrFromRes( IDS_STRING65, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, 0, 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #7 - test GetOutputFormat with user's format"; + //====================================================================== + + hr = SPCreateStreamOnHGlobal( NULL, true, SPDFID_WaveFormatEx, &Fmtex, &cpStream ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output to cpStream + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + //Speak calls GetOutputFormat() and passs in the above defined junk wave format + //as the first two paramters + hr = cpVoice->Speak( szwSpeakStr, 0, 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_SetRate(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test tests the ISpTTSEngine::SetRate method through the ISpVoice::SetRate method. +// It does simple, normal usage tests. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + tpr = t_ISpTTSEngine_SetRate_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_SetRate_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + WCHAR szwDebug[MAX_PATH]=L""; + WCHAR szwSpeakStr[MAX_PATH]=L""; + ULONG cSamples1=0, cSamples2=0, ulHightRateSample=0; + + + // Logging info and abort the test if fails here + CHECKHRGOTOId( hr, tpr, IDS_STRING12 ); + + //get the debug string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING16, szwDebug );); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING10, szwSpeakStr );); + + // + // Test #1 - Set a rate to 5 + // + cSamples1 = 0, cSamples2 = 0; + + hr = cpVoice->SetRate( 5 ); + CHECKHRId( hr, tpr, IDS_STRING16 ); + + //Speak + hr = t_SpeakTwoStreams(cpVoice, szwSpeakStr, szwSpeakStr, cSamples1, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, "SetRate to 5"); + + //save the output for later comparision + ulHightRateSample = cSamples1; + + // + // Test #2 - SetRate to -5 + // + cSamples1 = 0, cSamples2 = 0; + + hr = cpVoice->SetRate( -5 ); + CHECKHRId( hr, tpr, IDS_STRING16 ); + + //Speak + hr = t_SpeakTwoStreams(cpVoice, szwSpeakStr, szwSpeakStr, cSamples1, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, "SetRate to -5" ); + + //In multithreaded case, we do not check audio output + if (!bCalledByMulti ) + { + //The test will abort if the outputs = 0 + CHECKASSERTGOTOId( ( ulHightRateSample > 0 ), tpr, IDS_STRING16); + CHECKASSERTGOTOId( ( cSamples1 > 0 ), tpr, IDS_STRING16); + + //compare the output streams. The output stream when the rate = -5 should be much + //longer than one when the rate = 5. + + CHECKASSERTId( ( ulHightRateSample < cSamples1), tpr, IDS_STRING16); + } + + // + // Test #3 - SetRate to 0 + // + + //set the rate back to the default + hr = cpVoice->SetRate( 0 ); + CHECKHRId( hr, tpr, IDS_STRING16 ); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_SetVolume(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test tests the ISpTTSEngine::SetVolume method through the ISpVoice::SetVolume method. +// It does simple, normal usage tests. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + tpr = t_ISpTTSEngine_SetVolume_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_SetVolume_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + WCHAR szwSpeakStr[MAX_PATH]=L""; + CComPtr cpStream1; + CComPtr cpStream2; + CSpStreamFormat NewFmt; + ULONG totalAmp1 = 0, totalAmp2 = 0; + const char * TEST_TOPIC = ""; + + + if( SUCCEEDED( hr ) ) + { + hr = NewFmt.AssignFormat(SPSF_22kHz16BitMono); + } + + // Logging info + CHECKHRGOTOId( hr, tpr, IDS_STRING12 ); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING10, szwSpeakStr );); + + //====================================================================== + TEST_TOPIC = "Test #1: SetVolume to 50"; + //====================================================================== + + // + // Test #1 - SetVolume to 50 + // + + //set volume to 50 + hr = cpVoice->SetVolume( 50 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, 0, 0 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + LARGE_INTEGER l; + l.QuadPart = 0; + + // Reset stream to beginning + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream1, &totalAmp1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #2: SetVolume to 0"; + //====================================================================== + + // + // Test #2 - SetVolume to 0 + // + hr = cpVoice->SetVolume( 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Test #3: SetVolume to 100"; + //====================================================================== + + // + // Test #3 - SetVolume to 100 + // + hr = cpVoice->SetVolume( 100 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, 0, 0 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //In multithreaded case, we do not check audio output + if (!bCalledByMulti ) + { + // Reset stream to beginning + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream2, &totalAmp2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + //Make sure the amplitudes of stream1 and stream2 are greater than 0 + CHECKASSERTGOTOId( (totalAmp1 > 0), tpr, IDS_STRING35 ); + CHECKASSERTGOTOId( (totalAmp2 > 0), tpr, IDS_STRING35 ); + + //compare the output streams. The amplitude of output stream when the volume = 100 + //should be higher than one when the volume = 50 + + CHECKASSERTId( ( totalAmp1 < totalAmp2), tpr, IDS_STRING18); + } + +EXIT: + return tpr; +} + + +// Release global objects +void CleanupVoiceAndEngine() +{ +} diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/lexicon.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/lexicon.cpp new file mode 100644 index 00000000..565925a4 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/lexicon.cpp @@ -0,0 +1,495 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// lexicon.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** + +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + +//****************************************************************************** +TESTPROCAPI t_UserLexiconTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //this procedure tests the user lexicon by + // . Add a new word pron + // . Remove the word pron + + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CComPtr cpStream1; + CComPtr cpStream2; + CComPtr cpVoice; + CComPtr cpConlexicon; + LANGID LangID; + ULONG cSamples1=0, cSamples2=0; + ULONG cDiff=0; + WCHAR szwNewWord[MAX_PATH]=L""; + WCHAR szwPronStr[MAX_PATH]=L""; + WCHAR szPronunciation[MAX_PATH]=L""; + STATSTG Stat; + + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "User lexicon test: Initialization"; + //====================================================================== + CSpStreamFormat InFormat(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //get new word and its pronounciation + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING76, szwNewWord );); + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING94, szwPronStr );); + + // Create the SAPI voice + DOCHECKHRGOTO(hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); ); + DOCHECKHRGOTO (hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon);); + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + //remove its pron if it exists already in the User lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //Speak the new word + hr = cpVoice->Speak(szwNewWord, 0, 0); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + //save to cSamples1 for later comparation + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + CHECKASSERTGOTOIdEx((cSamples1 > 0 ), tpr, IDS_STRING75, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "User lexicon test: Test #1"; + //====================================================================== + // + //test #1 - Add a word pron + // + cpStream2.Release(); + cSamples2 = 0; + + //create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStr, szPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + //remove its pron if it exists already in the User lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //add the pronounciation of the new word to User's lexicon as verb and noun + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Verb, szPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + hr = cpVoice->Speak(szwNewWord, 0, 0); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + CHECKASSERTGOTOId((cSamples2 > 0 ), tpr, IDS_STRING75); + + //The test assume that cSamples2 should be twice greater than cSamples1 + CHECKASSERTIdEx(( cSamples2 > 2 * cSamples1), tpr, IDS_STRING75, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "User lexicon test: Test #2"; + //====================================================================== + + // + //Test #2 - Remove the word pron + // + cpStream2.Release(); + cSamples2 = 0; + + //remove all pronounciation of the word + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING89, TEST_TOPIC); + + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak(szwNewWord, 0, 0); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + CHECKASSERTGOTOId((cSamples2 > 0 ), tpr, IDS_STRING75); + + //cSamples1 and cSamples2 should be very close + cDiff = abs(cSamples2 - cSamples1); + CHECKASSERTIdEx(( 5 * cDiff < cSamples2), tpr, IDS_STRING75, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "User lexicon test: Test #3"; + //====================================================================== + + //Choose a common word, "Computer", which IS a noun, and it may exist + //in app or vendor lexicion. Now we add its pron to the user lexicon + //as Noun word. Engine should use the pron in the user lexicon. + + cSamples1=0, cSamples2=0; + + //get new word and its pronounciation + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING64, szwNewWord );); + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING71, szwPronStr );); + + //this Speak uses the default pronunciation + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWord, cSamples1, cSamples1); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStr, szPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + //remove its pronounciation if it exists already in the user lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //add the pronounciation of the new word to User's lexicon + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + //This Speak should pick up the new pronounciation in the user lexicon + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWord, cSamples2, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //remove it if it exists already + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //The test assume that cSamples2 should be twice greater than cSamples1 + CHECKASSERTIdEx(( 2 * cSamples1 RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStrLower, szPronunciationLower); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + //remove its pronounciation if it exists already in the user lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWordLower, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //add the pronounciation of the new word to User's lexicon + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + //add the pronounciation of the new word to User's lexicon + hr = cpConlexicon->AddPronunciation(szwNewWordLower, LangID, SPPS_Noun, szPronunciationLower); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + //This Speak should pick up the new pronounciation in the user lexicon + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWordLower, cSamples1, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //remove it if it exists already + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //remove it if it exists already + hr = cpConlexicon->RemovePronunciation(szwNewWordLower, LangID, SPPS_Noun, szPronunciationLower); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //For Chinese/Japanese TTS Engines, the test ignores result check since + //No case Sensitivity in Chinese language + if ( ( LangID != 2052 ) && ( LangID != 1041 )) + { + //The test assume that cSamples1(upper case) should be twice greater than cSamples2 (lower case) + CHECKASSERTIdEx(( 2 * cSamples2 cpVoice; + CComPtr cpConlexicon; + CComPtr cpStream; + LANGID LangID; + WCHAR szwNewWord[MAX_PATH]=L""; + WCHAR szwPronStr[MAX_PATH]=L""; + WCHAR szAppPronunciation[MAX_PATH]=L""; + ULONG sample1 = 0, sample2 = 0; + + SPWORDPRONUNCIATIONLIST spPronList; + SPWORDPRONUNCIATION *psppron = NULL; + CComPtr cpLexiconApp; + + const char * TEST_TOPIC = "App lexicon test"; + + CSpStreamFormat InFormat(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId(hr, tpr, IDS_STRING84); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //get new word and its pronounciation + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING76, szwNewWord );); + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING94, szwPronStr );); + + //remove the test app lexicon if it exists from the last test run + DOCHECKHRGOTO( hr = RemoveTestAppLexicon();); + + //Make a backup of all existing App lexicons + hr = RegRecursiveCopyKey( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\Tokens"), + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\TokensBackup"), + TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING96, TEST_TOPIC ); + + //Disenable/delete exsisting app lexicons + hr = RegRecursiveDeleteKey( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\Tokens"), + TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING97, TEST_TOPIC ); + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); ); + + // Create a lexicon + DOCHECKHRGOTO (hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon); ); + + //the following is to erase the pronunciations of the new word in User's lexicon + ZeroStruct ( spPronList ); + + //get the pronounciation of the new word from the User's lexicon + hr = cpConlexicon->GetPronunciations(szwNewWord, LangID, eLEXTYPE_USER, &spPronList); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING86, TEST_TOPIC); + + //remove all the pronunciations of the new word in User lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //Speak this word before testing app lexicon and save the result to sample1 + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWord, sample1, sample1); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStr, szAppPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + //Create a test app lexicon + hr = CreateAppLexicon( + L"App lex test", + LangID, + L"App Lex test", + L"TTSCompliance;AppLexTest", + &cpLexiconApp); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING98, TEST_TOPIC ); + + // add a new word pronunciation to the new created app lexicon + hr = cpLexiconApp->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szAppPronunciation); + CHECKHRId( hr, tpr, IDS_STRING87); + + hr = cpLexiconApp->AddPronunciation(szwNewWord, LangID, SPPS_Verb, szAppPronunciation); + CHECKHRId( hr, tpr, IDS_STRING87); + + cpLexiconApp.Release(); + + //recreate a voice to make sure that the container lexicon notices the test app leixcon + cpVoice.Release(); + DOCHECKHRGOTO (hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); ); + + //The new pronunciation from the test app lexicon should be used here and + //its output will be saved to sample2 + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWord, sample2, sample2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //restore the pronounciation of the new word to User's lexicon + for(psppron = spPronList.pFirstWordPronunciation; psppron && SUCCEEDED(hr) && (hr != SP_ALREADY_IN_LEX); psppron = psppron->pNextWordPronunciation) + { + hr = cpConlexicon -> AddPronunciation(szwNewWord, psppron->LangID, psppron->ePartOfSpeech, psppron->szPronunciation ); + } + ::CoTaskMemFree(spPronList.pvBuffer); + CHECKHRALTIdEx( hr, SP_ALREADY_IN_LEX, tpr, IDS_STRING87, TEST_TOPIC); + + cpConlexicon.Release(); + cpVoice.Release(); + + //remove the test app lexicon if it exists from the last test run + DOCHECKHR( hr = RemoveTestAppLexicon();); + + //Now, the test is done, so delete the test app lexicon + // and restore the previous app lexicons + hr = RegRecursiveCopyKey( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\TokensBackup"), + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\Tokens"), + TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING96, TEST_TOPIC ); + + //delete the backups + hr = RegRecursiveDeleteKey( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\TokensBackup")); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING97, TEST_TOPIC ); + + CHECKASSERTGOTOIdEx( ( sample1 > 0 ), tpr, IDS_STRING74, TEST_TOPIC ); + CHECKASSERTGOTOIdEx( ( sample2 > 0 ), tpr, IDS_STRING74, TEST_TOPIC ); + + // Now compare the values from the 2 streams + // check to ensure the voice uses the new pronounciation in the test app lexicon + // which generates bigger samples than normal. + CHECKASSERTIdEx( (( 2 * sample2) > (3 * sample1)), tpr, IDS_STRING74, TEST_TOPIC ); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_LexiconMulti_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpConlexicon; + CComPtr cpStream; + LANGID LangID; + WCHAR szwNewWord[MAX_PATH]=L""; + WCHAR szwPronStr[MAX_PATH]=L""; + WCHAR szPronunciation[MAX_PATH]=L""; + + + CSpStreamFormat InFormat(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId(hr, tpr, IDS_STRING84); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //new word and its pronounciation + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING76, szwNewWord );); + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING94, szwPronStr );); + + // Create a lexicon + DOCHECKHRGOTO (hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon); ); + + //create stream + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOId( hr, tpr, IDS_STRING81); + + // Set the output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOId( hr, tpr, IDS_STRING60); + + //The new word is stored in szwNewWord and its pronunciation is in szwPronStr. + //First get the pronounciation of the string stored in szwPronStr, + //and then assign the pronounciation to szwNewWord + // + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStr, szPronunciation); + CHECKHRGOTOId(hr, tpr, IDS_STRING77 ); + + //add the pronounciation of the new word to User's lexicon + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRALTId( hr, SP_ALREADY_IN_LEX, tpr, IDS_STRING87); + + hr = cpVoice->Speak(szwNewWord, 0, 0); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, " in t_LexiconMultiTest"); + + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRALTId(hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89); + +EXIT: + return tpr; +} diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/realtime.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/realtime.cpp new file mode 100644 index 00000000..407c5848 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/realtime.cpp @@ -0,0 +1,623 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// realtime.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Helper class to slow down writes to memory stream. It simply forwards all +//***** calls onto IStream. However these tests write output to memory which is +//***** too fast to get events. The write method here has a Sleep(100) statement +//***** in it to make it closer to real time. +//****************************************************************************** + +class CTestStream : public ISpStream +{ + + /*=== Methods =======*/ + public: + /*--- Constructors/Destructors ---*/ + CTestStream(CSpStreamFormat &Fmt, HRESULT * phr) + : m_ulRef(1) + { + *phr = SPCreateStreamOnHGlobal( NULL, true, Fmt.FormatId(), Fmt.WaveFormatExPtr(), &m_cpStream ); + } + ~CTestStream() { SPDBG_ASSERT(m_ulRef == 0); } + + //--- IUnknown ---------------------------------------------- + STDMETHODIMP QueryInterface(REFIID riid, void ** ppv) + { + if (riid == __uuidof(ISpStream) || + riid == __uuidof(ISpStreamFormat) || + riid == IID_ISequentialStream || // Note: __uuidof() wont work on Windows CE + riid == __uuidof(IUnknown)) + { + *ppv = (ISpStream *)this; + m_ulRef++; + return S_OK; + } + *ppv = NULL; + return E_NOINTERFACE; + } + STDMETHODIMP_(ULONG) AddRef() + { + return ++m_ulRef; + } + STDMETHODIMP_(ULONG) Release() + { + if(--m_ulRef == 0) + { + delete this; + } + return m_ulRef; + } + + //--- ISequentialStream ------------------------------------- + STDMETHOD(Read)( void * pv, ULONG cb, ULONG * pcbRead ) + { return m_cpStream->Read(pv, cb, pcbRead); } + STDMETHOD(Write)( void const* pv, ULONG cb, ULONG * pcbWritten ) + { + ::Sleep( 2 ); + return m_cpStream->Write(pv, cb, pcbWritten); + } + + //--- ISpStream ------------------------------------- + STDMETHOD (GetFormat)(GUID * pFmtId, WAVEFORMATEX ** ppCoMemWaveFormatEx) + { return m_cpStream->GetFormat(pFmtId, ppCoMemWaveFormatEx);}; + + STDMETHOD (SetBaseStream)(IStream * pStream, REFGUID rguidFormat, const WAVEFORMATEX * pWaveFormatEx) + { return m_cpStream->SetBaseStream(pStream, rguidFormat, pWaveFormatEx);}; + + STDMETHOD (GetBaseStream)(IStream ** ppStream) + { return m_cpStream->GetBaseStream(ppStream);}; + STDMETHOD (BindToFile)(const WCHAR * pszFileName, SPFILEMODE eMode, + const GUID * pguidFormatId, const WAVEFORMATEX * pWaveformatEx, + ULONGLONG ullEventInterest) + { return m_cpStream->BindToFile(pszFileName, eMode, pguidFormatId, pWaveformatEx, ullEventInterest);}; + STDMETHOD (Close)() + { return m_cpStream->Close();}; + + //--- IStream -------------------------------------- + STDMETHOD(Seek)( LARGE_INTEGER dlibMove, DWORD dwOrigin, + ULARGE_INTEGER * plibNewPosition ) + { return m_cpStream->Seek(dlibMove, dwOrigin, plibNewPosition); } + STDMETHOD(SetSize)( ULARGE_INTEGER libNewSize ) + { return m_cpStream->SetSize(libNewSize); } + STDMETHOD(CopyTo)( IStream * pstm, ULARGE_INTEGER cb, ULARGE_INTEGER * pcbRead, + ULARGE_INTEGER * pcbWritten ) + { return m_cpStream->CopyTo(pstm, cb, pcbRead, pcbWritten); } + STDMETHOD(Commit)( DWORD grfCommitFlags ) + { return m_cpStream->Commit(grfCommitFlags); } + STDMETHOD(Revert)( void ) + { return m_cpStream->Revert(); } + STDMETHOD(LockRegion)( ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, + DWORD dwLockType ) + { return m_cpStream->LockRegion(libOffset, cb, dwLockType); } + STDMETHOD(UnlockRegion)( ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, + DWORD dwLockType ) + { return m_cpStream->UnlockRegion( libOffset, cb, dwLockType); } + STDMETHOD(Stat)( STATSTG * pstatstg, DWORD grfStatFlag ) + { return m_cpStream->Stat(pstatstg, grfStatFlag); } + STDMETHOD(Clone)( IStream ** ppstm ) + { return m_cpStream->Clone(ppstm); } + + /*=== Member Data ===*/ + protected: + CComPtr m_cpStream; + ULONG m_ulRef; +}; + +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + +/*****************************************************************************/ +TESTPROCAPI t_RealTimeRateChange(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test changes the rate of a TTS driver on the fly and checks to see if +// it actually sped up. +// NOTE - this test uses the SAPI Event Model to get bookmark event and will fail +//if engines have not implemented bookmark event. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_RealTimeRateChange_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_RealTimeRateChange_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) + +{ + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0, cSamples3=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId( hr, tpr, IDS_STRING84); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING53, szwSpeakStr );); + + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest( SPFEI(SPEI_TTS_BOOKMARK), 0);); + + //set the rate to the minimum value + DOCHECKHRGOTO (hr = cpVoice->SetRate( -10 );); + + //====================================================================== + TEST_TOPIC = "t_RealTimeRateChange test: First stream"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetRate to -5 test - Thread Id: %x", GetCurrentThreadId()); + //*** First stream with rate set to -5 below default + + // Create memory stream #1 + CComPtr cpMemStream1; + cpMemStream1.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the output to memory + hr = cpVoice->SetOutput( cpMemStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the rate. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetRate( -5 ); + CHECKHRIdEx( hr, tpr, IDS_STRING16, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Get stream size + hr = cpMemStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + } + //====================================================================== + TEST_TOPIC = "t_RealTimeRateChange test: Second stream"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetRate to 0 test - Thread Id: %x", GetCurrentThreadId()); + //*** Second stream with rate set to default + + CComPtr cpMemStream2; + cpMemStream2.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the output to memory + hr = cpVoice->SetOutput( cpMemStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the rate. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetRate( 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING16, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Get stream size + hr = cpMemStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + } + + //====================================================================== + TEST_TOPIC = "t_RealTimeRateChange test: third stream"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetRate to 10 test - Thread Id: %x", GetCurrentThreadId()); + //*** third stream with rate set to 10 above default + + // Create memory stream #3 + CComPtr cpMemStream3; + cpMemStream3.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the output to memory + hr = cpVoice->SetOutput(cpMemStream3, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the rate. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetRate( 10 ); + CHECKHRIdEx( hr, tpr, IDS_STRING16, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Get stream size + hr = cpMemStream3->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples3 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + } + + //In Multithreaded case, the test only checks to ensure the system does not fail + if (!bCalledByMulti ) + { + // Now compare the values from the 3 streams + // Note - The higher rate, the shorter the overall stream length + // + CHECKASSERTGOTOId(( cSamples1 > 0 ), tpr, IDS_STRING54); + CHECKASSERTGOTOId(( cSamples2 > 0 ), tpr, IDS_STRING54); + CHECKASSERTGOTOId(( cSamples3 > 0 ), tpr, IDS_STRING54); + + CHECKASSERTId(( cSamples1 > cSamples2 ), tpr, IDS_STRING54); + CHECKASSERTId(( cSamples2 > cSamples3 ), tpr, IDS_STRING54); + } + +EXIT: + //set back to default + cpVoice->SetRate( 0 ); + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_RealTimeVolumeChange(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test changes the volume of a TTS driver on the fly and checks to see if +// it actually got louder. +// NOTE - this test uses the SAPI Event Model to get bookmark event and will fail +//if engines have not implemented bookmark event. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_RealTimeVolumeChange_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_RealTimeVolumeChange_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) + +{ + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + WCHAR szwSpeakStr[MAX_PATH]=L""; + ULONG totalAmp1 = 0, totalAmp2 = 0, totalAmp3 = 0; + const char * TEST_TOPIC = ""; + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId( hr, tpr, IDS_STRING84); + + LARGE_INTEGER l; + l.QuadPart = 0; + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING53, szwSpeakStr );); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest( SPFEI(SPEI_TTS_BOOKMARK), 0);); + + //set the start volume to max + DOCHECKHRGOTO (hr = cpVoice->SetVolume( 100 );); + + //====================================================================== + TEST_TOPIC = "t_RealTimeVolumeChangeTest: Stream 1 with Volume 100"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetVolume to 90 test - Thread Id: %x", GetCurrentThreadId()); + + // Create memory for stream #1 + CComPtr cpMemStream1; + cpMemStream1.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the default output format + hr = cpVoice->SetOutput( cpMemStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the volume. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetVolume( 90 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Reset stream to beginning + hr = cpMemStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpMemStream1, &totalAmp1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + } + //====================================================================== + TEST_TOPIC = "t_RealTimeVolumeChangeTest: Stream 2 with Volume 50"; + //====================================================================== + // Create stream #2 + { + g_pKato->Comment(5, "Real time SetVolume to 50 test - Thread Id: %x", GetCurrentThreadId()); + // Create memory for stream #2 + CComPtr cpMemStream2; + cpMemStream2.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the default output format + hr = cpVoice->SetOutput(cpMemStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the volume. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetVolume( 50 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Reset stream to beginning + hr = cpMemStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 2 + hr = GetAmpFromSamples (cpMemStream2, &totalAmp2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + } + + //====================================================================== + TEST_TOPIC = "t_RealTimeVolumeChangeTest: Stream 3 with Volume 1"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetVolume to 1 test - Thread Id: %x", GetCurrentThreadId()); + // Create memory for stream #3 + CComPtr cpMemStream3; + cpMemStream3.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the default output format + hr = cpVoice->SetOutput( cpMemStream3, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the volume. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetVolume( 1 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Reset stream to beginning + hr = cpMemStream3->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 3 + hr = GetAmpFromSamples (cpMemStream3, &totalAmp3 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + } + + if (!bCalledByMulti ) + { + // Now compare the values from the 3 streams + + CHECKASSERTGOTOId(( totalAmp1 > 0 ), tpr, IDS_STRING55); + CHECKASSERTGOTOId(( totalAmp2 > 0 ), tpr, IDS_STRING55); + CHECKASSERTGOTOId(( totalAmp3 > 0 ), tpr, IDS_STRING55); + + CHECKASSERTId(( totalAmp1 > totalAmp2 ), tpr, IDS_STRING55); + CHECKASSERTId(( totalAmp2 > totalAmp3 ), tpr, IDS_STRING55); + + } + +EXIT: + //set back to default + cpVoice->SetVolume( 100 ); + return tpr; +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/resource.h b/mp/src/utils/sapi51/Tools/Comp/TTS/resource.h new file mode 100644 index 00000000..eab9e0a8 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/resource.h @@ -0,0 +1,137 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ttscomp.rc +// +#define IDS_STRING1 1 +#define IDS_STRING2 2 +#define IDS_STRING3 3 +#define IDS_STRING4 4 +#define IDS_STRING5 5 +#define IDS_STRING6 6 +#define IDS_STRING7 7 +#define IDS_STRING8 8 +#define IDS_STRING9 9 +#define IDS_STRING10 10 +#define IDS_STRING11 11 +#define IDS_STRING12 12 +#define IDS_STRING13 13 +#define IDS_STRING14 14 +#define IDS_STRING15 15 +#define IDS_STRING16 16 +#define IDS_STRING17 17 +#define IDS_STRING18 18 +#define IDS_STRING19 19 +#define IDS_STRING20 20 +#define IDS_STRING21 21 +#define IDS_STRING22 22 +#define IDS_STRING23 23 +#define IDS_STRING24 24 +#define IDS_STRING25 25 +#define IDS_STRING26 26 +#define IDS_STRING27 27 +#define IDS_STRING28 28 +#define IDS_STRING29 29 +#define IDS_STRING30 30 +#define IDS_STRING31 31 +#define IDS_STRING32 32 +#define IDS_STRING33 33 +#define IDS_STRING34 34 +#define IDS_STRING35 35 +#define IDS_STRING36 36 +#define IDS_STRING37 37 +#define IDS_STRING38 38 +#define IDS_STRING39 39 +#define IDS_STRING40 40 +#define IDS_STRING41 41 +#define IDS_STRING42 42 +#define IDS_STRING43 43 +#define IDS_STRING44 44 +#define IDS_STRING45 45 +#define IDS_STRING46 46 +#define IDS_STRING47 47 +#define IDS_STRING48 48 +#define IDS_STRING49 49 +#define IDS_STRING50 50 +#define IDS_STRING51 51 +#define IDS_STRING52 52 +#define IDS_STRING53 53 +#define IDS_STRING54 54 +#define IDS_STRING55 55 +#define IDS_STRING56 56 +#define IDS_STRING57 57 +#define IDS_STRING58 58 +#define IDS_STRING59 59 +#define IDS_STRING60 60 +#define IDS_STRING61 61 +#define IDS_STRING62 62 +#define IDS_STRING63 63 +#define IDS_STRING64 64 +#define IDS_STRING65 65 +#define IDS_STRING66 66 +#define IDS_STRING67 67 +#define IDS_STRING68 68 +#define IDS_STRING69 69 +#define IDS_STRING70 70 +#define IDS_STRING71 71 +#define IDS_STRING72 72 +#define IDS_STRING73 73 +#define IDS_STRING74 74 +#define IDS_STRING75 75 +#define IDS_STRING76 76 +#define IDS_STRING77 77 +#define IDS_STRING78 78 +#define IDS_STRING79 79 +#define IDS_STRING81 81 +#define IDS_STRING82 82 +#define IDS_STRING83 83 +#define IDS_STRING84 84 +#define IDS_STRING85 85 +#define IDS_STRING86 86 +#define IDS_STRING87 87 +#define IDS_STRING88 88 +#define IDS_STRING89 89 +#define IDS_STRING90 90 +#define IDS_STRING91 91 +#define IDS_STRING92 92 +#define IDS_STRING93 93 +#define IDS_STRING94 94 +#define IDS_STRING95 95 +#define IDS_STRING96 96 +#define IDS_STRING97 97 +#define IDS_STRING98 98 +#define IDS_STRING99 99 +#define IDS_STRING100 100 +#define IDS_STRING101 101 +#define IDS_STRING102 102 +#define IDD_DIALOG1 102 +#define IDS_STRING103 103 +#define IDS_STRING104 104 +#define IDS_STRING105 105 +#define IDS_STRING106 106 +#define IDS_STRING107 107 +#define IDS_STRING108 108 +#define IDS_STRING109 109 +#define IDS_STRING110 110 +#define IDS_STRING111 111 +#define IDS_STRING112 112 +#define IDS_STRING113 113 +#define IDS_STRING114 114 +#define IDS_STRING115 115 +#define IDS_STRING116 116 +#define IDS_STRING117 117 +#define IDS_STRING118 118 +#define IDS_STRING119 119 +#define IDS_STRING120 120 +#define IDS_STRING121 121 +#define IDS_STRING122 122 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.cpp new file mode 100644 index 00000000..7cb08134 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.cpp @@ -0,0 +1,176 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// spgeterrormsg.cpp +// +//****************************************************************************** + +#include "ttscomp.h" + +#pragma warning (disable : 4786) +#include + +typedef std::map HRMAP; +typedef HRMAP::value_type HRPAIR; + +void InitSpErrorMsg(HRMAP& rhrmap); + +inline LPCSTR SpGetErrorMsg(HRESULT hr) +{ + static char szMessageBuffer[MAX_PATH]; + static bool s_fInit; + static HRMAP s_hrmap; + + if(!s_fInit) + { + InitSpErrorMsg(s_hrmap); + s_fInit = true; + } + + HRMAP::iterator it = s_hrmap.find(hr); + if(it != s_hrmap.end()) + { + return it->second; + } + else if(FAILED(hr)) // FormatMessage will treat SUCCEEDED(hr) as Win32 error code + { + DWORD cbWrite = ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), szMessageBuffer, 256, NULL); + if(cbWrite > 0) + { + // truncate the ending CRLF + szMessageBuffer[strlen(szMessageBuffer) - 2] = 0; + return szMessageBuffer; + } + } + + sprintf(szMessageBuffer, "0x%08x", hr); + return szMessageBuffer; +} + +inline void InitSpErrorMsg(HRMAP& rhrmap) +{ +#define ADD_HR_PAIR(hr) rhrmap.insert(HRPAIR(hr, #hr)) +#define ADD_WIN32_PAIR(errno) rhrmap.insert(HRPAIR(SpHrFromWin32(errno), "SpHrFromWin32("#errno")")) + ADD_HR_PAIR(S_OK); + ADD_HR_PAIR(S_FALSE); + + // If we have two names for the same hr, the first one inserted will count. + // So the SAPI names are put before standard names. + + // The following error codes are based on sperror.h#10 + // Note: Please update the version number above when new codes added. + ADD_HR_PAIR(SPERR_UNINITIALIZED); + ADD_HR_PAIR(SPERR_ALREADY_INITIALIZED); + ADD_HR_PAIR(SPERR_UNSUPPORTED_FORMAT); + ADD_HR_PAIR(SPERR_INVALID_FLAGS); + ADD_HR_PAIR(SP_END_OF_STREAM); + ADD_HR_PAIR(SPERR_DEVICE_BUSY); + ADD_HR_PAIR(SPERR_DEVICE_NOT_SUPPORTED); + ADD_HR_PAIR(SPERR_DEVICE_NOT_ENABLED); + ADD_HR_PAIR(SPERR_NO_DRIVER); + ADD_HR_PAIR(SPERR_FILE_MUST_BE_UNICODE); + ADD_HR_PAIR(SP_INSUFFICIENT_DATA); + ADD_HR_PAIR(SPERR_INVALID_PHRASE_ID); + ADD_HR_PAIR(SPERR_BUFFER_TOO_SMALL); + ADD_HR_PAIR(SPERR_FORMAT_NOT_SPECIFIED); + ADD_HR_PAIR(SPERR_AUDIO_STOPPED); + ADD_HR_PAIR(SP_AUDIO_PAUSED); + ADD_HR_PAIR(SPERR_RULE_NOT_FOUND); + ADD_HR_PAIR(SPERR_TTS_ENGINE_EXCEPTION); + ADD_HR_PAIR(SPERR_TTS_NLP_EXCEPTION); + ADD_HR_PAIR(SPERR_ENGINE_BUSY); + ADD_HR_PAIR(SP_AUDIO_CONVERSION_ENABLED); + ADD_HR_PAIR(SP_NO_HYPOTHESIS_AVAILABLE); + ADD_HR_PAIR(SPERR_CANT_CREATE); + ADD_HR_PAIR(SP_ALREADY_IN_LEX); + ADD_HR_PAIR(SPERR_NOT_IN_LEX); + ADD_HR_PAIR(SP_LEX_NOTHING_TO_SYNC); + ADD_HR_PAIR(SPERR_LEX_VERY_OUT_OF_SYNC); + ADD_HR_PAIR(SPERR_UNDEFINED_FORWARD_RULE_REF); + ADD_HR_PAIR(SPERR_EMPTY_RULE); + ADD_HR_PAIR(SPERR_GRAMMAR_COMPILER_INTERNAL_ERROR); + ADD_HR_PAIR(SPERR_RULE_NOT_DYNAMIC); + ADD_HR_PAIR(SPERR_DUPLICATE_RULE_NAME); + ADD_HR_PAIR(SPERR_DUPLICATE_RESOURCE_NAME); + ADD_HR_PAIR(SPERR_TOO_MANY_GRAMMARS); + ADD_HR_PAIR(SPERR_CIRCULAR_REFERENCE); + ADD_HR_PAIR(SPERR_INVALID_IMPORT); + ADD_HR_PAIR(SPERR_INVALID_WAV_FILE); + ADD_HR_PAIR(SP_REQUEST_PENDING); + ADD_HR_PAIR(SPERR_ALL_WORDS_OPTIONAL); + ADD_HR_PAIR(SPERR_INSTANCE_CHANGE_INVALID); + ADD_HR_PAIR(SPERR_RULE_NAME_ID_CONFLICT); + ADD_HR_PAIR(SPERR_NO_RULES); + ADD_HR_PAIR(SPERR_CIRCULAR_RULE_REF); + ADD_HR_PAIR(SP_NO_PARSE_FOUND); + ADD_HR_PAIR(SPERR_INVALID_HANDLE); + ADD_HR_PAIR(SPERR_REMOTE_CALL_TIMED_OUT); + ADD_HR_PAIR(SPERR_AUDIO_BUFFER_OVERFLOW); + ADD_HR_PAIR(SPERR_NO_AUDIO_DATA); + ADD_HR_PAIR(SPERR_DEAD_ALTERNATE); + ADD_HR_PAIR(SPERR_HIGH_LOW_CONFIDENCE); + ADD_HR_PAIR(SPERR_INVALID_FORMAT_STRING); + ADD_HR_PAIR(SP_UNSUPPORTED_ON_STREAM_INPUT); + ADD_HR_PAIR(SPERR_APPLEX_READ_ONLY); + ADD_HR_PAIR(SPERR_NO_TERMINATING_RULE_PATH); + ADD_HR_PAIR(SP_WORD_EXISTS_WITHOUT_PRONUNCIATION); + ADD_HR_PAIR(SPERR_STREAM_CLOSED); + ADD_HR_PAIR(SPERR_NO_MORE_ITEMS); + ADD_HR_PAIR(SPERR_NOT_FOUND); + ADD_HR_PAIR(SPERR_INVALID_AUDIO_STATE); + ADD_HR_PAIR(SPERR_GENERIC_MMSYS_ERROR); + ADD_HR_PAIR(SPERR_MARSHALER_EXCEPTION); + ADD_HR_PAIR(SPERR_NOT_DYNAMIC_GRAMMAR); + ADD_HR_PAIR(SPERR_AMBIGUOUS_PROPERTY); + ADD_HR_PAIR(SPERR_INVALID_REGISTRY_KEY); + ADD_HR_PAIR(SPERR_INVALID_TOKEN_ID); + ADD_HR_PAIR(SPERR_XML_BAD_SYNTAX); + ADD_HR_PAIR(SPERR_XML_RESOURCE_NOT_FOUND); + ADD_HR_PAIR(SPERR_TOKEN_IN_USE); + ADD_HR_PAIR(SPERR_TOKEN_DELETED); + ADD_HR_PAIR(SPERR_MULTI_LINGUAL_NOT_SUPPORTED); + ADD_HR_PAIR(SPERR_EXPORT_DYNAMIC_RULE); + ADD_HR_PAIR(SPERR_STGF_ERROR); + ADD_HR_PAIR(SPERR_WORDFORMAT_ERROR); + ADD_HR_PAIR(SPERR_STREAM_NOT_ACTIVE); + ADD_HR_PAIR(SPERR_ENGINE_RESPONSE_INVALID); + ADD_HR_PAIR(SPERR_SR_ENGINE_EXCEPTION); + ADD_HR_PAIR(SPERR_STREAM_POS_INVALID); + ADD_HR_PAIR(SP_RECOGNIZER_INACTIVE); + ADD_HR_PAIR(SPERR_REMOTE_CALL_ON_WRONG_THREAD); + ADD_HR_PAIR(SPERR_REMOTE_PROCESS_TERMINATED); + ADD_HR_PAIR(SPERR_REMOTE_PROCESS_ALREADY_RUNNING); + ADD_HR_PAIR(SPERR_LANGID_MISMATCH); + ADD_HR_PAIR(SP_PARTIAL_PARSE_FOUND); + ADD_HR_PAIR(SPERR_NOT_TOPLEVEL_RULE); + ADD_HR_PAIR(SP_NO_RULE_ACTIVE); + ADD_HR_PAIR(SPERR_LEX_REQUIRES_COOKIE); + ADD_HR_PAIR(SP_STREAM_UNINITIALIZED); + ADD_HR_PAIR(SPERR_UNSUPPORTED_LANG); + ADD_HR_PAIR(SPERR_VOICE_PAUSED); + ADD_HR_PAIR(SPERR_AUDIO_BUFFER_UNDERFLOW); + ADD_HR_PAIR(SPERR_AUDIO_STOPPED_UNEXPECTEDLY); + ADD_HR_PAIR(SPERR_NO_WORD_PRONUNCIATION); + ADD_HR_PAIR(SPERR_ALTERNATES_WOULD_BE_INCONSISTENT); + + // These are standard error codes: + ADD_HR_PAIR(E_NOTIMPL); + ADD_HR_PAIR(E_UNEXPECTED); + ADD_HR_PAIR(E_OUTOFMEMORY); + ADD_HR_PAIR(E_INVALIDARG); + ADD_HR_PAIR(E_NOINTERFACE); + ADD_HR_PAIR(E_POINTER); + ADD_HR_PAIR(E_HANDLE); + ADD_HR_PAIR(E_ABORT); + ADD_HR_PAIR(E_FAIL); + ADD_HR_PAIR(E_ACCESSDENIED); + ADD_HR_PAIR(REGDB_E_CLASSNOTREG); + ADD_HR_PAIR(REGDB_E_IIDNOTREG); + + ADD_WIN32_PAIR(ERROR_BAD_EXE_FORMAT); + ADD_WIN32_PAIR(ERROR_RESOURCE_DATA_NOT_FOUND); + ADD_WIN32_PAIR(ERROR_RESOURCE_TYPE_NOT_FOUND); + ADD_WIN32_PAIR(ERROR_RESOURCE_NAME_NOT_FOUND); + ADD_WIN32_PAIR(ERROR_RESOURCE_LANG_NOT_FOUND); +#undef ADD_HR_PAIR +#undef ADD_WIN32_PAIR +} \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.h b/mp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.h new file mode 100644 index 00000000..f869a169 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.h @@ -0,0 +1,9 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// spgeterrormsg.h +// +//****************************************************************************** + +#include + +extern LPCSTR SpGetErrorMsg(HRESULT hr); diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/stress.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/stress.cpp new file mode 100644 index 00000000..8362a023 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/stress.cpp @@ -0,0 +1,186 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// stress.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** +extern CRITICAL_SECTION g_csProcess; + +#define NUM_STRESS_RUNS 20 +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + + +/*****************************************************************************/ +TESTPROCAPI t_MultiInstanceTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test randomly calls all the other functions contained in this dll. This +// function will be called on multiple threads and each thread has its own voice +// Object. + + + // Message check + if (uMsg == TPM_QUERY_THREAD_COUNT) + { + CleanupVoiceAndEngine(); + ((LPTPS_QUERY_THREAD_COUNT)tpParam)->dwThreadCount = 4; + return TPR_HANDLED; + } + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + else + { + srand(reinterpret_cast(tpParam)->dwRandomSeed); + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + int iRand, i; + CComPtr cpLocalVoice; + + + //create a SAPI voice, each thread has its own voice + hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice ); + CHECKHRGOTOId( hr, tpr, IDS_STRING85 ); + + for( i=0; iComment(5, TEXT("Test #0 - Enter t_ISpTTSEngine_Speak - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_Speak_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #0 - Exit t_ISpTTSEngine_Speak - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 1: + g_pKato->Comment(5, TEXT("Test #1 - Enter t_ISpTTSEngine_Skip - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_Skip_Test ( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #1 - Exit t_ISpTTSEngine_Skip - Thread Id: %x"), GetCurrentThreadId()); + + break; + + case 2: + g_pKato->Comment(5, TEXT("Test #2 - Enter t_ISpTTSEngine_GetOutputFormat - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_GetOutputFormat_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #2 - Exit t_ISpTTSEngine_GetOutputFormat - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 3: + g_pKato->Comment(5, TEXT("Test #3 - Enter t_ISpTTSEngine_SetRate - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_SetRate_Test( uMsg, tpParam, NULL , cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #3 - Exit t_ISpTTSEngine_SetRate - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 4: + g_pKato->Comment(5, TEXT("Test #4 - Enter t_ISpTTSEngine_SetVolume - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_SetVolume_Test( uMsg, tpParam, NULL , cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #4 - Exit t_ISpTTSEngine_SetVolume - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 5: + g_pKato->Comment(5, TEXT("Test #5 - Enter t_CheckEventsSAPI - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_CheckEventsSAPI_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #5 - Exit t_CheckEventsSAPI - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 6: + g_pKato->Comment(5, TEXT("Test #6 - Enter t_XMLBookmarkTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLBookmark_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #6 - Exit t_XMLBookmarkTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 7: + g_pKato->Comment(5, TEXT("Test #7 - Enter t_XMLSilenceTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLSilence_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #7 - Exit t_XMLSilenceTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 8: + g_pKato->Comment(5, TEXT("Test #8 - Enter t_XMLSpellTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLSpell_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #8 - Exit t_XMLSpellTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 9: + g_pKato->Comment(5, TEXT("Test #9 - Enter t_XMLPronounceTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLPronounce_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #9 - Exit t_XMLPronounceTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 10: + g_pKato->Comment(5, TEXT("Test #10 - Enter t_XMLRateTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLRate_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #10 - Exit t_XMLRateTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 11: + g_pKato->Comment(5, TEXT("Test #11 - Enter t_XMLVolumeTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLVolume_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #11 - Exit t_XMLVolumeTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 12: + g_pKato->Comment(5, TEXT("Test #12 - Enter t_XMLPitchTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLPitch_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #12 - Exit t_XMLPitchTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 13: + g_pKato->Comment(5, TEXT("Test #13 - Enter t_RealTimeRateChangeTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_RealTimeRateChange_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #13 - Exit t_RealTimeRateChangeTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 14: + g_pKato->Comment(5, TEXT("Test #14 - Enter t_RealTimeVolumeChangeTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_RealTimeVolumeChange_Test( uMsg, tpParam, NULL , cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #14 - Exit t_RealTimeVolumeChangeTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 15: + g_pKato->Comment(5, TEXT("Test #15 - Enter t_SpeakStop_Test - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_SpeakStop_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #15 - Exit t_SpeakStop_Test - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 16: + g_pKato->Comment(5, TEXT("Test #16 - Enter t_LexiconMultiTest Test - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_LexiconMulti_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #16 - Exit t_LexiconMultiTest Test - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 17: + g_pKato->Comment(5, TEXT("Test #17 - Enter t_XMLSAPIMarkupTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLSAPIMarkup_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #17 - Exit t_XMLSAPIMarkupTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 18: + g_pKato->Comment(5, TEXT("Test #18 - Enter t_XMLContext_Test - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLContext_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #18 - Exit t_XMLContext_Test - Thread Id: %x"), GetCurrentThreadId()); + break; + } + + if( tpr != TPR_PASS ) + { + return tpr; + } + } + +EXIT: + return tpr; +} diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/tts.dsp b/mp/src/utils/sapi51/Tools/Comp/TTS/tts.dsp new file mode 100644 index 00000000..f3a7bf40 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/tts.dsp @@ -0,0 +1,156 @@ +# Microsoft Developer Studio Project File - Name="ttscomp" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=ttscomp - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tts.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tts.mak" CFG="ttscomp - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ttscomp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "ttscomp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ttscomp - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TTSCOMP_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\common\include" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TTSCOMP_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 f0r.lib urlmon.lib kato.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /machine:I386 /out:"Release/ttscomp.dll" /pdbtype:sept /libpath:"..\common\lib" /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "ttscomp - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TTSCOMP_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\common\include" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TTSCOMP_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 f0d.lib urlmon.lib kato.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/ttscomp.dll" /pdbtype:sept /libpath:"..\common\lib" /libpath:"..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "ttscomp - Win32 Release" +# Name "ttscomp - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "Test Modules" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\audiostate.cpp +# End Source File +# Begin Source File + +SOURCE=.\compevents.cpp +# End Source File +# Begin Source File + +SOURCE=.\ispttsengine.cpp +# End Source File +# Begin Source File + +SOURCE=.\lexicon.cpp +# End Source File +# Begin Source File + +SOURCE=.\realtime.cpp +# End Source File +# Begin Source File + +SOURCE=.\stress.cpp +# End Source File +# Begin Source File + +SOURCE=.\ttsmarkup.cpp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\spgeterrormsg.cpp +# End Source File +# Begin Source File + +SOURCE=.\ttscomp.cpp +# End Source File +# Begin Source File + +SOURCE=.\ttscomp.rc +# End Source File +# Begin Source File + +SOURCE=..\Common\def\ttscomp.def +# End Source File +# Begin Source File + +SOURCE=..\Common\cpp\TUXDLL.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.cpp new file mode 100644 index 00000000..57339304 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.cpp @@ -0,0 +1,69 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// ttscomp.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +// BASE is a unique value assigned to a given tester or component. This value, +// when combined with each of the following test's unique IDs, allows every +// test case within the entire team to be uniquely identified. + +#define BASE 0x000A4000 + + +// Our function table that we pass to Tux +FUNCTION_TABLE_ENTRY g_lpFTE[] = { +TEXT("TTS Compliance Test" ), 0, 0, 0, NULL, + TEXT("ISpTTSEngine" ), 1, 0, 0, NULL, + TEXT( "Speak" ), 2, 0, BASE+ 1, t_ISpTTSEngine_Speak, + TEXT( "Skip" ), 2, 0, BASE+ 2, t_ISpTTSEngine_Skip, + TEXT( "GetOutputFormat" ), 2, 0, BASE+ 3, t_ISpTTSEngine_GetOutputFormat, + TEXT( "SetRate" ), 2, 0, BASE+ 4, t_ISpTTSEngine_SetRate, + TEXT( "SetVolume" ), 2, 0, BASE+ 5, t_ISpTTSEngine_SetVolume, + TEXT( "Eventing" ), 1, 0, 0, NULL, + TEXT( "Check SAPI required Events" ), 2, 0, BASE+ 101, t_CheckEventsSAPI, + TEXT("TTS XML Markup" ), 1, 0, 0, NULL, + TEXT( "Bookmark" ), 2, 0, BASE+ 201, t_XMLBookmark, + TEXT( "Silence" ), 2, 0, BASE+ 202, t_XMLSilence, + TEXT( "Spell" ), 2, 0, BASE+ 203, t_XMLSpell, + TEXT( "Pronounce" ), 2, 0, BASE+ 204, t_XMLPronounce, + TEXT( "Rate" ), 2, 0, BASE+ 205, t_XMLRate, + TEXT( "Volume" ), 2, 0, BASE+ 206, t_XMLVolume, + TEXT( "Pitch" ), 2, 0, BASE+ 207, t_XMLPitch, + TEXT( "Non-SAPI tags" ), 2, 0, BASE+ 208, t_XMLNonSapiTagsTest, + TEXT( "Context" ), 2, 0, BASE+ 212, t_XMLContext, + TEXT("Real Time Rate/Vol Tests" ), 1, 0, 0, NULL, + TEXT( "Real time rate change" ), 2, 0, BASE+ 301, t_RealTimeRateChange, + TEXT( "Real time volume change" ), 2, 0, BASE+ 302, t_RealTimeVolumeChange, + TEXT("Audio State Tests" ), 1, 0, 0, NULL, + TEXT( "Speak Stop" ), 2, 0, BASE+ 402, t_SpeakStop, + TEXT( "Speak Destroy" ), 2, 0, BASE+ 403, t_SpeakDestroy, + TEXT("Lexicon Tests" ), 1, 0, 0, NULL, + TEXT( "User Lexicon Test" ), 2, 0, BASE+ 501, t_UserLexiconTest, + TEXT( "App Lexicon Test" ), 2, 0, BASE+ 502, t_AppLexiconTest, + TEXT("Multiple Instance Test" ), 1, 0, 0, NULL, + TEXT( "Multiple-Instance Test" ), 2, 0, BASE+ 601, t_MultiInstanceTest, + TEXT("Features" ), 0, 0, 0, NULL, + TEXT( "Emph" ), 1, 0, BASE+ 801, t_XMLEmphTest, + TEXT( "Phoneme & Viseme Events" ), 1, 0, BASE+ 805, t_CheckEventsNotRequire, + TEXT( "PartOfSp" ), 1, 0, BASE+ 806, t_XMLPartOfSpTest, + + NULL , 0, 0, 0, NULL // marks end of list +}; + + +// Stub function for cleaning up globals before dll is unloaded +void CleanupTest() +{ + CleanupVoiceAndEngine(); +} + +HRESULT PreTestSetup(void) { + return S_OK; +} + +HRESULT PostTestCleanup(void) { + return S_OK; +} diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.h b/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.h new file mode 100644 index 00000000..614c7e98 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.h @@ -0,0 +1,1012 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// ttscomp.h +// +//****************************************************************************** + +#ifndef __TTSCOMP_H__ +#define __TTSCOMP_H__ + +#include + +#include +#define ATLASSERT(expr) SPDBG_ASSERT(expr) +// Replace ATLASSERT with SPDBG_ASSERT. +// If the compiler says macro redefinition at this line, you need to remove any +// #include before include this file +#include + +#include +#include +#include +#include +#include +#include "sapi.h" +#include "sapiddk.h" +#include +#include +#include "spgeterrormsg.h" +#include "resource.h" +#include +#include + + +// Added for logging across .cpp files +extern CKato *g_pKato; +extern SPS_SHELL_INFO *g_pShellInfo; + +//************* Helper function prototypes ************* +HRESULT GetWStrFromRes( UINT id, WCHAR* szwStr, int cchBufferMax = MAX_PATH); +HRESULT RegRecursiveCopyKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, HKEY hkeyDest, LPCTSTR szSubKeyDest, BOOL fClearDest = FALSE); +HRESULT RegRecursiveDeleteKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, BOOL fKeepEmptyRoot = FALSE); +void CleanupVoiceAndEngine(); +HRESULT GetFreqFromSamples (ISpStream * pStream, int sampFreq, ULONG &length, ULONG * pAverage ); +int ComputeF0 (float* data, int nData, int sampFreq, int minF0, int maxF0, int feaSampFreq, + float** f0, int* nF0, float **pRms, int *nRms); +HRESULT SpGetLanguageIdFromDefaultVoice(LANGID *plangid); +HRESULT SPCreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, REFGUID rguidFormatId, + const WAVEFORMATEX * pwfex, ISpStream ** ppStream ); + +#define TTS_WAITTIME 30000 //30 seconds +#define TTS_WAITTIME_LONG 90000 //90 seconds + +// Useful macros and definitions +#define ZeroStruct(structvar) memset(&(structvar),0,sizeof(structvar)) +#define SP_IS_BAD_WRITE_PTR(p) ( SPIsBadWritePtr( p, sizeof(*(p)) )) + +inline BOOL SPIsBadWritePtr( void* pMem, UINT Size ) +{ +#ifdef _DEBUG + BOOL bIsBad = ::IsBadWritePtr( pMem, Size ); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ::IsBadWritePtr( pMem, Size ); +#endif +} + +template +class CAutoReleaseComPtr: public CComPtr +{ +public: + T ** operator&() + { + Release(); + return CComPtr::operator &(); + } +}; + +#define DOCHECKHRGOTO(statement) statement CHECKHRGOTO(hr, tpr, #statement); +#define DOCHECKHR(statement) statement CHECKHR(hr, tpr, #statement); + +inline LPCSTR CatMsg( LPCSTR psz1, LPCSTR psz2 = NULL, LPCSTR psz3 = NULL, LPCSTR psz4 = NULL, LPCSTR psz5 = NULL) +{ + static std::string s_str; + + { // make a new copy so that it works for CatMsg(CatMsg(str1, ...), str2, ...); + std::string str = psz1; + if(psz2) str += psz2; + if(psz3) str += psz3; + if(psz4) str += psz4; + if(psz5) str += psz5; + s_str = str; + } + + return s_str.c_str(); +} + +#define CHECKHRALTId( hr, althr, tpr, id ) \ +{ \ + if( FAILED( hr ) && (hr != althr) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if(SUCCEEDED(GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + } \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRALTIdEx( hr, althr, tpr, id, topic ) \ +{ \ + \ + if( FAILED( hr ) && (hr != althr) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + g_pKato->Comment(10, CatMsg(SpGetErrorMsg(hr), " in ", topic)); \ + } \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRALTGOTOIdEx( hr, althr, tpr, id, topic ) \ +{ \ + \ + if( FAILED( hr ) && (hr != althr) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + g_pKato->Comment(10, CatMsg(SpGetErrorMsg(hr), " in ", topic)); \ + } \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} +// for more general asserts. +// will not output error message based on hr +#define CHECKASSERTGOTOId( cond, tpr, id ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed")); \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} + +#define CHECKASSERTGOTOIdEx( cond, tpr, id, topic ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed in ", topic)); \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} + +#define CHECKASSERTId( cond, tpr, id ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed")); \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKISSUPPORTEDId( cond, tpr, id ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed")); \ + tpr = TPR_UNSUPPORTED; \ + } \ +} + +#define CHECKASSERTIdEx( cond, tpr, id, topic ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed in ", topic)); \ + tpr = TPR_FAIL; \ + } \ +} +// Useful macros and definitions +#define CHECKHRId( hr, tpr, id ) \ +{ \ + if( FAILED( hr ) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + } \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRIdEx( hr, tpr, id, topic ) \ +{ \ + \ + if( FAILED( hr ) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg(SpGetErrorMsg(hr), " in ", topic )); \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRGOTOId( hr, tpr, id) \ +{ \ + if( FAILED( hr ) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} + +#define CHECKHRGOTOIdEx( hr, tpr, id, topic ) \ +{ \ + if( FAILED( hr ) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg (SpGetErrorMsg(hr), " in ", topic)); \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} +// Useful macros and definitions +#define CHECKHR( hr, tpr, szError ) \ +{ \ + if( FAILED( hr ) ) \ + { \ + if( szError) \ + { \ + g_pKato->Comment(5, szError); \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + } \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRGOTO( hr, tpr, szError ) \ +{ \ + if( FAILED( hr ) ) \ + { \ + if( szError ) \ + { \ + g_pKato->Comment(5, szError); \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + } \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} + +// Get a random number between min and max +#define GET_RANDOM( min, max ) ((rand() % (int)(((max) + 1) - (min))) + (min)) + + +/***** Helper Classes *****/ +class CEventingTest : public ISpNotifyCallback +{ + /*=== Methods =======*/ + public: + STDMETHODIMP NotifyCallback(WPARAM wParam, LPARAM lParam) { m_bCallbackNotified = true; return S_OK; } + + BOOL m_bCallbackNotified; + + CEventingTest() { m_bCallbackNotified = false; } +}; + +//speak two streams: stream1 and stream2, and return back samples: sample1 and sample2 +inline HRESULT t_SpeakTwoStreams(ISpVoice *cpVoice, WCHAR *stream1, + WCHAR *stream2, ULONG &sample1, ULONG &sample2) +{ + + HRESULT hr = S_OK; + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + + CSpStreamFormat InFormat(SPSF_22kHz16BitMono, &hr); + + // Create stream #1 + if( SUCCEEDED( hr ) ) + { + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream1 ); + } + // Set the default output format + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetOutput( cpStream1, TRUE); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->Speak(stream1, 0, 0); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + sample1 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + } + + // Create stream #2 + if( SUCCEEDED( hr ) ) + { + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream2 ); + } + + // Set the default output format + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetOutput( cpStream2, TRUE); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->Speak(stream2, 0, 0); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + sample2 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + } + + return hr; +} + +inline HRESULT GetFreqFromSamples (ISpStream * pStream, int sampFreq, ULONG &length, ULONG * pAverage ) +{ + //this is a help function to get Frequency from the wav stream. The test allocates a + // buffer with length * sizeof (BUCKET) bytes. + + //Note: The application uses 16 bits wave stream. + + HRESULT hr = S_OK; + ULONG cbActuallyRead = 0; + ULONG cSamples = 0; + ULONG freq =0; + BOOL bPositive = FALSE; + + typedef short BUCKET; //use 16 bits + BUCKET *buff = NULL, *buffHead = NULL; + float *afUnfilteredBuffer = NULL, *afUnfilteredBufferHead = NULL; + + int feaSampFreq = 100; //sample rate + int minF0 = 30; //low freq Range of frequences interested + int maxF0 = 500; //high freq + + float *f0 = NULL; + int nF0 = 0; + + float *pRms = NULL; + int nRms = 0; + *pAverage = 0; + float *pAverageRms =0; + int NumRms =0; + + buff = (BUCKET *)::CoTaskMemAlloc ( length * sizeof (BUCKET) ); + if(!buff) + { + return E_OUTOFMEMORY; + } + + afUnfilteredBuffer = (float *)::CoTaskMemAlloc ( length * sizeof ( float) ); + if(!afUnfilteredBuffer) + { + return E_OUTOFMEMORY; + } + + pAverageRms = (float *)::CoTaskMemAlloc ( length * sizeof ( float) ); + if(!pAverageRms) + { + return E_OUTOFMEMORY; + } + + //save the head pointer + buffHead = buff; + afUnfilteredBufferHead = afUnfilteredBuffer; + + // Read stream into a buffer until EOF + if( SUCCEEDED( hr ) ) + { + hr = pStream->Read( buff, length * sizeof (BUCKET), &cbActuallyRead); + } + + cSamples = cbActuallyRead / sizeof(BUCKET); + + // Create a low frequency filter and run the samples through + if( SUCCEEDED( hr ) ) + { + for( ULONG i=0; i< cSamples; i++ ) + { + afUnfilteredBuffer[i] = (float)buff[i]; + } + } + + if (!ComputeF0 (afUnfilteredBuffer, cSamples, sampFreq, minF0, maxF0, + feaSampFreq, &f0, &nF0, &pRms, &nRms)) + { + hr = E_FAIL; + return hr; + } + *pAverage = 0; + for( ULONG i=0; i < nF0; i++ ) + { + if( f0[i] >0 ) + { + *pAverage += (ULONG)f0[i]; + freq++; + } + } + + *pAverageRms = 0; + for( ULONG j=0; j < nRms; j++ ) + { + if( pRms[j] >0 ) + { + *pAverageRms += (ULONG)pRms[j]; + NumRms++; + } + } + if (NumRms > 0 ) + *pAverageRms /= NumRms; + + if (freq > 0 ) + *pAverage /= freq; + + ::CoTaskMemFree (buffHead); + ::CoTaskMemFree (afUnfilteredBufferHead); + ::CoTaskMemFree (pAverageRms); + if ( f0 ) + { + free (f0); + f0 = NULL; + } + if ( pRms ) + { + free (pRms); + pRms = NULL; + } + return hr; +} + +inline HRESULT GetAmpFromSamples (ISpStream * pStream, ULONG * pamp ) +{ + //this is a help function to get amplitude from the stream. The test assume that + // the max of the buffer for Read is 1000 X 2 bytes, i.e. everytime Read gets called, at most + // 2000 bytes are readed. + + //Note: The application uses 16 bits wave stream. + + HRESULT hr = S_OK; + + ULONG cbActuallyRead = 1; + ULONG nRead = 1000; + ULONG totalAmp = 0, average = 0; + + typedef short BUCKET; + BUCKET *buff = NULL, *buffHead = NULL; + + buff = (BUCKET *)::CoTaskMemAlloc ( nRead * sizeof (BUCKET) ); + if(!buff) + { + return E_OUTOFMEMORY; + } + + //save the head pointer + buffHead = buff; + + // Read stream into a buffer until EOF + while ( cbActuallyRead && SUCCEEDED( hr ) ) + { + if( SUCCEEDED( hr ) ) + { + hr = pStream->Read( buff, nRead * sizeof (BUCKET), &cbActuallyRead); + } + + // Sum abs value of amplitude + if( SUCCEEDED( hr ) ) + { + average += (cbActuallyRead / sizeof(BUCKET)); + + for( ULONG i=0; i < cbActuallyRead / sizeof(BUCKET); i++ ) + { + + if( buff[i] < 0 ) + { + buff[i] = -(buff[i]); + } + totalAmp += buff[i]; + } + } + } + + if ( average > 0) + *pamp = totalAmp/average; + + ::CoTaskMemFree (buffHead); + return hr; +} + + +inline HRESULT TTSSymToPhoneId(LANGID langid, WCHAR* pszSym, WCHAR* pszPhoneId) +{ + CComPtr cpPhoneConv; + CComPtr cpToken; + CComPtr cpEnum; + HRESULT hr = S_OK; + + if(SUCCEEDED(hr)) + { + hr = SpCreatePhoneConverter(langid, NULL, NULL, &cpPhoneConv); + } + if(SUCCEEDED(hr)) + { + hr = cpPhoneConv->PhoneToId(pszSym, pszPhoneId); + } + return hr; +} + +inline HRESULT CreateAppLexicon( + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + WCHAR* pwszAttributes, + ISpLexicon** ppLexicon) +{ + HRESULT hr = S_OK; + + CComPtr cpToken; + CComPtr cpDataKeyAttribs; + if(SUCCEEDED(hr)) + { + hr = SpCreateNewTokenEx(SPCAT_APPLEXICONS, pszLangIndependentName, &CLSID_SpUnCompressedLexicon, pszLangIndependentName, langid, pszLangDependentName, &cpToken, &cpDataKeyAttribs); + } + if(SUCCEEDED(hr)) + { + CSpDynamicString str(pwszAttributes); // make a copy of the pwszAttributes + WCHAR* p = wcstok(str, L";"); + while(SUCCEEDED(hr) && p) + { + if(WCHAR* pe = wcschr(p, L'=')) + { + *(pe++) = L'\0'; + hr = cpDataKeyAttribs->SetStringValue(p, pe); + } + else + { + hr = cpDataKeyAttribs->SetStringValue(p, L""); + } + p = wcstok(NULL, L";"); + } + } + if(SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(cpToken, ppLexicon); + } + + return hr; +} + +inline HRESULT RegRecursiveDeleteKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, BOOL fKeepEmptyRoot) +{ + HRESULT hr = S_OK; + LONG l; + HKEY hkey; + + // try to use RegDeleteKey. On Win95/98 this will be enough. + l = ::RegDeleteKey(hkeySrc, szSubKeySrc); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + if(SUCCEEDED(hr)) + { + if(fKeepEmptyRoot) + { + HKEY hkey; + l = ::RegCreateKeyEx(hkeySrc, szSubKeySrc, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &hkey, NULL); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + if(SUCCEEDED(hr)) + { + ::RegCloseKey(hkey); + } + } + return hr; + } + + l = ::RegOpenKeyEx(hkeySrc, szSubKeySrc, 0, KEY_ALL_ACCESS, &hkey); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + if(SUCCEEDED(hr)) // open hkey + { + TCHAR szName[MAX_PATH]; + DWORD cbName; + + // recursively copy the subkeys + if(SUCCEEDED(hr)) + { + for(DWORD i = 0; SUCCEEDED(hr); i++) + { + cbName = MAX_PATH; + + // always enum the first subkey because the old one has been deleted + l = ::RegEnumKeyEx(hkey, 0, szName, &cbName, NULL, NULL, NULL, NULL); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + + if(SUCCEEDED(hr)) + { + hr = RegRecursiveDeleteKey(hkey, szName); + } + } + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = S_OK; + } + + ::RegCloseKey(hkey); + } + + if(SUCCEEDED(hr) && !fKeepEmptyRoot) + { + l = ::RegDeleteKey(hkeySrc, szSubKeySrc); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + } + + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = SPERR_NO_MORE_ITEMS; + if(hr == SpHrFromWin32(ERROR_FILE_NOT_FOUND)) hr = SPERR_NOT_FOUND; + return hr; +} + +inline HRESULT RegRecursiveCopyKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, HKEY hkeyDest, LPCTSTR szSubKeyDest, BOOL fClearDest) +{ + HRESULT hr = S_OK; + LONG l; + HKEY hkey1, hkey2; + + l = ::RegOpenKeyEx(hkeySrc, szSubKeySrc, 0, KEY_ALL_ACCESS, &hkey1); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + + if(SUCCEEDED(hr)) + { + if(fClearDest) + { + hr = RegRecursiveDeleteKey(hkeyDest, szSubKeyDest); + if(hr == SPERR_NOT_FOUND) + { + hr = S_OK; + } + } + + if(SUCCEEDED(hr)) + { + l = ::RegCreateKeyEx(hkeyDest, szSubKeyDest, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey2, NULL); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + } + + if(SUCCEEDED(hr)) + { + TCHAR szName[MAX_PATH]; + BYTE data[MAX_PATH]; + DWORD cbName, cbData, dwType; + + // copy the values + if(SUCCEEDED(hr)) + { + for(DWORD i = 0; SUCCEEDED(hr); i++) + { + BYTE* _data = data; + cbName = cbData = MAX_PATH; + l = ::RegEnumValue(hkey1, i, szName, &cbName, NULL, &dwType, data, &cbData); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + if(hr == HRESULT_FROM_WIN32(ERROR_MORE_DATA)) // buffer is not large enough to hold the data + { + _data = new BYTE[cbData]; + if(_data) + { + l = ::RegEnumValue(hkey1, i, szName, &cbName, NULL, &dwType, _data, &cbData); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + } + } + if(SUCCEEDED(hr)) + { + l = ::RegSetValueEx(hkey2, szName, NULL, dwType, _data, cbData); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + } + if(_data && _data != data) + { + delete[] _data; + } + } + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = S_OK; + } + + // recursively copy the subkeys + if(SUCCEEDED(hr)) + { + for(DWORD i = 0; SUCCEEDED(hr); i++) + { + cbName = MAX_PATH; + l = ::RegEnumKeyEx(hkey1, i, szName, &cbName, NULL, NULL, NULL, NULL); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + + if(SUCCEEDED(hr)) + { + hr = RegRecursiveCopyKey(hkey1, szName, hkey2, szName); + } + } + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = S_OK; + } + + ::RegCloseKey(hkey2); + } + + ::RegCloseKey(hkey1); + } + + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = SPERR_NO_MORE_ITEMS; + if(hr == SpHrFromWin32(ERROR_FILE_NOT_FOUND)) hr = SPERR_NOT_FOUND; + return hr; +} + +inline HRESULT RemoveTestAppLexicon() +{ + + HRESULT hr = S_OK; + CComPtr cpEnum; + CComPtr cpSpObjectToken; + + if( SUCCEEDED( hr ) ) + { + // Get tts test engine voice + hr = SpEnumTokens(SPCAT_APPLEXICONS, L"TTSCompliance", NULL, &cpEnum); + } + + if( hr == S_OK ) + { + CAutoReleaseComPtr cpToken; + hr = cpEnum->Next(1, &cpToken, NULL); + while(hr == S_OK) + { + hr = cpToken->RemoveStorageFileName(CLSID_SpUnCompressedLexicon, L"DataFile", TRUE); + if(( hr == S_OK ) || (hr == SPERR_NOT_FOUND)) + { + hr = cpToken->Remove(NULL); // remove the token itself + } + if(SUCCEEDED(hr)) + { + hr = cpEnum->Next(1, &cpToken, NULL); + } + } + } + + return hr; +} + + +//*****************************************************************************/ +//Similar to CreateStreamOnHGlobal Win32 API, but allows a stream to be created +inline HRESULT SPCreateStreamOnHGlobal( + HGLOBAL hGlobal, //Memory handle for the stream object + BOOL fDeleteOnRelease, //Whether to free memory when the object is released + REFGUID rguidFormatId, //Format ID for stream + const WAVEFORMATEX * pwfex, //WaveFormatEx for stream + ISpStream ** ppStream) //Address of variable to receive ISpStream pointer +{ + HRESULT hr; + IStream * pMemStream; + *ppStream = NULL; + hr = ::CreateStreamOnHGlobal(hGlobal, fDeleteOnRelease, &pMemStream); + if (SUCCEEDED(hr)) + { + hr = ::CoCreateInstance(CLSID_SpStream, NULL, CLSCTX_ALL, __uuidof(*ppStream), (void **)ppStream); + if (SUCCEEDED(hr)) + { + hr = (*ppStream)->SetBaseStream(pMemStream, rguidFormatId, pwfex); + if (FAILED(hr)) + { + (*ppStream)->Release(); + *ppStream = NULL; + } + } + pMemStream->Release(); + } + return hr; +} + + +/************* Test function prototypes (TestProc's) *************/ +// ISpTTSEngine Tests +TESTPROCAPI t_ISpTTSEngine_Speak (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_ISpTTSEngine_Skip (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_ISpTTSEngine_GetOutputFormat (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_ISpTTSEngine_SetRate (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_ISpTTSEngine_SetVolume (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// Eventing Tests +TESTPROCAPI t_CheckEventsSAPI (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEventsNotRequire (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// TTS Markup Tests +TESTPROCAPI t_XMLBookmark (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLSilence (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLSpell (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLPronounce (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLRate (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLVolume (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLPitch (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLNonSapiTagsTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLEmphTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLPartOfSpTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLContext (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// Real Time Rate/Vol Tests +TESTPROCAPI t_RealTimeRateChange (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_RealTimeVolumeChange (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +//Multiple Instances test +TESTPROCAPI t_MultiInstanceTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// Audio State Tests +TESTPROCAPI t_SpeakStop (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_SpeakDestroy (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// Lexicon test +TESTPROCAPI t_UserLexiconTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_AppLexiconTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +//the following are used in Multiple instance tests + +TESTPROCAPI t_ISpTTSEngine_Skip_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false); +TESTPROCAPI t_ISpTTSEngine_Speak_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false); +TESTPROCAPI t_ISpTTSEngine_GetOutputFormat_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false); +TESTPROCAPI t_ISpTTSEngine_SetRate_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false) ; +TESTPROCAPI t_ISpTTSEngine_SetVolume_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false) ; +TESTPROCAPI t_RealTimeRateChange_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_RealTimeVolumeChange_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_SpeakStop_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_CheckEventsSAPI_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) ; +TESTPROCAPI t_LexiconMulti_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLSAPIMarkup_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLContext_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLBookmark_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLSilence_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLPronounce_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLRate_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLVolume_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLPitch_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLSpell_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); + +#endif //__TTSCOMP_H__ \ No newline at end of file diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.rc b/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.rc new file mode 100644 index 00000000..9af2fc71 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.rc @@ -0,0 +1,532 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING1 "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20" + IDS_STRING5 "SpeakStop Ž¸”s" + IDS_STRING6 "‚±‚Ì’·‚¢•¶Žš—ñ‚ÍI—¹‚³‚¹‚È‚¢‚Å‚­‚¾‚³‚¢BŽŸ‚̃R[ƒh‚Å•ú‚½‚ê‚Ü‚·BƒGƒ“ƒWƒ“‚͊ԈႢ‚È‚­³‚µ‚­Á‹Ž‚·‚é‚Í‚¸‚Å‚·B" + IDS_STRING7 "SpeakDestroy Ž¸”s" + IDS_STRING8 "‚Ý‚È‚³‚ñ ‚±‚ñ‚É‚¿‚Í" + IDS_STRING9 "SAPI required Eventing Ž¸”s" + IDS_STRING10 "‚±‚ê‚̓eƒXƒg‚Å‚·B" + IDS_STRING11 "‰½‚Æ‚©‚©‚ñ‚Æ‚©B‰½‚Æ‚©‚©‚ñ‚Æ‚©B‰½‚Æ‚©‚©‚ñ‚Æ‚©B B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚©" + IDS_STRING12 "Initialization function Ž¸”s" + IDS_STRING13 "ISpVoice::Speak Ž¸”s" + IDS_STRING14 "ISpTTSEngine::GetOutputFormat Ž¸”s" + IDS_STRING15 "SAPI feature(optional) events Ž¸”s" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING16 "ISpVoice::SetRate Ž¸”s" + IDS_STRING17 "ISpVoice::GetRate Ž¸”s" + IDS_STRING18 "ISpVoice::SetVolume Ž¸”s" + IDS_STRING19 "ISpVoice::GetVolume Ž¸”s" + IDS_STRING20 " ƒuƒbƒNƒ}[ƒNB ƒeƒXƒgB" + IDS_STRING21 "123" + IDS_STRING22 "Engine bookmark Ž¸”s" + IDS_STRING23 "‚Ý‚È‚³‚ñ‚±‚ñ‚É‚¿‚Í" + IDS_STRING24 "‚Ý‚È‚³‚ñ ‚±‚ñ‚É‚¿‚Í" + IDS_STRING25 "Engine Silence tag Ž¸”s" + IDS_STRING26 "ENGLISH LANGUAGE" + IDS_STRING27 "ENGLISH LANGUAGE" + IDS_STRING28 "Engine Spell Ž¸”s" + IDS_STRING29 "Engine Pronounce Ž¸”s" + IDS_STRING30 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING31 "‚±‚ñ‚É‚¿‚Í" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING32 "Engine rate Ž¸”s" + IDS_STRING33 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING34 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING35 "Engine volumeE Ž¸”s" + IDS_STRING36 "±‚ñ‚É‚¿‚Í" + IDS_STRING37 "±‚ñ‚É‚¿‚Í" + IDS_STRING38 "±‚ñ‚É‚¿‚Í" + IDS_STRING39 "Engine pitch Ž¸”s" + IDS_STRING41 "‚Ý‚È‚³‚ñ ‚±‚ñ‚É‚¿‚Í" + IDS_STRING42 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING43 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING44 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING45 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING46 "‚±‚ñ‚É‚¿‚Í" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING48 "ƒNƒCƒŠƒŠƒ‰" + IDS_STRING49 "%s" + IDS_STRING50 "%s" + IDS_STRING51 "Engine partofspeech Ž¸”s" + IDS_STRING52 "ƒ\ƒ‰ƒ‚ƒZƒiƒJƒCƒXƒgƒ‰ƒnƒJƒeƒ`ƒXƒCƒ}ƒ`ƒZƒ`ƒ~ƒCƒgƒCƒJƒCƒTƒJƒJƒ‰ƒgƒZƒCƒCƒ\ƒCƒ~ƒLƒjƒ~ƒC" + IDS_STRING53 " ‚±‚Ì•¶Žš—ñ‚̓ŠƒAƒ‹ƒ^ƒCƒ€‚Ì‘¬“x‚Ɖ¹—ʃeƒXƒg‚ÅŽg‚¢‚Ü‚·B‘¬“x‚Ɖ¹—Ê‚Í’†‚ɇ‚킹‚Ü‚·BƒGƒ“ƒWƒ“‚ÍA‚±‚̕ω»‚ð“Ç‚ÝŽæ‚è‚Ü‚·B" + IDS_STRING54 "Real time SetRate Ž¸”s" + IDS_STRING55 "Real time SetVolume Ž¸”s" + IDS_STRING56 "“Œ" + IDS_STRING57 "“Œ" + IDS_STRING59 "ISpVoice::Skip Ž¸”s" + IDS_STRING60 "ISpVoice::SetOutput Ž¸”s" + IDS_STRING61 "ISpVoice::WaitUntilDone Ž¸”s" + IDS_STRING62 "ISpVoice::WaitForNotifyEvent Ž¸”s" + IDS_STRING63 "‚¢‚¿B ‚ÉB ‚³‚ñB ‚æ‚ñB ‚²B ‚ë‚­B ‚µ‚¿B ‚Í‚¿B ‚«‚イB ‚¶‚イBB‚¢‚¿B ‚ÉB ‚³‚ñB ‚æ‚ñB ‚²B ‚ë‚­B ‚µ‚¿B ‚Í‚¿B ‚«‚イB ‚¶‚イB" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING64 "ƒRƒ“ƒsƒ…[ƒ^" + IDS_STRING65 "This is the TTS Compliance " + IDS_STRING66 "Non-SAPI tags Ž¸”s" + IDS_STRING67 " Non-SAPI tags " + IDS_STRING68 "•·‚±‚¦‚Ü‚·‚©H@‚Ü‚·‚©H" + IDS_STRING69 "•·‚±‚¦‚Ü‚·‚©H@‚Ü‚·‚©H" + IDS_STRING70 "Engine Emph tag Ž¸”s" + IDS_STRING71 "ƒ“ƒ‰ƒiƒ`ƒXƒCƒiƒgƒjƒ~ƒLƒ}ƒ`ƒZƒ`ƒ~ƒCƒgƒCƒJƒCƒ~ƒLƒjƒ~ƒCƒ`ƒ~ƒVƒJƒCƒgƒJƒjƒ~ƒLƒZƒXƒ‰ƒ~ƒiƒ~ƒ\ƒjƒ`ƒJƒjƒ‰ƒ~" + IDS_STRING74 "App Lexicon Ž¸”s" + IDS_STRING75 "User Lexicon Ž¸”s" + IDS_STRING76 "ƒnƒ‹" + IDS_STRING77 "TTSSymToPhoneId Ž¸”s" + IDS_STRING78 "Out of memory!" + IDS_STRING79 "ISpStream::Seek Ž¸”s" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING81 "SPCreateStreamOnHGlobal or create CTestStream Ž¸”s" + IDS_STRING82 "GetAmpFromSamples Ž¸”s" + IDS_STRING83 "GetWStrFromRes Ž¸”s" + IDS_STRING84 "new CSpStreamFormat or AssignFormat Ž¸”s" + IDS_STRING85 "CoCreateInstance Ž¸”s" + IDS_STRING86 "GetPronunciations Ž¸”s" + IDS_STRING87 "AddPronunciation Ž¸”s" + IDS_STRING88 "t_SpeakTwoStreams Ž¸”s" + IDS_STRING89 "RemovePronunciation Ž¸”s" + IDS_STRING90 "Get stream size Ž¸”s" + IDS_STRING91 "GetFreqFromSamples Ž¸”s" + IDS_STRING93 "SPBindToFile Ž¸”s" + IDS_STRING94 "ƒNƒCƒŠƒŠƒ‰ƒNƒCƒŠƒŠƒ‰ƒeƒ‰ƒXƒŠƒVƒ“ƒ‰ƒiƒ`ƒXƒCƒiƒgƒjƒ~ƒLƒ}ƒ`ƒZƒ`ƒ~ƒCƒgƒCƒJƒCƒ~ƒLƒjƒ~ƒCƒ`ƒ~ƒVƒJƒCƒgƒJƒjƒ~ƒLƒZƒXƒ‰ƒ~ƒiƒ~ƒ\ƒjƒ`ƒJƒjƒ‰ƒ~" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING96 "RegRecursiveCopyKey Ž¸”s" + IDS_STRING97 "RegRecursiveDeleteKey Ž¸”s" + IDS_STRING98 "CreateAppLexicon Ž¸”s" + IDS_STRING99 "12/21/9912.21.00 12-21-9999" + IDS_STRING100 "21/12/0021.12.3321-12-1999" + IDS_STRING101 "99/12/2199.12.21 1999-12-21" + IDS_STRING102 "99-121999.1299/12" + IDS_STRING103 "12-9912.199912/99" + IDS_STRING104 "21.12 21-12 21/12""" + IDS_STRING105 "12-21 12.21 12/21" + IDS_STRING106 " 1999 2001" + IDS_STRING107 "12:30:1012:301'21""" + IDS_STRING108 "3432" + IDS_STRING109 "3432" + IDS_STRING110 "3/15" + IDS_STRING111 "423.12433" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING112 "(425)706-2693" + IDS_STRING113 " \\ 12312.91" + IDS_STRING114 "http://www.Microsoft.com" + IDS_STRING115 "bob@microsoft.com" + IDS_STRING116 "—X•Ö”Ô†@996-8890@“Œ‹ž“s`‹æ˜Z–{–Ø@1-5-6 " + IDS_STRING117 " A2C 4X5 " + IDS_STRING118 "ƒeƒXƒg" + IDS_STRING119 "MSN ƒ[ƒ‹ƒ}ƒKƒWƒ“‚ÆMSN ƒ[ƒŠƒ“ƒOƒŠƒXƒg‚̃T[ƒrƒXŠJŽn‚É‚æ‚èAƒ†[ƒU[‚ÍA16,000Ž‚ð‰z‚¦‚éƒ[ƒ‹ƒ}ƒKƒWƒ“‚ÆA11,000ˆÈã‚̃[ƒŠƒ“ƒOƒŠƒXƒg‚Ìî•ñ‚ðAMSNã‚Å—˜—p‚Å‚«‚é‚悤‚É‚È‚è‚Ü‚·B My name is Frances Sandy Joseph Hill Alam Jr. I was born in 12/1/2006, 12:30:11pm on 123 St., St. Luis. I weight 6.23456789 lb I got my B.S., M.S., and Ph.D from Flintstone Univ. in Mars planet. I have created many 3D pictures. I have to pay $123123123123.5 tax every year. It costs about 85% of my income. Anyway, life is a box of M & M chocolate. Usually I watch DVD and listen MTV on VH1 between 3pm to 12am w/o Mathew. If you like, Go to http://www.DoesNotExist.com/ and send your comments to ttsengines@hotmail.com or call me at (888)888-CONTEXT, or mail to: 1845666 9th Ave. NE Earth, WA 98188 ." + IDS_STRING120 "GetEvents Ž¸”s" + IDS_STRING121 "ƒ“ƒ‰ƒiƒ`ƒXƒCƒiƒgƒjƒ~ƒLƒ}ƒ`ƒZƒ`ƒ~ƒCƒgƒCƒJƒCƒ~ƒLƒjƒ~ƒCƒ`ƒ~ƒVƒJƒCƒgƒJƒjƒ~ƒLƒZƒXƒ‰ƒ~ƒiƒ~ƒ\ƒjƒ`ƒJƒjƒ‰ƒ~" + IDS_STRING122 "ƒNƒCƒŠƒŠƒ‰" +END + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Chinese (P.R.C.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) +#ifdef _WIN32 +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +#pragma code_page(936) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING1 "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20" + IDS_STRING5 "SpeakStop ²âÊÔʧ°Ü¡£" + IDS_STRING6 "ÕâÊÇÒ»¸ö²»»á±»Íê³ÉµÄ³¤×Ö·û´®£¬ÒòΪÎÒÃÇÔÚÏÂÒ»ÐгÌÐòÀïÊÍ·ÅÁËËü¡£ÎÒÃÇÆÚÍûÒýÇæÄÜÕýÈ·µØÇåÀí¡£" + IDS_STRING7 "SpeakDestroy ²âÊÔʧ°Ü¡£" + IDS_STRING8 "ÄãºÃ ÊÀ½ç¡£" + IDS_STRING9 "SAPI required Events ²âÊÔʧ°Ü£¡" + IDS_STRING10 "ÕâÊÇÒ»¸ö²âÊÔ¡£" + IDS_STRING11 "ºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃ" + IDS_STRING12 "³õʼ»¯º¯Êýʧ°Ü¡£" + IDS_STRING13 "ISpVoice::Speak ʧ°Ü¡£" + IDS_STRING14 "ISpTTSEngine::GetOutputFormat ʧ°Ü¡£" + IDS_STRING15 "SAPI feature(optional) events ²âÊÔʧ°Ü£¡" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING16 "ISpVoice::SetRate ʧ°Ü¡£" + IDS_STRING17 "ISpVoice::GetRate ʧ°Ü¡£" + IDS_STRING18 "ISpVoice::SetVolume ʧ°Ü¡£" + IDS_STRING19 "ISpVoice::GetVolume ʧ°Ü¡£" + IDS_STRING20 " Ê顣ǩ¡£ ²âÊÔ¡£" + IDS_STRING21 "123" + IDS_STRING22 "Engine BOOKMARK ²âÊÔʧ°Ü£¡" + IDS_STRING23 "ÄãºÃ£¬ÊÀ½ç¡£" + IDS_STRING24 "ÄãºÃ ÊÀ½ç¡£" + IDS_STRING25 "Engine Silence tag ²âÊÔʧ°Ü£¡" + IDS_STRING26 "ENGLISH LANGUAGE" + IDS_STRING27 "ENGLISH LANGUAGE" + IDS_STRING28 "Engine Spell tag ²âÊÔʧ°Ü£¡" + IDS_STRING29 "Engine Pron tag ²âÊÔʧ°Ü£¡" + IDS_STRING30 "ÄãºÃÊÀ½ç" + IDS_STRING31 "ÄãºÃÊÀ½ç" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING32 "Engine Rate ²âÊÔʧ°Ü£¡" + IDS_STRING33 "ÄãºÃ" + IDS_STRING34 "ÄãºÃ" + IDS_STRING35 "Engine Volume ²âÊÔʧ°Ü£¡" + IDS_STRING36 "ÄãºÃ" + IDS_STRING37 "ÄãºÃ" + IDS_STRING38 "ÄãºÃ" + IDS_STRING39 "Engine Pitch ²âÊÔʧ°Ü£¡" + IDS_STRING41 "ÄãºÃ ÊÀ½ç¡£" + IDS_STRING42 "ÄãºÃ" + IDS_STRING43 "ÄãºÃ" + IDS_STRING44 "ÄãºÃ" + IDS_STRING45 "ÄãºÃ" + IDS_STRING46 "ÄãºÃ" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING48 "hao 3 kuai 4" + IDS_STRING49 "%s" + IDS_STRING50 "%s" + IDS_STRING51 "Engine Part Of Speech ²âÊÔʧ°Ü£¡" + IDS_STRING52 "shou 3 shu 4 mu 4 lu 4 di 4 zhei 5 wo 3 wu 2 lun 4 xi 1 fang 1 xiao 3 xie 3 she 2 ma 3 mao 1 meng 4 shao 4 nian 2" + IDS_STRING53 "Õâ ¸ö×Ö·û´®±»ÓÃ×öʵʱÊýÂʺÍÒôÁ¿²âÊÔ¡£ËüµÄÊýÂʺÍÒôÁ¿ÔÚÖм䱻µ÷Õû¡£ÒýÇæÒò¸ÃʵÐÐÕâЩµ÷Õû¡£" + IDS_STRING54 "Engine Real time SetRate ²âÊÔʧ°Ü£¡" + IDS_STRING55 "Engine Real time SetVolume ²âÊÔʧ°Ü£¡" + IDS_STRING56 "Äã" + IDS_STRING57 "Äã" + IDS_STRING59 "ISpVoice::Skip ʧ°Ü" + IDS_STRING60 "ISpVoice::SetOutput ʧ°Ü" + IDS_STRING61 "ISpVoice::WaitUntilDone ʧ°Ü" + IDS_STRING62 "ISpVoice::WaitForNotifyEvent ʧ°Ü" + IDS_STRING63 "¾ä×ÓÒ»¡£¾ä×Ó¶þ¡£¾ä×ÓÈý¡£¾ä×ÓËÄ¡£¾ä×ÓÎå¡£¾ä×ÓÁù¡£¾ä×ÓÆß¡£¾ä×Ó°Ë¡£¾ä×Ӿš£ ¾ä×ÓÊ®¡£ ¡£ ¾ä×ÓÒ»¡£¾ä×Ó¶þ¡£¾ä×ÓÈý¡£¾ä×ÓËÄ¡£¾ä×ÓÎå¡£¾ä×ÓÁù¡£¾ä×ÓÆß¡£¾ä×Ó°Ë¡£¾ä×Ó¡£ ¾ä×ÓÊ®¡£ " +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING64 "Äã" + IDS_STRING65 "ÕâÊÇÒ»¸öÔĶÁÈí¼þÒ»ÖÂÐԵIJâÊÔ" + IDS_STRING66 "Engine Non SAPI tags ²âÊÔʧ°Ü£¡" + IDS_STRING67 "ÕâÊÇÒ»¸ö·Ç±ê×¼²âÊÔ" + IDS_STRING68 "ÄãÄÜÌý¼ûÎÒÂð?" + IDS_STRING69 "ÄãÄÜÌý¼ûÎÒÂð?" + IDS_STRING70 "Engine EMPH ²âÊÔʧ°Ü£¡" + IDS_STRING71 "jian 3 cha 2 chan 3 ye 4 shou 3 shu 4 mu 4 lu 4 di 4 zhei 5 wo 3 wu 2 lun 4 xi 1 fang 1 xiao 3 xie 3 she 2 ma 3 mao 1 meng 4 shao 4 nian 2 fo 2 chuang 4 ye 4 lun 2 chuan 2 fu 4 qin 1 kan 4 fei 1 fan 4 er 3 nu 3 li 4 a 1 fei 1 lu 4 di 4" + IDS_STRING74 "App Lexicon ²âÊÔʧ°Ü£¡" + IDS_STRING75 "User Lexicon ²âÊÔʧ°Ü£¡" + IDS_STRING76 "×ö" + IDS_STRING77 "TTSSymToPhoneId ʧ°Ü" + IDS_STRING78 "ÄÚ´æ²»¹»!" + IDS_STRING79 "ISpStream::Seek ʧ°Ü" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING81 "SPCreateStreamOnHGlobal or create CTestStream ʧ°Ü" + IDS_STRING82 "GetAmpFromSamples ʧ°Ü" + IDS_STRING83 "GetWStrFromRes ʧ°Ü" + IDS_STRING84 "CSpStreamFormat or AssignFormat ʧ°Ü" + IDS_STRING85 "CoCreateInstance ʧ°Ü" + IDS_STRING86 "GetPronunciation ʧ°Ü" + IDS_STRING87 "AddPronunciation ʧ°Ü" + IDS_STRING88 "t_SpeakTwoStreams ʧ°Ü" + IDS_STRING89 "RemovePronunciation ʧ°Ü" + IDS_STRING90 "Get stream size ʧ°Ü" + IDS_STRING91 "GetFreqFromSamples ʧ°Ü" + IDS_STRING93 "SPBindToFile ʧ°Ü" + IDS_STRING94 "fei 1 fei 1 shu 4 mu 4 lu 4 di 4 zhei 5 wo 3 wu 2 lun 4 xi 1 fang 1 xiao 3 xie 3 she 2 ma 3 mao 1 meng 4 ga 1 ma 3 gan 1 jing 4 tie 3 qi 4 ni 3 hao 3 hao 3" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING96 "RegRecursiveCopyKey ʧ°Ü" + IDS_STRING97 "RegRecursiveDeleteKey ʧ°Ü" + IDS_STRING98 "CreateAppLexicon ʧ°Ü" + IDS_STRING99 "12/21/9912.21.00 12-21-9999" + IDS_STRING100 "21/12/0021.12.3321-12-1999" + IDS_STRING101 "99/12/2199.12.21 1999-12-21" + IDS_STRING102 "99-121999.1299/12" + IDS_STRING103 "12-9912.199912/99" + IDS_STRING104 "21.12 21-12 21/12""" + IDS_STRING105 "12-21 12.21 12/21" + IDS_STRING106 " 1999 2001" + IDS_STRING107 "12:30:1012:301'21""" + IDS_STRING108 "3432" + IDS_STRING109 "3432" + IDS_STRING110 "3/15" + IDS_STRING111 "423.12433" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING112 "(425)706-2693" + IDS_STRING113 " £¤ 12312.91" + IDS_STRING114 "http://www.Microsoft.com" + IDS_STRING115 "bob@microsoft.com" + IDS_STRING116 "ÖйúÉϺ£ÊÐÄϾ©Â·178ºÅ 3 Ū 4 ÊÒ ÓÊÕþ±àÂë 203203 " + IDS_STRING117 "A2C 4X5 " + IDS_STRING118 "ÄãºÃ" + IDS_STRING119 "ÎÒµÄÃû×ֽдóɽ¡£ ÎÒ³öÉíÓÚ12/1/2006 12:30:11pm ±±¾©ÊÐÕÒ²»µ½´ó½Ö¡£ÎÒÓÐ 6.23456789lb¡£ÎÒÓÐ B.S. M.S. ºÍ Ph.D. ÎÒÿÄêÒª¸¶³ö £¤123123123123.5 µÄË°¡£ÕâÊÇ ´óÔ¼Õ¼85%ÎÒµÄÊÕÈë¡£ÎÞÂÛÈçºÎ£¬ÉúÃü¾ÍÏñÒ»ºÐ M&M ÇÉ¿ËÁ¦¡£Í¨³£ÎÒ¿´DVD´Ó3pmµ½12pm¡£Èç¹ûÄãÏ룬Çë¿´ÍøÂç http://www.DoesNotExist.com¡£ ͬʱÇëÀ´µç×ÓÓʼþµ½£ºttsengines@hotmial.com£¬ »òÔòÀ´µç (888)888-CONTEXT £¬ »òÔòÀ´ÐÅÇë¼Ä Öйú±±¾©Óöµ½´ó½Ö20ºÅ£¬µØÇò£¬Ì«Ñôϵ 98008¡£" + IDS_STRING120 "GetEvents ʧ°Ü" + IDS_STRING121 "fei 1 fei 1 shu 4 mu 4 lu 4 di 4 zhei 5 wo 3 wu 2 lun 4 xi 1 fang 1 xiao 3 xie 3 she 2 ma 3 mao 1 meng 4 ga 1 ma 3 gan 1 jing 4 tie 3 qi 4 ni 3 hao 3 hao 3" + IDS_STRING122 "fei 1 fei 1 shu 4 mu 4 lu 4 di 4" +END + +#endif // Chinese (P.R.C.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING1 "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20" + IDS_STRING5 "SpeakStop test failed." + IDS_STRING6 "This is a long string of text that will not complete because we release it in the next line of code. We expect the engine to clean-up correctly and not fault." + IDS_STRING7 "SpeakDestroy test failed." + IDS_STRING8 "Hello world." + IDS_STRING9 "SAPI required Eventing test failed!" + IDS_STRING10 "This is a test." + IDS_STRING11 "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah." + IDS_STRING12 "Initialization function failed. Skipping tests." + IDS_STRING13 "ISpVoice::Speak failed" + IDS_STRING14 "ISpTTSEngine::GetOutputFormat failed" + IDS_STRING15 "SAPI feature Eventing test failed!" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING16 "ISpVoice::SetRate failed" + IDS_STRING17 "ISpVoice::GetRate failed" + IDS_STRING18 "ISpVoice::SetVolume failed" + IDS_STRING19 "ISpVoice::GetVolume failed" + IDS_STRING20 " Book. mark. test1." + IDS_STRING21 "123" + IDS_STRING22 "Engine bookmark test failed." + IDS_STRING23 "Hello world." + IDS_STRING24 "Hello world." + IDS_STRING25 "Engine Silence tag test failed!" + IDS_STRING26 "ENGLISH LANGUAGE" + IDS_STRING27 "ENGLISH LANGUAGE" + IDS_STRING28 "Engine Spell test failed!" + IDS_STRING29 "Engine Pronounce test failed!" + IDS_STRING30 "hello world" + IDS_STRING31 "hello world" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING32 "Engine rate test failed!" + IDS_STRING33 "hello" + IDS_STRING34 "hello" + IDS_STRING35 "Engine volume test failed!" + IDS_STRING36 "a" + IDS_STRING37 "a" + IDS_STRING38 "a" + IDS_STRING39 "Engine pitch test failed!" + IDS_STRING41 "Hello world." + IDS_STRING42 "hello" + IDS_STRING43 "hello" + IDS_STRING44 "hello" + IDS_STRING45 "hello" + IDS_STRING46 "hello" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING48 "h l ow" + IDS_STRING49 "%s" + IDS_STRING50 "%s" + IDS_STRING51 "Engine partofspeech test failed!" + IDS_STRING52 "n ow n p r ow n ow aa ae ah ao aw b ch eh er" + IDS_STRING53 "This string is used in the real time rate and volume tests. It's rate and volume are adjusted mid stream. Engines should pick these changes up." + IDS_STRING54 "Real time SetRate test failed!" + IDS_STRING55 "Real time SetVolume test failed." + IDS_STRING56 "a" + IDS_STRING57 "a" + IDS_STRING59 "ISpVoice::Skip failed" + IDS_STRING60 "ISpVoice::SetOutput failed" + IDS_STRING61 "ISpVoice::WaitUntilDone failed" + IDS_STRING62 "ISpVoice::WaitForNotifyEvent failed" + IDS_STRING63 "one. two. three. four. five. six. seven. eight. nine. ten. bookmark event. one. two. three. four. five. six. seven. eight. nine. ten. " +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING64 "Computer" + IDS_STRING65 "This is the TTS Compliance Test" + IDS_STRING66 "Non-SAPI tags Test Failed" + IDS_STRING67 " Non-SAPI tags test " + IDS_STRING68 "Do you hear me?" + IDS_STRING69 "Do you hearme?" + IDS_STRING70 "Engine Emph tag test failed" + IDS_STRING71 "dh aa n th ow p ow l ow jh iy aa n th ow p ow l ow jh iy aa n th ow p ow l ow jh ch ow ao ah ow ow p ow l ow jh ch ow ao ah ow" + IDS_STRING74 "App Lexicon test failed" + IDS_STRING75 "User Lexicon test failed!" + IDS_STRING76 "test" + IDS_STRING77 "TTSSymToPhoneId failed" + IDS_STRING78 "Out of memory!" + IDS_STRING79 "ISpStream::Seek failed" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING81 "SPCreateStreamOnHGlobal or create CTestStream failed" + IDS_STRING82 "GetAmpFromSamples failed" + IDS_STRING83 "GetWStrFromRes failed" + IDS_STRING84 "new CSpStreamFormat or AssignFormat failed" + IDS_STRING85 "CoCreateInstance failed" + IDS_STRING86 "GetPronunciations failed" + IDS_STRING87 "AddPronunciation failed" + IDS_STRING88 "t_SpeakTwoStreams failed" + IDS_STRING89 "RemovePronunciation failed" + IDS_STRING90 "Get stream size failed" + IDS_STRING91 "GetFreqFromSamples failed" + IDS_STRING93 "SPBindToFile failed" + IDS_STRING94 "h eh l ow w er l d h eh l ow w er l d h eh l ow w er l d h eh l ow w er l d" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING96 "RegRecursiveCopyKey failed" + IDS_STRING97 "RegRecursiveDeleteKey failed" + IDS_STRING98 "CreateAppLexicon failed" + IDS_STRING99 "12/21/9912.21.00 12-21-9999" + IDS_STRING100 "21/12/0021.12.3321-12-1999" + IDS_STRING101 "99/12/2199.12.21 1999-12-21" + IDS_STRING102 "99-121999.1299/12" + IDS_STRING103 "12-9912.199912/99" + IDS_STRING104 "21.12 21-12 21/12""" + IDS_STRING105 "12-21 12.21 12/21" + IDS_STRING106 " 1999 2001" + IDS_STRING107 "12:30:1012:301'21""" + IDS_STRING108 "3432" + IDS_STRING109 "3432" + IDS_STRING110 "3/15" + IDS_STRING111 "423.12433" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING112 "(425)706-2693" + IDS_STRING113 "$12312.90" + IDS_STRING114 "http://www.Microsoft.com" + IDS_STRING115 "bob@microsoft.com" + IDS_STRING116 "One Microsoft Way, Redmond, WA, 98052 " + IDS_STRING117 " A2C 4X5 " + IDS_STRING118 " text " + IDS_STRING119 "My name is Frances Sandy Joseph Hill Alam Jr. I was born in 12/1/2006, 12:30:11pm on 123 St., St. Luis. I weight 6.23456789 lb I got my B.S., M.S., and Ph.D from Flintstone Univ. in Mars planet. I have created many 3D pictures. I have to pay $123123123123.5 tax every year. It costs about 85% of my income. Anyway, life is a box of M & M chocolate. Usually I watch DVD and listen MTV on VH1 between 3pm to 12am w/o Mathew. If you like, Go to http://www.DoesNotExist.com/ and send your comments to ttsengines@hotmail.com or call me at (888)888-CONTEXT, or mail to: 1845666 9th Ave. NE Earth, WA 98188 ." + IDS_STRING120 "GetEvents failed" + IDS_STRING121 "aa dh aa n th ow p ow l ow jh iy aa n th ow p ow l ow jh iy aa n th ow p ow l ow jh ch ow ao ah ow ow p ow l ow jh ch ow ao ah ow" + IDS_STRING122 "aa dh aa n th ow" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/ttsmarkup.cpp b/mp/src/utils/sapi51/Tools/Comp/TTS/ttsmarkup.cpp new file mode 100644 index 00000000..c015b5cb --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/ttsmarkup.cpp @@ -0,0 +1,1726 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// ttsmarkup.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** +#include "f0.h" +int +ComputeF0 (float* data, int nData, int sampFreq, int minF0, int maxF0, int feaSampFreq, + float** f0, int* nF0, float **pRms, int *nRms) +{ + char parStr[128]; + F0Data f0Obj = NULL; + F0Out f0Frame; + int buffSize; + int buffStep; + int nFrames; + int remainder; + int nOutput; + int outSampNum; + int i; + int j; + +// assert (data); + // assert (nData>0); + // assert (sampFreq); + // assert (feaSampFreq); + // assert (f0); + + /* + * Create and initialize the f0 object + */ + if ((f0Obj = F0_NewF0Obj ()) == NULL) { + goto error; + } + + sprintf (parStr ,"frame_step=%f", 1.0/feaSampFreq); + if (!F0_ParseParameter (f0Obj, parStr)) { + goto error; + } + + sprintf (parStr ,"min_f0=%f", (float)minF0); + if (!F0_ParseParameter (f0Obj, parStr)) { + goto error; + } + + sprintf (parStr ,"max_f0=%f", (float)maxF0); + if (!F0_ParseParameter (f0Obj, parStr)) { + goto error; + } + + if (!F0_Init (f0Obj, sampFreq, &buffSize, &buffStep)) { + goto error; + } + + /* + * Prepare memory for output + */ + *nF0 = *nRms = (int) (((nData / (float)sampFreq) * feaSampFreq) + 0.5); + + *f0 = NULL; + *pRms = NULL; + if ( (*f0 = (float *) malloc(*nF0 * sizeof(**f0))) == NULL) + { + goto error; + } + if ( (*pRms = (float *) malloc(*nRms * sizeof(**pRms))) == NULL) + { + goto error; + } + + /* + * Start processing + */ + nFrames = (nData - buffSize) / buffStep + 1; + remainder = nData - nFrames*buffStep; + + outSampNum = 0; + + /* Iterate over number of frames*/ + for (i = 0; i cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLBookmark_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLBookmark_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test passes a Bookmark through XML marked up text to a TTS engine and checks +// to make sure a SPFEI_BOOKMARK event has fired. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + BOOL bGetEvents = true; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + DWORD dwEventsRetrieved = 0; + WCHAR szwBmk[MAX_PATH]=L""; + + + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetNotifyWin32Event(); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetInterest( SPFEI(SPEI_TTS_BOOKMARK), SPFEI(SPEI_TTS_BOOKMARK) ); + } + + //clean up the event queue + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + } + CHECKHRId( hr, tpr, IDS_STRING120 ); + + if( SUCCEEDED( hr ) ) + { + GetWStrFromRes( IDS_STRING20, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->WaitUntilDone( TTS_WAITTIME ); + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, " in t_XMLBookmarkTest"); + } + + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + + if( hr == S_OK ) + { + // Record the events retrieved in dwFlagsRetrieved + dwEventsRetrieved |= (DWORD)Event.eEventId; + + if (Event.eEventId == SPEI_TTS_BOOKMARK ) + { + //swprintf( szwBmk, L"%s, %d", (WCHAR*)Event.lParam, Event.wParam ); + //g_pKato->Comment(10, szwBmk); + + //verify bookmark string (lparam and wparam) + GetWStrFromRes( IDS_STRING21, szwDebug ); + CHECKASSERTGOTOId(( !wcscmp( (WCHAR*)Event.lParam, szwDebug ) ), tpr, IDS_STRING22); + CHECKASSERTGOTOId(( Event.wParam == _wtol(szwDebug) ), tpr, IDS_STRING22); + + break; + } + } + + } + + + // Logging info + CHECKHRId( hr, tpr, IDS_STRING22 ); + + // Make sure correct events were retrieved + CHECKASSERTGOTOId(((dwEventsRetrieved & SPEI_TTS_BOOKMARK) == SPEI_TTS_BOOKMARK), tpr, IDS_STRING22); + + +EXIT: + + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLSilence(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLSilence_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLSilence_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test speaks 2 streams. One with a Silence pause and one without. It analyzes +//the two streams to make sure a change has occured. This tests SILENCE tag. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with no SILENCE tag"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING23, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples1 > 0), tpr, IDS_STRING25, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 2 with SILENCE tag"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING24, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples2 > 0), tpr, IDS_STRING25, TEST_TOPIC ); + + // Now compare the length of the 2 streams + // Note - check to ensure cSamples2 is at least twice greater than cSamples1. + CHECKASSERTId((cSamples2 > 2 * cSamples1), tpr, IDS_STRING25); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLSpell(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLSpell_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLSpell_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test generates two streams. One that says English as a single word and one that +// spells it out. It analyzes the produced .wav forms to make sure that the second streams +// overall size is greater. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + LANGID LangID; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with no Spell tag"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING26, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + + //====================================================================== + TEST_TOPIC = "Stream 2 with Spell tag"; + //====================================================================== + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING27, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + + //For Chinese/Japanese TTS Engines, the test ignores result check since + //Spell tag can be ignored in those languages + + if ( ( LangID != 2052 ) && ( LangID != 1041 )) + { + CHECKASSERTGOTOIdEx((cSamples2 != 0), tpr, IDS_STRING28, TEST_TOPIC ); + CHECKASSERTGOTOIdEx((cSamples1 != 0), tpr, IDS_STRING28, TEST_TOPIC ); + + // Now compare the values from the 2 streams. + // Note - check to ensure cSamples2 is at least 4/3 greater than cSamples1. + CHECKASSERTId(((3 * cSamples2 )> (4 * cSamples1)), tpr, IDS_STRING28); + } +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLPronounce(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLPronounce_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLPronounce_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test generates two streams. One that says "a" as a single word. The next stream +// says "a" but tells the engine to pronounce it as a random long word. It analyzes the +// produced .wav forms to make sure that the second stream's overall size is greater. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with no PRON tag"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + // short string + hr = GetWStrFromRes( IDS_STRING56, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples1 != 0), tpr, IDS_STRING29, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 2 with PRON tag"; + //====================================================================== + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + // short string pronounced as a long string + hr = GetWStrFromRes( IDS_STRING57, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples2 != 0), tpr, IDS_STRING29, TEST_TOPIC ); + + // Now compare the values from the 2 streams + // Note - check to ensure cSamples2 is at least twice greater than cSamples1. + CHECKASSERTId((cSamples2> (2 * cSamples1)), tpr, IDS_STRING29); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLRate(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLRate_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLRate_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test changes the rate of a TTS engine twice through XML and analyzes the +// .wav form to make sure a change has occured. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with rate set to -5"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING30, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples1 != 0), tpr, IDS_STRING32, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 2 with rate set to 5"; + //====================================================================== + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING31, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + CHECKASSERTGOTOIdEx((cSamples2 != 0), tpr, IDS_STRING32, TEST_TOPIC ); + + // Now compare the values from the 2 streams + // 1. First check ensures low rate has bigger cSamples than higher rate + // 2. Secondly check ensures cSamples1 and cSamples2 has enough distance + // + CHECKASSERTId((cSamples1 > cSamples2 ), tpr, IDS_STRING32); + +EXIT: + + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLVolume(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLVolume_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLVolume_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test changes the volume of a TTS engine twice through XML and analyzes the +// .wav form to make sure a change has occured. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + CComPtr cpStream1; + CComPtr cpStream2; + ULONG cSamples=0; + ULONG ulRatio=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + ULONG totalAmp1 = 0, totalAmp2 = 0; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId( hr, tpr, IDS_STRING84 ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with Volume 100"; + //====================================================================== + + //*** First stream with volume set to 100 + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING33, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + LARGE_INTEGER l; + l.QuadPart = 0; + + // Reset stream to beginning + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream1, &totalAmp1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 2 with Volume 1"; + //====================================================================== + + //*** Second stream with volume set to 1 + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING34, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Reset stream to beginning + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream2, &totalAmp2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + //Make sure the amplitudes of stream1 and stream2 are greater than 0 + CHECKASSERTGOTOId( (totalAmp1 > 0), tpr, IDS_STRING35 ); + CHECKASSERTGOTOId( (totalAmp2 > 0), tpr, IDS_STRING35 ); + + // Note - The test assumes that the overall amplitude from stream 1 will + // be at least 3 times that of stream 2 + + ulRatio = totalAmp1/totalAmp2; + + CHECKASSERTId( (ulRatio>1), tpr, IDS_STRING35 ); + +EXIT: + + return tpr; +} + +//******************************************************************************** +TESTPROCAPI t_XMLPitch(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLPitch_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLPitch_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test changes the pitch of a TTS engine twice through XML and analyzes the +// .wav form to make sure a change has occured. It first speaks a sentence at +// normal pitch and finds the average of the positive amplitude. The average positive +// amplitude is then used as a threshhold above which peak detection is measured. It +// is expected that a higher pitch wav form will have more peaks above the threshhold +// then a lower pitch wav form will. +// NOTE - wav samples are run through a low frequency filter to generate a smother +// wav form. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + ULONG cSamples = 0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + ULONG freq1=0, freq2=0; + float fratio = 0; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); //sampFreq = 22050; + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + hr = cpVoice->SetVolume( 100 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + hr = cpVoice->SetRate( 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING16, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Stream # 1 with low pitch"; + //====================================================================== + + // Create stream #1 with low pitch + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + hr = GetWStrFromRes( IDS_STRING37, szwSpeakStr ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING83, TEST_TOPIC ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC ); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples != 0), tpr, IDS_STRING39, TEST_TOPIC ); + + LARGE_INTEGER l; + l.QuadPart = 0; + + // Reset stream to beginning + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + hr = GetFreqFromSamples (cpStream1, 22050, cSamples, &freq1); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING91, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream # 2 with high pitch"; + //====================================================================== + + // Create stream #2 with high pitch + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + hr = GetWStrFromRes( IDS_STRING38, szwSpeakStr ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING83, TEST_TOPIC ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC ); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + CHECKASSERTGOTOIdEx((cSamples != 0), tpr, IDS_STRING39, TEST_TOPIC ); + + // Reset stream to beginning + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + hr = GetFreqFromSamples (cpStream2, 22050, cSamples, &freq2); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING91, TEST_TOPIC ); + + { + //debug + TCHAR szDInfo[MAX_PATH]=TEXT(""); + _stprintf( szDInfo, TEXT("freq1 = %d, freq2 = %d"), freq1, freq2 ); + g_pKato->Comment(10, szDInfo); + } + + // Now compare the frequencies of the audio output streams + // Note - Average freqencey with high pitch has at least 1.2 times higher than + // low pitch + CHECKASSERTId((freq1 > 0), tpr, IDS_STRING39 ); + CHECKASSERTId((freq2 > 0), tpr, IDS_STRING39 ); + fratio = (float)freq2/(float)freq1; + CHECKASSERTId((fratio > 1.2 ), tpr, IDS_STRING39 ); + +EXIT: + + return tpr; +} + +//*************************************************************************************** +TESTPROCAPI t_XMLNonSapiTagsTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with an arbitrary non-sapi tag. In this case, SAPI supplys the + //SPVA_ParseUnknownTag text fragment state to the tts engine. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CComPtr cpVoice; + CComPtr cpStream; + WCHAR szwSpeakStr[MAX_PATH]=L""; + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId(hr, tpr, IDS_STRING84); + + //create a SAPI voice + hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); + CHECKHRGOTOId( hr, tpr, IDS_STRING85 ); + + hr = GetWStrFromRes( IDS_STRING67, szwSpeakStr ); + CHECKHRGOTOId(hr, tpr, IDS_STRING83); + + // Create a generic stream to send the audio data to so we don't have to listen to it + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOId(hr, tpr, IDS_STRING81 ); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOId(hr, tpr, IDS_STRING60 ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRId(hr, tpr, IDS_STRING13); + +EXIT: + return tpr; +} + +//********************************************************************************* +TESTPROCAPI t_XMLEmphTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with EMPH tag. Test uses Pitch, Rate and volume to measure + //the output streams. The test assume that the output stream of EMPH is different + //in Rate, or Volume, or pitch from one without emph. If engines implement EMPH in + //other different way, rather than use pitch, rate, or volume, then this test will + //fail. And the test result will be "Not Supported". + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CComPtr cpVoice; + CComPtr cpStream1; + CComPtr cpStream2; + ULONG ulRatio=0; + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + ULONG totalAmp1 = 0, totalAmp2 = 0; + ULONG freq1=0, freq2=0; + + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + hr = GetWStrFromRes( IDS_STRING69, szwSpeakStr ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING83, TEST_TOPIC ); + + // Create the SAPI voice + hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING85, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream #1 without Emph"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + //no Emph + hr = GetWStrFromRes( IDS_STRING68, szwSpeakStr ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING83, TEST_TOPIC ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC ); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + + LARGE_INTEGER l; + l.QuadPart = 0; + + // Reset stream to beginning + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream1, &totalAmp1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + // Reset stream to beginning again + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + //get frequency + hr = GetFreqFromSamples (cpStream1, 22050, cSamples1, &freq1); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING91, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream #2 with Emph"; + //====================================================================== + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + GetWStrFromRes( IDS_STRING69, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC ); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + + // Reset stream to beginning + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + // get the sum of the amplitude from the stream 2 + hr = GetAmpFromSamples (cpStream2, &totalAmp2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82 , TEST_TOPIC ); + + // Reset stream to beginning again + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + hr = GetFreqFromSamples (cpStream2, 22050, cSamples2, &freq2); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING91, TEST_TOPIC ); + + //Compare the two streams by Pitch, volume, and Rate. + //The output streams should be different in pitch, or volume, or Rate. + + //Rate measurement + + CHECKISSUPPORTEDId( (cSamples2 > 0), tpr, IDS_STRING70 ); + CHECKISSUPPORTEDId( (cSamples1 > 0), tpr, IDS_STRING70 ); + + //Volume measurement + CHECKISSUPPORTEDId( (totalAmp1 > 0), tpr, IDS_STRING70 ); + CHECKISSUPPORTEDId( (totalAmp2 > 0), tpr, IDS_STRING70 ); + + // Pitch measurement + CHECKISSUPPORTEDId( (freq2 > 0), tpr, IDS_STRING70 ); + CHECKISSUPPORTEDId( (freq1 > 0), tpr, IDS_STRING70 ); + + CHECKISSUPPORTEDId( (freq2 != freq1 ) || (cSamples2 != cSamples1 ) || (totalAmp2 != totalAmp1) , tpr, IDS_STRING70 ); + +EXIT: + return tpr; +} + +//******************************************************************************** +TESTPROCAPI t_XMLContext(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLContext_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +//******************************************************************************** +TESTPROCAPI t_XMLContext_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpStream; + const char * TEST_TOPIC = ""; + WCHAR szwSpeakStr[1024]=L""; + + //====================================================================== + TEST_TOPIC = "Context: Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + // Create stream + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#1a - date_mdy"; + //====================================================================== + + //Date in mdy format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING99, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#1b - date_dmy"; + //====================================================================== + + //Date in date_dmy format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING100, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#1c - date_ymd"; + //====================================================================== + + //Date in date_ymd format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING101, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2a - date_ym"; + //====================================================================== + + //Date in date_ym format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING102, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2b - date_my"; + //====================================================================== + + //Date in date_my format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING103, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2c - date_dm"; + //====================================================================== + + //Date in date_dm format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING104, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2d - date_md"; + //====================================================================== + + //Date in date_md format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING105, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2e - date_md"; + //====================================================================== + + //Date in date_year format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING106, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#3 - time"; + //====================================================================== + + //Time in time_hms format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING107, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#4a - number_cardinal"; + //====================================================================== + + //Number in number_cardinal format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING108, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#4b - number_digit"; + //====================================================================== + + //Number in number_digit format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING109, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#4c - number_fraction"; + //====================================================================== + + //Number in number_fraction format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING110, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#4d - number_decimal"; + //====================================================================== + + //Number in number_decimal format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING111, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#5 - phone_number"; + //====================================================================== + + // phone_number format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING112, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#6 - currency"; + //====================================================================== + + // currency format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING113, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#7 - web"; + //====================================================================== + + // web format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING114, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#8 - email_address"; + //====================================================================== + + // email address format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING115, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#9 - address"; + //====================================================================== + + // address format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING116, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#10 - address_postal"; + //====================================================================== + + // address postal format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING117, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#11 - my context tests"; + //====================================================================== + // + // ms context format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING118, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + +EXIT: + return tpr; +} + +//************************************************************************************* +TESTPROCAPI t_XMLPartOfSpTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test is trying to Speak with PartOfSP tags. + //Currently it is in the feature list. The test result will be "Supported" + // or "Unsupported". + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + + CComPtr cpVoice; + CComPtr cpConlexicon; + LANGID LangID; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStrNoun[MAX_PATH]=L""; + WCHAR szwSpeakStrVerb[MAX_PATH]=L""; + WCHAR szNewWord[MAX_PATH]=L""; + WCHAR szwSpeakstr[MAX_PATH]=L""; + WCHAR szVPronunciation[MAX_PATH]=L""; + WCHAR szNPronunciation[MAX_PATH]=L""; + + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + hr = GetWStrFromRes( IDS_STRING76, szNewWord ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //create a SAPI voice + hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING85, TEST_TOPIC ); + + hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING85, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Add verb pronunciation to a word"; + //====================================================================== + + hr = GetWStrFromRes( IDS_STRING48, szwSpeakStrVerb ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwSpeakStrVerb, szVPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + hr = cpConlexicon->RemovePronunciation(szNewWord, LangID, SPPS_Verb, szVPronunciation); + CHECKHRALTGOTOIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //Assign the verb pronunciation of the new word + hr = cpConlexicon->AddPronunciation(szNewWord, LangID, SPPS_Verb, szVPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING87, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Add noun pronunciation to a word"; + //====================================================================== + + hr = GetWStrFromRes( IDS_STRING52, szwSpeakStrNoun ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwSpeakStrNoun, szNPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + hr = cpConlexicon->RemovePronunciation(szNewWord, LangID, SPPS_Noun, szNPronunciation); + CHECKHRALTGOTOIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //add the word in noun pronunciation to Lexicon + hr = cpConlexicon->AddPronunciation(szNewWord, LangID, SPPS_Noun, szNPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING87, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Speak two streams with PartOfSp"; + //====================================================================== + + //speak two streams + hr = GetWStrFromRes( IDS_STRING49, szwSpeakstr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + swprintf( szwSpeakStrNoun, szwSpeakstr, szNewWord ); + + hr = GetWStrFromRes( IDS_STRING50, szwSpeakstr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + swprintf( szwSpeakStrVerb, szwSpeakstr, szNewWord ); + + hr = t_SpeakTwoStreams(cpVoice, szwSpeakStrNoun, szwSpeakStrVerb, cSamples1, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC); + + hr = cpConlexicon->RemovePronunciation(szNewWord, LangID, SPPS_Noun, szNPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING89, TEST_TOPIC); + + hr = cpConlexicon->RemovePronunciation(szNewWord, LangID, SPPS_Verb, szVPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING89, TEST_TOPIC); + + CHECKISSUPPORTEDId((cSamples1 > 0 ), tpr, IDS_STRING51); + CHECKISSUPPORTEDId((cSamples2 > 0 ), tpr, IDS_STRING51); + + //This test assumes that second stream should be twice shorter than the first one. + CHECKISSUPPORTEDId( ( 2* cSamples2 < cSamples1), tpr, IDS_STRING51); + +EXIT: + return tpr; +} + +//************************************************************************************** +TESTPROCAPI t_XMLSAPIMarkup_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + // This test expects TTS engines to handle all possible spec'ed out combinations + //of the XML tags. + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + else if(lpFTE) // called by SpComp directly. It is NULL in multiInstance test. + { + srand(reinterpret_cast(tpParam)->dwRandomSeed); + } + + CComPtr cpStream; + + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwXMLString[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId(hr, tpr, IDS_STRING84); + + //====================================================================== + TEST_TOPIC = "Markup Test: Initialization"; + //====================================================================== + + // Create a generic stream to send the audio data to so we don't have to listen to it + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Bookmark"; + //====================================================================== + + // Bookmark + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING8, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Silence"; + //====================================================================== + + // Silence + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING41, szwSpeakStr );); + swprintf( szwXMLString, szwSpeakStr, GET_RANDOM(0, 2000) ); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Spell"; + //====================================================================== + + // Spell + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING27, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Pron"; + //====================================================================== + + // Pronounce + + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING43, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Rate"; + //====================================================================== + + // Rate + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING44, szwSpeakStr );); + swprintf( szwXMLString, szwSpeakStr, GET_RANDOM(-10, 10) ); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + //====================================================================== + TEST_TOPIC = "Markup Test: Volume"; + //====================================================================== + + // Volume + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING45, szwSpeakStr );); + swprintf( szwXMLString, szwSpeakStr, GET_RANDOM(0, 100) ); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Pitch"; + //====================================================================== + + // Pitch + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING46, szwSpeakStr );); + swprintf( szwXMLString, szwSpeakStr, GET_RANDOM(-10, 10) ); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Non-Sapi"; + //====================================================================== + //Non-Sapi + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING67, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Context"; + //====================================================================== + + //Context + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING119, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING61, " in t_XMLBookmarkTest"); + + +EXIT: + return tpr; +} + + + diff --git a/mp/src/utils/sapi51/Tools/Comp/TTS/version.rc2 b/mp/src/utils/sapi51/Tools/Comp/TTS/version.rc2 new file mode 100644 index 00000000..10937ef2 --- /dev/null +++ b/mp/src/utils/sapi51/Tools/Comp/TTS/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Microsoft TTS Compliance Test Tool\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "ttscomp\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "ttscomp.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Bin/SAPI51ListBox.ocx b/sp/src/utils/sapi51/Bin/SAPI51ListBox.ocx new file mode 100644 index 00000000..cf95b595 Binary files /dev/null and b/sp/src/utils/sapi51/Bin/SAPI51ListBox.ocx differ diff --git a/sp/src/utils/sapi51/Docs/Help/sapi.chm b/sp/src/utils/sapi51/Docs/Help/sapi.chm new file mode 100644 index 00000000..49c84bfa Binary files /dev/null and b/sp/src/utils/sapi51/Docs/Help/sapi.chm differ diff --git a/sp/src/utils/sapi51/IDL/sapi.idl b/sp/src/utils/sapi51/IDL/sapi.idl new file mode 100644 index 00000000..130efbda --- /dev/null +++ b/sp/src/utils/sapi51/IDL/sapi.idl @@ -0,0 +1,2197 @@ +/**************************************************************************** +* sapi.idl +* +* This is the interface definition file for the Microsoft Speech API +* Version 5.0. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +//--- Compiler Directive ---------------------------------------------------- +cpp_quote("#pragma warning(disable:4201) // Allow nameless structs/unions") + +//--- Includes -------------------------------------------------------------- +import "oaidl.idl"; +import "ocidl.idl"; + +//--- Locally scoped define for LANGID +#ifndef LANGID +#define LANGID WORD +#endif + +//--- Link with sapi.lib +cpp_quote("#pragma comment(lib, \"sapi.lib\")") + +//--- Forward and External Declarations ------------------------------------- + +cpp_quote("#if 0") // Ignore our definition in the .H file +typedef [restricted, hidden] struct WAVEFORMATEX +{ + WORD wFormatTag; /* format type */ + WORD nChannels; /* number of channels (i.e. mono, stereo...) */ + DWORD nSamplesPerSec; /* sample rate */ + DWORD nAvgBytesPerSec; /* for buffer estimation */ + WORD nBlockAlign; /* block size of data */ + WORD wBitsPerSample; /* Number of bits per sample of mono data */ + WORD cbSize; /* The count in bytes of the size of + extra information (after cbSize) */ + +} WAVEFORMATEX; +cpp_quote("#else") +cpp_quote("#include ") +cpp_quote("#endif") + + +//--- Notifications +interface ISpNotifySource; +interface ISpNotifySink; +interface ISpNotifyTranslator; + +//--- Object tokens +interface ISpDataKey; +interface ISpObjectTokenCategory; +interface ISpObjectToken; +interface IEnumSpObjectTokens; +interface ISpObjectWithToken; + +//--- Resource management +interface ISpResourceManager; + +//--- Speech specific events +interface ISpEventSource; +interface ISpEventSink; + +//--- Audio streams +interface ISpStreamFormat; +interface ISpStream; +interface ISpStreamFormatConverter; +interface ISpAudio; +interface ISpMMSysAudio; +interface ISpTranscript; + + +//--- TTS interface +interface ISpVoice; + +//--- SR interfaces +interface ISpRecoResult; +interface ISpRecoContext; +interface ISpRecognizer; +interface ISpProperties; + +//--- Lexicon interfaces +interface ISpLexicon; + +//--- Phone Converter +interface ISpPhoneConverter; + +//--- Phrase interface +interface ISpPhrase; + +// +//--- Constants ------------------------------------------------------------- +// + +//--- DataKey locations +typedef [hidden] enum SPDATAKEYLOCATION +{ + SPDKL_DefaultLocation = 0, + SPDKL_CurrentUser = 1, + SPDKL_LocalMachine = 2, + SPDKL_CurrentConfig = 5 +} SPDATAKEYLOCATION; + +//--- TokenUI constants +cpp_quote("#define SPDUI_EngineProperties L\"EngineProperties\"") +cpp_quote("#define SPDUI_AddRemoveWord L\"AddRemoveWord\"") +cpp_quote("#define SPDUI_UserTraining L\"UserTraining\"") +cpp_quote("#define SPDUI_MicTraining L\"MicTraining\"") +cpp_quote("#define SPDUI_RecoProfileProperties L\"RecoProfileProperties\"") +cpp_quote("#define SPDUI_AudioProperties L\"AudioProperties\"") +cpp_quote("#define SPDUI_AudioVolume L\"AudioVolume\"") + +//--- Data formats - these are used by the CSpStreamFormat class in sphelper.h +typedef [hidden] enum SPSTREAMFORMAT +{ + SPSF_Default = -1, + SPSF_NoAssignedFormat = 0, // Similar to GUID_NULL + SPSF_Text, + SPSF_NonStandardFormat, // Non-SAPI 5.1 standard format with no WAVEFORMATEX description + SPSF_ExtendedAudioFormat, // Non-SAPI 5.1 standard format but has WAVEFORMATEX description + // Standard PCM wave formats + SPSF_8kHz8BitMono, + SPSF_8kHz8BitStereo, + SPSF_8kHz16BitMono, + SPSF_8kHz16BitStereo, + SPSF_11kHz8BitMono, + SPSF_11kHz8BitStereo, + SPSF_11kHz16BitMono, + SPSF_11kHz16BitStereo, + SPSF_12kHz8BitMono, + SPSF_12kHz8BitStereo, + SPSF_12kHz16BitMono, + SPSF_12kHz16BitStereo, + SPSF_16kHz8BitMono, + SPSF_16kHz8BitStereo, + SPSF_16kHz16BitMono, + SPSF_16kHz16BitStereo, + SPSF_22kHz8BitMono, + SPSF_22kHz8BitStereo, + SPSF_22kHz16BitMono, + SPSF_22kHz16BitStereo, + SPSF_24kHz8BitMono, + SPSF_24kHz8BitStereo, + SPSF_24kHz16BitMono, + SPSF_24kHz16BitStereo, + SPSF_32kHz8BitMono, + SPSF_32kHz8BitStereo, + SPSF_32kHz16BitMono, + SPSF_32kHz16BitStereo, + SPSF_44kHz8BitMono, + SPSF_44kHz8BitStereo, + SPSF_44kHz16BitMono, + SPSF_44kHz16BitStereo, + SPSF_48kHz8BitMono, + SPSF_48kHz8BitStereo, + SPSF_48kHz16BitMono, + SPSF_48kHz16BitStereo, + // TrueSpeech format + SPSF_TrueSpeech_8kHz1BitMono, + // A-Law formats + SPSF_CCITT_ALaw_8kHzMono, + SPSF_CCITT_ALaw_8kHzStereo, + SPSF_CCITT_ALaw_11kHzMono, + SPSF_CCITT_ALaw_11kHzStereo, + SPSF_CCITT_ALaw_22kHzMono, + SPSF_CCITT_ALaw_22kHzStereo, + SPSF_CCITT_ALaw_44kHzMono, + SPSF_CCITT_ALaw_44kHzStereo, + // u-Law formats + SPSF_CCITT_uLaw_8kHzMono, + SPSF_CCITT_uLaw_8kHzStereo, + SPSF_CCITT_uLaw_11kHzMono, + SPSF_CCITT_uLaw_11kHzStereo, + SPSF_CCITT_uLaw_22kHzMono, + SPSF_CCITT_uLaw_22kHzStereo, + SPSF_CCITT_uLaw_44kHzMono, + SPSF_CCITT_uLaw_44kHzStereo, + // ADPCM formats + SPSF_ADPCM_8kHzMono, + SPSF_ADPCM_8kHzStereo, + SPSF_ADPCM_11kHzMono, + SPSF_ADPCM_11kHzStereo, + SPSF_ADPCM_22kHzMono, + SPSF_ADPCM_22kHzStereo, + SPSF_ADPCM_44kHzMono, + SPSF_ADPCM_44kHzStereo, + // GSM 6.10 formats + SPSF_GSM610_8kHzMono, + SPSF_GSM610_11kHzMono, + SPSF_GSM610_22kHzMono, + SPSF_GSM610_44kHzMono, + SPSF_NUM_FORMATS +} SPSTREAMFORMAT; + +cpp_quote("EXTERN_C const GUID SPDFID_Text;") +cpp_quote("EXTERN_C const GUID SPDFID_WaveFormatEx;") + +//--- Root of registry entries for speech use +cpp_quote("#define SPREG_USER_ROOT L\"HKEY_CURRENT_USER\\\\SOFTWARE\\\\Microsoft\\\\Speech\"") +cpp_quote("#define SPREG_LOCAL_MACHINE_ROOT L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\"") + +//--- Categories for speech resource management +cpp_quote("#define SPCAT_AUDIOOUT L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioOutput\"") +cpp_quote("#define SPCAT_AUDIOIN L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioInput\"") +cpp_quote("#define SPCAT_VOICES L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\Voices\"") +cpp_quote("#define SPCAT_RECOGNIZERS L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\Recognizers\"") +cpp_quote("#define SPCAT_APPLEXICONS L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AppLexicons\"") +cpp_quote("#define SPCAT_PHONECONVERTERS L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\PhoneConverters\"") +cpp_quote("#define SPCAT_RECOPROFILES L\"HKEY_CURRENT_USER\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\RecoProfiles\"") + +//--- Specific token ids of interest +cpp_quote("#define SPMMSYS_AUDIO_IN_TOKEN_ID L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioInput\\\\TokenEnums\\\\MMAudioIn\\\\\"") +cpp_quote("#define SPMMSYS_AUDIO_OUT_TOKEN_ID L\"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\AudioOutput\\\\TokenEnums\\\\MMAudioOut\\\\\"") +cpp_quote("#define SPCURRENT_USER_LEXICON_TOKEN_ID L\"HKEY_CURRENT_USER\\\\SOFTWARE\\\\Microsoft\\\\Speech\\\\CurrentUserLexicon\"") + +//--- Standard token values +cpp_quote("#define SPTOKENVALUE_CLSID L\"CLSID\"") +cpp_quote("#define SPTOKENKEY_FILES L\"Files\"") +cpp_quote("#define SPTOKENKEY_UI L\"UI\"") +cpp_quote("#define SPTOKENKEY_ATTRIBUTES L\"Attributes\"") + +//--- Standard voice category values +cpp_quote("#define SPVOICECATEGORY_TTSRATE L\"DefaultTTSRate\"") + +//--- Standard SR Engine properties +cpp_quote("#define SPPROP_RESOURCE_USAGE L\"ResourceUsage\"") +cpp_quote("#define SPPROP_HIGH_CONFIDENCE_THRESHOLD L\"HighConfidenceThreshold\"") +cpp_quote("#define SPPROP_NORMAL_CONFIDENCE_THRESHOLD L\"NormalConfidenceThreshold\"") +cpp_quote("#define SPPROP_LOW_CONFIDENCE_THRESHOLD L\"LowConfidenceThreshold\"") +cpp_quote("#define SPPROP_RESPONSE_SPEED L\"ResponseSpeed\"") +cpp_quote("#define SPPROP_COMPLEX_RESPONSE_SPEED L\"ComplexResponseSpeed\"") +cpp_quote("#define SPPROP_ADAPTATION_ON L\"AdaptationOn\"") + +//--- Standard SAPI Recognition Topics +cpp_quote("#define SPTOPIC_SPELLING L\"Spelling\"") + +// CFG Wildcard token +cpp_quote("#define SPWILDCARD L\"...\"") + +// CFG Dication token +cpp_quote("#define SPDICTATION L\"*\"") +cpp_quote("#define SPINFDICTATION L\"*+\"") + +// CFG confidence scores +const signed char SP_LOW_CONFIDENCE = -1; +const signed char SP_NORMAL_CONFIDENCE = 0; +const signed char SP_HIGH_CONFIDENCE = +1; + +// CFG default weight +const float DEFAULT_WEIGHT = 1.0; + +// Lexicon word and pronunciation limits +const ULONG SP_MAX_WORD_LENGTH = 128; +const ULONG SP_MAX_PRON_LENGTH = 384; + +// +//--- Interface definitions ------------------------------------------------- +// + +//--- ISpNotifyCallback ----------------------------------------------------- + +cpp_quote("#if defined(__cplusplus)") +cpp_quote("interface ISpNotifyCallback") +cpp_quote("{") +cpp_quote("virtual HRESULT STDMETHODCALLTYPE NotifyCallback(") +cpp_quote(" WPARAM wParam,") +cpp_quote(" LPARAM lParam) = 0;") +cpp_quote("};") +cpp_quote("#else") +typedef void * ISpNotifyCallback; +cpp_quote("#endif") + +cpp_quote("#if 0") +typedef void * SPNOTIFYCALLBACK; +cpp_quote("#else") +cpp_quote("typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam);") +cpp_quote("#endif") + +//--- ISpNotifySource ------------------------------------------------------- +[ + object, + uuid(5EFF4AEF-8487-11D2-961C-00C04F8EE628), + helpstring("ISpNotifySource Interface"), + pointer_default(unique), + restricted +] +interface ISpNotifySource : IUnknown +{ + HRESULT SetNotifySink([in] ISpNotifySink * pNotifySink); + [local] HRESULT SetNotifyWindowMessage( + [in] HWND hWnd, + [in] UINT Msg, + [in] WPARAM wParam, + [in] LPARAM lParam); + [local] HRESULT SetNotifyCallbackFunction( + [in] SPNOTIFYCALLBACK * pfnCallback, + [in] WPARAM wParam, + [in] LPARAM lParam); + [local] HRESULT SetNotifyCallbackInterface( + [in] ISpNotifyCallback * pSpCallback, + [in] WPARAM wParam, + [in] LPARAM lParam); + [local] HRESULT SetNotifyWin32Event(void); + [local] HRESULT WaitForNotifyEvent([in] DWORD dwMilliseconds); + [local] HANDLE GetNotifyEventHandle(); +} + +//--- ISpNotifySink --------------------------------------------------------- +[ + object, + uuid(259684DC-37C3-11D2-9603-00C04F8EE628), + helpstring("ISpNotifySink Interface"), + pointer_default(unique), + restricted +] +interface ISpNotifySink : IUnknown +{ + HRESULT Notify(void); +} + + +//--- ISpNotifyTranslator --------------------------------------------------- +[ + object, + uuid(ACA16614-5D3D-11D2-960E-00C04F8EE628), + helpstring("ISpNotifyTranslator Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpNotifyTranslator : ISpNotifySink +{ + HRESULT InitWindowMessage( + [in] HWND hWnd, + [in] UINT Msg, + [in] WPARAM wParam, + [in] LPARAM lParam); + HRESULT InitCallback( + [in] SPNOTIFYCALLBACK * pfnCallback, + [in] WPARAM wParam, + [in] LPARAM lParam); + HRESULT InitSpNotifyCallback( + [in] ISpNotifyCallback * pSpCallback, + [in] WPARAM wParam, + [in] LPARAM lParam); + + HRESULT InitWin32Event( + HANDLE hEvent, + BOOL fCloseHandleOnRelease); + HRESULT Wait([in] DWORD dwMilliseconds); + HANDLE GetEventHandle(); +} + + +//--- ISpDataKey ------------------------------------------------------------ +[ + object, + uuid(14056581-E16C-11D2-BB90-00C04F8EE6C0), + helpstring("ISpDataKey Interface"), + pointer_default(unique), + restricted +] +interface ISpDataKey : IUnknown +{ + HRESULT SetData( const WCHAR * pszValueName, ULONG cbData, const BYTE * pData); + HRESULT GetData( const WCHAR * pszValueName, ULONG * pcbData, BYTE * pData); + HRESULT SetStringValue( const WCHAR * pszValueName, const WCHAR * pszValue ); + HRESULT GetStringValue( const WCHAR * pszValueName, WCHAR ** ppszValue); + HRESULT SetDWORD(const WCHAR * pszValueName, DWORD dwValue ); + HRESULT GetDWORD(const WCHAR * pszValueName, DWORD *pdwValue ); + HRESULT OpenKey(const WCHAR * pszSubKeyName, ISpDataKey ** ppSubKey); + HRESULT CreateKey(const WCHAR * pszSubKey, ISpDataKey ** ppSubKey); + HRESULT DeleteKey(const WCHAR * pszSubKey); + HRESULT DeleteValue(const WCHAR * pszValueName); + HRESULT EnumKeys(ULONG Index, WCHAR ** ppszSubKeyName); + HRESULT EnumValues(ULONG Index, WCHAR ** ppszValueName); +}; + +//--- ISpRegDataKey --------------------------------------------------------- +[ + object, + uuid(92A66E2B-C830-4149-83DF-6FC2BA1E7A5B), + helpstring("ISpRegDataKey"), + pointer_default(unique), + restricted +] +interface ISpRegDataKey : ISpDataKey +{ + [local] HRESULT SetKey([in] HKEY hkey, [in] BOOL fReadOnly); +} + +//--- ISpObjectTokenCategory ------------------------------------------------ +[ + object, + uuid(2D3D3845-39AF-4850-BBF9-40B49780011D), + helpstring("ISpObjectTokenCategory"), + pointer_default(unique), + restricted +] +interface ISpObjectTokenCategory : ISpDataKey +{ + HRESULT SetId([in] const WCHAR * pszCategoryId, BOOL fCreateIfNotExist); + HRESULT GetId([out] WCHAR ** ppszCoMemCategoryId); + HRESULT GetDataKey(SPDATAKEYLOCATION spdkl, ISpDataKey ** ppDataKey); + + HRESULT EnumTokens( + [in, string] const WCHAR * pzsReqAttribs, + [in, string] const WCHAR * pszOptAttribs, + [out] IEnumSpObjectTokens ** ppEnum); + + HRESULT SetDefaultTokenId([in] const WCHAR * pszTokenId); + HRESULT GetDefaultTokenId([out] WCHAR ** ppszCoMemTokenId); +}; + +//--- ISpObjectToken -------------------------------------------------------- +[ + object, + uuid(14056589-E16C-11D2-BB90-00C04F8EE6C0), + helpstring("ISpObjectToken Interface"), + pointer_default(unique), + restricted +] +interface ISpObjectToken : ISpDataKey +{ + HRESULT SetId(const WCHAR * pszCategoryId, const WCHAR * pszTokenId, BOOL fCreateIfNotExist); + HRESULT GetId(WCHAR ** ppszCoMemTokenId); + HRESULT GetCategory(ISpObjectTokenCategory ** ppTokenCategory); + + HRESULT CreateInstance( + [in] IUnknown * pUnkOuter, + [in] DWORD dwClsContext, + [in] REFIID riid, + [out, iid_is(riid)] void ** ppvObject); + + HRESULT GetStorageFileName( + [in] REFCLSID clsidCaller, + [in] const WCHAR * pszValueName, + [in] const WCHAR * pszFileNameSpecifier, + [in] ULONG nFolder, // Same as SHGetFolderPath -- If non-zero, must set CSIDL_FLAG_CREATE + [out] WCHAR ** ppszFilePath); + HRESULT RemoveStorageFileName( + [in] REFCLSID clsidCaller, + [in] const WCHAR * pszKeyName, + [in] BOOL fDeleteFile); + + HRESULT Remove(const CLSID * pclsidCaller); + + [local] HRESULT IsUISupported( + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [in] IUnknown * punkObject, + [out] BOOL *pfSupported); + [local] HRESULT DisplayUI( + [in] HWND hwndParent, + [in] const WCHAR * pszTitle, + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [in] IUnknown * punkObject); + HRESULT MatchesAttributes( + [in] const WCHAR * pszAttributes, + [out] BOOL *pfMatches); +}; + +[ + object, + uuid(B8AAB0CF-346F-49D8-9499-C8B03F161D51), + helpstring("ISpObjectTokenInit Interface"), + pointer_default(unique), + restricted +] +interface ISpObjectTokenInit : ISpObjectToken +{ + HRESULT InitFromDataKey( + [in] const WCHAR * pszCategoryId, + [in] const WCHAR * pszTokenId, + [in] ISpDataKey * pDataKey); +}; + +//--- IEnumSpObjectTokens --------------------------------------------------- +// This interface is used to enumerate speech object tokens + +[ + object, + uuid(06B64F9E-7FDA-11D2-B4F2-00C04F797396), + helpstring("IEnumSpObjectTokens Interface"), + pointer_default(unique), + restricted +] +interface IEnumSpObjectTokens : IUnknown +{ + HRESULT Next([in] ULONG celt, + [out, size_is(celt), length_is(*pceltFetched)] ISpObjectToken ** pelt, + [out] ULONG *pceltFetched); + HRESULT Skip([in] ULONG celt); + + HRESULT Reset(void); + HRESULT Clone([out] IEnumSpObjectTokens **ppEnum); + + HRESULT Item([in] ULONG Index, [out] ISpObjectToken ** ppToken); + + HRESULT GetCount([out] ULONG* pCount); +}; + +//--- ISpObjectWithToken ---------------------------------------------------- +[ + object, + uuid(5B559F40-E952-11D2-BB91-00C04F8EE6C0), + helpstring("ISpObjectWithToken Interface"), + pointer_default(unique), + restricted +] +interface ISpObjectWithToken : IUnknown +{ + HRESULT SetObjectToken(ISpObjectToken * pToken); + HRESULT GetObjectToken(ISpObjectToken ** ppToken); +}; + +//--- ISpResourceManager ---------------------------------------------------- +[ + object, + uuid(93384E18-5014-43D5-ADBB-A78E055926BD), + helpstring("ISpResourceManager Interface"), + pointer_default(unique), + restricted +] +#ifdef _WIN32_WCE +interface ISpResourceManager : IUnknown //IServiceProvider +#else +interface ISpResourceManager : IServiceProvider +#endif // _WIN32_WCE +{ + HRESULT SetObject( + [in] REFGUID guidServiceId, + [in] IUnknown *pUnkObject); + HRESULT GetObject( + [in] REFGUID guidServiceId, + [in] REFCLSID ObjectCLSID, + [in] REFIID ObjectIID, + [in] BOOL fReleaseWhenLastExternalRefReleased, + [out, iid_is(ObjectIID)] void** ppObject); +}; + +//--- ISpEventSource -------------------------------------------------------- +typedef [hidden] enum SPEVENTLPARAMTYPE +{ + SPET_LPARAM_IS_UNDEFINED = 0, + SPET_LPARAM_IS_TOKEN, + SPET_LPARAM_IS_OBJECT, + SPET_LPARAM_IS_POINTER, + SPET_LPARAM_IS_STRING, +} SPEVENTLPARAMTYPE; + +typedef [hidden] enum SPEVENTENUM +{ + SPEI_UNDEFINED = 0, + + //--- TTS engine + SPEI_START_INPUT_STREAM = 1, + SPEI_END_INPUT_STREAM = 2, + SPEI_VOICE_CHANGE = 3, // LPARAM_IS_TOKEN + SPEI_TTS_BOOKMARK = 4, // LPARAM_IS_STRING + SPEI_WORD_BOUNDARY = 5, + SPEI_PHONEME = 6, + SPEI_SENTENCE_BOUNDARY = 7, + SPEI_VISEME = 8, + SPEI_TTS_AUDIO_LEVEL = 9, // wParam contains current output audio level + + //--- Engine vendors use these reserved bits + SPEI_TTS_PRIVATE = 15, + + SPEI_MIN_TTS = 1, + SPEI_MAX_TTS = 15, + + //--- Speech Recognition + SPEI_END_SR_STREAM = 34, // LPARAM contains HRESULT, WPARAM contains flags (SPESF_xxx) + SPEI_SOUND_START = 35, + SPEI_SOUND_END = 36, + SPEI_PHRASE_START = 37, + SPEI_RECOGNITION = 38, + SPEI_HYPOTHESIS = 39, + SPEI_SR_BOOKMARK = 40, + SPEI_PROPERTY_NUM_CHANGE = 41, // LPARAM points to a string, WPARAM is the attrib value + SPEI_PROPERTY_STRING_CHANGE= 42, // LPARAM pointer to buffer. Two concatinated null terminated strings. + SPEI_FALSE_RECOGNITION = 43, // apparent speech with no valid recognition + SPEI_INTERFERENCE = 44, // LPARAM is any combination of SPINTERFERENCE flags + SPEI_REQUEST_UI = 45, // LPARAM is string. + SPEI_RECO_STATE_CHANGE = 46, // wParam contains new reco state + SPEI_ADAPTATION = 47, // we are now ready to accept the adaptation buffer + SPEI_START_SR_STREAM = 48, + SPEI_RECO_OTHER_CONTEXT = 49, // Phrase finished and recognized, but for other context + SPEI_SR_AUDIO_LEVEL = 50, // wParam contains current input audio level + + //--- Engine vendors use these reserved bits + SPEI_SR_PRIVATE = 52, + + SPEI_MIN_SR = 34, + SPEI_MAX_SR = 52, + + SPEI_RESERVED1 = 30, // do not use + SPEI_RESERVED2 = 33, // do not use + SPEI_RESERVED3 = 63 // do not use +} SPEVENTENUM; + +cpp_quote("#define SPFEI_FLAGCHECK ( (1ui64 << SPEI_RESERVED1) | (1ui64 << SPEI_RESERVED2) )") + +cpp_quote("#define SPFEI_ALL_TTS_EVENTS (0x000000000000FFFEui64 | SPFEI_FLAGCHECK)") +cpp_quote("#define SPFEI_ALL_SR_EVENTS (0x001FFFFC00000000ui64 | SPFEI_FLAGCHECK)") +cpp_quote("#define SPFEI_ALL_EVENTS 0xEFFFFFFFFFFFFFFFui64") + +// The SPFEI macro converts an SPEVENTENUM event value into a 64-bit value. +// Multiple values can then be OR-ed together and passed to SetInterest. +cpp_quote("#define SPFEI(SPEI_ord) ((1ui64 << SPEI_ord) | SPFEI_FLAGCHECK)") + +// SPEVENT is defined 2 ways, because the current version of MIDL does not allow enumerations +// to be used as bit fields. So we define eEventId and elParamType as int bitfields for MIDL +// and redefine them as their appropriate enumerations for C++ +cpp_quote("#if 0") +typedef [restricted, hidden] struct SPEVENT +{ + WORD eEventId; //SPEVENTENUM + WORD elParamType; //SPEVENTLPARAMTYPE + ULONG ulStreamNum; // Input stream number this event is associated with + ULONGLONG ullAudioStreamOffset; + WPARAM wParam; + LPARAM lParam; +} SPEVENT; + +typedef [restricted, hidden] struct SPSERIALIZEDEVENT +{ + WORD eEventId; //SPEVENTENUM + WORD elParamType; //SPEVENTLPARAMTYPE + ULONG ulStreamNum; // Input stream number this event is associated with + ULONGLONG ullAudioStreamOffset; + ULONG SerializedwParam; + LONG SerializedlParam; +} SPSERIALIZEDEVENT; + +typedef [restricted, hidden] struct SPSERIALIZEDEVENT64 +{ + WORD eEventId; //SPEVENTENUM + WORD elParamType; //SPEVENTLPARAMTYPE + ULONG ulStreamNum; // Input stream number this event is associated with + ULONGLONG ullAudioStreamOffset; + ULONGLONG SerializedwParam; + LONGLONG SerializedlParam; +} SPSERIALIZEDEVENT64; + +cpp_quote("#else") +cpp_quote("typedef struct SPEVENT") +cpp_quote("{") +cpp_quote(" SPEVENTENUM eEventId : 16;") +cpp_quote(" SPEVENTLPARAMTYPE elParamType : 16;") +cpp_quote(" ULONG ulStreamNum;") +cpp_quote(" ULONGLONG ullAudioStreamOffset;") +cpp_quote(" WPARAM wParam;") +cpp_quote(" LPARAM lParam;") +cpp_quote("} SPEVENT;") +cpp_quote("typedef struct SPSERIALIZEDEVENT") +cpp_quote("{") +cpp_quote(" SPEVENTENUM eEventId : 16;") +cpp_quote(" SPEVENTLPARAMTYPE elParamType : 16;") +cpp_quote(" ULONG ulStreamNum;") +cpp_quote(" ULONGLONG ullAudioStreamOffset;") +cpp_quote(" ULONG SerializedwParam;") +cpp_quote(" LONG SerializedlParam;") +cpp_quote("} SPSERIALIZEDEVENT;") +cpp_quote("typedef struct SPSERIALIZEDEVENT64") +cpp_quote("{") +cpp_quote(" SPEVENTENUM eEventId : 16;") +cpp_quote(" SPEVENTLPARAMTYPE elParamType : 16;") +cpp_quote(" ULONG ulStreamNum;") +cpp_quote(" ULONGLONG ullAudioStreamOffset;") +cpp_quote(" ULONGLONG SerializedwParam;") +cpp_quote(" LONGLONG SerializedlParam;") +cpp_quote("} SPSERIALIZEDEVENT64;") +cpp_quote("#endif") + +//--- Types of interference +typedef [hidden] enum SPINTERFERENCE +{ + SPINTERFERENCE_NONE = 0, + SPINTERFERENCE_NOISE, + SPINTERFERENCE_NOSIGNAL, + SPINTERFERENCE_TOOLOUD, + SPINTERFERENCE_TOOQUIET, + SPINTERFERENCE_TOOFAST, + SPINTERFERENCE_TOOSLOW +} SPINTERFERENCE; + +//--- Flags for END_SR_STREAM event (in WPARAM) +typedef [hidden] enum SPENDSRSTREAMFLAGS +{ + SPESF_NONE = 0, + SPESF_STREAM_RELEASED = (1 << 0) +} SPENDSRSTREAMFLAGS; + +//--- Viseme features +typedef [hidden] enum SPVFEATURE +{ + SPVFEATURE_STRESSED = (1L << 0), + SPVFEATURE_EMPHASIS = (1L << 1) +} SPVFEATURE; + + +//--- Viseme event groups +typedef [hidden] enum SPVISEMES +{ + // English examples + //------------------ + SP_VISEME_0 = 0, // Silence + SP_VISEME_1, // AE, AX, AH + SP_VISEME_2, // AA + SP_VISEME_3, // AO + SP_VISEME_4, // EY, EH, UH + SP_VISEME_5, // ER + SP_VISEME_6, // y, IY, IH, IX + SP_VISEME_7, // w, UW + SP_VISEME_8, // OW + SP_VISEME_9, // AW + SP_VISEME_10, // OY + SP_VISEME_11, // AY + SP_VISEME_12, // h + SP_VISEME_13, // r + SP_VISEME_14, // l + SP_VISEME_15, // s, z + SP_VISEME_16, // SH, CH, JH, ZH + SP_VISEME_17, // TH, DH + SP_VISEME_18, // f, v + SP_VISEME_19, // d, t, n + SP_VISEME_20, // k, g, NG + SP_VISEME_21, // p, b, m +} SPVISEMES; + +typedef [restricted, hidden] struct SPEVENTSOURCEINFO +{ + ULONGLONG ullEventInterest; + ULONGLONG ullQueuedInterest; + ULONG ulCount; +} SPEVENTSOURCEINFO; + +[ + object, + uuid(BE7A9CCE-5F9E-11D2-960F-00C04F8EE628), + helpstring("ISpEventSource Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpEventSource : ISpNotifySource +{ + // It is neccessary to use the SPFEI macro to convert the + // SPEVENTENUM values into ULONGULONG values. + HRESULT SetInterest( + [in] ULONGLONG ullEventInterest, + [in] ULONGLONG ullQueuedInterest); + + HRESULT GetEvents( + [in] ULONG ulCount, + [out, size_is(ulCount)] SPEVENT* pEventArray, + [out] ULONG *pulFetched); + + HRESULT GetInfo([out] SPEVENTSOURCEINFO * pInfo); +}; + +//--- ISpEventSink --------------------------------------------------------- +[ + object, + uuid(BE7A9CC9-5F9E-11D2-960F-00C04F8EE628), + helpstring("ISpEventSink Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpEventSink : IUnknown +{ + HRESULT AddEvents([in] const SPEVENT* pEventArray, [in] ULONG ulCount); + HRESULT GetEventInterest([out] ULONGLONG * pullEventInterest); +}; + + +//--- ISpStreamFormat ------------------------------------------------------- +[ + object, + uuid(BED530BE-2606-4F4D-A1C0-54C5CDA5566F), + helpstring("ISpStreamFormat Interface"), + pointer_default(unique), + restricted +] +interface ISpStreamFormat : IStream +{ + HRESULT GetFormat(GUID * pguidFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); +} + +typedef [hidden] enum SPFILEMODE +{ + SPFM_OPEN_READONLY, // Open existing file, read-only + SPFM_OPEN_READWRITE, // (Not supported for wav files) Open existing file, read-write + SPFM_CREATE, // (Not supported for wav files) Open file if exists, else create if does not exist (opens read-write) + SPFM_CREATE_ALWAYS, // Create file even if file exists. Destroys old file. + SPFM_NUM_MODES // Used for limit checking +} SPFILEMODE; + +//--- ISpStream ------------------------------------------------------------- + +[ + object, + uuid(12E3CCA9-7518-44C5-A5E7-BA5A79CB929E), + helpstring("ISpStream Interface"), + pointer_default(unique), + restricted +] +interface ISpStream : ISpStreamFormat +{ + HRESULT SetBaseStream(IStream * pStream, REFGUID rguidFormat, const WAVEFORMATEX * pWaveFormatEx); + HRESULT GetBaseStream(IStream ** ppStream); + HRESULT BindToFile(const WCHAR * pszFileName, SPFILEMODE eMode, + const GUID * pFormatId, const WAVEFORMATEX * pWaveFormatEx, + ULONGLONG ullEventInterest); + HRESULT Close(); +} + +//--- ISpStreamFormatConverter ---------------------------------------------- +[ + object, + uuid(678A932C-EA71-4446-9B41-78FDA6280A29), + helpstring("ISpStreamFormatConverter Interface"), + pointer_default(unique), + restricted +] +interface ISpStreamFormatConverter : ISpStreamFormat +{ + HRESULT SetBaseStream( + [in] ISpStreamFormat * pStream, + [in] BOOL fSetFormatToBaseStreamFormat, // If true, then format of format converter stream + [in] BOOL fWriteToBaseStream ); // will be set to same format as bass stream + // (set up as a pass-through). If pStream == NULL + // and this is set to TRUE, then format of stream is reset + HRESULT GetBaseStream([out] ISpStreamFormat **ppStream); + + HRESULT SetFormat([in] REFGUID rguidFormatIdOfConvertedStream, [in] const WAVEFORMATEX * pWaveFormatExOfConvertedStream); + // Note: GetFormat method of ISpStreamFormat returns the format of the converted stream. + + HRESULT ResetSeekPosition(); + + HRESULT ScaleConvertedToBaseOffset( + [in] ULONGLONG ullOffsetConvertedStream, + [out] ULONGLONG * pullOffsetBaseStream); + + HRESULT ScaleBaseToConvertedOffset( + [in] ULONGLONG ullOffsetBaseStream, + [out] ULONGLONG * pullOffsetConvertedStream); +}; + +//--- ISpAudio -------------------------------------------------------------- + +typedef [hidden] enum _SPAUDIOSTATE +{ + SPAS_CLOSED, + SPAS_STOP, + SPAS_PAUSE, + SPAS_RUN +} SPAUDIOSTATE; + +typedef [restricted, hidden] struct SPAUDIOSTATUS +{ + long cbFreeBuffSpace; + ULONG cbNonBlockingIO; + SPAUDIOSTATE State; + ULONGLONG CurSeekPos; + ULONGLONG CurDevicePos; + DWORD dwReserved1; + DWORD dwReserved2; +} SPAUDIOSTATUS; + +typedef [restricted, hidden] struct SPAUDIOBUFFERINFO +{ + ULONG ulMsMinNotification; + ULONG ulMsBufferSize; + ULONG ulMsEventBias; +} SPAUDIOBUFFERINFO; + +[ + object, + uuid(C05C768F-FAE8-4EC2-8E07-338321C12452), + helpstring("ISpAudio Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpAudio : ISpStreamFormat +{ + HRESULT SetState([in] SPAUDIOSTATE NewState, [in]ULONGLONG ullReserved ); + HRESULT SetFormat([in] REFGUID rguidFmtId, [in] const WAVEFORMATEX * pWaveFormatEx); + HRESULT GetStatus([out] SPAUDIOSTATUS * pStatus); + HRESULT SetBufferInfo([in] const SPAUDIOBUFFERINFO * pBuffInfo); + HRESULT GetBufferInfo([out] SPAUDIOBUFFERINFO * pBuffInfo); + HRESULT GetDefaultFormat([out] GUID * pFormatId, [out] WAVEFORMATEX ** ppCoMemWaveFormatEx); + HANDLE EventHandle(); + HRESULT GetVolumeLevel([out] ULONG *pLevel); + HRESULT SetVolumeLevel([in] ULONG Level); + HRESULT GetBufferNotifySize([out] ULONG *pcbSize); + HRESULT SetBufferNotifySize([in] ULONG cbSize); +}; + +//--- ISpMMSysAudio --------------------------------------------------------- +[ + object, + uuid(15806F6E-1D70-4B48-98E6-3B1A007509AB), + helpstring("ISpMMSysAudio Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpMMSysAudio : ISpAudio +{ + HRESULT GetDeviceId([out] UINT * puDeviceId); + HRESULT SetDeviceId([in] UINT uDeviceId); + HRESULT GetMMHandle(void ** pHandle); + HRESULT GetLineId([out] UINT *puLineId); + HRESULT SetLineId([in] UINT uLineId); +}; + +//--- ISpTranscript --------------------------------------------------------- +[ + object, + uuid(10F63BCE-201A-11D3-AC70-00C04F8EE6C0), + helpstring("ISpTranscript Interface"), + pointer_default(unique), + restricted +] +interface ISpTranscript : IUnknown +{ + HRESULT GetTranscript([out, string] WCHAR ** ppszTranscript); + HRESULT AppendTranscript([in, string] const WCHAR * pszTranscript); +}; + +//--- Structures used by ISpPhrase interface -------------------------------- + +typedef [hidden] enum SPDISPLYATTRIBUTES +{ + SPAF_ONE_TRAILING_SPACE = 0x02, + SPAF_TWO_TRAILING_SPACES = 0x04, + SPAF_CONSUME_LEADING_SPACES = 0x08, + SPAF_ALL = 0x0F +} SPDISPLAYATTRIBUTES; + +typedef unsigned short SPPHONEID; + +typedef [restricted, hidden] struct SPPHRASEELEMENT +{ + ULONG ulAudioTimeOffset; + ULONG ulAudioSizeTime; // In 100ns units + ULONG ulAudioStreamOffset; + ULONG ulAudioSizeBytes; + ULONG ulRetainedStreamOffset; + ULONG ulRetainedSizeBytes; + const WCHAR * pszDisplayText; + const WCHAR * pszLexicalForm; + const SPPHONEID * pszPronunciation; + BYTE bDisplayAttributes; + signed char RequiredConfidence; + signed char ActualConfidence; + BYTE Reserved; + float SREngineConfidence; +} SPPHRASEELEMENT; + +typedef [restricted, hidden] struct SPPHRASERULE SPPHRASERULE; + +[hidden] struct SPPHRASERULE +{ + const WCHAR * pszName; + ULONG ulId; + ULONG ulFirstElement; + ULONG ulCountOfElements; + const SPPHRASERULE * pNextSibling; + const SPPHRASERULE * pFirstChild; + float SREngineConfidence; + signed char Confidence; +}; + + +typedef [restricted, hidden] struct SPPHRASEPROPERTY SPPHRASEPROPERTY; + +[hidden] struct SPPHRASEPROPERTY +{ + const WCHAR * pszName; + ULONG ulId; + const WCHAR * pszValue; + VARIANT vValue; // Will be VT_BOOL, VT_I4, VT_R4, VT_R8, or VT_BYREF (only for dynamic grammars) + ULONG ulFirstElement; + ULONG ulCountOfElements; + const SPPHRASEPROPERTY* pNextSibling; + const SPPHRASEPROPERTY* pFirstChild; + float SREngineConfidence; + signed char Confidence; +}; + +typedef [restricted, hidden] struct SPPHRASEREPLACEMENT +{ + BYTE bDisplayAttributes; + const WCHAR * pszReplacementText; + ULONG ulFirstElement; + ULONG ulCountOfElements; +} SPPHRASEREPLACEMENT; + +typedef [restricted, hidden] struct SPPHRASE +{ + ULONG cbSize; // Size of structure + LANGID LangID; + WORD wReserved; + ULONGLONG ullGrammarID; + ULONGLONG ftStartTime; + ULONGLONG ullAudioStreamPosition; + ULONG ulAudioSizeBytes; + ULONG ulRetainedSizeBytes; + ULONG ulAudioSizeTime; // In 100ns units + SPPHRASERULE Rule; + const SPPHRASEPROPERTY* pProperties; + const SPPHRASEELEMENT * pElements; + ULONG cReplacements; + const SPPHRASEREPLACEMENT * pReplacements; + GUID SREngineID; + ULONG ulSREnginePrivateDataSize; + const BYTE * pSREnginePrivateData; +} SPPHRASE; + + +//--- Serialized phrase + +typedef [restricted, hidden] struct SPSERIALIZEDPHRASE +{ + ULONG ulSerializedSize; // Size of structure in bytes +} SPSERIALIZEDPHRASE; + + + +typedef [hidden] enum SPVALUETYPE +{ + SPDF_PROPERTY = 0x00000001, + SPDF_REPLACEMENT = 0x00000002, + SPDF_RULE = 0x00000004, + SPDF_DISPLAYTEXT = 0x00000008, + SPDF_LEXICALFORM = 0x00000010, + SPDF_PRONUNCIATION = 0x00000020, + SPDF_AUDIO = 0x00000040, + SPDF_ALTERNATES = 0x00000080, + SPDF_ALL = 0x000000FF +} SPVALUETYPE; + + +// Binary grammar public declaration + +typedef [hidden] struct SPBINARYGRAMMAR +{ + ULONG ulTotalSerializedSize; +} SPBINARYGRAMMAR; + +// Possible arguments for methods that take phrase element start and count + +typedef [hidden] enum SPPHRASERNG +{ + SPPR_ALL_ELEMENTS = -1 +} SPPHRASERNG; +cpp_quote("#define SP_GETWHOLEPHRASE SPPR_ALL_ELEMENTS") +cpp_quote("#define SPRR_ALL_ELEMENTS SPPR_ALL_ELEMENTS") + +cpp_quote("#if 0") +typedef void * SPSTATEHANDLE; +cpp_quote("#else") +cpp_quote("DECLARE_HANDLE(SPSTATEHANDLE);") +cpp_quote("#endif") + + + + +typedef [hidden] enum SPRECOEVENTFLAGS +{ + SPREF_AutoPause = (1 << 0), + SPREF_Emulated = (1 << 1) +} SPRECOEVENTFLAGS; + + + +//--- ISpLexicon ------------------------------------------------------------ +typedef [hidden] enum SPPARTOFSPEECH +{ + //--- SAPI5 public POS category values (bits 28-31) + SPPS_NotOverriden = -1, + SPPS_Unknown = 0, + SPPS_Noun = 0x1000, + SPPS_Verb = 0x2000, + SPPS_Modifier = 0x3000, + SPPS_Function = 0x4000, + SPPS_Interjection = 0x5000 +} SPPARTOFSPEECH; + +typedef [hidden] enum SPLEXICONTYPE +{ + eLEXTYPE_USER = (1L << 0), + eLEXTYPE_APP = (1L << 1), + eLEXTYPE_RESERVED1 = (1L << 2), + eLEXTYPE_RESERVED2 = (1L << 3), + eLEXTYPE_RESERVED3 = (1L << 4), + eLEXTYPE_RESERVED4 = (1L << 5), + eLEXTYPE_RESERVED5 = (1L << 6), + eLEXTYPE_RESERVED6 = (1L << 7), + eLEXTYPE_RESERVED7 = (1L << 8), + eLEXTYPE_RESERVED8 = (1L << 9), + eLEXTYPE_RESERVED9 = (1L << 10), + eLEXTYPE_RESERVED10 = (1L << 11), + eLEXTYPE_PRIVATE1 = (1L << 12), + eLEXTYPE_PRIVATE2 = (1L << 13), + eLEXTYPE_PRIVATE3 = (1L << 14), + eLEXTYPE_PRIVATE4 = (1L << 15), + eLEXTYPE_PRIVATE5 = (1L << 16), + eLEXTYPE_PRIVATE6 = (1L << 17), + eLEXTYPE_PRIVATE7 = (1L << 18), + eLEXTYPE_PRIVATE8 = (1L << 19), + eLEXTYPE_PRIVATE9 = (1L << 20), + eLEXTYPE_PRIVATE10 = (1L << 21), + eLEXTYPE_PRIVATE11 = (1L << 22), + eLEXTYPE_PRIVATE12 = (1L << 23), + eLEXTYPE_PRIVATE13 = (1L << 24), + eLEXTYPE_PRIVATE14 = (1L << 25), + eLEXTYPE_PRIVATE15 = (1L << 26), + eLEXTYPE_PRIVATE16 = (1L << 27), + eLEXTYPE_PRIVATE17 = (1L << 28), + eLEXTYPE_PRIVATE18 = (1L << 29), + eLEXTYPE_PRIVATE19 = (1L << 30), + eLEXTYPE_PRIVATE20 = (1L << 31), +} SPLEXICONTYPE; + +typedef [hidden] enum SPWORDTYPE +{ + eWORDTYPE_ADDED = (1L << 0), + eWORDTYPE_DELETED = (1L << 1) +} SPWORDTYPE; + +typedef [restricted, hidden] struct SPWORDPRONUNCIATION +{ + struct SPWORDPRONUNCIATION * pNextWordPronunciation; + SPLEXICONTYPE eLexiconType; + LANGID LangID; + WORD wReserved; + SPPARTOFSPEECH ePartOfSpeech; + SPPHONEID szPronunciation[1]; +} SPWORDPRONUNCIATION; + +typedef [restricted, hidden] struct SPWORDPRONUNCIATIONLIST +{ + ULONG ulSize; + BYTE * pvBuffer; + SPWORDPRONUNCIATION * pFirstWordPronunciation; +} SPWORDPRONUNCIATIONLIST; + +typedef [restricted, hidden] struct SPWORD +{ + struct SPWORD * pNextWord; + LANGID LangID; + WORD wReserved; + SPWORDTYPE eWordType; + WCHAR * pszWord; + SPWORDPRONUNCIATION * pFirstWordPronunciation; +} SPWORD; + +typedef [restricted, hidden] struct SPWORDLIST +{ + ULONG ulSize; + BYTE * pvBuffer; + SPWORD * pFirstWord; +} SPWORDLIST; + +[ + object, + uuid(DA41A7C2-5383-4DB2-916B-6C1719E3DB58), + helpstring("ISpLexicon Interface"), + pointer_default(unique), + restricted +] +interface ISpLexicon : IUnknown +{ + HRESULT GetPronunciations( + [in] const WCHAR * pszWord, + [in] LANGID LangID, + [in] DWORD dwFlags, + [in, out] SPWORDPRONUNCIATIONLIST * pWordPronunciationList + ); + HRESULT AddPronunciation( + [in] const WCHAR * pszWord, + [in] LANGID LangID, + [in] SPPARTOFSPEECH ePartOfSpeech, + [in] const SPPHONEID * pszPronunciation + ); + HRESULT RemovePronunciation( + [in] const WCHAR * pszWord, + [in] LANGID LangID, + [in] SPPARTOFSPEECH ePartOfSpeech, + [in] const SPPHONEID * pszPronunciation + ); + + HRESULT GetGeneration(DWORD *pdwGeneration); + HRESULT GetGenerationChange( + [in] DWORD dwFlags, + [in, out] DWORD *pdwGeneration, + [in, out] SPWORDLIST * pWordList + ); + + HRESULT GetWords( + [in] DWORD dwFlags, + [in, out] DWORD *pdwGeneration, + [in, out] DWORD * pdwCookie, + [in, out] SPWORDLIST *pWordList + ); +}; + +[ + object, + uuid(8565572F-C094-41CC-B56E-10BD9C3FF044), + + helpstring("ISpContainerLexicon Interface"), + pointer_default(unique), + restricted +] +interface ISpContainerLexicon : ISpLexicon +{ + HRESULT AddLexicon([in] ISpLexicon *pAddLexicon, [in] DWORD dwFlags); +}; + +//--- ISpPhoneConverter ----------------------------------------------------- +[ + object, + uuid(8445C581-0CAC-4A38-ABFE-9B2CE2826455), + helpstring("ISpPhoneConverter Interface"), + pointer_default(unique), + restricted +] +interface ISpPhoneConverter : ISpObjectWithToken +{ + HRESULT PhoneToId([in] const WCHAR * pszPhone, [out] SPPHONEID * pId); + HRESULT IdToPhone([in] const SPPHONEID * pId, [out] WCHAR * pszPhone); +}; + +//--- ISpVoice -------------------------------------------------------------- +// These structures maintain the absolute state of the voice relative to +// the voice's baseline XML state. +typedef [restricted, hidden] struct SPVPITCH +{ + long MiddleAdj; + long RangeAdj; +} SPVPITCH; + +typedef [hidden] enum SPVACTIONS +{ + SPVA_Speak = 0, + SPVA_Silence, + SPVA_Pronounce, + SPVA_Bookmark, + SPVA_SpellOut, + SPVA_Section, + SPVA_ParseUnknownTag +} SPVACTIONS; + +typedef [restricted, hidden] struct SPVCONTEXT +{ + LPCWSTR pCategory; + LPCWSTR pBefore; + LPCWSTR pAfter; +} SPVCONTEXT; + +typedef [restricted, hidden] struct SPVSTATE +{ + //--- Action + SPVACTIONS eAction; + + //--- Running state values + LANGID LangID; + WORD wReserved; + long EmphAdj; + long RateAdj; + ULONG Volume; + SPVPITCH PitchAdj; + ULONG SilenceMSecs; + SPPHONEID* pPhoneIds; // NULL terminated array of phone ids + SPPARTOFSPEECH ePartOfSpeech; + SPVCONTEXT Context; +} SPVSTATE; + +typedef [hidden] enum SPRUNSTATE +{ + SPRS_DONE = (1L << 0), // The voice is done rendering all queued phrases + SPRS_IS_SPEAKING = (1L << 1) // The SpVoice currently has the audio queue claimed +} SPRUNSTATE; + +typedef [hidden] enum SPVLIMITS +{ + SPMIN_VOLUME = 0, + SPMAX_VOLUME = 100, + SPMIN_RATE = -10, + SPMAX_RATE = 10 +} SPVLIMITS; + +typedef [hidden] enum SPVPRIORITY +{ + SPVPRI_NORMAL = 0, + SPVPRI_ALERT = (1L << 0), + SPVPRI_OVER = (1L << 1) +} SPVPRIORITY; + +typedef [restricted, hidden] struct SPVOICESTATUS +{ + ULONG ulCurrentStream; // Current stream being rendered + ULONG ulLastStreamQueued; // Number of the last stream queued + HRESULT hrLastResult; // Result of last speak + DWORD dwRunningState; // SPRUNSTATE + ULONG ulInputWordPos; // Input position of current word being rendered + ULONG ulInputWordLen; // Length of current word being rendered + ULONG ulInputSentPos; // Input position of current sentence being rendered + ULONG ulInputSentLen; // Length of current sentence being rendered + LONG lBookmarkId; // Current bookmark converted to a long integer + SPPHONEID PhonemeId; // Current phoneme id + SPVISEMES VisemeId; // Current viseme + DWORD dwReserved1; // Reserved for future expansion + DWORD dwReserved2; // Reserved for future expansion +} SPVOICESTATUS; + +typedef [hidden] enum SPEAKFLAGS +{ + //--- SpVoice flags + SPF_DEFAULT = 0, // Synchronous, no purge, xml auto detect + SPF_ASYNC = (1L << 0), // Asynchronous call + SPF_PURGEBEFORESPEAK = (1L << 1), // Purge current data prior to speaking this + SPF_IS_FILENAME = (1L << 2), // The string passed to Speak() is a file name + SPF_IS_XML = (1L << 3), // The input text will be parsed for XML markup + SPF_IS_NOT_XML = (1L << 4), // The input text will not be parsed for XML markup + SPF_PERSIST_XML = (1L << 5), // Persists XML global state changes + + //--- Normalizer flags + SPF_NLP_SPEAK_PUNC = (1L << 6), // The normalization processor should speak the punctuation + + //--- Masks + SPF_NLP_MASK = (SPF_NLP_SPEAK_PUNC), + SPF_VOICE_MASK = (SPF_ASYNC|SPF_PURGEBEFORESPEAK|SPF_IS_FILENAME|SPF_IS_XML|SPF_IS_NOT_XML|SPF_NLP_MASK|SPF_PERSIST_XML), + SPF_UNUSED_FLAGS = ~(SPF_VOICE_MASK) +} SPEAKFLAGS; + +[ + object, + uuid(6C44DF74-72B9-4992-A1EC-EF996E0422D4), + helpstring("ISpVoice Interface"), + pointer_default(unique), + restricted +] +interface ISpVoice : ISpEventSource +{ + HRESULT SetOutput( [in] IUnknown * pUnkOutput, [in]BOOL fAllowFormatChanges ); + HRESULT GetOutputObjectToken( [out] ISpObjectToken ** ppObjectToken ); + HRESULT GetOutputStream( [out] ISpStreamFormat ** ppStream ); + + HRESULT Pause( void ); + HRESULT Resume( void ); + + HRESULT SetVoice([in] ISpObjectToken *pToken); + HRESULT GetVoice([out] ISpObjectToken **ppToken); + + HRESULT Speak( + [in, string] const WCHAR* pwcs, + [in] DWORD dwFlags, + [out] ULONG * pulStreamNumber); + HRESULT SpeakStream( + [in] IStream* pStream, // If not ISpStreamFormat supported then SPDFID_Text assumed + [in] DWORD dwFlags, + [out] ULONG * pulStreamNumber); + + HRESULT GetStatus( + [out] SPVOICESTATUS *pStatus, + [out, string] WCHAR ** ppszLastBookmark); + + HRESULT Skip( [in,string]WCHAR* pItemType, [in]long lNumItems, [out]ULONG* pulNumSkipped ); + + HRESULT SetPriority([in] SPVPRIORITY ePriority ); + HRESULT GetPriority([out] SPVPRIORITY* pePriority ); + + HRESULT SetAlertBoundary( [in] SPEVENTENUM eBoundary ); + HRESULT GetAlertBoundary( [out] SPEVENTENUM* peBoundary ); + + HRESULT SetRate([in] long RateAdjust ); + HRESULT GetRate([out] long* pRateAdjust); + + HRESULT SetVolume([in] USHORT usVolume); + HRESULT GetVolume([out] USHORT* pusVolume); + + HRESULT WaitUntilDone([in] ULONG msTimeout); + + HRESULT SetSyncSpeakTimeout([in] ULONG msTimeout); + HRESULT GetSyncSpeakTimeout([out] ULONG * pmsTimeout); + + [local] HANDLE SpeakCompleteEvent(); + + [local] HRESULT IsUISupported( + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [out] BOOL *pfSupported); + [local] HRESULT DisplayUI( + [in] HWND hwndParent, + [in] const WCHAR * pszTitle, + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData); + +}; + + +//--- ISpPhrase interface --------------------------------------------------- +[ + object, + uuid(1A5C0354-B621-4b5a-8791-D306ED379E53), + local, + helpstring("ISpPhrase Interface"), + pointer_default(unique), + restricted +] +interface ISpPhrase : IUnknown +{ + HRESULT GetPhrase([out] SPPHRASE ** ppCoMemPhrase); + HRESULT GetSerializedPhrase([out] SPSERIALIZEDPHRASE ** ppCoMemPhrase); + HRESULT GetText([in] ULONG ulStart, [in] ULONG ulCount, [in] BOOL fUseTextReplacements, + [out] WCHAR ** ppszCoMemText, [out] BYTE * pbDisplayAttributes); + HRESULT Discard([in] DWORD dwValueTypes); +}; + +[ + object, + uuid(8FCEBC98-4E49-4067-9C6C-D86A0E092E3D), + local, + helpstring("ISpPhraseAlt Interface"), + pointer_default(unique), + restricted +] +interface ISpPhraseAlt : ISpPhrase +{ + HRESULT GetAltInfo(ISpPhrase **ppParent, ULONG *pulStartElementInParent, ULONG *pcElementsInParent, + ULONG *pcElementsInAlt); + HRESULT Commit(); +}; + + + +//--- ISpRecoResult --------------------------------------------------------- +typedef [restricted, hidden] struct SPRECORESULTTIMES +{ + FILETIME ftStreamTime; // GetSystemTimeAsFileTime() at start of result + // UTC time as number of 100-nanosecond intervals + // since January 1, 1601 + ULONGLONG ullLength; // length in 100ns units + DWORD dwTickCount; // GetTickCount() at start of result + // milliseconds that have elapsed since the + // system was started. + ULONGLONG ullStart; // 100ns units since start of stream +} SPRECORESULTTIMES; + + +typedef [hidden] struct SPSERIALIZEDRESULT +{ + ULONG ulSerializedSize; // Count in bytes (including this ULONG) of the entire phrase +} SPSERIALIZEDRESULT; + + +[ + object, + uuid(20B053BE-E235-43cd-9A2A-8D17A48B7842), + helpstring("ISpRecoResult Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpRecoResult : ISpPhrase +{ + HRESULT GetResultTimes([out] SPRECORESULTTIMES *pTimes); + + HRESULT GetAlternates( + [in] ULONG ulStartElement, + [in] ULONG cElements, + [in] ULONG ulRequestCount, + [out] ISpPhraseAlt **ppPhrases, + [out] ULONG *pcPhrasesReturned); + + HRESULT GetAudio( + [in] ULONG ulStartElement, + [in] ULONG cElements, + [out] ISpStreamFormat **ppStream); + HRESULT SpeakAudio( + [in] ULONG ulStartElement, + [in] ULONG cElements, + [in] DWORD dwFlags, + [out] ULONG * pulStreamNumber); + + HRESULT Serialize([out] SPSERIALIZEDRESULT ** ppCoMemSerializedResult); + + HRESULT ScaleAudio([in] const GUID * pAudioFormatId, [in] const WAVEFORMATEX *pWaveFormatEx); + + HRESULT GetRecoContext([out] ISpRecoContext ** ppRecoContext); +}; + + + +typedef [hidden] struct tagSPTEXTSELECTIONINFO +{ + ULONG ulStartActiveOffset; + ULONG cchActiveChars; + ULONG ulStartSelection; + ULONG cchSelection; +} SPTEXTSELECTIONINFO; + + +typedef [hidden] enum SPWORDPRONOUNCEABLE +{ + SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = 0, + SPWP_UNKNOWN_WORD_PRONOUNCEABLE = 1, + SPWP_KNOWN_WORD_PRONOUNCEABLE = 2 +} SPWORDPRONOUNCEABLE; + + +typedef [hidden] enum SPGRAMMARSTATE +{ + SPGS_DISABLED = 0, + SPGS_ENABLED = 1, + SPGS_EXCLUSIVE = 3 +} SPGRAMMARSTATE; + + +typedef [hidden] enum SPCONTEXTSTATE +{ + SPCS_DISABLED = 0, + SPCS_ENABLED = 1, +} SPCONTEXTSTATE; + + +typedef [hidden] enum SPRULESTATE +{ + SPRS_INACTIVE = 0, + SPRS_ACTIVE = 1, + SPRS_ACTIVE_WITH_AUTO_PAUSE = 3 +} SPRULESTATE; + +const ULONGLONG SP_STREAMPOS_ASAP = 0; +const ULONGLONG SP_STREAMPOS_REALTIME = -1; + + + +// Special transition types used only by AddRuleTransition + +cpp_quote("#define SPRULETRANS_TEXTBUFFER (SPSTATEHANDLE)(-1)") +cpp_quote("#define SPRULETRANS_WILDCARD (SPSTATEHANDLE)(-2)") +cpp_quote("#define SPRULETRANS_DICTATION (SPSTATEHANDLE)(-3)") + + +typedef [hidden] enum SPGRAMMARWORDTYPE +{ + SPWT_DISPLAY, + SPWT_LEXICAL, + SPWT_PRONUNCIATION +} SPGRAMMARWORDTYPE; + +typedef [hidden] struct tagSPPROPERTYINFO +{ + const WCHAR * pszName; + ULONG ulId; + const WCHAR * pszValue; + VARIANT vValue; // Must be VT_BOOL, VT_I4, VT_R4, VT_R8, or VT_BYREF (only for dynamic grammars) +} SPPROPERTYINFO; + +typedef [hidden] enum SPCFGRULEATTRIBUTES +{ + SPRAF_TopLevel = (1 << 0), + SPRAF_Active = (1 << 1), + SPRAF_Export = (1 << 2), + SPRAF_Import = (1 << 3), + SPRAF_Interpreter = (1 << 4), + SPRAF_Dynamic = (1 << 5), + // The following flag is only valid at run-time as part of a rule state and + // is not valid to pass as part of a rule definition. + SPRAF_AutoPause = (1 << 16) +} SPCFGRULEATTRIBUTES; + + +[ + object, + uuid(8137828F-591A-4A42-BE58-49EA7EBAAC68), + helpstring("ISpGrammarBuilder Interface"), + pointer_default(unique), + restricted, + local +] +interface ISpGrammarBuilder : IUnknown +{ + HRESULT ResetGrammar([in] LANGID NewLanguage); + + HRESULT GetRule([in] const WCHAR * pszRuleName, + [in] DWORD dwRuleId, + [in] DWORD dwAttributes, + [in] BOOL fCreateIfNotExist, + [out] SPSTATEHANDLE * phInitialState); + HRESULT ClearRule(SPSTATEHANDLE hState); + + HRESULT CreateNewState( + SPSTATEHANDLE hState, + SPSTATEHANDLE * phState); + + HRESULT AddWordTransition( + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR * psz, // If NULL then epsilon + const WCHAR * pszSeparators, // If NULL then psz points to a single word, else specifies valid separator characters + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO * pPropInfo); + + HRESULT AddRuleTransition( + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, // Must be the initial state of the rule + float Weight, + const SPPROPERTYINFO * pPropInfo); + + HRESULT AddResource([in] SPSTATEHANDLE hRuleState, // Any state handle in a rule is OK + [in] const WCHAR * pszResourceName, + [in] const WCHAR * pszResourceValue); + + HRESULT Commit(DWORD dwReserved); +}; + + +// --- Options for Load methods on ISpRecoGrammar +typedef [hidden] enum SPLOADOPTIONS +{ + SPLO_STATIC = 0, + SPLO_DYNAMIC = 1 +} SPLOADOPTIONS; + + + +//--- ISpRecoGrammar ------------------------------------------------------- +[ + object, + uuid(2177DB29-7F45-47D0-8554-067E91C80502), + helpstring("ISpRecoGrammar Interface"), + pointer_default(unique), + restricted, + local +] +interface ISpRecoGrammar : ISpGrammarBuilder +{ + HRESULT GetGrammarId([out] ULONGLONG * pullGrammarId); + HRESULT GetRecoContext([out] ISpRecoContext **ppRecoCtxt); + + // Command and control interfaces + HRESULT LoadCmdFromFile([in, string] const WCHAR * pszFileName, [in] SPLOADOPTIONS Options); + HRESULT LoadCmdFromObject([in] REFCLSID rcid, [in, string] const WCHAR * pszGrammarName, [in] SPLOADOPTIONS Options); + HRESULT LoadCmdFromResource([in] HMODULE hModule, + [in, string] const WCHAR * pszResourceName, + [in, string] const WCHAR * pszResourceType, + [in] WORD wLanguage, + [in] SPLOADOPTIONS Options); + HRESULT LoadCmdFromMemory([in] const SPBINARYGRAMMAR * pGrammar, [in] SPLOADOPTIONS Options); + HRESULT LoadCmdFromProprietaryGrammar( + [in] REFGUID rguidParam, + [in, string] const WCHAR * pszStringParam, + [in] const void * pvDataPrarm, + [in] ULONG cbDataSize, + [in] SPLOADOPTIONS Options); + HRESULT SetRuleState([in, string] const WCHAR * pszName, void * pReserved, + [in] SPRULESTATE NewState); + HRESULT SetRuleIdState([in] ULONG ulRuleId, [in] SPRULESTATE NewState); + + + // Dictation / statistical language model + HRESULT LoadDictation([in, string] const WCHAR * pszTopicName, [in] SPLOADOPTIONS Options); + HRESULT UnloadDictation(); + HRESULT SetDictationState([in] SPRULESTATE NewState); + + // Word sequence buffer + HRESULT SetWordSequenceData([in] const WCHAR * pText, [in] ULONG cchText, [in] const SPTEXTSELECTIONINFO * pInfo); + HRESULT SetTextSelection([in] const SPTEXTSELECTIONINFO * pInfo); + + HRESULT IsPronounceable([in, string] const WCHAR * pszWord, [out] SPWORDPRONOUNCEABLE *pWordPronounceable); + + HRESULT SetGrammarState([in] SPGRAMMARSTATE eGrammarState); + + HRESULT SaveCmd([in] IStream * pStream, [out, optional] WCHAR ** ppszCoMemErrorText); + + HRESULT GetGrammarState([out] SPGRAMMARSTATE * peGrammarState); +}; + + + + + +//--- ISpRecoContext -------------------------------------------------------- +typedef [restricted, hidden] struct SPRECOCONTEXTSTATUS +{ + SPINTERFERENCE eInterference; + WCHAR szRequestTypeOfUI[255]; // If first byte null, there is no UI request + DWORD dwReserved1; + DWORD dwReserved2; +} SPRECOCONTEXTSTATUS; + +typedef [hidden] enum SPBOOKMARKOPTIONS +{ + SPBO_NONE = 0, + SPBO_PAUSE = 1 +} SPBOOKMARKOPTIONS; + + +typedef [hidden] enum SPAUDIOOPTIONS +{ + SPAO_NONE = 0, + SPAO_RETAIN_AUDIO = (1 << 0) +} SPAUDIOOPTIONS; + +[ + object, + uuid(F740A62F-7C15-489E-8234-940A33D9272D), + helpstring("ISpRecoContext Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpRecoContext : ISpEventSource +{ + HRESULT GetRecognizer([out] ISpRecognizer ** ppRecognizer); + + HRESULT CreateGrammar([in] ULONGLONG ullGrammarId, [out] ISpRecoGrammar ** ppGrammar); + + HRESULT GetStatus([out] SPRECOCONTEXTSTATUS *pStatus); + + HRESULT GetMaxAlternates([in] ULONG * pcAlternates); + HRESULT SetMaxAlternates([in] ULONG cAlternates); + + HRESULT SetAudioOptions([in] SPAUDIOOPTIONS Options, [in] const GUID *pAudioFormatId, [in] const WAVEFORMATEX *pWaveFormatEx); + HRESULT GetAudioOptions([in] SPAUDIOOPTIONS * pOptions, [out] GUID *pAudioFormatId, [out] WAVEFORMATEX **ppCoMemWFEX); + + HRESULT DeserializeResult( + [in] const SPSERIALIZEDRESULT * pSerializedResult, + [out] ISpRecoResult **ppResult); + + HRESULT Bookmark([in] SPBOOKMARKOPTIONS Options, [in] ULONGLONG ullStreamPosition, [in] LPARAM lparamEvent); + + HRESULT SetAdaptationData([in, string] const WCHAR *pAdaptationData, [in] const ULONG cch); + + HRESULT Pause( DWORD dwReserved ); + HRESULT Resume( DWORD dwReserved ); + + HRESULT SetVoice([in] ISpVoice *pVoice, [in] BOOL fAllowFormatChanges); + HRESULT GetVoice([out] ISpVoice **ppVoice); + HRESULT SetVoicePurgeEvent([in] ULONGLONG ullEventInterest); + HRESULT GetVoicePurgeEvent([out] ULONGLONG *pullEventInterest); + + HRESULT SetContextState([in] SPCONTEXTSTATE eContextState); + HRESULT GetContextState([in] SPCONTEXTSTATE * peContextState); +}; + + +//--- ISpProperties ------------------------------------------------------------ +[ + object, + uuid(5B4FB971-B115-4DE1-AD97-E482E3BF6EE4), + helpstring("ISpProperties Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpProperties : IUnknown +{ + HRESULT SetPropertyNum( [in]const WCHAR* pName, [in]LONG lValue ); + HRESULT GetPropertyNum( [in]const WCHAR* pName, [out]LONG* plValue ); + HRESULT SetPropertyString( [in]const WCHAR* pName, [in]const WCHAR* pValue ); + HRESULT GetPropertyString( [in]const WCHAR* pName, [out]WCHAR** ppCoMemValue ); +}; + +const ULONG SP_MAX_LANGIDS = 20; // Engine can support up to 20 languages at once + +//--- ISpRecognizer --------------------------------------------------------- +typedef [restricted, hidden] struct SPRECOGNIZERSTATUS +{ + SPAUDIOSTATUS AudioStatus; + ULONGLONG ullRecognitionStreamPos; + ULONG ulStreamNumber; + ULONG ulNumActive; + CLSID clsidEngine; + ULONG cLangIDs; + LANGID aLangID[SP_MAX_LANGIDS]; + DWORD dwReserved1; + DWORD dwReserved2; +} SPRECOGNIZERSTATUS; + +typedef [hidden] enum SPWAVEFORMATTYPE +{ + SPWF_INPUT, // WAVEFORMATEX of audio input source + SPWF_SRENGINE // WAVEFORMATEX of the audio received by the SR engine +} SPSTREAMFORMATTYPE; + +typedef [hidden] enum SPRECOSTATE +{ + SPRST_INACTIVE, // Audio deactivated + SPRST_ACTIVE, // Audio running only if one or more rules are active + SPRST_ACTIVE_ALWAYS, // Audio running regardless of rule state + SPRST_INACTIVE_WITH_PURGE, // State will be set to inactive, but all active audio purged + SPRST_NUM_STATES +} SPRECOSTATE; + + + + +[ + object, + uuid(C2B5F241-DAA0-4507-9E16-5A1EAA2B7A5C), + helpstring("ISpRecognizer Interface"), + pointer_default(unique), + restricted +] +interface ISpRecognizer : ISpProperties +{ + HRESULT SetRecognizer([in] ISpObjectToken * pRecognizer); + HRESULT GetRecognizer([out] ISpObjectToken **ppRecognizer); + + HRESULT SetInput([in] IUnknown * pUnkInput, [in] BOOL fAllowFormatChanges); + HRESULT GetInputObjectToken( [out] ISpObjectToken ** ppToken); + + HRESULT GetInputStream( [out] ISpStreamFormat ** ppStream); + HRESULT CreateRecoContext([out] ISpRecoContext ** ppNewCtxt); + + HRESULT GetRecoProfile([out] ISpObjectToken **ppToken); + HRESULT SetRecoProfile([in] ISpObjectToken *pToken); + + HRESULT IsSharedInstance(void); + + HRESULT GetRecoState([out] SPRECOSTATE *pState); + HRESULT SetRecoState([in] SPRECOSTATE NewState); + + HRESULT GetStatus([out] SPRECOGNIZERSTATUS * pStatus); + HRESULT GetFormat([in] SPSTREAMFORMATTYPE WaveFormatType, [out] GUID *pFormatId, [out] WAVEFORMATEX **ppCoMemWFEX); + + [local] HRESULT IsUISupported( + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [out] BOOL *pfSupported); + [local] HRESULT DisplayUI( + [in] HWND hwndParent, + [in] const WCHAR * pszTitle, + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData); + HRESULT EmulateRecognition([in] ISpPhrase *pPhrase); +}; + + + +// +//=== CoClass definitions ===================================================== +// +[ + helpstring("Microsoft Speech Object Library"), + uuid(C866CA3A-32F7-11D2-9602-00C04F8EE628), + version(5.1) +] +library SpeechLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + #include "sapiaut.idl" + + //--- SpNotifyTranslator ------------------------------------------------ + [ + uuid(E2AE5372-5D40-11D2-960E-00C04F8EE628), + helpstring("SpNotify"), + restricted, + hidden + ] + coclass SpNotifyTranslator + { + interface ISpNotifyTranslator; + } + + //--- SpObjectTokenCategory --------------------------------------------- + [ + uuid(A910187F-0C7A-45AC-92CC-59EDAFB77B53), + helpstring("SpObjectTokenCategory Class"), + ] + coclass SpObjectTokenCategory + { + [default] interface ISpeechObjectTokenCategory; + interface ISpObjectTokenCategory; + } + //--- SpObjectToken --------------------------------------------- + [ + uuid(EF411752-3736-4CB4-9C8C-8EF4CCB58EFE), + helpstring("SpObjectToken Class") + ] + coclass SpObjectToken + { + [default] interface ISpeechObjectToken; + interface ISpObjectToken; + } + + //--- SpResourceManager ------------------------------------------------- + [ + uuid(96749373-3391-11D2-9EE3-00C04F797396), + helpstring("SpResourceManger"), + restricted, + hidden + ] + coclass SpResourceManager + { + [default] interface ISpResourceManager; + }; + + //--- SpStreamFormatConverter ------------------------------------------- + [ + uuid(7013943A-E2EC-11D2-A086-00C04F8EF9B5), + helpstring("FormatConverter Class"), + restricted, + hidden + ] + coclass SpStreamFormatConverter + { + [default] interface ISpStreamFormatConverter; + }; + + //--- SpMMAudioEnum ----------------------------------------------------- + [ + uuid(AB1890A0-E91F-11D2-BB91-00C04F8EE6C0), + helpstring("SpMMAudioEnum Class"), + restricted, + hidden + ] + coclass SpMMAudioEnum + { + interface IEnumSpObjectTokens; + }; + + //--- SpMMAudioIn ------------------------------------------------------- + [ + uuid(CF3D2E50-53F2-11D2-960C-00C04F8EE628), + helpstring("SpMMAudioIn Class") + ] + coclass SpMMAudioIn + { + [default] interface ISpeechMMSysAudio; + interface ISpEventSource; + interface ISpEventSink; + interface ISpObjectWithToken; + interface ISpMMSysAudio; + }; + + //--- SpMMAudioOut ------------------------------------------------------ + [ + uuid(A8C680EB-3D32-11D2-9EE7-00C04F797396), + helpstring("SpMMAudioOut Class") + ] + coclass SpMMAudioOut + { + [default] interface ISpeechMMSysAudio; + interface ISpEventSource; + interface ISpEventSink; + interface ISpObjectWithToken; + interface ISpMMSysAudio; + }; + + //--- SpRecPlayAudio ------------------------------------------------- + [ + uuid(FEE225FC-7AFD-45E9-95D0-5A318079D911), + helpstring("SpRecPlayAudio Class"), + restricted, + hidden + ] + coclass SpRecPlayAudio + { + interface ISpObjectWithToken; + interface ISpAudio; + }; + + //--- SpStream ---------------------------------------------------------- + [ + uuid(715D9C59-4442-11D2-9605-00C04F8EE628), + helpstring("SpStream Class"), + restricted, + hidden + ] + coclass SpStream + { + interface ISpStream; + }; + + //--- SpVoice ----------------------------------------------------------- + [ + uuid(96749377-3391-11D2-9EE3-00C04F797396), + helpstring("SpVoice Class") + ] + coclass SpVoice + { + [default] interface ISpeechVoice; + interface ISpVoice; + + [default, source] dispinterface _ISpeechVoiceEvents; + }; + + //--- SpSharedRecoContext ----------------------------------------------- + [ + uuid(47206204-5ECA-11D2-960F-00C04F8EE628), + helpstring("SpSharedRecoContext Class") + ] + coclass SpSharedRecoContext + { + [default] interface ISpeechRecoContext; + interface ISpRecoContext; + + [default, source] dispinterface _ISpeechRecoContextEvents; + }; + + //--- SpInprocRecognizer ------------------------------------------------ + [ + uuid(41B89B6B-9399-11D2-9623-00C04F8EE628), + helpstring("SpInprocRecognizer Class") + ] + coclass SpInprocRecognizer + { + [default] interface ISpeechRecognizer; + interface ISpRecognizer; + }; + + //--- SpSharedRecognizer ---------------------------------------------- + [ + uuid(3BEE4890-4FE9-4A37-8C1E-5E7E12791C1F), + helpstring("SpSharedRecognizer Class") + ] + coclass SpSharedRecognizer + { + [default] interface ISpeechRecognizer; + interface ISpRecognizer; + }; + + //--- SpLexicon ---------------------------------------------------------- + [ + uuid(0655E396-25D0-11D3-9C26-00C04F8EF87C), + helpstring("SpLexicon Class") + ] + coclass SpLexicon + { + [default] interface ISpeechLexicon; + interface ISpLexicon; + }; + + //--- SpUnCompressedLexicon --------------------------------------------------- + [ + uuid(C9E37C15-DF92-4727-85D6-72E5EEB6995A), + helpstring("SpUnCompressedLexicon Class") + ] + coclass SpUnCompressedLexicon + { + [default] interface ISpeechLexicon; + interface ISpLexicon; + interface ISpObjectWithToken; + }; + + //--- SpCompressedLexicon --------------------------------------------------- + [ + uuid(90903716-2F42-11D3-9C26-00C04F8EF87C), + helpstring("SpCompressedLexicon Class"), + restricted, + hidden + ] + coclass SpCompressedLexicon + { + [default] interface ISpLexicon; + interface ISpObjectWithToken; + }; + + //--- SpPhoneConverter ------------------------------------------------ + [ + uuid(9185F743-1143-4C28-86B5-BFF14F20E5C8), + helpstring("SpPhoneConverter Class") + ] + coclass SpPhoneConverter + { + [default] interface ISpeechPhoneConverter; + interface ISpPhoneConverter; + }; + + //--- SpNullPhoneConverter ------------------------------------------------ + [ + uuid(455F24E9-7396-4A16-9715-7C0FDBE3EFE3), + helpstring("SpNullPhoneConverter Class"), + restricted, + hidden + ] + coclass SpNullPhoneConverter + { + [default] interface ISpPhoneConverter; + }; + +#ifdef SAPI_AUTOMATION + + //--- SpTextSelectionInformation ------------------------------------------------ + [ + uuid(0F92030A-CBFD-4AB8-A164-FF5985547FF6), + helpstring("SpTextSelectionInformation Class"), + ] + coclass SpTextSelectionInformation + { + [default] interface ISpeechTextSelectionInformation; + }; + + //--- SpPhraseInfoBuilder ------------------------------------------------ + [ + uuid(C23FC28D-C55F-4720-8B32-91F73C2BD5D1), + helpstring("SpPhraseInfoBuilder Class"), + ] + coclass SpPhraseInfoBuilder + { + [default] interface ISpeechPhraseInfoBuilder; + }; + + //--- SpAudioFormat ------------------------------------------------ + [ + uuid(9EF96870-E160-4792-820D-48CF0649E4EC), + helpstring("SpAudioFormat Class"), + ] + coclass SpAudioFormat + { + [default] interface ISpeechAudioFormat; + }; + + //--- SpWaveFormatEx ------------------------------------------------ + [ + uuid(C79A574C-63BE-44b9-801F-283F87F898BE), + helpstring("SpWaveFormatEx Class"), + ] + coclass SpWaveFormatEx + { + [default] interface ISpeechWaveFormatEx; + }; + + //--- SpInProcRecoContext ----------------------------------------------- + [ + uuid(73AD6842-ACE0-45E8-A4DD-8795881A2C2A), + helpstring("SpInProcRecoContext Class") + ] + coclass SpInProcRecoContext + { + [default] interface ISpeechRecoContext; + interface ISpRecoContext; + + [default, source] dispinterface _ISpeechRecoContextEvents; + }; + + //--- SpCustomStream ------------------------------------------------ + [ + uuid(8DBEF13F-1948-4aa8-8CF0-048EEBED95D8), + helpstring("SpCustomStream Class"), + ] + coclass SpCustomStream + { + [default] interface ISpeechCustomStream; + interface ISpStream; + }; + + //--- SpFileStream ------------------------------------------------ + [ + uuid(947812B3-2AE1-4644-BA86-9E90DED7EC91), + helpstring("SpFileStream Class"), + ] + coclass SpFileStream + { + [default] interface ISpeechFileStream; + interface ISpStream; + }; + + //--- SpMemoryStream ------------------------------------------------ + [ + uuid(5FB7EF7D-DFF4-468a-B6B7-2FCBD188F994), + helpstring("SpMemoryStream Class"), + ] + coclass SpMemoryStream + { + [default] interface ISpeechMemoryStream; + interface ISpStream; + }; + + +#endif // SAPI_AUTOMATION +} + diff --git a/sp/src/utils/sapi51/IDL/sapiaut.idl b/sp/src/utils/sapi51/IDL/sapiaut.idl new file mode 100644 index 00000000..5e7cee76 --- /dev/null +++ b/sp/src/utils/sapi51/IDL/sapiaut.idl @@ -0,0 +1,4847 @@ +/**************************************************************************** +* sapiaut.idl +* +* This is the interface definition file for the Microsoft Speech API +* Version 5.0. +* +* It contains definitions for the Automation layer. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +// Includes +import "oaidl.idl"; +import "ocidl.idl"; + +// Token object declarations +interface ISpeechDataKey; +interface ISpeechObjectToken; // Token object +interface ISpeechObjectTokens; // Collection of Token Objects +interface ISpeechObjectTokenCategory; + +// Audio object declarations +interface ISpeechAudioBufferInfo; +interface ISpeechAudioStatus; +interface ISpeechAudioFormat; +interface ISpeechWaveFormatEx; +interface ISpeechBaseStream; +interface ISpeechFileStream; +interface ISpeechMemoryStream; +interface ISpeechCustomStream; +interface ISpeechAudio; +interface ISpeechMMSysAudio; + +// Voice object declarations +interface ISpeechVoice; +interface ISpeechVoiceStatus; +dispinterface _ISpeechVoiceEvents; + +// Recognizer object declarations +interface ISpeechRecognizer; +interface ISpeechRecognizerStatus; +interface ISpeechRecoContext; +interface ISpeechRecoGrammar; +dispinterface _ISpeechRecoContextEvents; + +// Grammar object declarations +interface ISpeechGrammarRule; +interface ISpeechGrammarRules; +interface ISpeechGrammarRuleState; +interface ISpeechGrammarRuleStateTransition; +interface ISpeechGrammarRuleStateTransitions; +interface ISpeechTextSelectionInformation; + +// RecoResult and phrase object declarations +interface ISpeechRecoResult; +interface ISpeechRecoResultTimes; +interface ISpeechPhraseAlternate; +interface ISpeechPhraseAlternates; +interface ISpeechPhraseInfo; +interface ISpeechPhraseElement; +interface ISpeechPhraseElements; +interface ISpeechPhraseReplacement; +interface ISpeechPhraseReplacements; +interface ISpeechPhraseProperty; +interface ISpeechPhraseProperties; +interface ISpeechPhraseRule; +interface ISpeechPhraseRules; + +// Lexicon declarations +interface ISpeechLexicon; +interface ISpeechLexiconWords; +interface ISpeechLexiconWord; +interface ISpeechLexiconPronunciations; +interface ISpeechLexiconPronunciation; + +typedef long SpeechLanguageId; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// String constants +// +// +// +// +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Line below (#define) is to work around getting these strings just defined in the typelib (Ignore our definition in the .H file) +// Strings will fail to be defined properly in .H unless they have four backslashes ("\\\\") but for being in the typelib +// can't do this and have the strings defined propertly. So for VC just use the existing SAPI defines in SAPI.IDL. +cpp_quote("#define __SpeechStringConstants_MODULE_DEFINED__") + +[ +uuid(E58442E4-0C80-402c-9559-867337A39765) +] +module SpeechStringConstants +{ + //--- Root of registry entries for speech use + const BSTR SpeechRegistryUserRoot = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech"; + const BSTR SpeechRegistryLocalMachineRoot = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech"; + + //--- Object Token Categories for speech resource management + const BSTR SpeechCategoryAudioOut = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioOutput"; + const BSTR SpeechCategoryAudioIn = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput"; + const BSTR SpeechCategoryVoices = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices"; + const BSTR SpeechCategoryRecognizers = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Recognizers"; + const BSTR SpeechCategoryAppLexicons = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AppLexicons"; + const BSTR SpeechCategoryPhoneConverters = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\PhoneConverters"; + const BSTR SpeechCategoryRecoProfiles = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\RecoProfiles"; + + //--- User Lexicon Token Id + const BSTR SpeechTokenIdUserLexicon = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\CurrentUserLexicon"; + + //--- Standard token values + const BSTR SpeechTokenValueCLSID = L"CLSID"; + const BSTR SpeechTokenKeyFiles = L"Files"; + const BSTR SpeechTokenKeyUI = L"UI"; + const BSTR SpeechTokenKeyAttributes = L"Attributes"; + + //--- Standard voice category values + const BSTR SpeechVoiceCategoryTTSRate = L"DefaultTTSRate"; + + //--- Standard SR Engine properties + const BSTR SpeechPropertyResourceUsage = L"ResourceUsage"; + const BSTR SpeechPropertyHighConfidenceThreshold = L"HighConfidenceThreshold"; + const BSTR SpeechPropertyNormalConfidenceThreshold = L"NormalConfidenceThreshold"; + const BSTR SpeechPropertyLowConfidenceThreshold = L"LowConfidenceThreshold"; + const BSTR SpeechPropertyResponseSpeed = L"ResponseSpeed"; + const BSTR SpeechPropertyComplexResponseSpeed = L"ComplexResponseSpeed"; + const BSTR SpeechPropertyAdaptationOn = L"AdaptationOn"; + + //--- Standard SAPI Recognition Topics + const BSTR SpeechDictationTopicSpelling = L"Spelling"; + + //--- Special Tags used in SR grammars + const BSTR SpeechGrammarTagWildcard = L"..."; + const BSTR SpeechGrammarTagDictation = L"*"; + const BSTR SpeechGrammarTagUnlimitedDictation = L"*+"; + + //--- TokenUI constants + const BSTR SpeechEngineProperties = L"EngineProperties"; + const BSTR SpeechAddRemoveWord = L"AddRemoveWord"; + const BSTR SpeechUserTraining = L"UserTraining"; + const BSTR SpeechMicTraining = L"MicTraining"; + const BSTR SpeechRecoProfileProperties = L"RecoProfileProperties"; + const BSTR SpeechAudioProperties = L"AudioProperties"; + const BSTR SpeechAudioVolume = L"AudioVolume"; + + //--- ISpeechVoice::Skip constant + const BSTR SpeechVoiceSkipTypeSentence = L"Sentence"; + + // The SpeechAudioFormat object includes a guid that can be used to set the format to + // a custom value. + const BSTR SpeechAudioFormatGUIDWave = L"{C31ADBAE-527F-4ff5-A230-F62BB61FF70C}"; + const BSTR SpeechAudioFormatGUIDText = L"{7CEEF9F9-3D13-11d2-9EE7-00C04F797396}"; + +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Number Constants +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +[ +uuid(F3E092B2-6BDC-410f-BCB2-4C5ED4424180) +] +module SpeechConstants +{ + const float Speech_Default_Weight = DEFAULT_WEIGHT; + const LONG Speech_Max_Word_Length = SP_MAX_WORD_LENGTH; + const LONG Speech_Max_Pron_Length = SP_MAX_PRON_LENGTH; + const LONG Speech_StreamPos_Asap = SP_STREAMPOS_ASAP; + const LONG Speech_StreamPos_RealTime = SP_STREAMPOS_REALTIME; + const LONG SpeechAllElements = SPPR_ALL_ELEMENTS; +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechDataKey +// SAPI C++ Only Interface Equivalent: ISpDataKey Interface +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechDataKey +{ + DISPID_SDKSetBinaryValue = 1, + DISPID_SDKGetBinaryValue, + DISPID_SDKSetStringValue, + DISPID_SDKGetStringValue, + DISPID_SDKSetLongValue, + DISPID_SDKGetlongValue, + DISPID_SDKOpenKey, + DISPID_SDKCreateKey, + DISPID_SDKDeleteKey, + DISPID_SDKDeleteValue, + DISPID_SDKEnumKeys, + DISPID_SDKEnumValues +} DISPID_SpeechDataKey; + +[ + object, + uuid(CE17C09B-4EFA-44d5-A4C9-59D9585AB0CD), + dual, + helpstring("ISpeechDataKey Interface"), + pointer_default(unique) +] +interface ISpeechDataKey : IDispatch +{ + // Methods + + // SetBinaryValue + // SAPI C++ Only Interface Equivalent: SetData + // + [helpstring("SetBinaryValue"), id(DISPID_SDKSetBinaryValue)] + HRESULT SetBinaryValue( [in]const BSTR ValueName, + [in]VARIANT Value ); + + // GetBinaryValue + // SAPI C++ Only Interface Equivalent: GetData + // + [helpstring("GetBinaryValue"), id(DISPID_SDKGetBinaryValue)] + HRESULT GetBinaryValue( [in]const BSTR ValueName, + [out,retval]VARIANT* Value ); + + // SetStringValue + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SetStringValue"), id(DISPID_SDKSetStringValue)] + HRESULT SetStringValue( [in]const BSTR ValueName, + [in]const BSTR Value ); + + // GetStringValue + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("GetStringValue"), id(DISPID_SDKGetStringValue)] + HRESULT GetStringValue( [in]const BSTR ValueName, + [out,retval]BSTR* Value ); + + // SetLongValue + // SAPI C++ Only Interface Equivalent: SetDWORD + // + [helpstring("SetLongValue"), id(DISPID_SDKSetLongValue)] + HRESULT SetLongValue( [in]const BSTR ValueName, + [in]long Value ); + + // GetLongValue + // SAPI C++ Only Interface Equivalent: GetDWORD + // + [helpstring("GetlongValue"), id(DISPID_SDKGetlongValue)] + HRESULT GetLongValue( [in]const BSTR ValueName, + [out,retval]long* Value ); + + // OpenKey + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("OpenKey"), id(DISPID_SDKOpenKey)] + HRESULT OpenKey( [in]const BSTR SubKeyName, [out,retval]ISpeechDataKey** SubKey ); + + // CreateKey + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("CreateKey"), id(DISPID_SDKCreateKey)] + HRESULT CreateKey( [in]const BSTR SubKeyName, [out,retval]ISpeechDataKey** SubKey ); + + // DeleteKey + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("DeleteKey"), id(DISPID_SDKDeleteKey)] + HRESULT DeleteKey( [in]const BSTR SubKeyName ); + + // DeleteValue + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("DeleteValue"), id(DISPID_SDKDeleteValue)] + HRESULT DeleteValue( [in]const BSTR ValueName ); + + // EnumKeys + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("EnumKeys"), id(DISPID_SDKEnumKeys)] + HRESULT EnumKeys( [in]long Index, [out,retval]BSTR* SubKeyName ); + + // EnumValues + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("EnumValues"), id(DISPID_SDKEnumValues)] + HRESULT EnumValues( [in]long Index, [out,retval]BSTR* ValueName ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechObjectToken +// SAPI C++ Only Interface Equivalent: ISpObjectToken +// Default Property: Id +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechObjectToken +{ + DISPID_SOTId = 1, + DISPID_SOTDataKey, + DISPID_SOTCategory, + DISPID_SOTGetDescription, + DISPID_SOTSetId, + DISPID_SOTGetAttribute, + DISPID_SOTCreateInstance, + DISPID_SOTRemove, + DISPID_SOTGetStorageFileName, + DISPID_SOTRemoveStorageFileName, + DISPID_SOTIsUISupported, + DISPID_SOTDisplayUI, + DISPID_SOTMatchesAttributes +} DISPID_SpeechObjectToken; + +////////////////////////////////// +// +// SpeechDataKeyLocation Enum +// SAPI C++ Only Interface Equivalent: SPDATAKEYLOCATION +// +////////////////////////////////// + +typedef enum SpeechDataKeyLocation +{ + SDKLDefaultLocation = SPDKL_DefaultLocation, + SDKLCurrentUser = SPDKL_CurrentUser, + SDKLLocalMachine = SPDKL_LocalMachine, + SDKLCurrentConfig = SPDKL_CurrentConfig +} SpeechDataKeyLocation; + +#define CLSCTXALL (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER) + +////////////////////////////////// +// +// SpeechTokenContext Enum +// SAPI C++ Only Interface Equivalent: N/A +// +////////////////////////////////// + +typedef enum SpeechTokenContext +{ + STCInprocServer = CLSCTX_INPROC_SERVER, + STCInprocHandler = CLSCTX_INPROC_HANDLER, + STCLocalServer = CLSCTX_LOCAL_SERVER, + STCRemoteServer = CLSCTX_REMOTE_SERVER, + STCAll = CLSCTXALL +} SpeechTokenContext; + +////////////////////////////////// +// +// SpeechTokenShellFolder Enum +// SAPI C++ Only Interface Equivalent: N/A +// +////////////////////////////////// + +// CSIDL_* symbols are from SHLOBJ.H +typedef enum SpeechTokenShellFolder +{ + STSF_AppData = 0x001a, // CSIDL_APPDATA, + STSF_LocalAppData = 0x001c, // CSIDL_LOCAL_APPDATA + STSF_CommonAppData = 0x0023, // CSIDL_COMMON_APPDATA + STSF_FlagCreate = 0x8000 // CSIDL_FLAG_CREATE +} SpeechTokenShellFolder; + +[ + object, + uuid(C74A3ADC-B727-4500-A84A-B526721C8B8C), + dual, + helpstring("ISpeechObjectToken Interface"), + pointer_default(unique) +] +interface ISpeechObjectToken : IDispatch +{ + // Properties + + // Id + // SAPI C++ Only Interface Equivalent: GetId + // Default: N/A + // + [propget, helpstring("Id"), id(DISPID_SOTId)] + HRESULT Id( [out,retval]BSTR* ObjectId ); + + // DataKey + // SAPI C++ Only Interface Equivalent: Inherited from ISpDataKey + // Default: N/A + // + [propget, helpstring("DataKey"), id(DISPID_SOTDataKey), hidden] + HRESULT DataKey( [out,retval]ISpeechDataKey** DataKey ); + + // Category + // SAPI C++ Only Interface Equivalent: GetCategory + // Default: N/A + // + [propget, helpstring("Category"), id(DISPID_SOTCategory)] + HRESULT Category( [out,retval]ISpeechObjectTokenCategory** Category); + + // Methods + + // GetDescription + // SAPI C++ Only Interface Equivalent: New + // + [helpstring("GetDescription"), id(DISPID_SOTGetDescription)] + HRESULT GetDescription( [in,defaultvalue(0)]long Locale, + [out,retval]BSTR* Description ); + + // SetId + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SetId"), hidden, id(DISPID_SOTSetId)] + HRESULT SetId( [in] BSTR Id, + [in, defaultvalue("")] BSTR CategoryID, + [in, defaultvalue(0)]VARIANT_BOOL CreateIfNotExist); + + // GetAttribute + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("GetAttribute"), id(DISPID_SOTGetAttribute)] + HRESULT GetAttribute( [in] BSTR AttributeName, + [out, retval]BSTR* AttributeValue); + + // CreateInstance + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("CreateInstance"), id(DISPID_SOTCreateInstance)] + HRESULT CreateInstance( [in, defaultvalue(NULL)] IUnknown *pUnkOuter, + [in,defaultvalue(STCALL)] SpeechTokenContext ClsContext, + [out, retval]IUnknown **Object); + + // Remove + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Remove"), hidden, id(DISPID_SOTRemove)] + HRESULT Remove( [in]BSTR ObjectStorageCLSID ); + + // GetStorageFileName + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("GetStorageFileName"), hidden, id(DISPID_SOTGetStorageFileName)] + HRESULT GetStorageFileName( [in]BSTR ObjectStorageCLSID, + [in]BSTR KeyName, + [in]BSTR FileName, + [in]SpeechTokenShellFolder Folder, + [out,retval]BSTR* FilePath ); + + // Remove + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("RemoveStorageFileName"), hidden, id(DISPID_SOTRemoveStorageFileName)] + HRESULT RemoveStorageFileName( [in]BSTR ObjectStorageCLSID, + [in]BSTR KeyName, + [in]VARIANT_BOOL DeleteFile); + + // IsUISupported + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("IsUISupported"), hidden, id(DISPID_SOTIsUISupported)] + HRESULT IsUISupported( [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData, + [in, defaultvalue(NULL)]IUnknown* Object, + [out,retval] VARIANT_BOOL *Supported ); + + // DisplayUI + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("DisplayUI"), hidden, id(DISPID_SOTDisplayUI)] + HRESULT DisplayUI( [in]long hWnd, + [in]BSTR Title, + [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData, + [in, defaultvalue(NULL)]IUnknown* Object); + + // MatchesAttributes + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("MatchesAttributes"), id(DISPID_SOTMatchesAttributes)] + HRESULT MatchesAttributes([in]BSTR Attributes, + [out,retval] VARIANT_BOOL* Matches); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechObjectTokens +// SAPI C++ Only Interface Equivalent: IEnumObjectTokens +// Default Property: Item +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechObjectTokens +{ + DISPID_SOTsCount = 1, + DISPID_SOTsItem = DISPID_VALUE, + DISPID_SOTs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechObjectTokens; + +[ + object, + uuid(9285B776-2E7B-4bc0-B53E-580EB6FA967F), + dual, + helpstring("ISpeechObjectTokens Interface"), + pointer_default(unique) +] +interface ISpeechObjectTokens : IDispatch +{ + // Property + + // Count + // SAPI C++ Only Interface Equivalent: GetCount + // + [propget, helpstring("Count"), id(DISPID_SOTsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Item"), id(DISPID_VALUE)] + HRESULT Item([in] long Index, [out, retval]ISpeechObjectToken** Token ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: N/A + // + [propget, helpstring("Enumerates the tokens"), restricted, id(DISPID_NEWENUM)] + HRESULT _NewEnum([out, retval] IUnknown** ppEnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechObjectTokenCategory +// +// SAPI C++ Only Interface Equivalent: ISpObjectTokenCategory +// Default Property: Id +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechObjectTokenCategory +{ + DISPID_SOTCId = 1, + DISPID_SOTCDefault, + DISPID_SOTCSetId, + DISPID_SOTCGetDataKey, + DISPID_SOTCEnumerateTokens, +} DISPID_SpeechObjectTokenCategory; + +[ + object, + uuid(CA7EAC50-2D01-4145-86D4-5AE7D70F4469), + dual, + helpstring("ISpeechObjectTokenCategory Interface"), + pointer_default(unique) +] +interface ISpeechObjectTokenCategory : IDispatch +{ + // Properties + + // Id + // SAPI C++ Only Interface Equivalent: GetId + // + [propget, helpstring("Id"), id(DISPID_SOTCId)] + HRESULT Id([out, retval] BSTR * Id); + + // Default + // SAPI C++ Only Interface Equivalent: Set/GetDefaultTokenId + // + [propput, helpstring("Default"), id(DISPID_SOTCDefault)] + HRESULT Default([in] const BSTR TokenId); + [propget, helpstring("Default"), id(DISPID_SOTCDefault)] + HRESULT Default([out, retval] BSTR * TokenId); + + // Methods + + // SetId + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SetId"), id(DISPID_SOTCSetId)] + HRESULT SetId([in] const BSTR Id, [in, defaultvalue(0)]VARIANT_BOOL CreateIfNotExist); + + // GetDataKey + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("GetDataKey"), hidden, id(DISPID_SOTCGetDataKey)] + HRESULT GetDataKey([in, defaultvalue(SDKLDefaultLocation)]SpeechDataKeyLocation Location, + [out, retval]ISpeechDataKey ** DataKey); + + // EnumerateTokens + // SAPI C++ Only Interface Equivalent: EnumTokens + // + [helpstring("EnumerateTokens"), id(DISPID_SOTCEnumerateTokens)] + HRESULT EnumerateTokens( [in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out, retval]ISpeechObjectTokens** Tokens ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechAudioFormat +// SAPI C++ Only Interface Equivalent: ISpStreamFormat +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////// +// +// SpeechAudioFormatType +// SAPI C++ Only Interface Equivalent: SPSTREAMFORMAT +// +////////////////////////////////// + +typedef enum SpeechAudioFormatType { + [hidden] SAFTDefault = -1, + [hidden] SAFTNoAssignedFormat = 0, + [hidden] SAFTText, + [hidden] SAFTNonStandardFormat, // Non-SAPI 5.0 standard format with no WAVEFORMATEX description + [hidden] SAFTExtendedAudioFormat, // Non-SAPI 5.0 standard format but has WAVEFORMATEX description + // Standard PCM wave formats + SAFT8kHz8BitMono, + SAFT8kHz8BitStereo, + SAFT8kHz16BitMono, + SAFT8kHz16BitStereo, + SAFT11kHz8BitMono, + SAFT11kHz8BitStereo, + SAFT11kHz16BitMono, + SAFT11kHz16BitStereo, + SAFT12kHz8BitMono, + SAFT12kHz8BitStereo, + SAFT12kHz16BitMono, + SAFT12kHz16BitStereo, + SAFT16kHz8BitMono, + SAFT16kHz8BitStereo, + SAFT16kHz16BitMono, + SAFT16kHz16BitStereo, + SAFT22kHz8BitMono, + SAFT22kHz8BitStereo, + SAFT22kHz16BitMono, + SAFT22kHz16BitStereo, + SAFT24kHz8BitMono, + SAFT24kHz8BitStereo, + SAFT24kHz16BitMono, + SAFT24kHz16BitStereo, + SAFT32kHz8BitMono, + SAFT32kHz8BitStereo, + SAFT32kHz16BitMono, + SAFT32kHz16BitStereo, + SAFT44kHz8BitMono, + SAFT44kHz8BitStereo, + SAFT44kHz16BitMono, + SAFT44kHz16BitStereo, + SAFT48kHz8BitMono, + SAFT48kHz8BitStereo, + SAFT48kHz16BitMono, + SAFT48kHz16BitStereo, + // TrueSpeech format + SAFTTrueSpeech_8kHz1BitMono, + // A-Law formats + SAFTCCITT_ALaw_8kHzMono, + SAFTCCITT_ALaw_8kHzStereo, + SAFTCCITT_ALaw_11kHzMono, + SAFTCCITT_ALaw_11kHzStereo, + SAFTCCITT_ALaw_22kHzMono, + SAFTCCITT_ALaw_22kHzStereo, + SAFTCCITT_ALaw_44kHzMono, + SAFTCCITT_ALaw_44kHzStereo, + // u-Law formats + SAFTCCITT_uLaw_8kHzMono, + SAFTCCITT_uLaw_8kHzStereo, + SAFTCCITT_uLaw_11kHzMono, + SAFTCCITT_uLaw_11kHzStereo, + SAFTCCITT_uLaw_22kHzMono, + SAFTCCITT_uLaw_22kHzStereo, + SAFTCCITT_uLaw_44kHzMono, + SAFTCCITT_uLaw_44kHzStereo, + // ADPCM formats + SAFTADPCM_8kHzMono, + SAFTADPCM_8kHzStereo, + SAFTADPCM_11kHzMono, + SAFTADPCM_11kHzStereo, + SAFTADPCM_22kHzMono, + SAFTADPCM_22kHzStereo, + SAFTADPCM_44kHzMono, + SAFTADPCM_44kHzStereo, + // GSM 6.10 formats + SAFTGSM610_8kHzMono, + SAFTGSM610_11kHzMono, + SAFTGSM610_22kHzMono, + SAFTGSM610_44kHzMono, +} SpeechAudioFormatType; + +typedef [hidden] enum DISPID_SpeechAudioFormat +{ + DISPID_SAFType = 1, + DISPID_SAFGuid, + DISPID_SAFGetWaveFormatEx, + DISPID_SAFSetWaveFormatEx +} DISPID_SpeechAudioFormat; + +[ + object, + uuid(E6E9C590-3E18-40e3-8299-061F98BDE7C7), + dual, + helpstring("ISpeechAudioFormat Interface"), + pointer_default(unique) +] +interface ISpeechAudioFormat : IDispatch { + // Properties + + // Type + // SAPI C++ Only Interface Equivalent: + // Default: GetFormat + // + [propget, helpstring("Type"), id(DISPID_SAFType)] + HRESULT Type([out,retval]SpeechAudioFormatType* AudioFormat); + [propput, helpstring("Type"), id(DISPID_SAFType)] + HRESULT Type([in]SpeechAudioFormatType AudioFormat); + + // Guid + // SAPI C++ Only Interface Equivalent: + // Default: N/A (used to be parameter of GetFormat) + // + [propget, hidden, helpstring("Guid"), id(DISPID_SAFGuid)] + HRESULT Guid([out,retval]BSTR* Guid); + [propput, hidden, helpstring("Guid"), id(DISPID_SAFGuid)] + HRESULT Guid([in]BSTR Guid); + + // Methods + + // GetWaveFormatEx + // SAPI C++ Only Interface Equivalent: (used to be parameter of GetFormat) + // + [hidden, helpstring("GetWaveFormatEx"), id(DISPID_SAFGetWaveFormatEx)] + HRESULT GetWaveFormatEx([out,retval]ISpeechWaveFormatEx** WaveFormatEx); + + // GetWaveFormatEx + // SAPI C++ Only Interface Equivalent: (used to be parameter of GetFormat) + // + [hidden, helpstring("SetWaveFormatEx"), id(DISPID_SAFSetWaveFormatEx)] + HRESULT SetWaveFormatEx([in]ISpeechWaveFormatEx* WaveFormatEx); +} + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechBaseStream +// SAPI C++ Only Interface Equivalent: ISpStreamFormat and IStream +// Default Property: Format +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechBaseStream +{ + DISPID_SBSFormat = 1, + DISPID_SBSRead, + DISPID_SBSWrite, + DISPID_SBSSeek +} DISPID_SpeechBaseStream; + +////////////////////////////////// +// +// SpeechStreamSeekPositionType +// SAPI C++ Only Interface Equivalent: N/A +// +////////////////////////////////// + +typedef enum SpeechStreamSeekPositionType +{ + SSSPTRelativeToStart = STREAM_SEEK_SET, + SSSPTRelativeToCurrentPosition = STREAM_SEEK_CUR, + SSSPTRelativeToEnd = STREAM_SEEK_END +} SpeechStreamSeekPositionType; + +[ + object, + uuid(6450336F-7D49-4ced-8097-49D6DEE37294), + dual, + helpstring("ISpeechBaseStream Interface"), + pointer_default(unique) +] +interface ISpeechBaseStream : IDispatch +{ + // Properties + + // Format + // SAPI C++ Only Interface Equivalent: N/A + // Default: N/A + // + [propget, helpstring("Format"), id(DISPID_SBSFormat)] + HRESULT Format([out,retval]ISpeechAudioFormat** AudioFormat); + [propputref, helpstring("Format"), id(DISPID_SBSFormat)] + HRESULT Format([in]ISpeechAudioFormat* AudioFormat); + + // Methods + + + // Read + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("Read"), id(DISPID_SBSRead)] + HRESULT Read([out]VARIANT* Buffer, [in]long NumberOfBytes, [out,retval]long* BytesRead); + + // Write + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("Write"), id(DISPID_SBSWrite)] + HRESULT Write([in]VARIANT Buffer, [out,retval]long* BytesWritten); + + // Seek + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("Seek"), id(DISPID_SBSSeek)] + HRESULT Seek([in]VARIANT Position, [in, defaultvalue(SSSPTRelativeToStart)]SpeechStreamSeekPositionType Origin, [out,retval]VARIANT* NewPosition); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechAudio +// SAPI C++ Only Interface Equivalent: ISpAudio +// Default Property: Volume +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechAudio +{ + DISPID_SAStatus = 200, + DISPID_SABufferInfo, + DISPID_SADefaultFormat, + DISPID_SAVolume, + DISPID_SABufferNotifySize, + DISPID_SAEventHandle, + DISPID_SASetState +} DISPID_SpeechAudio; + +////////////////////////////////// +// +// SpeechAudioState +// SAPI C++ Only Interface Equivalent: _SPAUDIOSTATE +// +////////////////////////////////// + +typedef enum SpeechAudioState +{ + SASClosed = SPAS_CLOSED, + SASStop = SPAS_STOP, + SASPause = SPAS_PAUSE, + SASRun = SPAS_RUN +} SpeechAudioState; + +[ + object, + uuid(CFF8E175-019E-11d3-A08E-00C04F8EF9B5), + dual, + helpstring("ISpeechAudio Interface"), + pointer_default(unique) +] +interface ISpeechAudio : ISpeechBaseStream +{ + // Properties + + // Status + // SAPI C++ Only Interface Equivalent: GetStatus + // Default: N/A + // + [propget, helpstring("Status"), id(DISPID_SAStatus)] + HRESULT Status([out,retval]ISpeechAudioStatus** Status); + + // BufferInfo + // SAPI C++ Only Interface Equivalent: GetBufferInfo + // Default: N/A + // + [propget, helpstring("BufferInfo"), id(DISPID_SABufferInfo)] + HRESULT BufferInfo([out,retval]ISpeechAudioBufferInfo** BufferInfo); + + // DefaultFormat + // SAPI C++ Only Interface Equivalent: GetDefaultFormat + // Default: N/A + // + [propget, helpstring("DefaultFormat"), id(DISPID_SADefaultFormat)] + HRESULT DefaultFormat([out,retval]ISpeechAudioFormat** StreamFormat); + + // Volume + // SAPI C++ Only Interface Equivalent: GetVolumeLevel + // Default: N/A + // + [propget, helpstring("Volume"), id(DISPID_SAVolume)] + HRESULT Volume([out,retval]long* Volume); + [propput, helpstring("Volume"), id(DISPID_SAVolume)] + HRESULT Volume([in]long Volume); + + // BufferNotifySize + // SAPI C++ Only Interface Equivalent: GetBufferNotifySize + // Default: N/A + // + [propget, helpstring("BufferNotifySize"), id(DISPID_SABufferNotifySize)] + HRESULT BufferNotifySize([out,retval]long* BufferNotifySize); + [propput, helpstring("BufferNotifySize"), id(DISPID_SABufferNotifySize)] + HRESULT BufferNotifySize([in]long BufferNotifySize); + + // EventHandle + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, hidden, helpstring("EventHandle"), id(DISPID_SAEventHandle)] + HRESULT EventHandle([out,retval]long* EventHandle); + + // Methods + + // SetState + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SetState"), id(DISPID_SASetState), hidden] + HRESULT SetState([in] SpeechAudioState State); + +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechMMSysAudio +// SAPI C++ Only Interface Equivalent: ISpMMSysAudio +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechMMSysAudio +{ + DISPID_SMSADeviceId = 300, + DISPID_SMSALineId, + DISPID_SMSAMMHandle +} DISPID_SpeechMMSysAudio; + +[ + object, + uuid(3C76AF6D-1FD7-4831-81D1-3B71D5A13C44), + dual, + helpstring("ISpeechMMSysAudio Interface"), + pointer_default(unique) +] +interface ISpeechMMSysAudio : ISpeechAudio +{ + // Properties + + // DeviceId + // SAPI C++ Only Interface Equivalent: Get/SetDeviceId + // Default: N/A + // + [propget, helpstring("DeviceId"), id(DISPID_SMSADeviceId)] + HRESULT DeviceId([out, retval] long* DeviceId); + [propput, helpstring("DeviceId"), id(DISPID_SMSADeviceId)] + HRESULT DeviceId([in] long DeviceId); + + // LineId + // SAPI C++ Only Interface Equivalent: Get/SetLineId + // Default: N/A + // + [propget, helpstring("LineId"), id(DISPID_SMSALineId)] + HRESULT LineId([out, retval] long* LineId); + [propput, helpstring("LineId"), id(DISPID_SMSALineId)] + HRESULT LineId([in] long LineId); + + // MMHandle + // SAPI C++ Only Interface Equivalent: GetMMHandle + // Default: N/A + // + [propget, hidden, helpstring("MMHandle"), id(DISPID_SMSAMMHandle)] + HRESULT MMHandle([out, retval] long* Handle); // 64bit issue? Declared as handle. +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechFileStream +// SAPI C++ Only Interface Equivalent: ISpStream +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechFileStream +{ + DISPID_SFSOpen = 100, + DISPID_SFSClose +} DISPID_SpeechFileStream; + +////////////////////////////////// +// +// SpeechStreamFileMode Enum +// SAPI C++ Only Interface Equivalent: +// +////////////////////////////////// + +typedef enum SpeechStreamFileMode +{ + SSFMOpenForRead = SPFM_OPEN_READONLY, // Open existing file, read-only. + [hidden] SSFMOpenReadWrite = SPFM_OPEN_READWRITE, // (Not supported for wav files) Open existing file, read-write. + [hidden] SSFMCreate = SPFM_CREATE, // (Not supported for wav files) Open file if exists, else create if does not exist (opens read-write) + SSFMCreateForWrite = SPFM_CREATE_ALWAYS, // Create file even if file exists. Destroys old file. +} SpeechStreamFileMode; + +[ + object, + uuid(AF67F125-AB39-4e93-B4A2-CC2E66E182A7), + dual, + helpstring("ISpeechFileStream Interface"), + pointer_default(unique) +] +interface ISpeechFileStream : ISpeechBaseStream +{ + // Properties + + // Methods + + // Open + // SAPI C++ Only Interface Equivalent: BindToFile + // Default: N/A + // + [helpstring("Open"), id(DISPID_SFSOpen)] + HRESULT Open([in] BSTR FileName, + [in, defaultvalue(SSFMOpenForRead)] SpeechStreamFileMode FileMode, + [in, defaultvalue(0)]VARIANT_BOOL DoEvents); + + // Close + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [helpstring("Close"), id(DISPID_SFSClose)] + HRESULT Close(void); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechCustomStream +// SAPI C++ Only Interface Equivalent: ISpStream +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechCustomStream +{ + DISPID_SCSBaseStream = 100 +} DISPID_SpeechCustomStream; + + +[ + object, + uuid(1A9E9F4F-104F-4db8-A115-EFD7FD0C97AE), + dual, + helpstring("ISpeechCustomStream Interface"), + pointer_default(unique) +] +interface ISpeechCustomStream : ISpeechBaseStream +{ + // Properties + + // BaseStream + // SAPI C++ Only Interface Equivalent: ISpStream::Get/SetBaseStream + // Default: N/A + // + [propget, helpstring("BaseStream"), id(DISPID_SCSBaseStream)] + HRESULT BaseStream([out, retval] IUnknown **ppUnkStream); + [propputref, helpstring("BaseStream"), id(DISPID_SCSBaseStream)] + HRESULT BaseStream([in] IUnknown *pUnkStream); + + // Methods +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechMemoryStream +// SAPI C++ Only Interface Equivalent: ISpStream +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechMemoryStream +{ + DISPID_SMSSetData = 100, + DISPID_SMSGetData +} DISPID_SpeechMemoryStream; + +[ + object, + uuid(EEB14B68-808B-4abe-A5EA-B51DA7588008), + dual, + helpstring("ISpeechMemoryStream Interface"), + pointer_default(unique) +] +interface ISpeechMemoryStream : ISpeechBaseStream +{ + // Properties + + // Methods + + // SetData + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("SetData"), id(DISPID_SMSSetData)] + HRESULT SetData([in] VARIANT Data); + + // GetData + // SAPI C++ Only Interface Equivalent: N/A + // + [helpstring("GetData"), id(DISPID_SMSGetData)] + HRESULT GetData([out, retval] VARIANT* pData); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechAudioStatus +// SAPI C++ Only Interface Equivalent: SPAUDIOSTATUS Struct +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechAudioStatus +{ + DISPID_SASFreeBufferSpace = 1, + DISPID_SASNonBlockingIO, + DISPID_SASState, + DISPID_SASCurrentSeekPosition, + DISPID_SASCurrentDevicePosition +} DISPID_SpeechAudioStatus; + +[ + object, + uuid(C62D9C91-7458-47f6-862D-1EF86FB0B278), + dual, + helpstring("ISpeechAudioStatus Interface"), + pointer_default(unique) +] +interface ISpeechAudioStatus : IDispatch +{ + // Properties + + // FreeBufferSpace + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("FreeBufferSpace"), id(DISPID_SASFreeBufferSpace)] + HRESULT FreeBufferSpace([out,retval]long* FreeBufferSpace); + + // NonBlockingIO + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("NonBlockingIO"), id(DISPID_SASNonBlockingIO)] + HRESULT NonBlockingIO([out,retval]long* NonBlockingIO); + + // State + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("State"), id(DISPID_SASState)] + HRESULT State([out, retval] SpeechAudioState * State); + + // CurrentSeekPosition + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("CurrentSeekPosition"), id(DISPID_SASCurrentSeekPosition)] + HRESULT CurrentSeekPosition([out,retval]VARIANT* CurrentSeekPosition); + + // CurrentDevicePosition + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("CurrentDevicePosition"), id(DISPID_SASCurrentDevicePosition)] + HRESULT CurrentDevicePosition([out,retval]VARIANT* CurrentDevicePosition); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechAudioBufferInfo +// P3. We're not sure what this is for. Should be hidden? +// SAPI C++ Only Interface Equivalent: SPAUDIOBUFFERINFO Struct +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechAudioBufferInfo +{ + DISPID_SABIMinNotification = 1, + DISPID_SABIBufferSize, + DISPID_SABIEventBias +} DISPID_SpeechAudioBufferInfo; + +[ + object, + uuid(11B103D8-1142-4edf-A093-82FB3915F8CC), + dual, + helpstring("ISpeechAudioBufferInfo Interface"), + pointer_default(unique) +] +interface ISpeechAudioBufferInfo : IDispatch +{ + // Properties + + // MinNotification + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("MinNotification"), id(DISPID_SABIMinNotification)] + HRESULT MinNotification([out,retval]long* MinNotification); + [propput, helpstring("MinNotification"), id(DISPID_SABIMinNotification)] + HRESULT MinNotification([in]long MinNotification); + + // BufferSize + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("BufferSize"), id(DISPID_SABIBufferSize)] + HRESULT BufferSize([out,retval]long* BufferSize); + [propput, helpstring("BufferSize"), id(DISPID_SABIBufferSize)] + HRESULT BufferSize([in]long BufferSize); + + // EventBias + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("EventBias"), id(DISPID_SABIEventBias)] + HRESULT EventBias([out,retval]long* EventBias); + [propput, helpstring("EventBias"), id(DISPID_SABIEventBias)] + HRESULT EventBias([in]long EventBias); +} + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechWaveFormatEx +// SAPI C++ Only Interface Equivalent: WAVEFORMATEX Struct +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechWaveFormatEx +{ + DISPID_SWFEFormatTag = 1, + DISPID_SWFEChannels, + DISPID_SWFESamplesPerSec, + DISPID_SWFEAvgBytesPerSec, + DISPID_SWFEBlockAlign, + DISPID_SWFEBitsPerSample, + DISPID_SWFEExtraData +} DISPID_SpeechWaveFormatEx; + +[ + object, + uuid(7A1EF0D5-1581-4741-88E4-209A49F11A10), + dual, + helpstring("ISpeechWaveFormatEx Interface"), + pointer_default(unique) +] +interface ISpeechWaveFormatEx : IDispatch +{ + // Properties + + // FormatTag + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("FormatTag"), id(DISPID_SWFEFormatTag)] + HRESULT FormatTag([out,retval]short* FormatTag); + [propput, helpstring("FormatTag"), id(DISPID_SWFEFormatTag)] + HRESULT FormatTag([in]short FormatTag); + + // Channels + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("Channels"), id(DISPID_SWFEChannels)] + HRESULT Channels([out,retval]short* Channels); + [propput, helpstring("Channels"), id(DISPID_SWFEChannels)] + HRESULT Channels([in]short Channels); + + // SamplesPerSec + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("SamplesPerSec"), id(DISPID_SWFESamplesPerSec)] + HRESULT SamplesPerSec([out,retval]long* SamplesPerSec); + [propput, helpstring("SamplesPerSec"), id(DISPID_SWFESamplesPerSec)] + HRESULT SamplesPerSec([in]long SamplesPerSec); + + // AvgBytesPerSec + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("AvgBytesPerSec"), id(DISPID_SWFEAvgBytesPerSec)] + HRESULT AvgBytesPerSec([out,retval]long* AvgBytesPerSec); + [propput, helpstring("AvgBytesPerSec"), id(DISPID_SWFEAvgBytesPerSec)] + HRESULT AvgBytesPerSec([in]long AvgBytesPerSec); + + // BlockAlign + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("BlockAlign"), id(DISPID_SWFEBlockAlign)] + HRESULT BlockAlign([out,retval]short* BlockAlign); + [propput, helpstring("BlockAlign"), id(DISPID_SWFEBlockAlign)] + HRESULT BlockAlign([in]short BlockAlign); + + // BitsPerSample + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("BitsPerSample"), id(DISPID_SWFEBitsPerSample)] + HRESULT BitsPerSample([out,retval]short* BitsPerSample); + [propput, helpstring("BitsPerSample"), id(DISPID_SWFEBitsPerSample)] + HRESULT BitsPerSample([in]short BitsPerSample); + + // ExtraData + // SAPI C++ Only Interface Equivalent: Same + // Default: N/A + // + [propget, helpstring("ExtraData"), id(DISPID_SWFEExtraData)] + HRESULT ExtraData([out,retval]VARIANT* ExtraData); + [propput, helpstring("ExtraData"), id(DISPID_SWFEExtraData)] + HRESULT ExtraData([in]VARIANT ExtraData); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechVoice +// SAPI C++ Only Interface Equivalent: ISpVoice +// Default Property: Speak +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechVoice +{ + DISPID_SVStatus = 1, + DISPID_SVVoice, + DISPID_SVAudioOutput, + DISPID_SVAudioOutputStream, + DISPID_SVRate, + DISPID_SVVolume, + DISPID_SVAllowAudioOuputFormatChangesOnNextSet, + DISPID_SVEventInterests, + DISPID_SVPriority, + DISPID_SVAlertBoundary, + DISPID_SVSyncronousSpeakTimeout, + DISPID_SVSpeak, + DISPID_SVSpeakStream, + DISPID_SVPause, + DISPID_SVResume, + DISPID_SVSkip, + DISPID_SVGetVoices, + DISPID_SVGetAudioOutputs, + DISPID_SVWaitUntilDone, + DISPID_SVSpeakCompleteEvent, + DISPID_SVIsUISupported, + DISPID_SVDisplayUI +} DISPID_SpeechVoice; + +////////////////////////////////// +// +// SpeechVoicePriority Enum +// SAPI C++ Only Interface Equivalent: SPVPRIORITY +// +////////////////////////////////// + +typedef enum SpeechVoicePriority +{ + SVPNormal = SPVPRI_NORMAL, + SVPAlert = SPVPRI_ALERT, + SVPOver = SPVPRI_OVER +} SpeechVoicePriority; + +////////////////////////////////// +// +// SpeechVoiceSpeakFlags Enum +// SAPI C++ Only Interface Equivalent: SPEAKFLAGS +// +////////////////////////////////// + +typedef enum SpeechVoiceSpeakFlags +{ + //--- SpeechVoice flags + SVSFDefault = SPF_DEFAULT, + SVSFlagsAsync = SPF_ASYNC, + SVSFPurgeBeforeSpeak = SPF_PURGEBEFORESPEAK, + SVSFIsFilename = SPF_IS_FILENAME, + SVSFIsXML = SPF_IS_XML, + SVSFIsNotXML = SPF_IS_NOT_XML, + SVSFPersistXML = SPF_PERSIST_XML, + + //--- Normalizer flags + SVSFNLPSpeakPunc = SPF_NLP_SPEAK_PUNC, + + //--- Masks + SVSFNLPMask = SPF_NLP_MASK, + SVSFVoiceMask = SPF_VOICE_MASK, + SVSFUnusedFlags = SPF_UNUSED_FLAGS +} SpeechVoiceSpeakFlags; + +////////////////////////////////// +// +// SpeechVoiceEvents Enum +// SAPI C++ Only Interface Equivalent: N/A +// +////////////////////////////////// + +typedef enum SpeechVoiceEvents +{ + SVEStartInputStream = (1L << 1), + SVEEndInputStream = (1L << 2), + SVEVoiceChange = (1L << 3), + SVEBookmark = (1L << 4), + SVEWordBoundary = (1L << 5), + SVEPhoneme = (1L << 6), + SVESentenceBoundary = (1L << 7), + SVEViseme = (1L << 8), + SVEAudioLevel = (1L << 9), + SVEPrivate = (1L << 15), + SVEAllEvents = 0x083FE // All TTS events on. +} SpeechVoiceEvents; + +[ + object, + uuid(269316D8-57BD-11D2-9EEE-00C04F797396), + dual, + helpstring("ISpeechVoice Interface"), + pointer_default(unique) +] +interface ISpeechVoice : IDispatch +{ + // Status + // SAPI C++ Only Interface Equivalent: GetStatus + // Default: + // + [propget, helpstring("Status"), id(DISPID_SVStatus)] + HRESULT Status([out, retval] ISpeechVoiceStatus** Status); + + // Voice + // SAPI C++ Only Interface Equivalent: Get/SetVoice + // Default: + // + [propget, helpstring("Voice"), id(DISPID_SVVoice)] + HRESULT Voice([out, retval] ISpeechObjectToken** Voice ); + [propputref, helpstring("Voice"), id(DISPID_SVVoice)] + HRESULT Voice([in]ISpeechObjectToken * Voice ); + + // AudioOutput + // SAPI C++ Only Interface Equivalent: GetOutputObjectTokens/SetOutput + // Default: + // + [propget, helpstring("Gets the audio output object"), id(DISPID_SVAudioOutput)] + HRESULT AudioOutput([out, retval]ISpeechObjectToken** AudioOutput); + [propputref, helpstring("Sets the audio output object"), id(DISPID_SVAudioOutput)] + HRESULT AudioOutput([in]ISpeechObjectToken* AudioOutput); + + // AudioOutputStream + // SAPI C++ Only Interface Equivalent: GetOutputStream/SetOutput + // Default: + // + [propget, helpstring("Gets the audio output stream"), id(DISPID_SVAudioOutputStream)] + HRESULT AudioOutputStream([out, retval]ISpeechBaseStream** AudioOutputStream); + [propputref, helpstring("Sets the audio output stream"), id(DISPID_SVAudioOutputStream)] + HRESULT AudioOutputStream([in]ISpeechBaseStream* AudioOutputStream); + + // Rate + // SAPI C++ Only Interface Equivalent: Get/SetRate + // Default: + // + [propget, helpstring("Rate"), id(DISPID_SVRate)] + HRESULT Rate([out, retval] long* Rate); + [propput, helpstring("Rate"), id(DISPID_SVRate)] + HRESULT Rate([in] long Rate); + + // Volume + // SAPI C++ Only Interface Equivalent: Get/SetVolume + // Default: + // + [propget, helpstring("Volume"), id(DISPID_SVVolume)] + HRESULT Volume([out, retval] long* Volume); + [propput, helpstring("Volume"), id(DISPID_SVVolume)] + HRESULT Volume([in] long Volume); + + // AllowAudioOutputFormatChangesOnNextSet + // SAPI C++ Only Interface Equivalent: N/A (used to be parameter of SetOutput) + // Default: + // + [propput, hidden, helpstring("AllowAudioOutputFormatChangesOnNextSet"), id(DISPID_SVAllowAudioOuputFormatChangesOnNextSet)] + HRESULT AllowAudioOutputFormatChangesOnNextSet([in] VARIANT_BOOL Allow ); + [propget, hidden, helpstring("AllowAudioOutputFormatChangesOnNextSet"), id(DISPID_SVAllowAudioOuputFormatChangesOnNextSet)] + HRESULT AllowAudioOutputFormatChangesOnNextSet([out,retval] VARIANT_BOOL* Allow ); + + // EventInterests + // SAPI C++ Only Interface Equivalent: ISpEventSink::GetEventInterests + // Default: + // + [propget, helpstring("EventInterests"), id(DISPID_SVEventInterests)] + HRESULT EventInterests([out,retval] SpeechVoiceEvents* EventInterestFlags); + [propput, helpstring("EventInterests"), id(DISPID_SVEventInterests)] + HRESULT EventInterests([in] SpeechVoiceEvents EventInterestFlags); + + // Priority + // SAPI C++ Only Interface Equivalent: Get/SetPriority + // Default: + // + [propput, helpstring("Priority"), id(DISPID_SVPriority)] + HRESULT Priority([in] SpeechVoicePriority Priority ); + [propget, helpstring("Priority"), id(DISPID_SVPriority)] + HRESULT Priority([out,retval] SpeechVoicePriority* Priority ); + + // AlertBoundary + // SAPI C++ Only Interface Equivalent: Get/SetAlertBoundary + // Default: + // + [propput, helpstring("AlertBoundary"), id(DISPID_SVAlertBoundary)] + HRESULT AlertBoundary( [in] SpeechVoiceEvents Boundary ); + [propget, helpstring("AlertBoundary"), id(DISPID_SVAlertBoundary)] + HRESULT AlertBoundary( [out,retval] SpeechVoiceEvents* Boundary ); + + // SyncSpeakTimeout + // SAPI C++ Only Interface Equivalent: Get/SetSyncSpeakTimeout + // Default: + // + [propput, helpstring("SyncSpeakTimeout"), id(DISPID_SVSyncronousSpeakTimeout)] + HRESULT SynchronousSpeakTimeout([in] long msTimeout ); + [propget, helpstring("SyncSpeakTimeout"), id(DISPID_SVSyncronousSpeakTimeout)] + HRESULT SynchronousSpeakTimeout([out,retval] long* msTimeout ); + + // Methods + + // Speak + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Speak"), id(DISPID_SVSpeak)] + HRESULT Speak( [in] BSTR Text, + [in, defaultvalue(SPF_DEFAULT)] SpeechVoiceSpeakFlags Flags, + [out, retval]long* StreamNumber ); + + // SpeakStream + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SpeakStream"), id(DISPID_SVSpeakStream)] + HRESULT SpeakStream( [in] ISpeechBaseStream* Stream, + [in, defaultvalue(SPF_DEFAULT)] SpeechVoiceSpeakFlags Flags, + [out, retval]long* StreamNumber ); + + // Pause + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Pauses the voices rendering."), id(DISPID_SVPause)] + HRESULT Pause( void ); + + // Resume + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Resumes the voices rendering."), id(DISPID_SVResume)] + HRESULT Resume( void ); + + // Skip + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("Skips rendering the specified number of items."), id(DISPID_SVSkip)] + HRESULT Skip( [in]const BSTR Type, [in]long NumItems, [out,retval]long* NumSkipped ); + + // GetVoices + // SAPI C++ Only Interface Equivalent: IEnumSpObjectTokens + // + [helpstring("GetVoices"), id(DISPID_SVGetVoices)] + HRESULT GetVoices([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + + // GetAudioOutputs + // SAPI C++ Only Interface Equivalent: IEnumSpObjectTokens + // + [helpstring("GetAudioOutputs"), id(DISPID_SVGetAudioOutputs)] + HRESULT GetAudioOutputs([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + + // WaitUntilDone + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("WaitUntilDone"), id(DISPID_SVWaitUntilDone)] + HRESULT WaitUntilDone([in]long msTimeout, [out,retval]VARIANT_BOOL * Done); + + // SpeakCompleteEvent + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("SpeakCompleteEvent"), hidden, id(DISPID_SVSpeakCompleteEvent)] + HRESULT SpeakCompleteEvent([out,retval]long* Handle); + + // IsUISupported + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("IsUISupported"), id(DISPID_SVIsUISupported)] + HRESULT IsUISupported( [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData, + [out,retval] VARIANT_BOOL* Supported ); + + // DisplayUI + // SAPI C++ Only Interface Equivalent: Same + // + [helpstring("DisplayUI"), id(DISPID_SVDisplayUI)] + HRESULT DisplayUI( [in]long hWndParent, + [in]BSTR Title, + [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechVoiceStatus +// SAPI C++ Only Interface Equivalent: SPVOICESTATUS Struct +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechVoiceStatus +{ + DISPID_SVSCurrentStreamNumber = 1, + DISPID_SVSLastStreamNumberQueued, + DISPID_SVSLastResult, + DISPID_SVSRunningState, + DISPID_SVSInputWordPosition, + DISPID_SVSInputWordLength, + DISPID_SVSInputSentencePosition, + DISPID_SVSInputSentenceLength, + DISPID_SVSLastBookmark, + DISPID_SVSLastBookmarkId, + DISPID_SVSPhonemeId, + DISPID_SVSVisemeId +} DISPID_SpeechVoiceStatus; + +////////////////////////////////// +// +// SpeechRunState Enum +// SAPI C++ Only Interface Equivalent: SPRUNSTATE +// +////////////////////////////////// + +typedef enum SpeechRunState +{ + SRSEDone = SPRS_DONE, // The voice is done rendering all queued phrases + SRSEIsSpeaking = SPRS_IS_SPEAKING // The SpVoice currently has the audio queue claimed +} SpeechRunState; + +[ + object, + uuid(8BE47B07-57F6-11d2-9EEE-00C04F797396), + dual, + helpstring("ISpeechVoiceStatus Interface"), + pointer_default(unique) +] +interface ISpeechVoiceStatus : IDispatch +{ + // CurrentStream + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("CurrentStreamNumber"), id(DISPID_SVSCurrentStreamNumber)] + HRESULT CurrentStreamNumber([out, retval] long* StreamNumber); + + // LastStreamNumberQueued + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("LastStreamNumberQueued"), id(DISPID_SVSLastStreamNumberQueued)] + HRESULT LastStreamNumberQueued([out, retval] long* StreamNumber); + + // LastHResult + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("LastHResult"), id(DISPID_SVSLastResult)] + HRESULT LastHResult([out, retval]long* HResult); + + // RunningState + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("RunningState"), id(DISPID_SVSRunningState)] + HRESULT RunningState([out, retval] SpeechRunState* State); + + // InputWordPosition + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("InputWordPosition"), id(DISPID_SVSInputWordPosition)] + HRESULT InputWordPosition([out, retval] long* Position); + + // InputWordLength + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("InputWordLength"), id(DISPID_SVSInputWordLength)] + HRESULT InputWordLength([out, retval] long* Length); + + // InputSentencePosition + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("InputSentencePosition"), id(DISPID_SVSInputSentencePosition)] + HRESULT InputSentencePosition([out, retval] long* Position); + + // InputSentenceLength + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("InputSentenceLength"), id(DISPID_SVSInputSentenceLength)] + HRESULT InputSentenceLength([out, retval] long* Length); + + // LastBookmark + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("LastBookmark"), id(DISPID_SVSLastBookmark)] + HRESULT LastBookmark([out, retval] BSTR* Bookmark); + + // LastBookmarkId + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("LastBookmarkId"), id(DISPID_SVSLastBookmarkId), hidden] + HRESULT LastBookmarkId([out, retval] long* BookmarkId); + + // PhonemeId + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("PhonemeId"), id(DISPID_SVSPhonemeId)] + HRESULT PhonemeId([out, retval] short* PhoneId); + + // VisemeId + // SAPI C++ Only Interface Equivalent: Same + // Default: + // + [propget, helpstring("VisemeId"), id(DISPID_SVSVisemeId)] + HRESULT VisemeId([out, retval] short* VisemeId); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// _ISpeechVoiceEvents +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////// +// +// SpeechVisemeType Enum +// SAPI C++ Only Interface Equivalent: SPVISEMES +// +////////////////////////////////// + +typedef enum SpeechVisemeType +{ + // English example + SVP_0 = 0, // silence + SVP_1, // ae, ax, ah + SVP_2, // aa + SVP_3, // ao + SVP_4, // ey, eh, uh + SVP_5, // er + SVP_6, // y, iy, ih, ix + SVP_7, // w, uw + SVP_8, // ow + SVP_9, // aw + SVP_10, // oy + SVP_11, // ay + SVP_12, // h + SVP_13, // r + SVP_14, // l + SVP_15, // s, z + SVP_16, // sh, ch, jh, zh + SVP_17, // th, dh + SVP_18, // f, v + SVP_19, // d, t, n + SVP_20, // k, g, ng + SVP_21, // p, b, m +} SpeechVisemeType ; + +////////////////////////////////// +// +// SpeechVisemeFeature Enum +// SAPI C++ Only Interface Equivalent: +// +////////////////////////////////// + +typedef enum SpeechVisemeFeature +{ + SVF_None = 0, + SVF_Stressed = SPVFEATURE_STRESSED, + SVF_Emphasis = SPVFEATURE_EMPHASIS +} SpeechVisemeFeature; + +typedef [hidden] enum DISPID_SpeechVoiceEvent +{ + DISPID_SVEStreamStart = 1, + DISPID_SVEStreamEnd, + DISPID_SVEVoiceChange, + DISPID_SVEBookmark, + DISPID_SVEWord, + DISPID_SVEPhoneme, + DISPID_SVESentenceBoundary, + DISPID_SVEViseme, + DISPID_SVEAudioLevel, + DISPID_SVEEnginePrivate +} DISPID_SpeechVoiceEvent; + +[ + uuid(A372ACD1-3BEF-4bbd-8FFB-CB3E2B416AF8) +] +dispinterface _ISpeechVoiceEvents +{ + properties: + methods: + + // StartStream + // SAPI C++ Only Interface Equivalent: + // + [helpstring("StartStream"), id(DISPID_SVEStreamStart)] + void StartStream([in]long StreamNumber, [in]VARIANT StreamPosition); + + // EndStream + // SAPI C++ Only Interface Equivalent: + // + [helpstring("EndStream"), id(DISPID_SVEStreamEnd)] + void EndStream([in]long StreamNumber, [in]VARIANT StreamPosition); + + // VoiceChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("VoiceChange"), id(DISPID_SVEVoiceChange)] + void VoiceChange([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]ISpeechObjectToken* VoiceObjectToken); + + // Bookmark + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Bookmark"), id(DISPID_SVEBookmark)] + void Bookmark([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]BSTR Bookmark, + [in]long BookmarkId); + + // Word + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Word"), id(DISPID_SVEWord)] + void Word([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long CharacterPosition, + [in]long Length); + + // Sentence + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Sentence"), id(DISPID_SVESentenceBoundary)] + void Sentence([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long CharacterPosition, + [in]long Length); + + // Phoneme + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Phoneme"), id(DISPID_SVEPhoneme)] + void Phoneme([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long Duration, // In milliseconds + [in]short NextPhoneId, + [in]SpeechVisemeFeature Feature, + [in]short CurrentPhoneId); + + // Viseme + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Viseme"), id(DISPID_SVEViseme)] + void Viseme([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long Duration, // In milliseconds + [in]SpeechVisemeType NextVisemeId, + [in]SpeechVisemeFeature Feature, + [in]SpeechVisemeType CurrentVisemeId); + + // AudioLevel + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AudioLevel"), id(DISPID_SVEAudioLevel)] + void AudioLevel([in]long StreamNumber, + [in]VARIANT StreamPosition, + [in]long AudioLevel); + + // EnginePrivate + // SAPI C++ Only Interface Equivalent: + // + [helpstring("EnginePrivate"), id(DISPID_SVEEnginePrivate)] + void EnginePrivate( [in]long StreamNumber, + [in]long StreamPosition, + [in]VARIANT EngineData); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecognizer +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecognizer +{ + DISPID_SRRecognizer = 1, + DISPID_SRAllowAudioInputFormatChangesOnNextSet, + DISPID_SRAudioInput, + DISPID_SRAudioInputStream, + DISPID_SRIsShared, + DISPID_SRState, + DISPID_SRStatus, + DISPID_SRProfile, + DISPID_SREmulateRecognition, + DISPID_SRCreateRecoContext, + DISPID_SRGetFormat, + DISPID_SRSetPropertyNumber, + DISPID_SRGetPropertyNumber, + DISPID_SRSetPropertyString, + DISPID_SRGetPropertyString, + DISPID_SRIsUISupported, + DISPID_SRDisplayUI, + DISPID_SRGetRecognizers, + DISPID_SVGetAudioInputs, + DISPID_SVGetProfiles +} DISPID_SpeechRecognizer; + +///////////////////////////////////////////////// +// +// SpeechLexiconType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRecognizerState +{ + SRSInactive = SPRST_INACTIVE, + SRSActive = SPRST_ACTIVE, + SRSActiveAlways = SPRST_ACTIVE_ALWAYS, + SRSInactiveWithPurge = SPRST_INACTIVE_WITH_PURGE, +} SpeechRecognizerState; + +///////////////////////////////////////////////// +// +// SpeechDisplayAttributes Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechDisplayAttributes +{ + SDA_No_Trailing_Space = 0, + SDA_One_Trailing_Space = SPAF_ONE_TRAILING_SPACE, + SDA_Two_Trailing_Spaces = SPAF_TWO_TRAILING_SPACES, + SDA_Consume_Leading_Spaces = SPAF_CONSUME_LEADING_SPACES +} SpeechDisplayAttributes; + +///////////////////////////////////////////////// +// +// SpeechFormatType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// +typedef enum SpeechFormatType +{ + SFTInput = SPWF_INPUT, + SFTSREngine = SPWF_SRENGINE +} SpeechFormatType; + +[ + object, + uuid(2D5F1C0C-BD75-4b08-9478-3B11FEA2586C), + dual, + helpstring("ISpeechRecognizer Interface"), + pointer_default(unique) +] +interface ISpeechRecognizer : IDispatch +{ + // Properties + + // Recognizer + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("Recognizer"), id(DISPID_SRRecognizer)] + HRESULT Recognizer( [in]ISpeechObjectToken* Recognizer ); + [propget, helpstring("Recognizer"), id(DISPID_SRRecognizer)] + HRESULT Recognizer( [out,retval]ISpeechObjectToken** Recognizer ); + + // AllowAudioInputFormatChangesOnNextSet + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet"), id(DISPID_SRAllowAudioInputFormatChangesOnNextSet)] + HRESULT AllowAudioInputFormatChangesOnNextSet([in] VARIANT_BOOL Allow ); + [propget, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet"), id(DISPID_SRAllowAudioInputFormatChangesOnNextSet)] + HRESULT AllowAudioInputFormatChangesOnNextSet([out,retval] VARIANT_BOOL* Allow ); + + // AudioInput + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("AudioInput"), id(DISPID_SRAudioInput)] + HRESULT AudioInput( [in,defaultvalue(0)]ISpeechObjectToken* AudioInput ); + [propget, helpstring("AudioInput"), id(DISPID_SRAudioInput)] + HRESULT AudioInput( [out,retval]ISpeechObjectToken** AudioInput ); + + // AudioInputStream + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("AudioInputStream"), id(DISPID_SRAudioInputStream)] + HRESULT AudioInputStream( [in,defaultvalue(0)]ISpeechBaseStream* AudioInputStream ); + [propget, helpstring("AudioInputStream"), id(DISPID_SRAudioInputStream)] + HRESULT AudioInputStream( [out,retval]ISpeechBaseStream** AudioInputStream ); + + // IsShared + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("IsShared"), id(DISPID_SRIsShared)] + HRESULT IsShared( [out,retval]VARIANT_BOOL* Shared ); + + // State + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("State"), id(DISPID_SRState)] + HRESULT State([in] SpeechRecognizerState State ); + [propget, helpstring("State"), id(DISPID_SRState)] + HRESULT State([out,retval] SpeechRecognizerState* State ); + + // Status + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Status"), id(DISPID_SRStatus)] + HRESULT Status([out,retval]ISpeechRecognizerStatus** Status ); + + // Profile + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("Profile"), id(DISPID_SRProfile)] + HRESULT Profile( [in,defaultvalue(0)]ISpeechObjectToken* Profile ); + [propget, helpstring("Profile"), id(DISPID_SRProfile)] + HRESULT Profile( [out,retval]ISpeechObjectToken** Profile ); + + // Methods + + // EmulateRecognition + // SAPI C++ Only Interface Equivalent: + // + // Notes: + // TextElements param: + // * This parameter specifies the elements of the phrase to EmulateRecognition with. + // * If it is a BSTR string then its assumed that the elements in TextElements are assumed to be + // space delimited and you cannot use the DisplayAttributes parameter (it is ignored). + // * If it is an array of BSTR words then you are specifying each element in the phrase and + // you can optionally specify the ElementDisplayAttributes as appropriate. + // * You can specify additional information for each element by using the following syntax on + // each TextElement: "/display_text/lexical_form/pronounciation;". This syntax can be used in both the + // BSTR and the array of BSTRs case. + // ElementDisplayAttributes param: + // * This parameter specifies the SpeechDisplayAttribute to use for each Word element. + // * If it is a NULL pointer, VT_NULL, or VT_EMPTY then SDA_No_Trailing_Space is assumed (default). + // * If it is a BSTR then it can be "" (empty string), " " (space), or " " (double space) + // and we'll pick the appropriate SpeechDispalyAttribute that matches and use this for all text elements. + // * If it is a integer value (VT_I1 to VT_I4) then this value is a SpeechDisplayAttribute value and + // it is used for each element in the Words array for the DisplayAttribute setting. + // and we'll pick the appropriate SpeechDispalyAttribute that matches and use this for all text elements. + // * If it is an array of integer values (VT_I1 to VT_I4) we'll use those values for the SpeechDisplayAttribute + // of each corresponding element in the TextElements array. + // * This parameter is only valid if you are using an array of BSTRs for the TextElements parameter (ignored + // if you pass in BSTR for Words). + // + [helpstring("EmulateRecognition"), id(DISPID_SREmulateRecognition)] + HRESULT EmulateRecognition( [in]VARIANT TextElements, [in, defaultvalue(NULL)]VARIANT* ElementDisplayAttributes, [in, defaultvalue(0)]long LanguageId); + + // CreateRecoContext + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CreateRecoContext"), id(DISPID_SRCreateRecoContext)] + HRESULT CreateRecoContext([out,retval]ISpeechRecoContext** NewContext ); + + // GetFormat + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetFormat"), id(DISPID_SRGetFormat)] + HRESULT GetFormat([in] SpeechFormatType Type, [out,retval]ISpeechAudioFormat** Format ); + + // SetPropertyNumber + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetPropertyNumber"), hidden, id(DISPID_SRSetPropertyNumber)] + HRESULT SetPropertyNumber( [in]const BSTR Name, [in]long Value, [out,retval]VARIANT_BOOL * Supported ); + + // GetPropertyNumber + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetPropertyNumber"), hidden, id(DISPID_SRGetPropertyNumber)] + HRESULT GetPropertyNumber( [in]const BSTR Name, [in,out]long* Value, [out,retval]VARIANT_BOOL * Supported ); + + // SetPropertyString + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetPropertyString"), hidden, id(DISPID_SRSetPropertyString)] + HRESULT SetPropertyString( [in]const BSTR Name, [in]const BSTR Value, [out,retval]VARIANT_BOOL * Supported ); + + // GetPropertyString + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetPropertyString"), hidden, id(DISPID_SRGetPropertyString)] + HRESULT GetPropertyString( [in]const BSTR Name, [in,out]BSTR* Value, [out,retval]VARIANT_BOOL * Supported ); + + // IsUISupported + // SAPI C++ Only Interface Equivalent: + // + [helpstring("IsUISupported"), id(DISPID_SRIsUISupported)] + HRESULT IsUISupported( [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData, + [out,retval] VARIANT_BOOL* Supported ); + + // DisplayUI + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DisplayUI"), id(DISPID_SRDisplayUI)] + HRESULT DisplayUI( [in]long hWndParent, + [in]BSTR Title, + [in]const BSTR TypeOfUI, + [in, defaultvalue(NULL)]const VARIANT* ExtraData); + + // GetRecognizers + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetRecognizers"), id(DISPID_SRGetRecognizers)] + HRESULT GetRecognizers([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + + // GetAudioOutputs + // SAPI C++ Only Interface Equivalent: IEnumSpObjectTokens + // + [helpstring("GetAudioInputs"), id(DISPID_SVGetAudioInputs)] + HRESULT GetAudioInputs([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + + // GetProfiles + // SAPI C++ Only Interface Equivalent: IEnumSpObjectTokens + // + [helpstring("GetProfiles"), id(DISPID_SVGetProfiles)] + HRESULT GetProfiles([in, defaultvalue("")]BSTR RequiredAttributes, + [in, defaultvalue("")]BSTR OptionalAttributes, + [out,retval]ISpeechObjectTokens** ObjectTokens ); + +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecognizerStatus +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecognizerStatus +{ + DISPID_SRSAudioStatus = 1, + DISPID_SRSCurrentStreamPosition, + DISPID_SRSCurrentStreamNumber, + DISPID_SRSNumberOfActiveRules, + DISPID_SRSClsidEngine, + DISPID_SRSSupportedLanguages +} DISPID_SpeechRecognizerStatus; + +[ + object, + uuid(BFF9E781-53EC-484e-BB8A-0E1B5551E35C), + dual, + helpstring("ISpeechRecognizerStatus Interface"), + pointer_default(unique) +] +interface ISpeechRecognizerStatus : IDispatch +{ + // Properties + + // AudioStatus + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioStatus"),id(DISPID_SRSAudioStatus)] + HRESULT AudioStatus([out,retval]ISpeechAudioStatus** AudioStatus ); + + // CurrentStreamPosition + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("CurrentStreamPosition"), id(DISPID_SRSCurrentStreamPosition)] + HRESULT CurrentStreamPosition([out,retval]VARIANT* pCurrentStreamPos ); + + // CurrentStreamNumber + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("CurrentStreamNumber"), id(DISPID_SRSCurrentStreamNumber)] + HRESULT CurrentStreamNumber([out,retval]long* StreamNumber ); + + // NumberOfActiveRules + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumberOfActiveRules"), id(DISPID_SRSNumberOfActiveRules)] + HRESULT NumberOfActiveRules([out,retval]long* NumberOfActiveRules ); + + // ClsidEngine + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("ClsidEngine"), id(DISPID_SRSClsidEngine)] + HRESULT ClsidEngine([out,retval]BSTR* ClsidEngine ); + + // SupportedLanguages + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("SupportedLanguages"), id(DISPID_SRSSupportedLanguages)] + HRESULT SupportedLanguages([out,retval]VARIANT* SupportedLanguages ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecoContext +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecoContext +{ + DISPID_SRCRecognizer = 1, + DISPID_SRCAudioInInterferenceStatus, + DISPID_SRCRequestedUIType, + DISPID_SRCVoice, + DISPID_SRAllowVoiceFormatMatchingOnNextSet, + DISPID_SRCVoicePurgeEvent, + DISPID_SRCEventInterests, + DISPID_SRCCmdMaxAlternates, + DISPID_SRCState, + DISPID_SRCRetainedAudio, + DISPID_SRCRetainedAudioFormat, + DISPID_SRCPause, + DISPID_SRCResume, + DISPID_SRCCreateGrammar, + DISPID_SRCCreateResultFromMemory, + DISPID_SRCBookmark, + DISPID_SRCSetAdaptationData +} DISPID_SpeechRecoContext; + +///////////////////////////////////////////////// +// +// SpeechRetainedAudioOptions Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRetainedAudioOptions +{ + SRAONone = SPAO_NONE, + SRAORetainAudio = SPAO_RETAIN_AUDIO +} SpeechRetainedAudioOptions; + +///////////////////////////////////////////////// +// +// SpeechBookmarkOptions Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechBookmarkOptions +{ + SBONone = SPBO_NONE, + SBOPause = SPBO_PAUSE +} SpeechBookmarkOptions; + +///////////////////////////////////////////////// +// +// SpeechInterference Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechInterference +{ + SINone = SPINTERFERENCE_NONE, + SINoise = SPINTERFERENCE_NOISE, + SINoSignal = SPINTERFERENCE_NOSIGNAL, + SITooLoud = SPINTERFERENCE_TOOLOUD, + SITooQuiet = SPINTERFERENCE_TOOQUIET, + SITooFast = SPINTERFERENCE_TOOFAST, + SITooSlow = SPINTERFERENCE_TOOSLOW +} SpeechInterference; + +///////////////////////////////////////////////// +// +// SpeechRecoEvents Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRecoEvents +{ + SREStreamEnd = (1L << 0), // SR engine has reached the end of an input stream + SRESoundStart = (1L << 1), // SR engine has detected the start of non-trivial audio data + SRESoundEnd = (1L << 2), // SR engine has detected the end of non-trivial audio data + SREPhraseStart = (1L << 3), // SR engine has detected the start of a recognizable phrase + SRERecognition = (1L << 4), // SR engine's best hypothesis for the audio data + SREHypothesis = (1L << 5), // SR engine's interim hypothesis for the result of the audio data + SREBookmark = (1L << 6), // SR engine has reached the specified point in the audio stream + SREPropertyNumChange = (1L << 7), // LPARAM points to a string, WPARAM is the attrib value + SREPropertyStringChange = (1L << 8), // LPARAM pointer to buffer. Two concatinated null terminated strings. + SREFalseRecognition = (1L << 9), // apparent speech with no valid recognition + SREInterference = (1L << 10), // LPARAM is any combination of SPINTERFERENCE flags + SRERequestUI = (1L << 11), // LPARAM is string. + SREStateChange = (1L << 12), // wParam contains new reco state + SREAdaptation = (1L << 13), // the adaptation buffer is now ready to be accepted + SREStreamStart = (1L << 14), // SR engine has reached the start of an input stream + SRERecoOtherContext = (1L << 15), // Phrase finished and recognized, but for other context + SREAudioLevel = (1L << 16), // input audio volume level + SREPrivate = (1L << 18), // private engine specific event + SREAllEvents = 0x5FFFF // All Reco events on. +} SpeechRecoEvents; + +///////////////////////////////////////////////// +// +// SpeechRecoContextState Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRecoContextState +{ + SRCS_Disabled = SPCS_DISABLED, + SRCS_Enabled = SPCS_ENABLED +} SpeechRecoContextState; + +[ + object, + uuid(580AA49D-7E1E-4809-B8E2-57DA806104B8), + dual, + helpstring("ISpeechRecoContext Interface"), + pointer_default(unique) +] +interface ISpeechRecoContext : IDispatch +{ + // Properties + + // Recognizer + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Recognizer"), id(DISPID_SRCRecognizer)] + HRESULT Recognizer( [out,retval]ISpeechRecognizer** Recognizer ); + + // AudioInInterferenceStatus + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioInInterferenceStatus"), id(DISPID_SRCAudioInInterferenceStatus)] + HRESULT AudioInputInterferenceStatus( [out,retval]SpeechInterference* Interference ); + + // RequestedUIType + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RequestedUIType"), id(DISPID_SRCRequestedUIType)] + HRESULT RequestedUIType( [out,retval]BSTR* UIType ); + + // Voice + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("Voice"), id(DISPID_SRCVoice)] + HRESULT Voice([in]ISpeechVoice *Voice ); + [propget, helpstring("Voice"), id(DISPID_SRCVoice)] + HRESULT Voice([out,retval]ISpeechVoice **Voice ); + + // AllowVoiceFormatMatchingOnNextSet + // + [propput, hidden, helpstring("AllowVoiceFormatMatchingOnNextSet"), id(DISPID_SRAllowVoiceFormatMatchingOnNextSet)] + HRESULT AllowVoiceFormatMatchingOnNextSet([in] VARIANT_BOOL Allow ); + [propget, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet"), id(DISPID_SRAllowVoiceFormatMatchingOnNextSet)] + HRESULT AllowVoiceFormatMatchingOnNextSet([out,retval] VARIANT_BOOL* pAllow ); + + // VoicePurgeEvent + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("VoicePurgeEvent"), id(DISPID_SRCVoicePurgeEvent)] + HRESULT VoicePurgeEvent( [in]SpeechRecoEvents EventInterest ); + [propget, helpstring("VoicePurgeEvent"), id(DISPID_SRCVoicePurgeEvent)] + HRESULT VoicePurgeEvent( [out,retval]SpeechRecoEvents* EventInterest ); + + // EventInterests + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("EventInterests"), id(DISPID_SRCEventInterests)] + HRESULT EventInterests( [in]SpeechRecoEvents EventInterest ); + [propget, helpstring("EventInterests"), id(DISPID_SRCEventInterests)] + HRESULT EventInterests( [out,retval]SpeechRecoEvents* EventInterest ); + + // CmdMaxAlternates + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("CmdMaxAlternates"), id(DISPID_SRCCmdMaxAlternates)] + HRESULT CmdMaxAlternates([in] long MaxAlternates ); + [propget, helpstring("CmdMaxAlternates"), id(DISPID_SRCCmdMaxAlternates)] + HRESULT CmdMaxAlternates([out,retval] long* MaxAlternates ); + + // State + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("State"), id(DISPID_SRCState)] + HRESULT State([in] SpeechRecoContextState State ); + [propget, helpstring("State"), id(DISPID_SRCState)] + HRESULT State([out,retval] SpeechRecoContextState* State ); + + // RetainedAudio + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("RetainedAudio"), id(DISPID_SRCRetainedAudio)] + HRESULT RetainedAudio([in]SpeechRetainedAudioOptions Option); + [propget, helpstring("RetainedAudio"), id(DISPID_SRCRetainedAudio)] + HRESULT RetainedAudio([out,retval]SpeechRetainedAudioOptions* Option); + + // RetainedAudioFormat + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("RetainedAudioFormat"), id(DISPID_SRCRetainedAudioFormat)] + HRESULT RetainedAudioFormat([in] ISpeechAudioFormat* Format ); + [propget, helpstring("RetainedAudioFormat"), id(DISPID_SRCRetainedAudioFormat)] + HRESULT RetainedAudioFormat([out,retval] ISpeechAudioFormat** Format ); + + // Methods + + // Pause + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Pause"), id(DISPID_SRCPause)] + HRESULT Pause(void); + + // Resume + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Resume"), id(DISPID_SRCResume)] + HRESULT Resume(void); + + // CreateGrammar + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CreateGrammar"), id(DISPID_SRCCreateGrammar)] + HRESULT CreateGrammar( [in, defaultvalue(0)]VARIANT GrammarId, [out,retval]ISpeechRecoGrammar** Grammar ); + + // CreateResultFromMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CreateResultFromMemory"), id(DISPID_SRCCreateResultFromMemory)] + HRESULT CreateResultFromMemory( [in]VARIANT* ResultBlock, [out,retval]ISpeechRecoResult **Result ); + + // Bookmark + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Bookmark"), id(DISPID_SRCBookmark)] + HRESULT Bookmark( [in]SpeechBookmarkOptions Options, [in]VARIANT StreamPos, [in]VARIANT BookmarkId ); + + // SetAdaptationData + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetAdaptationData"), id(DISPID_SRCSetAdaptationData)] + HRESULT SetAdaptationData( [in]BSTR AdaptationString ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecoGrammar +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPIDSPRG +{ + DISPID_SRGId = 1, + DISPID_SRGRecoContext, + DISPID_SRGState, + DISPID_SRGRules, + DISPID_SRGReset, + DISPID_SRGCommit, + DISPID_SRGCmdLoadFromFile, + DISPID_SRGCmdLoadFromObject, + DISPID_SRGCmdLoadFromResource, + DISPID_SRGCmdLoadFromMemory, + DISPID_SRGCmdLoadFromProprietaryGrammar, + DISPID_SRGCmdSetRuleState, + DISPID_SRGCmdSetRuleIdState, + DISPID_SRGDictationLoad, + DISPID_SRGDictationUnload, + DISPID_SRGDictationSetState, + DISPID_SRGSetWordSequenceData, + DISPID_SRGSetTextSelection, + DISPID_SRGIsPronounceable +} DISPIDSPRG; + +///////////////////////////////////////////////// +// +// SpeechLoadOption Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechLoadOption +{ + SLOStatic = SPLO_STATIC, + SLODynamic = SPLO_DYNAMIC +} SpeechLoadOption; + +///////////////////////////////////////////////// +// +// SpeechWordPronounceable Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechWordPronounceable +{ + SWPUnknownWordUnpronounceable = SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, + SWPUnknownWordPronounceable = SPWP_UNKNOWN_WORD_PRONOUNCEABLE, + SWPKnownWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE +} SpeechWordPronounceable; + +///////////////////////////////////////////////// +// +// SpeechGrammarState Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechGrammarState +{ + SGSEnabled = SPGS_ENABLED, + SGSDisabled = SPGS_DISABLED, + SGSExclusive = SPGS_EXCLUSIVE, +} SpeechGrammarState; + +///////////////////////////////////////////////// +// +// SpeechRuleState Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRuleState +{ + SGDSInactive = SPRS_INACTIVE, + SGDSActive = SPRS_ACTIVE, + SGDSActiveWithAutoPause = SPRS_ACTIVE_WITH_AUTO_PAUSE +} SpeechRuleState; + +///////////////////////////////////////////////// +// +// SpeechRuleAttributes Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRuleAttributes +{ + SRATopLevel = SPRAF_TopLevel, + SRADefaultToActive = SPRAF_Active, + SRAExport = SPRAF_Export, + SRAImport = SPRAF_Import, + SRAInterpreter = SPRAF_Interpreter, + SRADynamic = SPRAF_Dynamic +} SpeechRuleAttributes; + +///////////////////////////////////////////////// +// +// SpeechGrammarWordType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechGrammarWordType +{ + SGDisplay = SPWT_DISPLAY, // Not implemented + SGLexical = SPWT_LEXICAL, + SGPronounciation = SPWT_PRONUNCIATION // Not implemented +} SpeechGrammarWordType; + +[ + object, + uuid(B6D6F79F-2158-4e50-B5BC-9A9CCD852A09), + dual, + helpstring("ISpeechRecoGrammar Interface"), + pointer_default(unique) +] +interface ISpeechRecoGrammar : IDispatch +{ + // Properties + + // Id + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Id"), id(DISPID_SRGId)] + HRESULT Id( [out,retval]VARIANT* Id ); + + // RecoContext + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RecoContext"), id(DISPID_SRGRecoContext)] + HRESULT RecoContext( [out,retval] ISpeechRecoContext** RecoContext ); + + // State + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("State"), id(DISPID_SRGState)] + HRESULT State( [in]SpeechGrammarState State ); + [propget, helpstring("State"), id(DISPID_SRGState)] + HRESULT State( [out,retval]SpeechGrammarState* State); + + // Rules + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Rules"), id(DISPID_SRGRules)] + HRESULT Rules( [out,retval]ISpeechGrammarRules** Rules); + + // Methods + + // Reset + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Reset"), id(DISPID_SRGReset)] + HRESULT Reset([in, defaultvalue(0)]SpeechLanguageId NewLanguage); + + // CmdLoadFromFile + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromFile"), id(DISPID_SRGCmdLoadFromFile)] + HRESULT CmdLoadFromFile( [in]const BSTR FileName, [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdLoadFromObject + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromObject"), id(DISPID_SRGCmdLoadFromObject)] + HRESULT CmdLoadFromObject( [in]const BSTR ClassId, + [in]const BSTR GrammarName, + [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdLoadFromResource + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromResource"), id(DISPID_SRGCmdLoadFromResource)] + HRESULT CmdLoadFromResource( [in]long hModule, + [in]VARIANT ResourceName, + [in]VARIANT ResourceType, + [in]SpeechLanguageId LanguageId, + [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdLoadFromMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromMemory"), id(DISPID_SRGCmdLoadFromMemory)] + HRESULT CmdLoadFromMemory( [in] VARIANT GrammarData, [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdLoadFromProprietaryGrammar + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdLoadFromProprietaryGrammar"), id(DISPID_SRGCmdLoadFromProprietaryGrammar)] + HRESULT CmdLoadFromProprietaryGrammar( [in]const BSTR ProprietaryGuid, + [in]const BSTR ProprietaryString, + [in]VARIANT ProprietaryData, + [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // CmdSetRuleState + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdSetRuleState"), id(DISPID_SRGCmdSetRuleState)] + HRESULT CmdSetRuleState( [in/*, defaultvalue("")*/]const BSTR Name, [in]SpeechRuleState State); + + // CmdSetRuleIdState + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CmdSetRuleIdState"), id(DISPID_SRGCmdSetRuleIdState)] + HRESULT CmdSetRuleIdState( [in/*, defaultvalue(0)*/]long RuleId, [in]SpeechRuleState State ); + + // DictationLoad + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DictationLoad"), id(DISPID_SRGDictationLoad)] + HRESULT DictationLoad( [in, defaultvalue("")] const BSTR TopicName, [in, defaultvalue(SLOStatic)]SpeechLoadOption LoadOption ); + + // DictationUnload + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DictationUnload"), id(DISPID_SRGDictationUnload)] + HRESULT DictationUnload( void ); + + // DictationSetState + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DictationSetState"), id(DISPID_SRGDictationSetState)] + HRESULT DictationSetState( [in]SpeechRuleState State ); + + // SetWordSequenceData + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetWordSequenceData"), id(DISPID_SRGSetWordSequenceData)] + HRESULT SetWordSequenceData( [in]const BSTR Text, [in]long TextLength, [in]ISpeechTextSelectionInformation* Info ); + + // SetTextSelection + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SetTextSelection"), id(DISPID_SRGSetTextSelection)] + HRESULT SetTextSelection( [in]ISpeechTextSelectionInformation* Info ); + + // IsPronounceable + // SAPI C++ Only Interface Equivalent: + // + [helpstring("IsPronounceable"), id(DISPID_SRGIsPronounceable)] + HRESULT IsPronounceable( [in]const BSTR Word, [out,retval]SpeechWordPronounceable* WordPronounceable ); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// _ISpeechRecoContextEvents +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecoContextEvents +{ + DISPID_SRCEStartStream = 1, + DISPID_SRCEEndStream, + DISPID_SRCEBookmark, + DISPID_SRCESoundStart, + DISPID_SRCESoundEnd, + DISPID_SRCEPhraseStart, + DISPID_SRCERecognition, + DISPID_SRCEHypothesis, + DISPID_SRCEPropertyNumberChange, + DISPID_SRCEPropertyStringChange, + DISPID_SRCEFalseRecognition, + DISPID_SRCEInterference, + DISPID_SRCERequestUI, + DISPID_SRCERecognizerStateChange, + DISPID_SRCEAdaptation, + DISPID_SRCERecognitionForOtherContext, + DISPID_SRCEAudioLevel, + DISPID_SRCEEnginePrivate +} DISPID_SpeechRecoContextEvents; + +///////////////////////////////////////////////// +// +// SpeechRecognitionType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechRecognitionType +{ + SRTStandard = 0, + SRTAutopause = SPREF_AutoPause, + SRTEmulated = SPREF_Emulated +} SpeechRecognitionType; + +[ + uuid(7B8FCB42-0E9D-4f00-A048-7B04D6179D3D) +] +dispinterface _ISpeechRecoContextEvents +{ + properties: + methods: + + // Methods + + // StartStream + // SAPI C++ Only Interface Equivalent: + // + [helpstring("StartStream"), id(DISPID_SRCEStartStream)] + void StartStream([in]long StreamNumber, [in]VARIANT StreamPosition); + + // EndStream + // SAPI C++ Only Interface Equivalent: + // + [helpstring("EndStream"), id(DISPID_SRCEEndStream)] + void EndStream([in]long StreamNumber, [in]VARIANT StreamPosition, [in]VARIANT_BOOL StreamReleased); + + // Bookmark + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Bookmark"), id(DISPID_SRCEBookmark)] + void Bookmark([in]long StreamNumber, [in]VARIANT StreamPosition, [in]VARIANT BookmarkId, [in]SpeechBookmarkOptions Options); + + // SoundStart + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SoundStart"), id(DISPID_SRCESoundStart)] + void SoundStart([in]long StreamNumber, [in]VARIANT StreamPosition); + + // SoundEnd + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SoundEnd"), id(DISPID_SRCESoundEnd)] + void SoundEnd([in]long StreamNumber, [in]VARIANT StreamPosition); + + // PhraseStart + // SAPI C++ Only Interface Equivalent: + // + [helpstring("PhraseStart"), id(DISPID_SRCEPhraseStart)] + void PhraseStart([in]long StreamNumber, [in]VARIANT StreamPosition); + + // Recognition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Recognition"), id(DISPID_SRCERecognition)] + void Recognition([in]long StreamNumber, [in]VARIANT StreamPosition, [in]SpeechRecognitionType RecognitionType, [in]ISpeechRecoResult * Result); + + // Hypothesis + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Hypothesis"), id(DISPID_SRCEHypothesis)] + void Hypothesis([in]long StreamNumber, [in]VARIANT StreamPosition, [in]ISpeechRecoResult* Result); + + // PropertyNumberChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("PropertyNumberChange"), id(DISPID_SRCEPropertyNumberChange)] + void PropertyNumberChange([in]long StreamNumber, [in]VARIANT StreamPosition, [in]BSTR PropertyName, [in]long NewNumberValue); + + // PropertyStringChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("PropertyStringChange"), id(DISPID_SRCEPropertyStringChange)] + void PropertyStringChange([in]long StreamNumber, [in]VARIANT StreamPosition, [in]BSTR PropertyName, [in]BSTR NewStringValue); + + // FalseRecognition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("FalseRecognition"), id(DISPID_SRCEFalseRecognition)] + void FalseRecognition([in]long StreamNumber, [in]VARIANT StreamPosition, [in]ISpeechRecoResult* Result); + + // Interference + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Interference"), id(DISPID_SRCEInterference)] + void Interference([in]long StreamNumber, [in]VARIANT StreamPosition, [in]SpeechInterference Interference); + + // RequestUI + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RequestUI"), id(DISPID_SRCERequestUI)] + void RequestUI([in]long StreamNumber, [in]VARIANT StreamPosition, [in]BSTR UIType); + + // RecognizerStateChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RecognizerStateChange"), id(DISPID_SRCERecognizerStateChange)] + void RecognizerStateChange([in]long StreamNumber, [in]VARIANT StreamPosition, [in]SpeechRecognizerState NewState); + + // Adaption + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Adaptation"), id(DISPID_SRCEAdaptation)] + void Adaptation([in]long StreamNumber, [in]VARIANT StreamPosition); + + // RecognitionForOtherContext + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RecognitionForOtherContext"), id(DISPID_SRCERecognitionForOtherContext)] + void RecognitionForOtherContext([in]long StreamNumber, [in]VARIANT StreamPosition); + + // AudioLevel + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AudioLevel"), id(DISPID_SRCEAudioLevel)] + void AudioLevel([in]long StreamNumber, [in]VARIANT StreamPosition, [in]long AudioLevel); + + // EnginePrivate + // SAPI C++ Only Interface Equivalent: + // + [helpstring("EnginePrivate"), id(DISPID_SRCEEnginePrivate)] + void EnginePrivate([in]long StreamNumber, [in]VARIANT StreamPosition, [in]VARIANT EngineData); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarRule +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRule +{ + DISPID_SGRAttributes = 1, + DISPID_SGRInitialState, + DISPID_SGRName, + DISPID_SGRId, + DISPID_SGRClear, + DISPID_SGRAddResource, + DISPID_SGRAddState +} DISPID_SpeechGrammarRule; + +[ + object, + uuid(AFE719CF-5DD1-44f2-999C-7A399F1CFCCC), + dual, + helpstring("ISpeechGrammarRule Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRule : IDispatch +{ + // Properties + + // RuleAttributes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RuleAttributes"), id(DISPID_SGRAttributes)] + HRESULT Attributes([out, retval] SpeechRuleAttributes* Attributes ); + + // InitialState + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("InitialState"), id(DISPID_SGRInitialState)] + HRESULT InitialState([out, retval] ISpeechGrammarRuleState** State); + + // Name + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Name"), id(DISPID_SGRName)] + HRESULT Name([out, retval] BSTR* Name); + + // Id + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Id"), id(DISPID_SGRId)] + HRESULT Id([out, retval] long* Id); + + // Methods + + // Clear + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Clear"),id(DISPID_SGRClear)] + HRESULT Clear(); + + // AddResource + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddResource"), id(DISPID_SGRAddResource)] + HRESULT AddResource([in]const BSTR ResourceName, [in]const BSTR ResourceValue); + + // AddState + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddState"), id(DISPID_SGRAddState)] + HRESULT AddState([out, retval] ISpeechGrammarRuleState** State); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarRules +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRules +{ + DISPID_SGRsCount = 1, + DISPID_SGRsDynamic, + DISPID_SGRsAdd, + DISPID_SGRsCommit, + DISPID_SGRsCommitAndSave, + DISPID_SGRsFindRule, + DISPID_SGRsItem = DISPID_VALUE, + DISPID_SGRs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechGrammarRules; + +[ + object, + uuid(6FFA3B44-FC2D-40d1-8AFC-32911C7F1AD1), + dual, + helpstring("ISpeechGrammarRules Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRules : IDispatch +{ + // Properties + + // RuleAttributes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SGRsCount)] + HRESULT Count([out, retval] long* Count); + + // FindRule + // SAPI C++ Only Interface Equivalent: + // NOTE: This returns S_OK with NULL Rule if rule is not found. + [helpstring("FindRule"), id(DISPID_SGRsFindRule)] + HRESULT FindRule([in]VARIANT RuleNameOrId, [out, retval]ISpeechGrammarRule** Rule); + + // Item + // SAPI C++ Only Interface Equivalent: + // Default: + // + [id(DISPID_SGRsItem), helpstring("Item")] + HRESULT Item([in] long Index, [out, retval]ISpeechGrammarRule** Rule ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // Default: + // + [id(DISPID_SGRs_NewEnum), propget, helpstring("Enumerates the alternates"), restricted] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); + + // Dynamic + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Dynamic"), id(DISPID_SGRsDynamic)] + HRESULT Dynamic([out, retval] VARIANT_BOOL *Dynamic); + + // Methods + + // Add + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Add"), id(DISPID_SGRsAdd)] + HRESULT Add([in] BSTR RuleName, + [in] SpeechRuleAttributes Attributes, + [in, defaultvalue(0)] long RuleId, + [out, retval] ISpeechGrammarRule** Rule); + + // Commit + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Commit"), id(DISPID_SGRsCommit)] + HRESULT Commit(void); + + // CommitAndSave + // SAPI C++ Only Interface Equivalent: + // + [helpstring("CommitAndSave"), id(DISPID_SGRsCommitAndSave)] + HRESULT CommitAndSave([out] BSTR* ErrorText, [out, retval] VARIANT* SaveStream); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarRuleState +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRuleState +{ + DISPID_SGRSRule = 1, + DISPID_SGRSTransitions, + DISPID_SGRSAddWordTransition, + DISPID_SGRSAddRuleTransition, + DISPID_SGRSAddSpecialTransition +} DISPID_SpeechGrammarRuleState; + +typedef enum SpeechSpecialTransitionType +{ + SSTTWildcard = 1, + SSTTDictation, + SSTTTextBuffer +} SpeechSpecialTransitionType; + +[ + object, + uuid(D4286F2C-EE67-45ae-B928-28D695362EDA), + dual, + helpstring("ISpeechGrammarRuleState Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRuleState : IDispatch +{ + // Properties + + // Rule + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Rule"), id(DISPID_SGRSRule)] + HRESULT Rule([out, retval] ISpeechGrammarRule** Rule); + + // Transitions + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Transitions"), id(DISPID_SGRSTransitions)] + HRESULT Transitions([out, retval] ISpeechGrammarRuleStateTransitions** Transitions); + + // Methods + + // AddWordTransition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddWordTransition"), id(DISPID_SGRSAddWordTransition)] + HRESULT AddWordTransition([in]ISpeechGrammarRuleState* DestState, + [in]const BSTR Words, + [in, defaultvalue(" ")]const BSTR Separators, + [in, defaultvalue(SGLexical)]SpeechGrammarWordType Type, + [in, defaultvalue("")]const BSTR PropertyName, + [in, defaultvalue(0)]long PropertyId, + [in, defaultvalue(0)]VARIANT* PropertyValue, + [in, defaultvalue(1.0)]float Weight); + + // AddRuleTransition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddRuleTransition"), id(DISPID_SGRSAddRuleTransition)] + HRESULT AddRuleTransition([in]ISpeechGrammarRuleState* DestinationState, + [in]ISpeechGrammarRule* Rule, + [in, defaultvalue("")]const BSTR PropertyName, + [in, defaultvalue(0)]long PropertyId, + [in, defaultvalue(0)]VARIANT* PropertyValue, + [in, defaultvalue(1.0)]float Weight); + + // AddSpecialTransition + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddSpecialTransition"), id(DISPID_SGRSAddSpecialTransition)] + HRESULT AddSpecialTransition([in]ISpeechGrammarRuleState* DestinationState, + [in]SpeechSpecialTransitionType Type, + [in, defaultvalue("")]const BSTR PropertyName, + [in, defaultvalue(0)]long PropertyId, + [in, defaultvalue(0)]VARIANT* PropertyValue, + [in, defaultvalue(1.0)]float Weight); + +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarStateTransitions +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRuleStateTransitions +{ + DISPID_SGRSTsCount = 1, + DISPID_SGRSTsItem = DISPID_VALUE, + DISPID_SGRSTs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechGrammarRuleStateTransitions; + +[ + object, + uuid(EABCE657-75BC-44a2-AA7F-C56476742963), + dual, + helpstring("ISpeechGrammarRuleStateTransitions Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRuleStateTransitions : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SGRSTsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SGRSTsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechGrammarRuleStateTransition** Transition ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the transitions"), restricted, id(DISPID_SGRSTs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechGrammarStateTransition +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechGrammarRuleStateTransition +{ + DISPID_SGRSTType = 1, + DISPID_SGRSTText, + DISPID_SGRSTRule, + DISPID_SGRSTWeight, + DISPID_SGRSTPropertyName, + DISPID_SGRSTPropertyId, + DISPID_SGRSTPropertyValue, + DISPID_SGRSTNextState +} DISPID_SpeechGrammarRuleStateTransition; + +////////////////////////////////// +// +// SpeechGrammarRuleStateTransitionType Enum +// SAPI C++ Only Interface Equivalent: +// +////////////////////////////////// + +typedef enum SpeechGrammarRuleStateTransitionType +{ + SGRSTTEpsilon = 0, + SGRSTTWord, + SGRSTTRule, + SGRSTTDictation, + SGRSTTWildcard, + SGRSTTTextBuffer +} SpeechGrammarRuleStateTransitionType; + +[ + object, + uuid(CAFD1DB1-41D1-4a06-9863-E2E81DA17A9A), + dual, + helpstring("ISpeechGrammarRuleStateTransition Interface"), + pointer_default(unique) +] +interface ISpeechGrammarRuleStateTransition : IDispatch +{ + // Properties + + // Type + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Type"), id(DISPID_SGRSTType)] + HRESULT Type([out, retval] SpeechGrammarRuleStateTransitionType* Type); + + // Text + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Text"), id(DISPID_SGRSTText)] + HRESULT Text([out, retval] BSTR* Text); + + // Rule + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Rule"), id(DISPID_SGRSTRule)] + HRESULT Rule([out, retval] ISpeechGrammarRule ** Rule); + + // Weight + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Weight"), id(DISPID_SGRSTWeight)] + HRESULT Weight([out, retval] VARIANT * Weight); + + // PropertyName + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("PropertyName"), id(DISPID_SGRSTPropertyName)] + HRESULT PropertyName([out, retval] BSTR * PropertyName); + + // PropertyId + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("PropertyId"), id(DISPID_SGRSTPropertyId)] + HRESULT PropertyId([out, retval] long * PropertyId); + + // PropertyValue + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("PropertyValue"), id(DISPID_SGRSTPropertyValue)] + HRESULT PropertyValue([out, retval] VARIANT * PropertyValue); + + // NextState + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NextState"), id(DISPID_SGRSTNextState)] + HRESULT NextState([out, retval] ISpeechGrammarRuleState ** NextState); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechTextSelectionInformation +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPIDSPTSI +{ + DISPIDSPTSI_ActiveOffset = 1, + DISPIDSPTSI_ActiveLength, + DISPIDSPTSI_SelectionOffset, + DISPIDSPTSI_SelectionLength +} DISPIDSPTSI; + +[ + object, + uuid(3B9C7E7A-6EEE-4DED-9092-11657279ADBE), + dual, + helpstring("ISpeechTextSelectionInformation Interface"), + pointer_default(unique) +] +interface ISpeechTextSelectionInformation : IDispatch +{ + // Properties + + // ActiveOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("ActiveOffset"), id(DISPIDSPTSI_ActiveOffset)] + HRESULT ActiveOffset( [in]long ActiveOffset ); + [propget, helpstring("ActiveOffset"), id(DISPIDSPTSI_ActiveOffset)] + HRESULT ActiveOffset( [out, retval]long* ActiveOffset ); + + // ActiveLength + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("ActiveLength"), id(DISPIDSPTSI_ActiveLength)] + HRESULT ActiveLength( [in]long ActiveLength ); + [propget, helpstring("ActiveLength"), id(DISPIDSPTSI_ActiveLength)] + HRESULT ActiveLength( [out, retval]long* ActiveLength ); + + // SelectionOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("SelectionOffset"), id(DISPIDSPTSI_SelectionOffset)] + HRESULT SelectionOffset( [in]long SelectionOffset ); + [propget, helpstring("SelectionOffset"), id(DISPIDSPTSI_SelectionOffset)] + HRESULT SelectionOffset( [out, retval]long* SelectionOffset ); + + // SelectionLength + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propput, helpstring("SelectionLength"), id(DISPIDSPTSI_SelectionLength)] + HRESULT SelectionLength( [in]long SelectionLength ); + [propget, helpstring("SelectionLength"), id(DISPIDSPTSI_SelectionLength)] + HRESULT SelectionLength( [out, retval]long* SelectionLength ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecoResult +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecoResult +{ + DISPID_SRRRecoContext = 1, + DISPID_SRRTimes, + DISPID_SRRAudioFormat, + DISPID_SRRPhraseInfo, + DISPID_SRRAlternates, + DISPID_SRRAudio, + DISPID_SRRSpeakAudio, + DISPID_SRRSaveToMemory, + DISPID_SRRDiscardResultInfo +} DISPID_SpeechRecoResult; + +///////////////////////////////////////////////// +// +// SpeechDiscardType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechDiscardType +{ + SDTProperty = SPDF_PROPERTY, + SDTReplacement = SPDF_REPLACEMENT, + SDTRule = SPDF_RULE, + SDTDisplayText = SPDF_DISPLAYTEXT, + SDTLexicalForm = SPDF_LEXICALFORM, + SDTPronunciation = SPDF_PRONUNCIATION, + SDTAudio = SPDF_AUDIO, + SDTAlternates = SPDF_ALTERNATES, + SDTAll = SPDF_ALL +} SpeechDiscardType; + +[ + object, + uuid(ED2879CF-CED9-4ee6-A534-DE0191D5468D), + dual, + helpstring("ISpeechRecoResult Interface"), + pointer_default(unique) +] +interface ISpeechRecoResult : IDispatch +{ + // Properties + + // RecoContext + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RecoContext"), id(DISPID_SRRRecoContext)] + HRESULT RecoContext( [out,retval]ISpeechRecoContext** RecoContext ); + + // Times + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Times"), id(DISPID_SRRTimes)] + HRESULT Times( [out,retval]ISpeechRecoResultTimes** Times ); + + // AudioFormat + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propputref, helpstring("AudioFormat"), id(DISPID_SRRAudioFormat)] + HRESULT AudioFormat( [in]ISpeechAudioFormat* Format ); + [propget, helpstring("AudioFormat"), id(DISPID_SRRAudioFormat)] + HRESULT AudioFormat( [out,retval]ISpeechAudioFormat** Format ); + + // PhraseInfo + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("PhraseInfo"), id(DISPID_SRRPhraseInfo)] + HRESULT PhraseInfo( [out,retval]ISpeechPhraseInfo** PhraseInfo ); + + + // Methods + + // Alternates + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Alternates"), id(DISPID_SRRAlternates)] + HRESULT Alternates( [in] long RequestCount, + [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [out,retval] ISpeechPhraseAlternates** Alternates ); + + // Audio + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Audio"), id(DISPID_SRRAudio)] + HRESULT Audio( [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [out,retval] ISpeechMemoryStream **Stream ); + + // SpeakAudio + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SpeakAudio"), id(DISPID_SRRSpeakAudio)] + HRESULT SpeakAudio( [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [in, defaultvalue(SPF_DEFAULT)] SpeechVoiceSpeakFlags Flags, + [out,retval]long* StreamNumber ); + + // SaveToMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SaveToMemory"), id(DISPID_SRRSaveToMemory)] + HRESULT SaveToMemory( [out,retval] VARIANT* ResultBlock ); + + // DiscardResultInfo + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DiscardResultInfo"), id(DISPID_SRRDiscardResultInfo)] + HRESULT DiscardResultInfo( [in]SpeechDiscardType ValueTypes ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseInfoBuilder +// SAPI C++ Only Interface Equivalent: +// This interface corresponds to the ISpPhraseBuilder +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseBuilder +{ + DISPID_SPPBRestorePhraseFromMemory = 1 +} DISPID_SpeechPhraseBuilder ; + +[ + object, + uuid(3B151836-DF3A-4E0A-846C-D2ADC9334333), + dual, + helpstring("ISpeechPhraseInfoBuilder Interface"), + pointer_default(unique) +] +interface ISpeechPhraseInfoBuilder : IDispatch +{ + // Methods + + // RestorePhraseFromMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RestorePhraseFromMemory"), id(DISPID_SPPBRestorePhraseFromMemory)] + HRESULT RestorePhraseFromMemory([in] VARIANT* PhraseInMemory, + [out,retval] ISpeechPhraseInfo **PhraseInfo); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechRecoResultTimes +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechRecoResultTimes +{ + DISPID_SRRTStreamTime = 1, + DISPID_SRRTLength, + DISPID_SRRTTickCount, + DISPID_SRRTOffsetFromStart +} DISPID_SpeechRecoResultTimes; + +[ + object, + uuid(62B3B8FB-F6E7-41be-BDCB-056B1C29EFC0), + dual, + helpstring("ISpeechRecoResultTimes Interface"), + pointer_default(unique) +] +interface ISpeechRecoResultTimes : IDispatch +{ + // Properties + + // StreamTime + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("StreamTime"), id(DISPID_SRRTStreamTime)] + HRESULT StreamTime([out,retval]VARIANT* Time ); + + // Length + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Length"), id(DISPID_SRRTLength)] + HRESULT Length([out,retval]VARIANT* Length ); + + // TickCount + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("TickCount"), id(DISPID_SRRTTickCount)] + HRESULT TickCount([out,retval]long* TickCount ); + + // Start + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Start"), id(DISPID_SRRTOffsetFromStart)] + HRESULT OffsetFromStart([out,retval]VARIANT* OffsetFromStart ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseAlternate +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseAlternate +{ + DISPID_SPARecoResult = 1, + DISPID_SPAStartElementInResult, + DISPID_SPANumberOfElementsInResult, + DISPID_SPAPhraseInfo, + DISPID_SPACommit +} DISPID_SpeechPhraseAlternate; + +[ + object, + uuid(27864A2A-2B9F-4cb8-92D3-0D2722FD1E73), + dual, + helpstring("ISpeechPhraseAlternate Interface"), + pointer_default(unique) +] +interface ISpeechPhraseAlternate : IDispatch +{ + // Properties + + // RecoResult + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RecoResult"), id(DISPID_SPARecoResult)] + HRESULT RecoResult( [out,retval]ISpeechRecoResult** RecoResult ); // Was ISpPhrase, is this right? + + // StartElementInResult + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("StartElementInResult"), id(DISPID_SPAStartElementInResult)] + HRESULT StartElementInResult( [out,retval]long* StartElement ); + + // NumberOfElementsInResult + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumberOfElementsInResult"), id(DISPID_SPANumberOfElementsInResult)] + HRESULT NumberOfElementsInResult( [out,retval]long* NumberOfElements ); + + // PhraseInfo + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Phrase"), id(DISPID_SPAPhraseInfo)] + HRESULT PhraseInfo( [out,retval]ISpeechPhraseInfo** PhraseInfo ); + + // Methods + + // Commit + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Commit"), id(DISPID_SPACommit)] + HRESULT Commit( void ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseAlternates +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseAlternates +{ + DISPID_SPAsCount = 1, + DISPID_SPAsItem = DISPID_VALUE, + DISPID_SPAs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseAlternates; + +[ + object, + uuid(B238B6D5-F276-4c3d-A6C1-2974801C3CC2), + dual, + helpstring("ISpeechPhraseAlternates Interface"), + pointer_default(unique) +] +interface ISpeechPhraseAlternates : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPAsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPAsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseAlternate** PhraseAlternate ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the alternates"), restricted, id(DISPID_SPAs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseInfo +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseInfo +{ + DISPID_SPILanguageId = 1, + DISPID_SPIGrammarId, + DISPID_SPIStartTime, + DISPID_SPIAudioStreamPosition, + DISPID_SPIAudioSizeBytes, + DISPID_SPIRetainedSizeBytes, + DISPID_SPIAudioSizeTime, + DISPID_SPIRule, + DISPID_SPIProperties, + DISPID_SPIElements, + DISPID_SPIReplacements, + DISPID_SPIEngineId, + DISPID_SPIEnginePrivateData, + DISPID_SPISaveToMemory, + DISPID_SPIGetText, + DISPID_SPIGetDisplayAttributes +} DISPID_SpeechPhraseInfo; + +[ + object, + uuid(961559CF-4E67-4662-8BF0-D93F1FCD61B3), + dual, + helpstring("ISpeechPhraseInfo Interface"), + pointer_default(unique) +] +interface ISpeechPhraseInfo : IDispatch +{ + // Properties + + // LanguageId + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("LanguageId"), id(DISPID_SPILanguageId)] + HRESULT LanguageId( [out, retval]long* LanguageId ); + + // GrammarId + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("GrammarId"), id(DISPID_SPIGrammarId)] + HRESULT GrammarId( [out, retval]VARIANT* GrammarId ); + + // StartTime + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("StartTime"), id(DISPID_SPIStartTime)] + HRESULT StartTime( [out, retval]VARIANT* StartTime ); + + // AudioStreamPosition + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioStreamPosition"), id(DISPID_SPIAudioStreamPosition)] + HRESULT AudioStreamPosition( [out, retval]VARIANT* AudioStreamPosition ); + + // AudioSizeBytes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioSizeBytes"), id(DISPID_SPIAudioSizeBytes)] + HRESULT AudioSizeBytes( [out, retval]long* pAudioSizeBytes ); + + // RetainedSizeBytes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RetainedSizeBytes"), id(DISPID_SPIRetainedSizeBytes)] + HRESULT RetainedSizeBytes( [out, retval]long* RetainedSizeBytes ); + + // AudioSizeTime + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioSizeTime"), id(DISPID_SPIAudioSizeTime)] + HRESULT AudioSizeTime( [out, retval]long* AudioSizeTime ); + + // Rule + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Rule"), id(DISPID_SPIRule)] + HRESULT Rule( [out, retval]ISpeechPhraseRule** Rule ); + + // Properties + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Properties"), id(DISPID_SPIProperties)] + HRESULT Properties( [out, retval]ISpeechPhraseProperties** Properties ); + + // Elements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Elements"), id(DISPID_SPIElements)] + HRESULT Elements( [out, retval]ISpeechPhraseElements** Elements ); + + // Replacements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Replacements"), id(DISPID_SPIReplacements)] + HRESULT Replacements( [out, retval]ISpeechPhraseReplacements** Replacements ); + + // EngineId + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EngineId"), id(DISPID_SPIEngineId)] + HRESULT EngineId( [out, retval]BSTR* EngineIdGuid ); + + // EnginePrivateData + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EnginePrivateData"), id(DISPID_SPIEnginePrivateData)] + HRESULT EnginePrivateData( [out, retval]VARIANT *PrivateData ); + + // Methods + + // SaveToMemory + // SAPI C++ Only Interface Equivalent: + // + [helpstring("SaveToMemory"), id(DISPID_SPISaveToMemory)] + HRESULT SaveToMemory( [out,retval]VARIANT* PhraseBlock ); + + // GetText + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetText"), id(DISPID_SPIGetText)] + HRESULT GetText( [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [in, defaultvalue(-1)] VARIANT_BOOL UseReplacements, + [out,retval]BSTR* Text ); + + // DisplayAttributes + // SAPI C++ Only Interface Equivalent: + // + [helpstring("DisplayAttributes"), id(DISPID_SPIGetDisplayAttributes)] + HRESULT GetDisplayAttributes( [in, defaultvalue(0)] long StartElement, + [in, defaultvalue(SPPR_ALL_ELEMENTS)] long Elements, + [in, defaultvalue(-1)] VARIANT_BOOL UseReplacements, + [out,retval]SpeechDisplayAttributes* DisplayAttributes ); + +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseElement +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseElement +{ + DISPID_SPEAudioTimeOffset = 1, + DISPID_SPEAudioSizeTime, + DISPID_SPEAudioStreamOffset, + DISPID_SPEAudioSizeBytes, + DISPID_SPERetainedStreamOffset, + DISPID_SPERetainedSizeBytes, + DISPID_SPEDisplayText, + DISPID_SPELexicalForm, + DISPID_SPEPronunciation, + DISPID_SPEDisplayAttributes, + DISPID_SPERequiredConfidence, + DISPID_SPEActualConfidence, + DISPID_SPEEngineConfidence +} DISPID_SpeechPhraseElement; + +///////////////////////////////////////////////// +// +// SpeechEngineConfidence Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechEngineConfidence +{ + SECLowConfidence = -1, + SECNormalConfidence = 0, + SECHighConfidence = 1 +} SpeechEngineConfidence; + +[ + object, + uuid(E6176F96-E373-4801-B223-3B62C068C0B4), + dual, + helpstring("ISpeechPhraseElement Interface"), + pointer_default(unique) +] +interface ISpeechPhraseElement : IDispatch +{ + // Properties + + // AudioTimeOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioTimeOffset"), id(DISPID_SPEAudioTimeOffset)] + HRESULT AudioTimeOffset( [out, retval]long* AudioTimeOffset ); + + // AudioSizeTime + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioSizeTime"), id(DISPID_SPEAudioSizeTime)] + HRESULT AudioSizeTime( [out, retval]long* AudioSizeTime ); + + // AudioStreamOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioStreamOffset"), id(DISPID_SPEAudioStreamOffset)] + HRESULT AudioStreamOffset( [out, retval]long* AudioStreamOffset ); + + // AudioSizeBytes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("AudioSizeBytes"), id(DISPID_SPEAudioSizeBytes)] + HRESULT AudioSizeBytes( [out, retval]long* AudioSizeBytes ); + + // RetainedStreamOffset + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RetainedStreamOffset"), id(DISPID_SPERetainedStreamOffset)] + HRESULT RetainedStreamOffset( [out, retval]long* RetainedStreamOffset ); + + // RetainedSizeBytes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RetainedSizeBytes"), id(DISPID_SPERetainedSizeBytes)] + HRESULT RetainedSizeBytes( [out, retval]long* RetainedSizeBytes ); + + // DisplayText + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("DisplayText"), id(DISPID_SPEDisplayText)] + HRESULT DisplayText( [out, retval]BSTR* DisplayText ); + + // LexicalForm + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("LexicalForm"), id(DISPID_SPELexicalForm)] + HRESULT LexicalForm( [out, retval]BSTR* LexicalForm ); + + // Pronunciation + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Pronunciation"), id(DISPID_SPEPronunciation)] + HRESULT Pronunciation( [out, retval]VARIANT* Pronunciation ); + + // DisplayAttributes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("DisplayAttributes"), id(DISPID_SPEDisplayAttributes)] + HRESULT DisplayAttributes( [out, retval]SpeechDisplayAttributes* DisplayAttributes ); + + // RequiredConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("RequiredConfidence"), id(DISPID_SPERequiredConfidence)] + HRESULT RequiredConfidence( [out, retval]SpeechEngineConfidence* RequiredConfidence ); + + // ActualConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("ActualConfidence"), id(DISPID_SPEActualConfidence)] + HRESULT ActualConfidence( [out, retval]SpeechEngineConfidence* ActualConfidence ); + + // EngineConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EngineConfidence"), id(DISPID_SPEEngineConfidence)] + HRESULT EngineConfidence( [out, retval]float* EngineConfidence ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseElements +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseElements +{ + DISPID_SPEsCount = 1, + DISPID_SPEsItem = DISPID_VALUE, + DISPID_SPEs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseElements; + +[ + object, + uuid(0626B328-3478-467d-A0B3-D0853B93DDA3), + dual, + helpstring("ISpeechPhraseElements Interface"), + pointer_default(unique) +] +interface ISpeechPhraseElements : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPEsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPEsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseElement** Element ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the tokens"), restricted, id(DISPID_SPEs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseReplacement +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseReplacement +{ + DISPID_SPRDisplayAttributes = 1, + DISPID_SPRText, + DISPID_SPRFirstElement, + DISPID_SPRNumberOfElements +} DISPID_SpeechPhraseReplacement; + +[ + object, + uuid(2890A410-53A7-4fb5-94EC-06D4998E3D02), + dual, + helpstring("ISpeechPhraseReplacement Interface"), + pointer_default(unique) +] +interface ISpeechPhraseReplacement : IDispatch +{ + // Proerties + + // DisplayAttributes + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("DisplayAttributes"), id(DISPID_SPRDisplayAttributes)] + HRESULT DisplayAttributes( [out,retval]SpeechDisplayAttributes* DisplayAttributes ); + + // Text + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Text"), id(DISPID_SPRText)] + HRESULT Text( [out, retval]BSTR* Text ); + + // FirstElement + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("FirstElement"), id(DISPID_SPRFirstElement)] + HRESULT FirstElement( [out, retval]long* FirstElement ); + + // NumberOfElements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumElements"), id(DISPID_SPRNumberOfElements)] + HRESULT NumberOfElements( [out, retval]long* NumberOfElements ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseReplacements +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseReplacements +{ + DISPID_SPRsCount = 1, + DISPID_SPRsItem = DISPID_VALUE, + DISPID_SPRs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseReplacements; + +[ + object, + uuid(38BC662F-2257-4525-959E-2069D2596C05), + dual, + helpstring("ISpeechPhraseReplacements Interface"), + pointer_default(unique) +] +interface ISpeechPhraseReplacements : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPRsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPRsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseReplacement** Reps ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the tokens"), restricted, id(DISPID_SPRs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseProperty +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseProperty +{ + DISPID_SPPName = 1, + DISPID_SPPId, + DISPID_SPPValue, + DISPID_SPPFirstElement, + DISPID_SPPNumberOfElements, + DISPID_SPPEngineConfidence, + DISPID_SPPConfidence, + DISPID_SPPParent, + DISPID_SPPChildren +} DISPID_SpeechPhraseProperty; + +[ + object, + uuid(CE563D48-961E-4732-A2E1-378A42B430BE), + dual, + helpstring("ISpeechPhraseProperty Interface"), + pointer_default(unique) +] +interface ISpeechPhraseProperty : IDispatch +{ + // Properties + + // Name + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Name"), id(DISPID_SPPName)] + HRESULT Name( [out, retval]BSTR* Name ); + + // Id + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Id"), id(DISPID_SPPId)] + HRESULT Id( [out, retval]long* Id ); + + // Value + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Value"), id(DISPID_SPPValue)] + HRESULT Value( [out, retval]VARIANT* Value ); + + // FirstElement + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("FirstElement"), id(DISPID_SPPFirstElement)] + HRESULT FirstElement( [out, retval]long* FirstElement ); + + // NumberOfElements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumberOfElements"), id(DISPID_SPPNumberOfElements)] + HRESULT NumberOfElements( [out, retval]long* NumberOfElements ); + + // EngineConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EngineConfidence"), id(DISPID_SPPEngineConfidence)] + HRESULT EngineConfidence( [out, retval]float* Confidence ); + + // Confidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Confidence"), id(DISPID_SPPConfidence)] + HRESULT Confidence( [out, retval]SpeechEngineConfidence* Confidence ); + + // Parent + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Parent"), id(DISPID_SPPParent)] + HRESULT Parent( [out, retval]ISpeechPhraseProperty** ParentProperty ); + + // Children + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Children"), id(DISPID_SPPChildren)] + HRESULT Children( [out, retval]ISpeechPhraseProperties** Children ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseProperties +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseProperties +{ + DISPID_SPPsCount = 1, + DISPID_SPPsItem = DISPID_VALUE, + DISPID_SPPs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseProperties; + +[ + object, + uuid(08166B47-102E-4b23-A599-BDB98DBFD1F4), + dual, + helpstring("ISpeechPhraseProperties Interface"), + pointer_default(unique) +] +interface ISpeechPhraseProperties : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPPsCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPPsItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseProperty** Property ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the alternates"), restricted, id(DISPID_SPPs_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseRule +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseRule +{ + DISPID_SPRuleName = 1, + DISPID_SPRuleId, + DISPID_SPRuleFirstElement, + DISPID_SPRuleNumberOfElements, + DISPID_SPRuleParent, + DISPID_SPRuleChildren, + DISPID_SPRuleConfidence, + DISPID_SPRuleEngineConfidence +} DISPID_SpeechPhraseRule; + +[ + object, + uuid(A7BFE112-A4A0-48d9-B602-C313843F6964), + dual, + helpstring("ISpeechPhraseRule Interface"), + pointer_default(unique) +] +interface ISpeechPhraseRule : IDispatch +{ + // Properties + + // Name + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Name"), id(DISPID_SPRuleName)] + HRESULT Name( [out, retval]BSTR* Name ); + + // Id + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Id"), id(DISPID_SPRuleId)] + HRESULT Id( [out, retval]long* Id ); + + // FirstElement + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("FirstElement"), id(DISPID_SPRuleFirstElement)] + HRESULT FirstElement( [out, retval]long* FirstElement ); + + // NumElements + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("NumElements"), id(DISPID_SPRuleNumberOfElements)] + HRESULT NumberOfElements( [out, retval]long* NumberOfElements ); + + // Parent + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Parent"), id(DISPID_SPRuleParent)] + HRESULT Parent( [out, retval]ISpeechPhraseRule** Parent ); + + // Children + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Children"), id(DISPID_SPRuleChildren)] + HRESULT Children( [out, retval]ISpeechPhraseRules** Children ); + + // Confidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Confidence"), id(DISPID_SPRuleConfidence)] + HRESULT Confidence( [out, retval]SpeechEngineConfidence* ActualConfidence ); + + // EngineConfidence + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("EngineConfidence"), id(DISPID_SPRuleEngineConfidence)] + HRESULT EngineConfidence( [out, retval]float* EngineConfidence ); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhraseRules +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhraseRules +{ + DISPID_SPRulesCount = 1, + DISPID_SPRulesItem = DISPID_VALUE, + DISPID_SPRules_NewEnum = DISPID_NEWENUM +} DISPID_SpeechPhraseRules; + +[ + object, + uuid(9047D593-01DD-4b72-81A3-E4A0CA69F407), + dual, + helpstring("ISpeechPhraseRules Interface"), + pointer_default(unique) +] +interface ISpeechPhraseRules : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: + // + [propget, helpstring("Count"), id(DISPID_SPRulesCount)] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [helpstring("Item"), id(DISPID_SPRulesItem)] + HRESULT Item([in] long Index, [out, retval]ISpeechPhraseRule** Rule ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [propget, helpstring("Enumerates the Rules"), restricted, id(DISPID_SPRules_NewEnum)] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexicon +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechLexicon +{ + DISPID_SLGenerationId = 1, + DISPID_SLGetWords, + DISPID_SLAddPronunciation, + DISPID_SLAddPronunciationByPhoneIds, + DISPID_SLRemovePronunciation, + DISPID_SLRemovePronunciationByPhoneIds, + DISPID_SLGetPronunciations, + DISPID_SLGetGenerationChange +} DISPID_SpeechLexicon; + +///////////////////////////////////////////////// +// +// SpeechLexiconType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechLexiconType { + SLTUser = eLEXTYPE_USER, + SLTApp = eLEXTYPE_APP +} SpeechLexiconType; + +///////////////////////////////////////////////// +// +// SpeechPartOfSpeech Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechPartOfSpeech { +// ?? NotOverriden - what does this do + SPSNotOverriden = SPPS_NotOverriden, + SPSUnknown = SPPS_Unknown, + SPSNoun = SPPS_Noun, + SPSVerb = SPPS_Verb, + SPSModifier = SPPS_Modifier, + SPSFunction = SPPS_Function, + SPSInterjection = SPPS_Interjection +} SpeechPartOfSpeech; + +[ + object, + uuid(3DA7627A-C7AE-4b23-8708-638C50362C25), + dual, + helpstring("ISpeechLexicon Interface"), + pointer_default(unique) +] +interface ISpeechLexicon : IDispatch +{ + // Properties + + // GenerationId + // SAPI C++ Only Interface Equivalent: + // + // + [propget, helpstring("GenerationId"), id(DISPID_SLGenerationId), hidden] + HRESULT GenerationId([out,retval]long* GenerationId ); + + // Methods + + // GetWords + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetWords"), id(DISPID_SLGetWords)] + HRESULT GetWords([in, defaultvalue(eLEXTYPE_USER | eLEXTYPE_APP)]SpeechLexiconType Flags, + [out, defaultvalue(NULL)]long* GenerationID, + [out,retval]ISpeechLexiconWords** Words ); + + + // AddPronunciation + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddPronunciation"), id(DISPID_SLAddPronunciation)] + HRESULT AddPronunciation([in]BSTR bstrWord, + [in]SpeechLanguageId LangId, + [in, defaultvalue(SPSUnknown)]SpeechPartOfSpeech PartOfSpeech, + [in, defaultvalue("")]BSTR bstrPronunciation); + + + // AddPronunciationByPhoneIds + // SAPI C++ Only Interface Equivalent: + // + [helpstring("AddPronunciationByPhoneIds"), hidden, id(DISPID_SLAddPronunciationByPhoneIds)] + HRESULT AddPronunciationByPhoneIds([in]BSTR bstrWord, + [in]SpeechLanguageId LangId, + [in, defaultvalue(SPSUnknown)]SpeechPartOfSpeech PartOfSpeech, + [in, defaultvalue(NULL)]VARIANT* PhoneIds); + + + // RemovePronunciation + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RemovePronunciation"), id(DISPID_SLRemovePronunciation)] + HRESULT RemovePronunciation([in]BSTR bstrWord, + [in]SpeechLanguageId LangId, + [in, defaultvalue(SPSUnknown)]SpeechPartOfSpeech PartOfSpeech, + [in, defaultvalue("")]BSTR bstrPronunciation); + + // RemovePronunciationByPhoneIds + // SAPI C++ Only Interface Equivalent: + // + [helpstring("RemovePronunciationByPhoneIds"), hidden, id(DISPID_SLRemovePronunciationByPhoneIds)] + HRESULT RemovePronunciationByPhoneIds([in]BSTR bstrWord, + [in]SpeechLanguageId LangId, + [in, defaultvalue(SPSUnknown)]SpeechPartOfSpeech PartOfSpeech, + [in, defaultvalue(NULL)]VARIANT* PhoneIds); + + // GetPronunciations + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetPronunciations"), id(DISPID_SLGetPronunciations)] + HRESULT GetPronunciations([in]BSTR bstrWord, + [in, defaultvalue(0)]SpeechLanguageId LangId, + [in, defaultvalue(eLEXTYPE_USER | eLEXTYPE_APP)]SpeechLexiconType TypeFlags, + [out,retval]ISpeechLexiconPronunciations** ppPronunciations ); + + // GetGenerationChange + // SAPI C++ Only Interface Equivalent: + // + [helpstring("GetGenerationChange"), id(DISPID_SLGetGenerationChange), hidden] + HRESULT GetGenerationChange([in,out]long* GenerationID, + [out,retval]ISpeechLexiconWords** ppWords); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexiconWords +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechLexiconWords +{ + DISPID_SLWsCount = 1, + DISPID_SLWsItem = DISPID_VALUE, + DISPID_SLWs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechLexiconWords; + +[ + object, + uuid(8D199862-415E-47d5-AC4F-FAA608B424E6), + dual, + helpstring("ISpeechLexiconWords Interface"), + pointer_default(unique) +] +interface ISpeechLexiconWords : IDispatch +{ + // Properties + + // Count + // SAPI C++ Only Interface Equivalent: + // Default: N/A + // + [id(DISPID_SLWsCount), propget, helpstring("Count")] + HRESULT Count([out, retval] long* Count); + + // Methods + + // Item + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_VALUE), helpstring("Item")] + HRESULT Item([in] long Index, [out, retval]ISpeechLexiconWord** Word ); + + // _NewEnum + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_NEWENUM), propget, helpstring("Enumerates the tokens"), restricted] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexiconWord +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////// +// +// SpeechWordType Enum +// SAPI C++ Only Interface Equivalent: +// +///////////////////////////////////////////////// + +typedef enum SpeechWordType +{ + SWTAdded = eWORDTYPE_ADDED, + SWTDeleted = eWORDTYPE_DELETED +} SpeechWordType; + + +typedef [hidden] enum DISPID_SpeechLexiconWord +{ + DISPID_SLWLangId = 1, + DISPID_SLWType, + DISPID_SLWWord, + DISPID_SLWPronunciations +} DISPID_SpeechLexiconWord; + +[ + object, + uuid(4E5B933C-C9BE-48ed-8842-1EE51BB1D4FF), + dual, + helpstring("ISpeechLexiconWord Interface"), + pointer_default(unique) +] +interface ISpeechLexiconWord : IDispatch +{ + // Properties + + // LangID + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLWLangId), propget] + HRESULT LangId([out,retval]SpeechLanguageId* LangId); + + // Type + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLWType), propget] + HRESULT Type([out,retval]SpeechWordType* WordType); + + // Word + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLWWord), propget] + HRESULT Word([out,retval]BSTR* Word); + + // Pronounciations + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLWPronunciations), propget] + HRESULT Pronunciations([out,retval]ISpeechLexiconPronunciations** Pronunciations); +}; + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexiconPronunciations +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechLexiconProns +{ + DISPID_SLPsCount = 1, + DISPID_SLPsItem = DISPID_VALUE, + DISPID_SLPs_NewEnum = DISPID_NEWENUM +} DISPID_SpeechLexiconProns; + +[ + object, + uuid(72829128-5682-4704-A0D4-3E2BB6F2EAD3), + dual, + helpstring("ISpeechLexiconPronunciations Interface"), + pointer_default(unique) +] +interface ISpeechLexiconPronunciations : IDispatch +{ + // Count + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLPsCount), propget, helpstring("Count")] + HRESULT Count([out, retval] long* Count); + + // Item + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_VALUE), helpstring("Item")] + HRESULT Item([in] long Index, [out, retval]ISpeechLexiconPronunciation** Pronunciation ); + + // _NewEnum + // + // + [id(DISPID_NEWENUM), propget, helpstring("Enumerates the tokens"), restricted] + HRESULT _NewEnum([out, retval] IUnknown** EnumVARIANT); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechLexiconPronunciation +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechLexiconPronunciation +{ + DISPID_SLPType = 1, + DISPID_SLPLangId, + DISPID_SLPPartOfSpeech, + DISPID_SLPPhoneIds, + DISPID_SLPSymbolic, +} DISPID_SpeechLexiconPronunciation; + +[ + object, + uuid(95252C5D-9E43-4f4a-9899-48EE73352F9F), + dual, + helpstring("ISpeechLexiconPronunciation Interface"), + pointer_default(unique) +] +interface ISpeechLexiconPronunciation : IDispatch +{ + // Type + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLPType), propget, helpstring("Type")] + HRESULT Type([out, retval]SpeechLexiconType* LexiconType); + + // LangID + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLPLangId), propget, helpstring("LangId")] + HRESULT LangId([out, retval]SpeechLanguageId* LangId); + + // PartOfSpeech + // SAPI C++ Only Interface Equivalent: + // + // + [id(DISPID_SLPPartOfSpeech), propget, helpstring("PartOfSpeech")] + HRESULT PartOfSpeech([out, retval]SpeechPartOfSpeech* PartOfSpeech); + + // PhoneIds + // SAPI C++ Only Interface Equivalent: + // Zero terminated string of phoneids + // + [id(DISPID_SLPPhoneIds), propget, helpstring("PhoneIds")] + HRESULT PhoneIds([out, retval]VARIANT* PhoneIds); + + // Symbolic + // SAPI C++ Only Interface Equivalent: + // Zero terminated string of phones + // + [id(DISPID_SLPSymbolic), propget, helpstring("Symbolic")] + HRESULT Symbolic([out, retval]BSTR* Symbolic); +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// ISpeechPhoneConverter +// SAPI C++ Only Interface Equivalent: +// Default Property: N/A +// +//////////////////////////////////////////////////////////////////////////////////////////////////////////// + +typedef [hidden] enum DISPID_SpeechPhoneConverter +{ + DISPID_SPCLangId = 1, + DISPID_SPCPhoneToId, + DISPID_SPCIdToPhone +} DISPID_SpeechPhoneConverter; + +[ + object, + uuid(C3E4F353-433F-43d6-89A1-6A62A7054C3D), + dual, + helpstring("ISpeechPhoneConverter Interface"), + pointer_default(unique) +] +interface ISpeechPhoneConverter : IDispatch +{ + // Methods + + // LanguageId + // SAPI C++ Only Interface Equivalent: + // This can only be set once, if tried it fails + // + [propget, helpstring("LanguageId"), id(DISPID_SPCLangId)] + HRESULT LanguageId([out,retval]SpeechLanguageId* LanguageId); + [propput, helpstring("LanguageId"), id(DISPID_SPCLangId)] + HRESULT LanguageId([in]SpeechLanguageId LanguageId); + + // PhoneToId + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_SPCPhoneToId), helpstring("PhoneToId")] + HRESULT PhoneToId([in]const BSTR Phonemes, + [out,retval]VARIANT* IdArray); + + // IdToPhone + // SAPI C++ Only Interface Equivalent: + // + [id(DISPID_SPCIdToPhone), helpstring("IdToPhone")] + HRESULT IdToPhone([in]const VARIANT IdArray, + [out,retval]BSTR* Phonemes); +} diff --git a/sp/src/utils/sapi51/IDL/sapiddk.idl b/sp/src/utils/sapi51/IDL/sapiddk.idl new file mode 100644 index 00000000..280b010e --- /dev/null +++ b/sp/src/utils/sapi51/IDL/sapiddk.idl @@ -0,0 +1,818 @@ +/**************************************************************************** +* sapiddk.idl +* +* This is the interface definition file for the Microsoft Speech API DLL's +* Version 5.0. +* +* It contains definitions for the DDI layer between SAPI.DLL and both +* TTS and SR engines. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +//--- Includes -------------------------------------------------------------- +import "oaidl.idl"; +import "ocidl.idl"; +import "sapi.idl"; + +//--- Locally scoped define for LANGID +#ifndef LANGID +#define LANGID WORD +#endif + + +//--- ITN Processor +interface ISpITNProcessor; + +//--- Grammar compiler and dynamic manipulation +interface ISpErrorLog; +interface ISpGrammarCompiler; +interface ISpGramCompBackend; + +//--- Phrase builder +interface ISpPhraseBuilder; + +//--- Token String Key Names +cpp_quote("#define SPRECOEXTENSION L\"RecoExtension\"") +cpp_quote("#define SPALTERNATESCLSID L\"AlternatesCLSID\"") + +//--- ISpTokenUI ----------------------------------------------------------- +[ + object, + uuid(F8E690F0-39CB-4843-B8D7-C84696E1119D), + helpstring("ISpTokenUI Interface"), + pointer_default(unique), + restricted +] +interface ISpTokenUI : IUnknown +{ + [local] HRESULT IsUISupported( + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [in] IUnknown * punkObject, + [out] BOOL *pfSupported); + [local] HRESULT DisplayUI( + [in] HWND hwndParent, + [in] const WCHAR * pszTitle, + [in] const WCHAR * pszTypeOfUI, + [in] void * pvExtraData, + [in] ULONG cbExtraData, + [in] ISpObjectToken * pToken, + [in] IUnknown * punkObject); +}; + +//--- ISpObjectTokenEnumBuilder --------------------------------------------- +[ + object, + uuid(06B64F9F-7FDA-11d2-B4F2-00C04F797396), + helpstring("ISpObjectTokensEnumBuilder Interface"), + pointer_default(unique), + restricted +] +interface ISpObjectTokenEnumBuilder : IEnumSpObjectTokens +{ + HRESULT SetAttribs(const WCHAR * pszReqAttribs, const WCHAR * pszOptAttribs); + + HRESULT AddTokens(ULONG cTokens, ISpObjectToken ** pToken); + HRESULT AddTokensFromDataKey(ISpDataKey * pDataKey, const WCHAR * pszSubKey, const WCHAR * pszCategoryId); + HRESULT AddTokensFromTokenEnum(IEnumSpObjectTokens * pTokenEnum); + + HRESULT Sort(const WCHAR * pszTokenIdToListFirst); +}; + +//--- Handles for SR grammars and results +cpp_quote("#if 0") +typedef void * SPWORDHANDLE; +typedef void * SPRULEHANDLE; +typedef void * SPGRAMMARHANDLE; +typedef void * SPRECOCONTEXTHANDLE; +typedef void * SPPHRASERULEHANDLE; +typedef void * SPPHRASEPROPERTYHANDLE; +typedef void * SPTRANSITIONID; +cpp_quote("#else") +cpp_quote("DECLARE_HANDLE(SPWORDHANDLE);") +cpp_quote("DECLARE_HANDLE(SPRULEHANDLE);") +cpp_quote("DECLARE_HANDLE(SPGRAMMARHANDLE);") +cpp_quote("DECLARE_HANDLE(SPRECOCONTEXTHANDLE);") +cpp_quote("DECLARE_HANDLE(SPPHRASERULEHANDLE);") +cpp_quote("DECLARE_HANDLE(SPPHRASEPROPERTYHANDLE);") +cpp_quote("DECLARE_HANDLE(SPTRANSITIONID);") +cpp_quote("#endif") + + +//--- ISpErrorLog ----------------------------------------------------------- +// This interface is used to log error information. + +[ + object, + uuid(F4711347-E608-11d2-A086-00C04F8EF9B5), + helpstring("ISpErrorLog Interface"), + pointer_default(unique), + restricted +] +interface ISpErrorLog : IUnknown +{ + HRESULT AddError( + const long lLineNumber, + HRESULT hr, + const WCHAR * pszDescription, + const WCHAR * pszHelpFile, + DWORD dwHelpContext); +}; + +//--- ISpGrammarCompiler ---------------------------------------------------- + +[ + object, + uuid(B1E29D58-A675-11D2-8302-00C04F8EE6C0), + helpstring("ISpGrammarCompiler Interface"), + pointer_default(unique), + restricted +] +interface ISpGrammarCompiler : IUnknown +{ + HRESULT CompileStream( + IStream * pSource, + IStream * pDest, + IStream * pHeader, + IUnknown * pReserved, + ISpErrorLog * pErrorLog, + [in] DWORD dwFlags); +}; + +[ + object, + uuid(3DDCA27C-665C-4786-9F97-8C90C3488B61), + helpstring("ISpGramCompBackend Interface"), + pointer_default(unique), + restricted +] +interface ISpGramCompBackend : ISpGrammarBuilder +{ + HRESULT SetSaveObjects(IStream * pStream, ISpErrorLog * pErrorLog); + + HRESULT InitFromBinaryGrammar(const SPBINARYGRAMMAR * pBinaryData); +}; + + +//--- ISpITNProcessor ---------------------------------------------------------- +[ + object, + uuid(12D7360F-A1C9-11d3-BC90-00C04F72DF9F), + helpstring("ISpITNProcessor Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpITNProcessor : IUnknown +{ + HRESULT LoadITNGrammar(WCHAR *pszCLSID); + HRESULT ITNPhrase(ISpPhraseBuilder *pPhrase); +}; + + +[ + object, + uuid(88A3342A-0BED-4834-922B-88D43173162F), + local, + helpstring("ISpPhraseBuilder Interface"), + pointer_default(unique), + restricted +] +interface ISpPhraseBuilder : ISpPhrase +{ + HRESULT InitFromPhrase(const SPPHRASE * pPhrase); + HRESULT InitFromSerializedPhrase(const SPSERIALIZEDPHRASE * pPhrase); + HRESULT AddElements(ULONG cElements, const SPPHRASEELEMENT *pElement); + HRESULT AddRules(const SPPHRASERULEHANDLE hParent, const SPPHRASERULE * pRule, SPPHRASERULEHANDLE * phNewRule); + HRESULT AddProperties(const SPPHRASEPROPERTYHANDLE hParent, const SPPHRASEPROPERTY * pProperty, SPPHRASEPROPERTYHANDLE * phNewProperty); + HRESULT AddReplacements(ULONG cReplacements, const SPPHRASEREPLACEMENT * pReplacements); +}; + + + +//--- ISpTask --------------------------------------------------------------- + +cpp_quote("#if defined(__cplusplus)") +cpp_quote("interface ISpTask") +cpp_quote("{") +cpp_quote("virtual HRESULT STDMETHODCALLTYPE Execute(") +cpp_quote(" void *pvTaskData,") +cpp_quote(" volatile const BOOL* pfContinueProcessing) = 0;") +cpp_quote("};") +cpp_quote("#else") +typedef void * ISpTask; +cpp_quote("#endif") + +//--- ISpThreadTask --------------------------------------------------------- + +cpp_quote("#if defined(__cplusplus)") +cpp_quote("interface ISpThreadTask") +cpp_quote("{") +cpp_quote("virtual HRESULT STDMETHODCALLTYPE InitThread(") +cpp_quote(" void * pvTaskData,") +cpp_quote(" HWND hwnd) = 0;") +cpp_quote("virtual HRESULT STDMETHODCALLTYPE ThreadProc(") +cpp_quote(" void *pvTaskData,") +cpp_quote(" HANDLE hExitThreadEvent,") +cpp_quote(" HANDLE hNotifyEvent,") +cpp_quote(" HWND hwndWorker,") +cpp_quote(" volatile const BOOL * pfContinueProcessing) = 0;") +cpp_quote("virtual LRESULT STDMETHODCALLTYPE WindowMessage(") +cpp_quote(" void *pvTaskData,") +cpp_quote(" HWND hWnd,") +cpp_quote(" UINT Msg,") +cpp_quote(" WPARAM wParam,") +cpp_quote(" LPARAM lParam) = 0;") +cpp_quote("};") +cpp_quote("#else") +typedef void * ISpThreadTask; +cpp_quote("#endif") + +//--- ISpThreadControl ------------------------------------------------------ +[ + object, + uuid(A6BE4D73-4403-4358-B22D-0346E23B1764), + helpstring("ISpThreadControl Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpThreadControl : ISpNotifySink +{ + HRESULT StartThread(DWORD dwFlags, HWND * phwnd); + HRESULT WaitForThreadDone( + BOOL fForceStop, + HRESULT * phrThreadResult, + ULONG msTimeOut); + HRESULT TerminateThread(void); + HANDLE ThreadHandle(void); + DWORD ThreadId(void); + HANDLE NotifyEvent(void); + HWND WindowHandle(void); + HANDLE ThreadCompleteEvent(void); + HANDLE ExitThreadEvent(void); +}; + +//--- ISpTaskManager -------------------------------------------------------- +// This interface is used to implement a task managment service provider +// to optimize thread usage. + +typedef [restricted] struct SPTMTHREADINFO +{ + long lPoolSize; // Number of threads in pool (-1 default) + long lPriority; // Priority of threads in pool + ULONG ulConcurrencyLimit; // Number of threads allowed to concurrently execute (0 default) + ULONG ulMaxQuickAllocThreads; // Maximum number of dedicated threads retained +} SPTMTHREADINFO; + +[ + local, + uuid(2BAEEF81-2CA3-4331-98F3-26EC5ABEFB03), + helpstring("ISpTaskManager Interface"), + pointer_default(unique), + restricted +] +interface ISpTaskManager : IUnknown +{ + HRESULT SetThreadPoolInfo([in] const SPTMTHREADINFO* pPoolInfo); + HRESULT GetThreadPoolInfo([out] SPTMTHREADINFO* pPoolInfo); + + HRESULT QueueTask( + [in] ISpTask* pTask, + [in] void* pvTaskData, + [in] HANDLE hCompEvent, + [in, out] DWORD* pdwGroupId, + [out] DWORD* pTaskID); + HRESULT CreateReoccurringTask( + [in] ISpTask* pTask, + [in] void* pvTaskData, + [in] HANDLE hCompEvent, + [out] ISpNotifySink** ppTaskCtrl); + HRESULT CreateThreadControl( + [in] ISpThreadTask* pTask, + [in] void* pvTaskData, + [in] long nPriority, + [out] ISpThreadControl** ppTaskCtrl); + + HRESULT TerminateTask([in] DWORD dwTaskId, [in] ULONG ulWaitPeriod); + HRESULT TerminateTaskGroup([in] DWORD dwGroupId, [in] ULONG ulWaitPeriod); +}; + + +//--- ISpTTSEngineSite ------------------------------------------------------ + +typedef enum SPVSKIPTYPE +{ + SPVST_SENTENCE = (1L << 0) // Skip sentences +} SPVSKIPTYPE; + +typedef enum SPVESACTIONS +{ + SPVES_CONTINUE = 0, + SPVES_ABORT = ( 1L << 0 ), + SPVES_SKIP = ( 1L << 1 ), + SPVES_RATE = ( 1L << 2 ), + SPVES_VOLUME = ( 1L << 3 ) +} SPVESACTIONS; + +[ + object, + local, + uuid(9880499B-CCE9-11d2-B503-00C04F797396), + helpstring("ISpTTSEngineSite Interface"), + pointer_default(unique) +] +interface ISpTTSEngineSite : ISpEventSink +{ + DWORD GetActions( void ); + HRESULT Write( [in]const void* pBuff, [in]ULONG cb, [out]ULONG *pcbWritten ); + HRESULT GetRate( [out]long* pRateAdjust ); + HRESULT GetVolume( [out]USHORT* pusVolume ); + HRESULT GetSkipInfo( [out]SPVSKIPTYPE* peType, [out]long* plNumItems ); + HRESULT CompleteSkip( [in]long ulNumSkipped ); +}; + +//--- ISpTTSEngine ---------------------------------------------------------- + +typedef struct SPVTEXTFRAG +{ + struct SPVTEXTFRAG* pNext; // Next text fragment in list, NULL == end of list + SPVSTATE State; // Current XML attribute state + LPCWSTR pTextStart; + ULONG ulTextLen; + ULONG ulTextSrcOffset; // Original source position of the fragment text +} SPVTEXTFRAG; + +[ + object, + local, + uuid(A74D7C8E-4CC5-4f2f-A6EB-804DEE18500E), + helpstring("ISpTTSEngine Interface"), + pointer_default(unique) +] +interface ISpTTSEngine : IUnknown +{ + HRESULT Speak( [in]DWORD dwSpeakFlags, + [in]REFGUID rguidFormatId, [in]const WAVEFORMATEX * pWaveFormatEx, + [in]const SPVTEXTFRAG* pTextFragList, [in]ISpTTSEngineSite* pOutputSite ); + HRESULT GetOutputFormat( [in] const GUID * pTargetFmtId, [in] const WAVEFORMATEX * pTargetWaveFormatEx, + [out] GUID * pOutputFormatId, [out] WAVEFORMATEX ** ppCoMemOutputWaveFormatEx); +}; + + + +//--- SR Engine data structures ---------------------------------------- + + +typedef [restricted] struct SPWORDENTRY +{ + SPWORDHANDLE hWord; + LANGID LangID; + WCHAR * pszDisplayText; + WCHAR * pszLexicalForm; + SPPHONEID * aPhoneId; + void * pvClientContext; +} SPWORDENTRY; + +typedef [restricted] struct SPRULEENTRY +{ + SPRULEHANDLE hRule; + SPSTATEHANDLE hInitialState; + DWORD Attributes; // SPCFGRULEATTRIBUTES + void * pvClientRuleContext; + void * pvClientGrammarContext; +} SPRULEENTRY; + +typedef enum SPTRANSITIONTYPE +{ + SPTRANSEPSILON, + SPTRANSWORD, + SPTRANSRULE, + SPTRANSTEXTBUF, + SPTRANSWILDCARD, + SPTRANSDICTATION +} SPTRANSITIONTYPE; + +typedef [restricted] struct SPTRANSITIONENTRY +{ + SPTRANSITIONID ID; + SPSTATEHANDLE hNextState; + BYTE Type; // SPTRANSITIONTYPE + char RequiredConfidence; + struct + { + DWORD fHasProperty; // Boolean type + }; + float Weight; + union + { + struct + { + SPSTATEHANDLE hRuleInitialState; // Only if Type == SPTRANSRULE + SPRULEHANDLE hRule; + void * pvClientRuleContext; + }; + struct + { + SPWORDHANDLE hWord; // Only if Type == SPTRANSWORD + void * pvClientWordContext; + }; + struct + { + void * pvGrammarCookie; // Only if Type == SPTRANSTEXTBUF or SPTRANSWILDCARD or SPTRANSDICTATION + }; + }; +} SPTRANSITIONENTRY; + +typedef [restricted] struct SPTRANSITIONPROPERTY +{ + const WCHAR * pszName; + ULONG ulId; + const WCHAR * pszValue; + VARIANT vValue; // Will be VT_BOOL, VT_I4, VT_R4, VT_R8, or VT_BYREF (only for dynamic grammars) +} SPTRANSITIONPROPERTY; + +typedef [restricted] struct SPSTATEINFO +{ + ULONG cAllocatedEntries; + SPTRANSITIONENTRY * pTransitions; + ULONG cEpsilons; + ULONG cRules; + ULONG cWords; + ULONG cSpecialTransitions; +} SPSTATEINFO; + +typedef [restricted] struct SPPATHENTRY +{ + SPTRANSITIONID hTransition; + SPPHRASEELEMENT elem; +} SPPATHENTRY; + + + + + +//--- ISpCFGInterpreterSite ------------------------------------------------- +[ + object, + uuid(6A6FFAD8-78B6-473d-B844-98152E4FB16B), + helpstring("ISpCFGInterpreterSite Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpCFGInterpreterSite : IUnknown +{ + HRESULT AddTextReplacement([in] SPPHRASEREPLACEMENT * pReplace); + HRESULT AddProperty([in] const SPPHRASEPROPERTY *pProperty); + HRESULT GetResourceValue( + [in] const WCHAR *pszResourceName, + [out] WCHAR ** ppCoMemResource); +}; + + +//--- ISpCFGInterpreter ----------------------------------------------------- + +[ + object, + uuid(F3D3F926-11FC-11d3-BB97-00C04F8EE6C0), + helpstring("ISpCFGInterpreter Interface"), + pointer_default(unique), + local, + restricted +] +interface ISpCFGInterpreter : IUnknown +{ + HRESULT InitGrammar( + [in] const WCHAR * pszGrammarName, + [in] const void ** pvGrammarData); + HRESULT Interpret( + [in] ISpPhraseBuilder * pPhrase, + [in] const ULONG ulFirstElement, + [in] const ULONG ulCountOfElements, + [in] ISpCFGInterpreterSite * pSite); +}; + + +typedef enum SPCFGNOTIFY +{ + SPCFGN_ADD, + SPCFGN_REMOVE, + SPCFGN_INVALIDATE, + SPCFGN_ACTIVATE, + SPCFGN_DEACTIVATE +} SPCFGNOTIFY; + +//--- ISpSREngineSite ------------------------------------------------------- + +typedef enum SPRESULTTYPE +{ + SPRT_CFG = 0, + SPRT_SLM = 1, + SPRT_PROPRIETARY = 2, + SPRT_FALSE_RECOGNITION = ( 1L << 2 ) // Flag used to indicate a false recognition +} SPRESULTTYPE; + +typedef struct tagSPPHRASEALT +{ + ISpPhraseBuilder * pPhrase; + ULONG ulStartElementInParent; + ULONG cElementsInParent; + ULONG cElementsInAlternate; + void * pvAltExtra; + ULONG cbAltExtra; +} SPPHRASEALT; + +// Result structure passed from engine to SAPI +typedef struct SPRECORESULTINFO +{ + ULONG cbSize; // Total size of this structure + SPRESULTTYPE eResultType; // Type of result object (CFG, SLM, or Proprietary) + BOOL fHypothesis; // If true then this recognition is a hypothesis + BOOL fProprietaryAutoPause;// This field is only used for SPERT_PROPRIETARY grammars. If true, recognition will pause. + ULONGLONG ullStreamPosStart; // Start and end stream positions of recognition + ULONGLONG ullStreamPosEnd; + SPGRAMMARHANDLE hGrammar; // Required for SPERT_SLM and SPERT_PROPRIETARY else NULL + ULONG ulSizeEngineData; // Size of pvEngineData + void * pvEngineData; // Extra engine specific data + ISpPhraseBuilder* pPhrase; // Pointer to phrase object + SPPHRASEALT* aPhraseAlts; // Alternates array + ULONG ulNumAlts; // Number of alternates in the array +} SPRECORESULTINFO; + +typedef enum SPWORDINFOOPT +{ + SPWIO_NONE = 0, + SPWIO_WANT_TEXT = 1 +} SPWORDINFOOPT; + + +typedef enum SPRULEINFOOPT +{ + SPRIO_NONE = 0, +} SPRULEINFOOPT; + +typedef struct SPPARSEINFO +{ + ULONG cbSize; + SPRULEHANDLE hRule; + ULONGLONG ullAudioStreamPosition; + ULONG ulAudioSize; + ULONG cTransitions; + SPPATHENTRY * pPath; + GUID SREngineID; + ULONG ulSREnginePrivateDataSize; + const BYTE * pSREnginePrivateData; + BOOL fHypothesis; +} SPPARSEINFO; + +[ + object, + uuid(3B414AEC-720C-4883-B9EF-178CD394FB3A), + helpstring("ISpSREngineSite Interface"), + pointer_default(unique), + local +] +interface ISpSREngineSite : IUnknown +{ + HRESULT Read([in] void * pv, [in] ULONG cb, [out] ULONG * pcbRead); + HRESULT DataAvailable(ULONG * pcb); + HRESULT SetBufferNotifySize([in] ULONG cbSize); + HRESULT ParseFromTransitions([in] const SPPARSEINFO * pParseInfo, + [out] ISpPhraseBuilder ** ppNewPhrase); + HRESULT Recognition([in] const SPRECORESULTINFO * pResultInfo); + HRESULT AddEvent([in] const SPEVENT* pEvent, [in] SPRECOCONTEXTHANDLE hSAPIRecoContext); + HRESULT Synchronize([in] ULONGLONG ullProcessedThruPos); + HRESULT GetWordInfo([in, out] SPWORDENTRY * pWordEntry, [in] SPWORDINFOOPT Options); // Caller must fill in hWord. if fWantWordText then caller must CoTaskMemFree the pszWord. + HRESULT SetWordClientContext(SPWORDHANDLE hWord, void * pvClientContext); + HRESULT GetRuleInfo([in, out] SPRULEENTRY * pRuleEntry, [in] SPRULEINFOOPT Options); // Caller must fill in hRule.SPRULEHANDLE hRule, BOOL * pfActive, BOOL *pfAutoPause, SPSTATEHANDLE * phInitialState, void ** ppvClientContext); + HRESULT SetRuleClientContext(SPRULEHANDLE hRule, void * pvClientContext); + HRESULT GetStateInfo(SPSTATEHANDLE hState, SPSTATEINFO * pStateInfo); + HRESULT GetResource( [in] SPRULEHANDLE hRule, [in] const WCHAR *pszResourceName, [out] WCHAR ** ppCoMemResource ); + HRESULT GetTransitionProperty([in] SPTRANSITIONID ID, [out] SPTRANSITIONPROPERTY **ppCoMemProperty); + HRESULT IsAlternate( [in]SPRULEHANDLE hRule, [in]SPRULEHANDLE hAltRule ); + HRESULT GetMaxAlternates( [in]SPRULEHANDLE hRule, [out]ULONG* pulNumAlts ); + HRESULT GetContextMaxAlternates( [in] SPRECOCONTEXTHANDLE hContext, [out] ULONG * pulNumAlts); + HRESULT UpdateRecoPos([in] ULONGLONG ullCurrentRecoPos); +}; + +//--- ISpSREngine ----------------------------------------------------------- +typedef enum SPPROPSRC +{ + SPPROPSRC_RECO_INST, + SPPROPSRC_RECO_CTX, + SPPROPSRC_RECO_GRAMMAR +} SPPROPSRC; + +[ + object, + uuid(2F472991-854B-4465-B613-FBAFB3AD8ED8), + helpstring("ISpSREngine Interface"), + pointer_default(unique), + local +] +interface ISpSREngine : IUnknown +{ + HRESULT SetSite([in] ISpSREngineSite *pSite); + + HRESULT GetInputAudioFormat( + [in] const GUID * pguidSourceFormatId, + [in] const WAVEFORMATEX * pSourceWaveFormatEx, + [out] GUID * pguidDesiredFormatId, + [out] WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx); + + HRESULT RecognizeStream([in] REFGUID rguidFmtId, [in] const WAVEFORMATEX * pWaveFormatEx, + [in] HANDLE hRequestSync, [in] HANDLE hDataAvailable, + [in] HANDLE hExit, [in] BOOL fNewAudioStream, [in] BOOL fRealTimeAudio, + [in] ISpObjectToken * pAudioObjectToken); + + HRESULT SetRecoProfile(ISpObjectToken * pProfile); + + HRESULT OnCreateGrammar([in] void * pvEngineRecoContext, + [in] SPGRAMMARHANDLE hSAPIGrammar, + [out] void ** ppvEngineGrammarContext); + + HRESULT OnDeleteGrammar([in] void * pvEngineGrammar); + + HRESULT LoadProprietaryGrammar( + [in] void * pvEngineGrammar, + [in] REFGUID rguidParam, + [in, string] const WCHAR * pszStringParam, + [in] const void * pvDataParam, + [in] ULONG ulDataSize, + [in] SPLOADOPTIONS Options); // Note for SAPI 5.0 this is always SPLO_NONE + + HRESULT UnloadProprietaryGrammar([in] void * pvEngineGrammar); + + HRESULT SetProprietaryRuleState([in] void * pvEngineGrammar, + [in, string] const WCHAR * pszName, + [in] void * pReserved, + [in] SPRULESTATE NewState, + [out] ULONG * pcRulesChanged); + HRESULT SetProprietaryRuleIdState([in] void * pvEngineGrammar, + [in] DWORD dwRuleId, + [in] SPRULESTATE NewState); + HRESULT LoadSLM([in] void * pvEngineGrammar, [in, string] const WCHAR * pszTopicName); + HRESULT UnloadSLM([in] void * pvEngineGrammar); + HRESULT SetSLMState([in] void * pvEngineGrammar, [in] SPRULESTATE NewState); + HRESULT SetWordSequenceData([in] void * pvEngineGrammar, [in] const WCHAR * pText, [in] ULONG cchText, [in] const SPTEXTSELECTIONINFO * pInfo); + HRESULT SetTextSelection([in] void * pvEngineGrammar, [in] const SPTEXTSELECTIONINFO * pInfo); + HRESULT IsPronounceable([in] void * pvEngineGrammar, [in, string] const WCHAR * pszWord, [out] SPWORDPRONOUNCEABLE *pWordPronounceable); + + HRESULT OnCreateRecoContext( + [in] SPRECOCONTEXTHANDLE hSAPIRecoContext, + [out] void ** ppvEngineContext); + HRESULT OnDeleteRecoContext([in] void * pvEngineContext); + + HRESULT PrivateCall([in] void * pvEngineContext, [in, out] PVOID pCallFrame, [in] ULONG ulCallFrameSize); + + HRESULT SetAdaptationData([in] void * pvEngineContext, const WCHAR *pAdaptationData, const ULONG cch); + + HRESULT SetPropertyNum( [in]SPPROPSRC eSrc, [in]void* pvSrcObj, + [in]const WCHAR* pName, [in]LONG lValue ); + HRESULT GetPropertyNum( [in]SPPROPSRC eSrc, [in]void* pvSrcObj, + [in]const WCHAR* pName, [out]LONG* lValue ); + HRESULT SetPropertyString( [in]SPPROPSRC eSrc, [in]void* pvSrcObj, + [in]const WCHAR* pName, [in]const WCHAR* pValue ); + HRESULT GetPropertyString( [in]SPPROPSRC eSrc, [in]void* pvSrcObj, + [in]const WCHAR* pName, [out]WCHAR** ppCoMemValue ); + + HRESULT SetGrammarState([in] void * pvEngineGrammar, [in] SPGRAMMARSTATE eGrammarState); + + HRESULT WordNotify(SPCFGNOTIFY Action, ULONG cWords, const SPWORDENTRY * pWords); + HRESULT RuleNotify(SPCFGNOTIFY Action, ULONG cRules, const SPRULEENTRY * pRules); + + HRESULT PrivateCallEx([in] void * pvEngineContext, [in] const void * pInCallFrame, [in] ULONG ulInCallFrameSize, + [out] void ** ppvCoMemResponse, [out] ULONG * pulResponseSize); + + HRESULT SetContextState([in] void * pvEngineContext, [in] SPCONTEXTSTATE eContextState); +}; + + +//--- ISpSRAlternates + +typedef struct tagSPPHRASEALTREQUEST +{ + ULONG ulStartElement; + ULONG cElements; + ULONG ulRequestAltCount; + + void * pvResultExtra; + ULONG cbResultExtra; + + ISpPhrase * pPhrase; + ISpRecoContext * pRecoContext; +} SPPHRASEALTREQUEST; + +[ + object, + uuid(FECE8294-2BE1-408f-8E68-2DE377092F0E), + helpstring("ISpSRAlternates Interface"), + pointer_default(unique), + local +] +interface ISpSRAlternates : IUnknown +{ + HRESULT GetAlternates([in] SPPHRASEALTREQUEST * pAltRequest, + [out] SPPHRASEALT **ppAlts, + [out] ULONG *pcAlts); + HRESULT Commit([in] SPPHRASEALTREQUEST * pAltRequest, + [in] SPPHRASEALT * pAlt, + [out] void **ppvResultExtra, + [out] ULONG *pcbResultExtra); +} + +// Interface used by engine specific recoctxt extension object to call into engine +[ + object, + uuid(8E7C791E-4467-11d3-9723-00C04F72DB08), + helpstring("_ISpPrivateEngineCall Interface"), + pointer_default(unique), + local +] +interface _ISpPrivateEngineCall : IUnknown +{ + HRESULT CallEngine([in, out] void * pCallFrame, [in] ULONG ulCallFrameSize); + HRESULT CallEngineEx([in] const void * pInFrame, [in] ULONG ulInFrameSize, + [out] void ** ppCoMemOutFrame, [out] ULONG * pulOutFrameSize); +} + +// +//--- CoClass definitions --------------------------------------------------- +// + +[ + helpstring("Microsoft Speech Object DDK Library"), + uuid(9903F14C-12CE-4c99-9986-2EE3D7D588A8), + version(5.0) +] +library SpeechDDKLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + //--- SpDataKey --------------------------------------------------------- + [ + uuid(D9F6EE60-58C9-458b-88E1-2F908FD7F87C), + helpstring("Data Key") + ] + coclass SpDataKey + { + interface ISpRegDataKey; + [default] interface ISpDataKey; + } + + //--- SpObjectTokenEnum -------------------------------------------------- + [ + uuid(3918D75F-0ACB-41f2-B733-92AA15BCECF6), + helpstring("Object Token Enumerator") + ] + coclass SpObjectTokenEnum + { + interface ISpObjectTokenEnumBuilder; + [default] interface IEnumSpObjectTokens; + } + + //--- SpPhraseBuilder --------------------------------------------------- + [ + uuid(777B6BBD-2FF2-11d3-88FE-00C04F8EF9B5), + helpstring("Phrase Builder Class") + ] + coclass SpPhraseBuilder + { + [default] interface ISpPhraseBuilder; + } + //--- SpITNProcessor ---------------------------------------------------- + [ + uuid(12D73610-A1C9-11d3-BC90-00C04F72DF9F), + helpstring("SpITNProcessor Class"), + restricted + ] + coclass SpITNProcessor + { + [default] interface ISpITNProcessor; + }; + //--- SpGrammarCompiler --------------------------------------------- + [ + uuid(B1E29D59-A675-11D2-8302-00C04F8EE6C0), + helpstring("Microsoft Speech Grammar Compiler") + ] + coclass SpGrammarCompiler + { + [default] interface ISpGrammarCompiler; + }; + + //--- SpGramCompBackend --------------------------------------------- + [ + uuid(DA93E903-C843-11D2-A084-00C04F8EF9B5), + helpstring("Grammar Class"), + restricted + ] + coclass SpGramCompBackend + { + [default] interface ISpGramCompBackend; + }; + +} diff --git a/sp/src/utils/sapi51/Include/Spddkhlp.h b/sp/src/utils/sapi51/Include/Spddkhlp.h new file mode 100644 index 00000000..bc4134a7 --- /dev/null +++ b/sp/src/utils/sapi51/Include/Spddkhlp.h @@ -0,0 +1,854 @@ +/******************************************************************************* +* SPDDKHLP.h * +*------------* +* Description: +* This is the header file for core helper functions implementation. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +*******************************************************************************/ +#ifndef SPDDKHLP_h +#define SPDDKHLP_h + +#ifndef SPHelper_h +#include +#endif + +#include + +#ifndef SPError_h +#include +#endif + +#ifndef SPDebug_h +#include +#endif + +#ifndef _INC_LIMITS +#include +#endif + +#ifndef _INC_CRTDBG +#include +#endif + +#ifndef _INC_MALLOC +#include +#endif + +#ifndef _INC_MMSYSTEM +#include +#endif + +#ifndef __comcat_h__ +#include +#endif + +//=== Constants ============================================================== +#define sp_countof(x) ((sizeof(x) / sizeof(*(x)))) + +#define SP_IS_BAD_WRITE_PTR(p) ( SPIsBadWritePtr( p, sizeof(*(p)) )) +#define SP_IS_BAD_READ_PTR(p) ( SPIsBadReadPtr( p, sizeof(*(p)) )) +#define SP_IS_BAD_CODE_PTR(p) ( ::IsBadCodePtr((FARPROC)(p) ) +#define SP_IS_BAD_INTERFACE_PTR(p) ( SPIsBadInterfacePtr( (p) ) ) +#define SP_IS_BAD_VARIANT_PTR(p) ( SPIsBadVARIANTPtr( (p) ) ) +#define SP_IS_BAD_STRING_PTR(p) ( SPIsBadStringPtr( (p) ) ) + +#define SP_IS_BAD_OPTIONAL_WRITE_PTR(p) ((p) && SPIsBadWritePtr( p, sizeof(*(p)) )) +#define SP_IS_BAD_OPTIONAL_READ_PTR(p) ((p) && SPIsBadReadPtr( p, sizeof(*(p)) )) +#define SP_IS_BAD_OPTIONAL_INTERFACE_PTR(p) ((p) && SPIsBadInterfacePtr(p)) +#define SP_IS_BAD_OPTIONAL_STRING_PTR(p) ((p) && SPIsBadStringPtr(p)) + +//=== Class, Enum, Struct, Template, and Union Declarations ================== + +//=== Inlines ================================================================ + +/*** Pointer validation functions +*/ + +// TODO: Add decent debug output for bad parameters + +inline BOOL SPIsBadStringPtr( const WCHAR * psz, ULONG cMaxChars = 0xFFFF ) +{ + BOOL IsBad = false; + __try + { + do + { + if( *psz++ == 0 ) return IsBad; + } + while( --cMaxChars ); + } + __except( GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ) + { + IsBad = true; + } + + return IsBad; +} + +inline BOOL SPIsBadReadPtr( const void* pMem, UINT Size ) +{ +#ifdef _DEBUG + BOOL bIsBad = ::IsBadReadPtr( pMem, Size ); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ::IsBadReadPtr( pMem, Size ); +#endif +} + +inline BOOL SPIsBadWritePtr( void* pMem, UINT Size ) +{ +#ifdef _DEBUG + BOOL bIsBad = ::IsBadWritePtr( pMem, Size ); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ::IsBadWritePtr( pMem, Size ); +#endif +} + +inline BOOL SPIsBadInterfacePtr( const IUnknown* pUnknown ) +{ +#ifdef _DEBUG + BOOL bIsBad = ( ::IsBadReadPtr( pUnknown, sizeof( *pUnknown ) ) || + ::IsBadCodePtr( (FARPROC)((void**)pUnknown)[0] ))? + (true):(false); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ( ::IsBadReadPtr( pUnknown, sizeof( *pUnknown ) ) || + ::IsBadCodePtr( (FARPROC)((void**)pUnknown)[0] ))? + (true):(false); +#endif +} + +inline BOOL SPIsBadVARIANTPtr( const VARIANT* pVar ) +{ +#ifdef _DEBUG + BOOL bIsBad = ::IsBadReadPtr( pVar, sizeof( *pVar ) ); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ::IsBadReadPtr( pVar, sizeof( *pVar ) ); +#endif +} + +#ifdef __ATLCOM_H__ //--- Only enable these if ATL is being used + +// +// Helper functions can be used to implement GetObjectToken/SetObjectToken for objects that +// support ISpObjectWithToken +// +inline HRESULT SpGenericSetObjectToken(ISpObjectToken * pCallersToken, CComPtr & cpObjToken) +{ + HRESULT hr = S_OK; + if (SP_IS_BAD_INTERFACE_PTR(pCallersToken)) + { + hr = E_INVALIDARG; + } + else + { + if (cpObjToken) + { + hr = SPERR_ALREADY_INITIALIZED; + } + else + { + cpObjToken = pCallersToken; + } + } + return hr; +} + + +inline HRESULT SpGenericGetObjectToken(ISpObjectToken ** ppCallersToken, CComPtr & cpObjToken) +{ + HRESULT hr = S_OK; + if (SP_IS_BAD_WRITE_PTR(ppCallersToken)) + { + hr = E_POINTER; + } + else + { + *ppCallersToken = cpObjToken; + if (*ppCallersToken) + { + (*ppCallersToken)->AddRef(); + } + else + { + hr = S_FALSE; + } + } + return hr; +} + +#endif // __ATLCOM_H__ + + +// +// Helper class for SPSTATEINFO sturcture automatically initializes and cleans up +// the structure + provides a few helper functions. +// +class CSpStateInfo : public SPSTATEINFO +{ +public: + CSpStateInfo() + { + cAllocatedEntries = NULL; + pTransitions = NULL; + } + ~CSpStateInfo() + { + ::CoTaskMemFree(pTransitions); + } + SPTRANSITIONENTRY * FirstEpsilon() + { + return pTransitions; + } + SPTRANSITIONENTRY * FirstRule() + { + return pTransitions + cEpsilons; + } + SPTRANSITIONENTRY * FirstWord() + { + return pTransitions + cEpsilons + cRules; + } + SPTRANSITIONENTRY * FirstSpecialTransition() + { + return pTransitions + cEpsilons + cRules + cWords; + } +}; + + +// +// This basic queue implementation can be used to maintin linked lists of classes. The class T +// must contain the member m_pNext which is used by this template to point to the next element. +// If the bPurgeWhenDeleted is TRUE then all of the elements in the queue will be deleted +// when the queue is deleted, otherwise they will not. +// If bMaintainCount is TRUE then a running count will be maintained, and GetCount() will be +// efficent. If it is FALSE then a running count will not be maintained, and GetCount() will +// be an order N operation. If you do not require a count, then +// + +template class CSpBasicList; + +template +class CSpBasicQueue +{ +public: + T * m_pHead; + T * m_pTail; + ULONG m_cElements; // Warning! Use GetCount() -- Not maintained if bMaintainCount is FALSE. + + CSpBasicQueue() + { + m_pHead = NULL; + if (bMaintainCount) + { + m_cElements = 0; + } + } + + ~CSpBasicQueue() + { + if (bPurgeWhenDeleted) + { + Purge(); + } + } + + HRESULT CreateNode(T ** ppNode) + { + *ppNode = new T; + if (*ppNode) + { + return S_OK; + } + else + { + return E_OUTOFMEMORY; + } + } + + T * GetNext(const T * pNode) + { + return pNode->m_pNext; + } + + + T * Item(ULONG i) + { + T * pNode = m_pHead; + while (pNode && i) + { + i--; + pNode = pNode->m_pNext; + } + return pNode; + } + + void InsertAfter(T * pPrev, T * pNewNode) + { + if (pPrev) + { + pNewNode->m_pNext = pPrev->m_pNext; + pPrev->m_pNext = pNewNode; + if (pNewNode->m_pNext == NULL) + { + m_pTail = pNewNode; + } + if (bMaintainCount) ++m_cElements; + } + else + { + InsertHead(pNewNode); + } + } + + void InsertTail(T * pNode) + { + pNode->m_pNext = NULL; + if (m_pHead) + { + m_pTail->m_pNext = pNode; + } + else + { + m_pHead = pNode; + } + m_pTail = pNode; + if (bMaintainCount) ++m_cElements; + } + + void InsertHead(T * pNode) + { + pNode->m_pNext = m_pHead; + if (m_pHead == NULL) + { + m_pTail = pNode; + } + m_pHead = pNode; + if (bMaintainCount) ++m_cElements; + } + + T * RemoveHead() + { + T * pNode = m_pHead; + if (pNode) + { + m_pHead = pNode->m_pNext; + if (bMaintainCount) --m_cElements; + } + return pNode; + } + + T * RemoveTail() + { + T * pNode = m_pHead; + if (pNode) + { + if (pNode == m_pTail) + { + m_pHead = NULL; + } + else + { + T * pPrev; + do + { + pPrev = pNode; + pNode = pNode->m_pNext; + } while ( pNode != m_pTail ); + pPrev->m_pNext = NULL; + m_pTail = pPrev; + } + if (bMaintainCount) --m_cElements; + } + return pNode; + } + + void Purge() + { + while (m_pHead) + { + T * pDie = m_pHead; + m_pHead = pDie->m_pNext; + delete pDie; + } + if (bMaintainCount) m_cElements = 0; + } + + void ExplicitPurge() + { + T * pDie; + BYTE * pb; + + while (m_pHead) + { + pDie = m_pHead; + m_pHead = pDie->m_pNext; + + pDie->~T(); + + pb = reinterpret_cast(pDie); + delete [] pb; + } + if (bMaintainCount) m_cElements = 0; + } + + + T * GetTail() const + { + if (m_pHead) + { + return m_pTail; + } + return NULL; + } + + T * GetHead() const + { + return m_pHead; + } + + BOOL IsEmpty() const + { + return m_pHead == NULL; + } + + BOOL Remove(T * pNode) + { + if (m_pHead == pNode) + { + m_pHead = pNode->m_pNext; + if (bMaintainCount) --m_cElements; + return TRUE; + } + else + { + T * pCur = m_pHead; + while (pCur) + { + T * pNext = pCur->m_pNext; + if (pNext == pNode) + { + if ((pCur->m_pNext = pNode->m_pNext) == NULL) + { + m_pTail = pCur; + } + if (bMaintainCount) --m_cElements; + return TRUE; + } + pCur = pNext; + } + } + return FALSE; + } + + void MoveAllToHeadOf(CSpBasicQueue & DestQueue) + { + if (m_pHead) + { + m_pTail->m_pNext = DestQueue.m_pHead; + if (DestQueue.m_pHead == NULL) + { + DestQueue.m_pTail = m_pTail; + } + DestQueue.m_pHead = m_pHead; + m_pHead = NULL; + if (bMaintainCount) + { + DestQueue.m_cElements += m_cElements; + m_cElements = 0; + } + } + } + + void MoveAllToList(CSpBasicList & List) + { + if (m_pHead) + { + m_pTail->m_pNext = List.m_pFirst; + List.m_pFirst = m_pHead; + m_pHead = NULL; + } + if (bMaintainCount) + { + m_cElements = 0; + } + } + + BOOL MoveToList(T * pNode, CSpBasicList & List) + { + BOOL bFound = Remove(pNode); + if (bFound) + { + List.AddNode(pNode); + } + return bFound; + } + + ULONG GetCount() const + { + if (bMaintainCount) + { + return m_cElements; + } + else + { + ULONG c = 0; + for (T * pNode = m_pHead; + pNode; + pNode = pNode->m_pNext, c++) {} + return c; + } + } + + // + // The following functions require the class T to implement a static function: + // + // LONG Compare(const T * pElem1, const T * pElem2) + // + // which returns < 0 if pElem1 is less than pElem2, 0 if they are equal, and > 0 if + // pElem1 is greater than pElem2. + // + void InsertSorted(T * pNode) + { + if (m_pHead) + { + if (T::Compare(pNode, m_pTail) >= 0) + { + pNode->m_pNext = NULL; + m_pTail->m_pNext = pNode; + m_pTail = pNode; + } + else + { + // + // We don't have to worry about walking off of the end of the list here since + // we have already checked the tail. + // + T ** ppNext = &m_pHead; + while (T::Compare(pNode, *ppNext) >= 0) + { + ppNext = &((*ppNext)->m_pNext); + } + pNode->m_pNext = *ppNext; + *ppNext = pNode; + } + } + else + { + pNode->m_pNext = NULL; + m_pHead = m_pTail = pNode; + } + if (bMaintainCount) ++m_cElements; + } + + HRESULT InsertSortedUnique(T * pNode) + { + HRESULT hr = S_OK; + if (m_pHead) + { + if (T::Compare(pNode, m_pTail) > 0) + { + pNode->m_pNext = NULL; + m_pTail->m_pNext = pNode; + m_pTail = pNode; + } + else + { + // + // We don't have to worry about walking off of the end of the list here since + // we have already checked the tail. + // + T ** ppNext = &m_pHead; + while (T::Compare(pNode, *ppNext) > 0) + { + ppNext = &((*ppNext)->m_pNext); + } + if (T::Compare(pNode, *ppNext) != 0) + { + pNode->m_pNext = *ppNext; + *ppNext = pNode; + } + else + { + delete pNode; + hr = S_FALSE; + } + } + } + else + { + pNode->m_pNext = NULL; + m_pHead = m_pTail = pNode; + } + if (bMaintainCount) ++m_cElements; + return hr; + } + + // + // These functions must support the "==" operator for the TFIND type. + // + template + T * Find(TFIND & FindVal) const + { + for (T * pNode = m_pHead; pNode && (!(*pNode == FindVal)); pNode = pNode->m_pNext) + {} + return pNode; + } + + template + T * FindNext(const T * pCurNode, TFIND & FindVal) const + { + for (T * pNode = pCurNode->m_pNext; pNode && (!(*pNode == FindVal)); pNode = pNode->m_pNext) + {} + return pNode; + } + + // + // Searches for and removes a single list element + // + template + T * FindAndRemove(TFIND & FindVal) + { + T * pNode = m_pHead; + if (pNode) + { + if (*pNode == FindVal) + { + m_pHead = pNode->m_pNext; + if (bMaintainCount) --m_cElements; + } + else + { + T * pPrev = pNode; + for (pNode = pNode->m_pNext; + pNode; + pPrev = pNode, pNode = pNode->m_pNext) + { + if (*pNode == FindVal) + { + pPrev->m_pNext = pNode->m_pNext; + if (pNode->m_pNext == NULL) + { + m_pTail = pPrev; + } + if (bMaintainCount) --m_cElements; + break; + } + } + } + } + return pNode; + } + + // + // Searches for and deletes all list elements that match + // + template + void FindAndDeleteAll(TFIND & FindVal) + { + T * pNode = m_pHead; + while (pNode && *pNode == FindVal) + { + m_pHead = pNode->m_pNext; + delete pNode; + if (bMaintainCount) --m_cElements; + pNode = m_pHead; + } + T * pPrev = pNode; + while (pNode) + { + T * pNext = pNode->m_pNext; + if (*pNode == FindVal) + { + pPrev->m_pNext = pNext; + delete pNode; + if (bMaintainCount) --m_cElements; + } + else + { + pPrev = pNode; + } + pNode = pNext; + } + m_pTail = pPrev; // Just always set it in case we removed the tail. + } + + +}; + +template +class CSpBasicList +{ +public: + T * m_pFirst; + CSpBasicList() : m_pFirst(NULL) {} + ~CSpBasicList() + { + if (bPurgeWhenDeleted) + { + Purge(); + } + } + + void Purge() + { + while (m_pFirst) + { + T * pNext = m_pFirst->m_pNext; + delete m_pFirst; + m_pFirst = pNext; + } + } + + void ExplicitPurge() + { + T * pDie; + BYTE * pb; + + while (m_pFirst) + { + pDie = m_pFirst; + m_pFirst = pDie->m_pNext; + + pDie->~T(); + + pb = reinterpret_cast(pDie); + delete [] pb; + } + } + + HRESULT RemoveFirstOrAllocateNew(T ** ppNode) + { + if (m_pFirst) + { + *ppNode = m_pFirst; + m_pFirst = m_pFirst->m_pNext; + } + else + { + *ppNode = new T; + if (*ppNode == NULL) + { + return E_OUTOFMEMORY; + } + } + return S_OK; + } + + void AddNode(T * pNode) + { + pNode->m_pNext = m_pFirst; + m_pFirst = pNode; + } + T * GetFirst() + { + return m_pFirst; + } + T * RemoveFirst() + { + T * pNode = m_pFirst; + if (pNode) + { + m_pFirst = pNode->m_pNext; + } + return pNode; + } +}; + +#define STACK_ALLOC(TYPE, COUNT) (TYPE *)_alloca(sizeof(TYPE) * (COUNT)) +#define STACK_ALLOC_AND_ZERO(TYPE, COUNT) (TYPE *)memset(_alloca(sizeof(TYPE) * (COUNT)), 0, (sizeof(TYPE) * (COUNT))) +#define STACK_ALLOC_AND_COPY(TYPE, COUNT, SOURCE) (TYPE *)memcpy(_alloca(sizeof(TYPE) * (COUNT)), (SOURCE), (sizeof(TYPE) * (COUNT))) + +inline HRESULT SpGetSubTokenFromToken( + ISpObjectToken * pToken, + const WCHAR * pszSubKeyName, + ISpObjectToken ** ppToken, + BOOL fCreateIfNotExist = FALSE) +{ + SPDBG_FUNC("SpGetTokenFromDataKey"); + HRESULT hr = S_OK; + + if (SP_IS_BAD_INTERFACE_PTR(pToken) || + SP_IS_BAD_STRING_PTR(pszSubKeyName) || + SP_IS_BAD_WRITE_PTR(ppToken)) + { + hr = E_POINTER; + } + + // First, either create or open the datakey for the new token + CComPtr cpDataKeyForNewToken; + if (SUCCEEDED(hr)) + { + if (fCreateIfNotExist) + { + hr = pToken->CreateKey(pszSubKeyName, &cpDataKeyForNewToken); + } + else + { + hr = pToken->OpenKey(pszSubKeyName, &cpDataKeyForNewToken); + } + } + + // The sub token's category will be the token id of it's parent token + CSpDynamicString dstrCategoryId; + if (SUCCEEDED(hr)) + { + hr = pToken->GetId(&dstrCategoryId); + } + + // The sub token's token id will be it's category id + "\\" the key name + CSpDynamicString dstrTokenId; + if (SUCCEEDED(hr)) + { + dstrTokenId = dstrCategoryId; + dstrTokenId.Append2(L"\\", pszSubKeyName); + } + + // Now create the token and initalize it + CComPtr cpTokenInit; + if (SUCCEEDED(hr)) + { + hr = cpTokenInit.CoCreateInstance(CLSID_SpObjectToken); + } + + if (SUCCEEDED(hr)) + { + hr = cpTokenInit->InitFromDataKey(dstrCategoryId, dstrTokenId, cpDataKeyForNewToken); + } + + if (SUCCEEDED(hr)) + { + *ppToken = cpTokenInit.Detach(); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +template +HRESULT SpCreateObjectFromSubToken(ISpObjectToken * pToken, const WCHAR * pszSubKeyName, T ** ppObject, + IUnknown * pUnkOuter = NULL, DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateObjectFromSubToken"); + HRESULT hr; + + CComPtr cpSubToken; + hr = SpGetSubTokenFromToken(pToken, pszSubKeyName, &cpSubToken); + + if (SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(cpSubToken, ppObject, pUnkOuter, dwClsCtxt); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +#endif /* This must be the last line in the file */ diff --git a/sp/src/utils/sapi51/Include/sapi.h b/sp/src/utils/sapi51/Include/sapi.h new file mode 100644 index 00000000..6412e3da --- /dev/null +++ b/sp/src/utils/sapi51/Include/sapi.h @@ -0,0 +1,25599 @@ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 6.00.0347 */ +/* Compiler settings for sapi.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __sapi_h__ +#define __sapi_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ISpNotifySource_FWD_DEFINED__ +#define __ISpNotifySource_FWD_DEFINED__ +typedef interface ISpNotifySource ISpNotifySource; +#endif /* __ISpNotifySource_FWD_DEFINED__ */ + + +#ifndef __ISpNotifySink_FWD_DEFINED__ +#define __ISpNotifySink_FWD_DEFINED__ +typedef interface ISpNotifySink ISpNotifySink; +#endif /* __ISpNotifySink_FWD_DEFINED__ */ + + +#ifndef __ISpNotifyTranslator_FWD_DEFINED__ +#define __ISpNotifyTranslator_FWD_DEFINED__ +typedef interface ISpNotifyTranslator ISpNotifyTranslator; +#endif /* __ISpNotifyTranslator_FWD_DEFINED__ */ + + +#ifndef __ISpDataKey_FWD_DEFINED__ +#define __ISpDataKey_FWD_DEFINED__ +typedef interface ISpDataKey ISpDataKey; +#endif /* __ISpDataKey_FWD_DEFINED__ */ + + +#ifndef __ISpRegDataKey_FWD_DEFINED__ +#define __ISpRegDataKey_FWD_DEFINED__ +typedef interface ISpRegDataKey ISpRegDataKey; +#endif /* __ISpRegDataKey_FWD_DEFINED__ */ + + +#ifndef __ISpObjectTokenCategory_FWD_DEFINED__ +#define __ISpObjectTokenCategory_FWD_DEFINED__ +typedef interface ISpObjectTokenCategory ISpObjectTokenCategory; +#endif /* __ISpObjectTokenCategory_FWD_DEFINED__ */ + + +#ifndef __ISpObjectToken_FWD_DEFINED__ +#define __ISpObjectToken_FWD_DEFINED__ +typedef interface ISpObjectToken ISpObjectToken; +#endif /* __ISpObjectToken_FWD_DEFINED__ */ + + +#ifndef __ISpObjectTokenInit_FWD_DEFINED__ +#define __ISpObjectTokenInit_FWD_DEFINED__ +typedef interface ISpObjectTokenInit ISpObjectTokenInit; +#endif /* __ISpObjectTokenInit_FWD_DEFINED__ */ + + +#ifndef __IEnumSpObjectTokens_FWD_DEFINED__ +#define __IEnumSpObjectTokens_FWD_DEFINED__ +typedef interface IEnumSpObjectTokens IEnumSpObjectTokens; +#endif /* __IEnumSpObjectTokens_FWD_DEFINED__ */ + + +#ifndef __ISpObjectWithToken_FWD_DEFINED__ +#define __ISpObjectWithToken_FWD_DEFINED__ +typedef interface ISpObjectWithToken ISpObjectWithToken; +#endif /* __ISpObjectWithToken_FWD_DEFINED__ */ + + +#ifndef __ISpResourceManager_FWD_DEFINED__ +#define __ISpResourceManager_FWD_DEFINED__ +typedef interface ISpResourceManager ISpResourceManager; +#endif /* __ISpResourceManager_FWD_DEFINED__ */ + + +#ifndef __ISpEventSource_FWD_DEFINED__ +#define __ISpEventSource_FWD_DEFINED__ +typedef interface ISpEventSource ISpEventSource; +#endif /* __ISpEventSource_FWD_DEFINED__ */ + + +#ifndef __ISpEventSink_FWD_DEFINED__ +#define __ISpEventSink_FWD_DEFINED__ +typedef interface ISpEventSink ISpEventSink; +#endif /* __ISpEventSink_FWD_DEFINED__ */ + + +#ifndef __ISpStreamFormat_FWD_DEFINED__ +#define __ISpStreamFormat_FWD_DEFINED__ +typedef interface ISpStreamFormat ISpStreamFormat; +#endif /* __ISpStreamFormat_FWD_DEFINED__ */ + + +#ifndef __ISpStream_FWD_DEFINED__ +#define __ISpStream_FWD_DEFINED__ +typedef interface ISpStream ISpStream; +#endif /* __ISpStream_FWD_DEFINED__ */ + + +#ifndef __ISpStreamFormatConverter_FWD_DEFINED__ +#define __ISpStreamFormatConverter_FWD_DEFINED__ +typedef interface ISpStreamFormatConverter ISpStreamFormatConverter; +#endif /* __ISpStreamFormatConverter_FWD_DEFINED__ */ + + +#ifndef __ISpAudio_FWD_DEFINED__ +#define __ISpAudio_FWD_DEFINED__ +typedef interface ISpAudio ISpAudio; +#endif /* __ISpAudio_FWD_DEFINED__ */ + + +#ifndef __ISpMMSysAudio_FWD_DEFINED__ +#define __ISpMMSysAudio_FWD_DEFINED__ +typedef interface ISpMMSysAudio ISpMMSysAudio; +#endif /* __ISpMMSysAudio_FWD_DEFINED__ */ + + +#ifndef __ISpTranscript_FWD_DEFINED__ +#define __ISpTranscript_FWD_DEFINED__ +typedef interface ISpTranscript ISpTranscript; +#endif /* __ISpTranscript_FWD_DEFINED__ */ + + +#ifndef __ISpLexicon_FWD_DEFINED__ +#define __ISpLexicon_FWD_DEFINED__ +typedef interface ISpLexicon ISpLexicon; +#endif /* __ISpLexicon_FWD_DEFINED__ */ + + +#ifndef __ISpContainerLexicon_FWD_DEFINED__ +#define __ISpContainerLexicon_FWD_DEFINED__ +typedef interface ISpContainerLexicon ISpContainerLexicon; +#endif /* __ISpContainerLexicon_FWD_DEFINED__ */ + + +#ifndef __ISpPhoneConverter_FWD_DEFINED__ +#define __ISpPhoneConverter_FWD_DEFINED__ +typedef interface ISpPhoneConverter ISpPhoneConverter; +#endif /* __ISpPhoneConverter_FWD_DEFINED__ */ + + +#ifndef __ISpVoice_FWD_DEFINED__ +#define __ISpVoice_FWD_DEFINED__ +typedef interface ISpVoice ISpVoice; +#endif /* __ISpVoice_FWD_DEFINED__ */ + + +#ifndef __ISpPhrase_FWD_DEFINED__ +#define __ISpPhrase_FWD_DEFINED__ +typedef interface ISpPhrase ISpPhrase; +#endif /* __ISpPhrase_FWD_DEFINED__ */ + + +#ifndef __ISpPhraseAlt_FWD_DEFINED__ +#define __ISpPhraseAlt_FWD_DEFINED__ +typedef interface ISpPhraseAlt ISpPhraseAlt; +#endif /* __ISpPhraseAlt_FWD_DEFINED__ */ + + +#ifndef __ISpRecoResult_FWD_DEFINED__ +#define __ISpRecoResult_FWD_DEFINED__ +typedef interface ISpRecoResult ISpRecoResult; +#endif /* __ISpRecoResult_FWD_DEFINED__ */ + + +#ifndef __ISpGrammarBuilder_FWD_DEFINED__ +#define __ISpGrammarBuilder_FWD_DEFINED__ +typedef interface ISpGrammarBuilder ISpGrammarBuilder; +#endif /* __ISpGrammarBuilder_FWD_DEFINED__ */ + + +#ifndef __ISpRecoGrammar_FWD_DEFINED__ +#define __ISpRecoGrammar_FWD_DEFINED__ +typedef interface ISpRecoGrammar ISpRecoGrammar; +#endif /* __ISpRecoGrammar_FWD_DEFINED__ */ + + +#ifndef __ISpRecoContext_FWD_DEFINED__ +#define __ISpRecoContext_FWD_DEFINED__ +typedef interface ISpRecoContext ISpRecoContext; +#endif /* __ISpRecoContext_FWD_DEFINED__ */ + + +#ifndef __ISpProperties_FWD_DEFINED__ +#define __ISpProperties_FWD_DEFINED__ +typedef interface ISpProperties ISpProperties; +#endif /* __ISpProperties_FWD_DEFINED__ */ + + +#ifndef __ISpRecognizer_FWD_DEFINED__ +#define __ISpRecognizer_FWD_DEFINED__ +typedef interface ISpRecognizer ISpRecognizer; +#endif /* __ISpRecognizer_FWD_DEFINED__ */ + + +#ifndef __ISpeechDataKey_FWD_DEFINED__ +#define __ISpeechDataKey_FWD_DEFINED__ +typedef interface ISpeechDataKey ISpeechDataKey; +#endif /* __ISpeechDataKey_FWD_DEFINED__ */ + + +#ifndef __ISpeechObjectToken_FWD_DEFINED__ +#define __ISpeechObjectToken_FWD_DEFINED__ +typedef interface ISpeechObjectToken ISpeechObjectToken; +#endif /* __ISpeechObjectToken_FWD_DEFINED__ */ + + +#ifndef __ISpeechObjectTokens_FWD_DEFINED__ +#define __ISpeechObjectTokens_FWD_DEFINED__ +typedef interface ISpeechObjectTokens ISpeechObjectTokens; +#endif /* __ISpeechObjectTokens_FWD_DEFINED__ */ + + +#ifndef __ISpeechObjectTokenCategory_FWD_DEFINED__ +#define __ISpeechObjectTokenCategory_FWD_DEFINED__ +typedef interface ISpeechObjectTokenCategory ISpeechObjectTokenCategory; +#endif /* __ISpeechObjectTokenCategory_FWD_DEFINED__ */ + + +#ifndef __ISpeechAudioBufferInfo_FWD_DEFINED__ +#define __ISpeechAudioBufferInfo_FWD_DEFINED__ +typedef interface ISpeechAudioBufferInfo ISpeechAudioBufferInfo; +#endif /* __ISpeechAudioBufferInfo_FWD_DEFINED__ */ + + +#ifndef __ISpeechAudioStatus_FWD_DEFINED__ +#define __ISpeechAudioStatus_FWD_DEFINED__ +typedef interface ISpeechAudioStatus ISpeechAudioStatus; +#endif /* __ISpeechAudioStatus_FWD_DEFINED__ */ + + +#ifndef __ISpeechAudioFormat_FWD_DEFINED__ +#define __ISpeechAudioFormat_FWD_DEFINED__ +typedef interface ISpeechAudioFormat ISpeechAudioFormat; +#endif /* __ISpeechAudioFormat_FWD_DEFINED__ */ + + +#ifndef __ISpeechWaveFormatEx_FWD_DEFINED__ +#define __ISpeechWaveFormatEx_FWD_DEFINED__ +typedef interface ISpeechWaveFormatEx ISpeechWaveFormatEx; +#endif /* __ISpeechWaveFormatEx_FWD_DEFINED__ */ + + +#ifndef __ISpeechBaseStream_FWD_DEFINED__ +#define __ISpeechBaseStream_FWD_DEFINED__ +typedef interface ISpeechBaseStream ISpeechBaseStream; +#endif /* __ISpeechBaseStream_FWD_DEFINED__ */ + + +#ifndef __ISpeechFileStream_FWD_DEFINED__ +#define __ISpeechFileStream_FWD_DEFINED__ +typedef interface ISpeechFileStream ISpeechFileStream; +#endif /* __ISpeechFileStream_FWD_DEFINED__ */ + + +#ifndef __ISpeechMemoryStream_FWD_DEFINED__ +#define __ISpeechMemoryStream_FWD_DEFINED__ +typedef interface ISpeechMemoryStream ISpeechMemoryStream; +#endif /* __ISpeechMemoryStream_FWD_DEFINED__ */ + + +#ifndef __ISpeechCustomStream_FWD_DEFINED__ +#define __ISpeechCustomStream_FWD_DEFINED__ +typedef interface ISpeechCustomStream ISpeechCustomStream; +#endif /* __ISpeechCustomStream_FWD_DEFINED__ */ + + +#ifndef __ISpeechAudio_FWD_DEFINED__ +#define __ISpeechAudio_FWD_DEFINED__ +typedef interface ISpeechAudio ISpeechAudio; +#endif /* __ISpeechAudio_FWD_DEFINED__ */ + + +#ifndef __ISpeechMMSysAudio_FWD_DEFINED__ +#define __ISpeechMMSysAudio_FWD_DEFINED__ +typedef interface ISpeechMMSysAudio ISpeechMMSysAudio; +#endif /* __ISpeechMMSysAudio_FWD_DEFINED__ */ + + +#ifndef __ISpeechVoice_FWD_DEFINED__ +#define __ISpeechVoice_FWD_DEFINED__ +typedef interface ISpeechVoice ISpeechVoice; +#endif /* __ISpeechVoice_FWD_DEFINED__ */ + + +#ifndef __ISpeechVoiceStatus_FWD_DEFINED__ +#define __ISpeechVoiceStatus_FWD_DEFINED__ +typedef interface ISpeechVoiceStatus ISpeechVoiceStatus; +#endif /* __ISpeechVoiceStatus_FWD_DEFINED__ */ + + +#ifndef ___ISpeechVoiceEvents_FWD_DEFINED__ +#define ___ISpeechVoiceEvents_FWD_DEFINED__ +typedef interface _ISpeechVoiceEvents _ISpeechVoiceEvents; +#endif /* ___ISpeechVoiceEvents_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecognizer_FWD_DEFINED__ +#define __ISpeechRecognizer_FWD_DEFINED__ +typedef interface ISpeechRecognizer ISpeechRecognizer; +#endif /* __ISpeechRecognizer_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecognizerStatus_FWD_DEFINED__ +#define __ISpeechRecognizerStatus_FWD_DEFINED__ +typedef interface ISpeechRecognizerStatus ISpeechRecognizerStatus; +#endif /* __ISpeechRecognizerStatus_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecoContext_FWD_DEFINED__ +#define __ISpeechRecoContext_FWD_DEFINED__ +typedef interface ISpeechRecoContext ISpeechRecoContext; +#endif /* __ISpeechRecoContext_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecoGrammar_FWD_DEFINED__ +#define __ISpeechRecoGrammar_FWD_DEFINED__ +typedef interface ISpeechRecoGrammar ISpeechRecoGrammar; +#endif /* __ISpeechRecoGrammar_FWD_DEFINED__ */ + + +#ifndef ___ISpeechRecoContextEvents_FWD_DEFINED__ +#define ___ISpeechRecoContextEvents_FWD_DEFINED__ +typedef interface _ISpeechRecoContextEvents _ISpeechRecoContextEvents; +#endif /* ___ISpeechRecoContextEvents_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRule_FWD_DEFINED__ +#define __ISpeechGrammarRule_FWD_DEFINED__ +typedef interface ISpeechGrammarRule ISpeechGrammarRule; +#endif /* __ISpeechGrammarRule_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRules_FWD_DEFINED__ +#define __ISpeechGrammarRules_FWD_DEFINED__ +typedef interface ISpeechGrammarRules ISpeechGrammarRules; +#endif /* __ISpeechGrammarRules_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleState_FWD_DEFINED__ +#define __ISpeechGrammarRuleState_FWD_DEFINED__ +typedef interface ISpeechGrammarRuleState ISpeechGrammarRuleState; +#endif /* __ISpeechGrammarRuleState_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleStateTransition_FWD_DEFINED__ +#define __ISpeechGrammarRuleStateTransition_FWD_DEFINED__ +typedef interface ISpeechGrammarRuleStateTransition ISpeechGrammarRuleStateTransition; +#endif /* __ISpeechGrammarRuleStateTransition_FWD_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleStateTransitions_FWD_DEFINED__ +#define __ISpeechGrammarRuleStateTransitions_FWD_DEFINED__ +typedef interface ISpeechGrammarRuleStateTransitions ISpeechGrammarRuleStateTransitions; +#endif /* __ISpeechGrammarRuleStateTransitions_FWD_DEFINED__ */ + + +#ifndef __ISpeechTextSelectionInformation_FWD_DEFINED__ +#define __ISpeechTextSelectionInformation_FWD_DEFINED__ +typedef interface ISpeechTextSelectionInformation ISpeechTextSelectionInformation; +#endif /* __ISpeechTextSelectionInformation_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecoResult_FWD_DEFINED__ +#define __ISpeechRecoResult_FWD_DEFINED__ +typedef interface ISpeechRecoResult ISpeechRecoResult; +#endif /* __ISpeechRecoResult_FWD_DEFINED__ */ + + +#ifndef __ISpeechRecoResultTimes_FWD_DEFINED__ +#define __ISpeechRecoResultTimes_FWD_DEFINED__ +typedef interface ISpeechRecoResultTimes ISpeechRecoResultTimes; +#endif /* __ISpeechRecoResultTimes_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseAlternate_FWD_DEFINED__ +#define __ISpeechPhraseAlternate_FWD_DEFINED__ +typedef interface ISpeechPhraseAlternate ISpeechPhraseAlternate; +#endif /* __ISpeechPhraseAlternate_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseAlternates_FWD_DEFINED__ +#define __ISpeechPhraseAlternates_FWD_DEFINED__ +typedef interface ISpeechPhraseAlternates ISpeechPhraseAlternates; +#endif /* __ISpeechPhraseAlternates_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseInfo_FWD_DEFINED__ +#define __ISpeechPhraseInfo_FWD_DEFINED__ +typedef interface ISpeechPhraseInfo ISpeechPhraseInfo; +#endif /* __ISpeechPhraseInfo_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseElement_FWD_DEFINED__ +#define __ISpeechPhraseElement_FWD_DEFINED__ +typedef interface ISpeechPhraseElement ISpeechPhraseElement; +#endif /* __ISpeechPhraseElement_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseElements_FWD_DEFINED__ +#define __ISpeechPhraseElements_FWD_DEFINED__ +typedef interface ISpeechPhraseElements ISpeechPhraseElements; +#endif /* __ISpeechPhraseElements_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseReplacement_FWD_DEFINED__ +#define __ISpeechPhraseReplacement_FWD_DEFINED__ +typedef interface ISpeechPhraseReplacement ISpeechPhraseReplacement; +#endif /* __ISpeechPhraseReplacement_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseReplacements_FWD_DEFINED__ +#define __ISpeechPhraseReplacements_FWD_DEFINED__ +typedef interface ISpeechPhraseReplacements ISpeechPhraseReplacements; +#endif /* __ISpeechPhraseReplacements_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseProperty_FWD_DEFINED__ +#define __ISpeechPhraseProperty_FWD_DEFINED__ +typedef interface ISpeechPhraseProperty ISpeechPhraseProperty; +#endif /* __ISpeechPhraseProperty_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseProperties_FWD_DEFINED__ +#define __ISpeechPhraseProperties_FWD_DEFINED__ +typedef interface ISpeechPhraseProperties ISpeechPhraseProperties; +#endif /* __ISpeechPhraseProperties_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseRule_FWD_DEFINED__ +#define __ISpeechPhraseRule_FWD_DEFINED__ +typedef interface ISpeechPhraseRule ISpeechPhraseRule; +#endif /* __ISpeechPhraseRule_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseRules_FWD_DEFINED__ +#define __ISpeechPhraseRules_FWD_DEFINED__ +typedef interface ISpeechPhraseRules ISpeechPhraseRules; +#endif /* __ISpeechPhraseRules_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexicon_FWD_DEFINED__ +#define __ISpeechLexicon_FWD_DEFINED__ +typedef interface ISpeechLexicon ISpeechLexicon; +#endif /* __ISpeechLexicon_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexiconWords_FWD_DEFINED__ +#define __ISpeechLexiconWords_FWD_DEFINED__ +typedef interface ISpeechLexiconWords ISpeechLexiconWords; +#endif /* __ISpeechLexiconWords_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexiconWord_FWD_DEFINED__ +#define __ISpeechLexiconWord_FWD_DEFINED__ +typedef interface ISpeechLexiconWord ISpeechLexiconWord; +#endif /* __ISpeechLexiconWord_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexiconPronunciations_FWD_DEFINED__ +#define __ISpeechLexiconPronunciations_FWD_DEFINED__ +typedef interface ISpeechLexiconPronunciations ISpeechLexiconPronunciations; +#endif /* __ISpeechLexiconPronunciations_FWD_DEFINED__ */ + + +#ifndef __ISpeechLexiconPronunciation_FWD_DEFINED__ +#define __ISpeechLexiconPronunciation_FWD_DEFINED__ +typedef interface ISpeechLexiconPronunciation ISpeechLexiconPronunciation; +#endif /* __ISpeechLexiconPronunciation_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhraseInfoBuilder_FWD_DEFINED__ +#define __ISpeechPhraseInfoBuilder_FWD_DEFINED__ +typedef interface ISpeechPhraseInfoBuilder ISpeechPhraseInfoBuilder; +#endif /* __ISpeechPhraseInfoBuilder_FWD_DEFINED__ */ + + +#ifndef __ISpeechPhoneConverter_FWD_DEFINED__ +#define __ISpeechPhoneConverter_FWD_DEFINED__ +typedef interface ISpeechPhoneConverter ISpeechPhoneConverter; +#endif /* __ISpeechPhoneConverter_FWD_DEFINED__ */ + + +#ifndef __SpNotifyTranslator_FWD_DEFINED__ +#define __SpNotifyTranslator_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpNotifyTranslator SpNotifyTranslator; +#else +typedef struct SpNotifyTranslator SpNotifyTranslator; +#endif /* __cplusplus */ + +#endif /* __SpNotifyTranslator_FWD_DEFINED__ */ + + +#ifndef __SpObjectTokenCategory_FWD_DEFINED__ +#define __SpObjectTokenCategory_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpObjectTokenCategory SpObjectTokenCategory; +#else +typedef struct SpObjectTokenCategory SpObjectTokenCategory; +#endif /* __cplusplus */ + +#endif /* __SpObjectTokenCategory_FWD_DEFINED__ */ + + +#ifndef __SpObjectToken_FWD_DEFINED__ +#define __SpObjectToken_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpObjectToken SpObjectToken; +#else +typedef struct SpObjectToken SpObjectToken; +#endif /* __cplusplus */ + +#endif /* __SpObjectToken_FWD_DEFINED__ */ + + +#ifndef __SpResourceManager_FWD_DEFINED__ +#define __SpResourceManager_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpResourceManager SpResourceManager; +#else +typedef struct SpResourceManager SpResourceManager; +#endif /* __cplusplus */ + +#endif /* __SpResourceManager_FWD_DEFINED__ */ + + +#ifndef __SpStreamFormatConverter_FWD_DEFINED__ +#define __SpStreamFormatConverter_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpStreamFormatConverter SpStreamFormatConverter; +#else +typedef struct SpStreamFormatConverter SpStreamFormatConverter; +#endif /* __cplusplus */ + +#endif /* __SpStreamFormatConverter_FWD_DEFINED__ */ + + +#ifndef __SpMMAudioEnum_FWD_DEFINED__ +#define __SpMMAudioEnum_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpMMAudioEnum SpMMAudioEnum; +#else +typedef struct SpMMAudioEnum SpMMAudioEnum; +#endif /* __cplusplus */ + +#endif /* __SpMMAudioEnum_FWD_DEFINED__ */ + + +#ifndef __SpMMAudioIn_FWD_DEFINED__ +#define __SpMMAudioIn_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpMMAudioIn SpMMAudioIn; +#else +typedef struct SpMMAudioIn SpMMAudioIn; +#endif /* __cplusplus */ + +#endif /* __SpMMAudioIn_FWD_DEFINED__ */ + + +#ifndef __SpMMAudioOut_FWD_DEFINED__ +#define __SpMMAudioOut_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpMMAudioOut SpMMAudioOut; +#else +typedef struct SpMMAudioOut SpMMAudioOut; +#endif /* __cplusplus */ + +#endif /* __SpMMAudioOut_FWD_DEFINED__ */ + + +#ifndef __SpRecPlayAudio_FWD_DEFINED__ +#define __SpRecPlayAudio_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpRecPlayAudio SpRecPlayAudio; +#else +typedef struct SpRecPlayAudio SpRecPlayAudio; +#endif /* __cplusplus */ + +#endif /* __SpRecPlayAudio_FWD_DEFINED__ */ + + +#ifndef __SpStream_FWD_DEFINED__ +#define __SpStream_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpStream SpStream; +#else +typedef struct SpStream SpStream; +#endif /* __cplusplus */ + +#endif /* __SpStream_FWD_DEFINED__ */ + + +#ifndef __SpVoice_FWD_DEFINED__ +#define __SpVoice_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpVoice SpVoice; +#else +typedef struct SpVoice SpVoice; +#endif /* __cplusplus */ + +#endif /* __SpVoice_FWD_DEFINED__ */ + + +#ifndef __SpSharedRecoContext_FWD_DEFINED__ +#define __SpSharedRecoContext_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpSharedRecoContext SpSharedRecoContext; +#else +typedef struct SpSharedRecoContext SpSharedRecoContext; +#endif /* __cplusplus */ + +#endif /* __SpSharedRecoContext_FWD_DEFINED__ */ + + +#ifndef __SpInprocRecognizer_FWD_DEFINED__ +#define __SpInprocRecognizer_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpInprocRecognizer SpInprocRecognizer; +#else +typedef struct SpInprocRecognizer SpInprocRecognizer; +#endif /* __cplusplus */ + +#endif /* __SpInprocRecognizer_FWD_DEFINED__ */ + + +#ifndef __SpSharedRecognizer_FWD_DEFINED__ +#define __SpSharedRecognizer_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpSharedRecognizer SpSharedRecognizer; +#else +typedef struct SpSharedRecognizer SpSharedRecognizer; +#endif /* __cplusplus */ + +#endif /* __SpSharedRecognizer_FWD_DEFINED__ */ + + +#ifndef __SpLexicon_FWD_DEFINED__ +#define __SpLexicon_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpLexicon SpLexicon; +#else +typedef struct SpLexicon SpLexicon; +#endif /* __cplusplus */ + +#endif /* __SpLexicon_FWD_DEFINED__ */ + + +#ifndef __SpUnCompressedLexicon_FWD_DEFINED__ +#define __SpUnCompressedLexicon_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpUnCompressedLexicon SpUnCompressedLexicon; +#else +typedef struct SpUnCompressedLexicon SpUnCompressedLexicon; +#endif /* __cplusplus */ + +#endif /* __SpUnCompressedLexicon_FWD_DEFINED__ */ + + +#ifndef __SpCompressedLexicon_FWD_DEFINED__ +#define __SpCompressedLexicon_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpCompressedLexicon SpCompressedLexicon; +#else +typedef struct SpCompressedLexicon SpCompressedLexicon; +#endif /* __cplusplus */ + +#endif /* __SpCompressedLexicon_FWD_DEFINED__ */ + + +#ifndef __SpPhoneConverter_FWD_DEFINED__ +#define __SpPhoneConverter_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpPhoneConverter SpPhoneConverter; +#else +typedef struct SpPhoneConverter SpPhoneConverter; +#endif /* __cplusplus */ + +#endif /* __SpPhoneConverter_FWD_DEFINED__ */ + + +#ifndef __SpNullPhoneConverter_FWD_DEFINED__ +#define __SpNullPhoneConverter_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpNullPhoneConverter SpNullPhoneConverter; +#else +typedef struct SpNullPhoneConverter SpNullPhoneConverter; +#endif /* __cplusplus */ + +#endif /* __SpNullPhoneConverter_FWD_DEFINED__ */ + + +#ifndef __SpTextSelectionInformation_FWD_DEFINED__ +#define __SpTextSelectionInformation_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpTextSelectionInformation SpTextSelectionInformation; +#else +typedef struct SpTextSelectionInformation SpTextSelectionInformation; +#endif /* __cplusplus */ + +#endif /* __SpTextSelectionInformation_FWD_DEFINED__ */ + + +#ifndef __SpPhraseInfoBuilder_FWD_DEFINED__ +#define __SpPhraseInfoBuilder_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpPhraseInfoBuilder SpPhraseInfoBuilder; +#else +typedef struct SpPhraseInfoBuilder SpPhraseInfoBuilder; +#endif /* __cplusplus */ + +#endif /* __SpPhraseInfoBuilder_FWD_DEFINED__ */ + + +#ifndef __SpAudioFormat_FWD_DEFINED__ +#define __SpAudioFormat_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpAudioFormat SpAudioFormat; +#else +typedef struct SpAudioFormat SpAudioFormat; +#endif /* __cplusplus */ + +#endif /* __SpAudioFormat_FWD_DEFINED__ */ + + +#ifndef __SpWaveFormatEx_FWD_DEFINED__ +#define __SpWaveFormatEx_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpWaveFormatEx SpWaveFormatEx; +#else +typedef struct SpWaveFormatEx SpWaveFormatEx; +#endif /* __cplusplus */ + +#endif /* __SpWaveFormatEx_FWD_DEFINED__ */ + + +#ifndef __SpInProcRecoContext_FWD_DEFINED__ +#define __SpInProcRecoContext_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpInProcRecoContext SpInProcRecoContext; +#else +typedef struct SpInProcRecoContext SpInProcRecoContext; +#endif /* __cplusplus */ + +#endif /* __SpInProcRecoContext_FWD_DEFINED__ */ + + +#ifndef __SpCustomStream_FWD_DEFINED__ +#define __SpCustomStream_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpCustomStream SpCustomStream; +#else +typedef struct SpCustomStream SpCustomStream; +#endif /* __cplusplus */ + +#endif /* __SpCustomStream_FWD_DEFINED__ */ + + +#ifndef __SpFileStream_FWD_DEFINED__ +#define __SpFileStream_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpFileStream SpFileStream; +#else +typedef struct SpFileStream SpFileStream; +#endif /* __cplusplus */ + +#endif /* __SpFileStream_FWD_DEFINED__ */ + + +#ifndef __SpMemoryStream_FWD_DEFINED__ +#define __SpMemoryStream_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpMemoryStream SpMemoryStream; +#else +typedef struct SpMemoryStream SpMemoryStream; +#endif /* __cplusplus */ + +#endif /* __SpMemoryStream_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +void * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void * ); + +/* interface __MIDL_itf_sapi_0000 */ +/* [local] */ + +#pragma warning(disable:4201) // Allow nameless structs/unions +#pragma comment(lib, "sapi.lib") +#if 0 +typedef /* [hidden][restricted] */ struct WAVEFORMATEX + { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + WORD cbSize; + } WAVEFORMATEX; + +#else +#include +#endif + + + + + + + + + + + + + + + + + + + + + + + + + +typedef /* [hidden] */ +enum SPDATAKEYLOCATION + { SPDKL_DefaultLocation = 0, + SPDKL_CurrentUser = 1, + SPDKL_LocalMachine = 2, + SPDKL_CurrentConfig = 5 + } SPDATAKEYLOCATION; + +#define SPDUI_EngineProperties L"EngineProperties" +#define SPDUI_AddRemoveWord L"AddRemoveWord" +#define SPDUI_UserTraining L"UserTraining" +#define SPDUI_MicTraining L"MicTraining" +#define SPDUI_RecoProfileProperties L"RecoProfileProperties" +#define SPDUI_AudioProperties L"AudioProperties" +#define SPDUI_AudioVolume L"AudioVolume" +typedef /* [hidden] */ +enum SPSTREAMFORMAT + { SPSF_Default = -1, + SPSF_NoAssignedFormat = 0, + SPSF_Text = SPSF_NoAssignedFormat + 1, + SPSF_NonStandardFormat = SPSF_Text + 1, + SPSF_ExtendedAudioFormat = SPSF_NonStandardFormat + 1, + SPSF_8kHz8BitMono = SPSF_ExtendedAudioFormat + 1, + SPSF_8kHz8BitStereo = SPSF_8kHz8BitMono + 1, + SPSF_8kHz16BitMono = SPSF_8kHz8BitStereo + 1, + SPSF_8kHz16BitStereo = SPSF_8kHz16BitMono + 1, + SPSF_11kHz8BitMono = SPSF_8kHz16BitStereo + 1, + SPSF_11kHz8BitStereo = SPSF_11kHz8BitMono + 1, + SPSF_11kHz16BitMono = SPSF_11kHz8BitStereo + 1, + SPSF_11kHz16BitStereo = SPSF_11kHz16BitMono + 1, + SPSF_12kHz8BitMono = SPSF_11kHz16BitStereo + 1, + SPSF_12kHz8BitStereo = SPSF_12kHz8BitMono + 1, + SPSF_12kHz16BitMono = SPSF_12kHz8BitStereo + 1, + SPSF_12kHz16BitStereo = SPSF_12kHz16BitMono + 1, + SPSF_16kHz8BitMono = SPSF_12kHz16BitStereo + 1, + SPSF_16kHz8BitStereo = SPSF_16kHz8BitMono + 1, + SPSF_16kHz16BitMono = SPSF_16kHz8BitStereo + 1, + SPSF_16kHz16BitStereo = SPSF_16kHz16BitMono + 1, + SPSF_22kHz8BitMono = SPSF_16kHz16BitStereo + 1, + SPSF_22kHz8BitStereo = SPSF_22kHz8BitMono + 1, + SPSF_22kHz16BitMono = SPSF_22kHz8BitStereo + 1, + SPSF_22kHz16BitStereo = SPSF_22kHz16BitMono + 1, + SPSF_24kHz8BitMono = SPSF_22kHz16BitStereo + 1, + SPSF_24kHz8BitStereo = SPSF_24kHz8BitMono + 1, + SPSF_24kHz16BitMono = SPSF_24kHz8BitStereo + 1, + SPSF_24kHz16BitStereo = SPSF_24kHz16BitMono + 1, + SPSF_32kHz8BitMono = SPSF_24kHz16BitStereo + 1, + SPSF_32kHz8BitStereo = SPSF_32kHz8BitMono + 1, + SPSF_32kHz16BitMono = SPSF_32kHz8BitStereo + 1, + SPSF_32kHz16BitStereo = SPSF_32kHz16BitMono + 1, + SPSF_44kHz8BitMono = SPSF_32kHz16BitStereo + 1, + SPSF_44kHz8BitStereo = SPSF_44kHz8BitMono + 1, + SPSF_44kHz16BitMono = SPSF_44kHz8BitStereo + 1, + SPSF_44kHz16BitStereo = SPSF_44kHz16BitMono + 1, + SPSF_48kHz8BitMono = SPSF_44kHz16BitStereo + 1, + SPSF_48kHz8BitStereo = SPSF_48kHz8BitMono + 1, + SPSF_48kHz16BitMono = SPSF_48kHz8BitStereo + 1, + SPSF_48kHz16BitStereo = SPSF_48kHz16BitMono + 1, + SPSF_TrueSpeech_8kHz1BitMono = SPSF_48kHz16BitStereo + 1, + SPSF_CCITT_ALaw_8kHzMono = SPSF_TrueSpeech_8kHz1BitMono + 1, + SPSF_CCITT_ALaw_8kHzStereo = SPSF_CCITT_ALaw_8kHzMono + 1, + SPSF_CCITT_ALaw_11kHzMono = SPSF_CCITT_ALaw_8kHzStereo + 1, + SPSF_CCITT_ALaw_11kHzStereo = SPSF_CCITT_ALaw_11kHzMono + 1, + SPSF_CCITT_ALaw_22kHzMono = SPSF_CCITT_ALaw_11kHzStereo + 1, + SPSF_CCITT_ALaw_22kHzStereo = SPSF_CCITT_ALaw_22kHzMono + 1, + SPSF_CCITT_ALaw_44kHzMono = SPSF_CCITT_ALaw_22kHzStereo + 1, + SPSF_CCITT_ALaw_44kHzStereo = SPSF_CCITT_ALaw_44kHzMono + 1, + SPSF_CCITT_uLaw_8kHzMono = SPSF_CCITT_ALaw_44kHzStereo + 1, + SPSF_CCITT_uLaw_8kHzStereo = SPSF_CCITT_uLaw_8kHzMono + 1, + SPSF_CCITT_uLaw_11kHzMono = SPSF_CCITT_uLaw_8kHzStereo + 1, + SPSF_CCITT_uLaw_11kHzStereo = SPSF_CCITT_uLaw_11kHzMono + 1, + SPSF_CCITT_uLaw_22kHzMono = SPSF_CCITT_uLaw_11kHzStereo + 1, + SPSF_CCITT_uLaw_22kHzStereo = SPSF_CCITT_uLaw_22kHzMono + 1, + SPSF_CCITT_uLaw_44kHzMono = SPSF_CCITT_uLaw_22kHzStereo + 1, + SPSF_CCITT_uLaw_44kHzStereo = SPSF_CCITT_uLaw_44kHzMono + 1, + SPSF_ADPCM_8kHzMono = SPSF_CCITT_uLaw_44kHzStereo + 1, + SPSF_ADPCM_8kHzStereo = SPSF_ADPCM_8kHzMono + 1, + SPSF_ADPCM_11kHzMono = SPSF_ADPCM_8kHzStereo + 1, + SPSF_ADPCM_11kHzStereo = SPSF_ADPCM_11kHzMono + 1, + SPSF_ADPCM_22kHzMono = SPSF_ADPCM_11kHzStereo + 1, + SPSF_ADPCM_22kHzStereo = SPSF_ADPCM_22kHzMono + 1, + SPSF_ADPCM_44kHzMono = SPSF_ADPCM_22kHzStereo + 1, + SPSF_ADPCM_44kHzStereo = SPSF_ADPCM_44kHzMono + 1, + SPSF_GSM610_8kHzMono = SPSF_ADPCM_44kHzStereo + 1, + SPSF_GSM610_11kHzMono = SPSF_GSM610_8kHzMono + 1, + SPSF_GSM610_22kHzMono = SPSF_GSM610_11kHzMono + 1, + SPSF_GSM610_44kHzMono = SPSF_GSM610_22kHzMono + 1, + SPSF_NUM_FORMATS = SPSF_GSM610_44kHzMono + 1 + } SPSTREAMFORMAT; + +EXTERN_C const GUID SPDFID_Text; +EXTERN_C const GUID SPDFID_WaveFormatEx; +#define SPREG_USER_ROOT L"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech" +#define SPREG_LOCAL_MACHINE_ROOT L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech" +#define SPCAT_AUDIOOUT L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput" +#define SPCAT_AUDIOIN L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput" +#define SPCAT_VOICES L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Voices" +#define SPCAT_RECOGNIZERS L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\Recognizers" +#define SPCAT_APPLEXICONS L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AppLexicons" +#define SPCAT_PHONECONVERTERS L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\PhoneConverters" +#define SPCAT_RECOPROFILES L"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\RecoProfiles" +#define SPMMSYS_AUDIO_IN_TOKEN_ID L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioInput\\TokenEnums\\MMAudioIn\\" +#define SPMMSYS_AUDIO_OUT_TOKEN_ID L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech\\AudioOutput\\TokenEnums\\MMAudioOut\\" +#define SPCURRENT_USER_LEXICON_TOKEN_ID L"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\CurrentUserLexicon" +#define SPTOKENVALUE_CLSID L"CLSID" +#define SPTOKENKEY_FILES L"Files" +#define SPTOKENKEY_UI L"UI" +#define SPTOKENKEY_ATTRIBUTES L"Attributes" +#define SPVOICECATEGORY_TTSRATE L"DefaultTTSRate" +#define SPPROP_RESOURCE_USAGE L"ResourceUsage" +#define SPPROP_HIGH_CONFIDENCE_THRESHOLD L"HighConfidenceThreshold" +#define SPPROP_NORMAL_CONFIDENCE_THRESHOLD L"NormalConfidenceThreshold" +#define SPPROP_LOW_CONFIDENCE_THRESHOLD L"LowConfidenceThreshold" +#define SPPROP_RESPONSE_SPEED L"ResponseSpeed" +#define SPPROP_COMPLEX_RESPONSE_SPEED L"ComplexResponseSpeed" +#define SPPROP_ADAPTATION_ON L"AdaptationOn" +#define SPTOPIC_SPELLING L"Spelling" +#define SPWILDCARD L"..." +#define SPDICTATION L"*" +#define SPINFDICTATION L"*+" +#define SP_LOW_CONFIDENCE ( -1 ) + +#define SP_NORMAL_CONFIDENCE ( 0 ) + +#define SP_HIGH_CONFIDENCE ( +1 ) + +#define DEFAULT_WEIGHT ( 1 ) + +#define SP_MAX_WORD_LENGTH ( 128 ) + +#define SP_MAX_PRON_LENGTH ( 384 ) + +#if defined(__cplusplus) +interface ISpNotifyCallback +{ +virtual HRESULT STDMETHODCALLTYPE NotifyCallback( + WPARAM wParam, + LPARAM lParam) = 0; +}; +#else +typedef void *ISpNotifyCallback; + +#endif +#if 0 +typedef void *SPNOTIFYCALLBACK; + +#else +typedef void __stdcall SPNOTIFYCALLBACK(WPARAM wParam, LPARAM lParam); +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0000_v0_0_s_ifspec; + +#ifndef __ISpNotifySource_INTERFACE_DEFINED__ +#define __ISpNotifySource_INTERFACE_DEFINED__ + +/* interface ISpNotifySource */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpNotifySource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5EFF4AEF-8487-11D2-961C-00C04F8EE628") + ISpNotifySource : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetNotifySink( + /* [in] */ ISpNotifySink *pNotifySink) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetNotifyWindowMessage( + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetNotifyCallbackFunction( + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetNotifyCallbackInterface( + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetNotifyWin32Event( void) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE WaitForNotifyEvent( + /* [in] */ DWORD dwMilliseconds) = 0; + + virtual /* [local] */ HANDLE STDMETHODCALLTYPE GetNotifyEventHandle( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpNotifySourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpNotifySource * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpNotifySource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpNotifySource * This); + + HRESULT ( STDMETHODCALLTYPE *SetNotifySink )( + ISpNotifySource * This, + /* [in] */ ISpNotifySink *pNotifySink); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWindowMessage )( + ISpNotifySource * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackFunction )( + ISpNotifySource * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackInterface )( + ISpNotifySource * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWin32Event )( + ISpNotifySource * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForNotifyEvent )( + ISpNotifySource * This, + /* [in] */ DWORD dwMilliseconds); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *GetNotifyEventHandle )( + ISpNotifySource * This); + + END_INTERFACE + } ISpNotifySourceVtbl; + + interface ISpNotifySource + { + CONST_VTBL struct ISpNotifySourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpNotifySource_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpNotifySource_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpNotifySource_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpNotifySource_SetNotifySink(This,pNotifySink) \ + (This)->lpVtbl -> SetNotifySink(This,pNotifySink) + +#define ISpNotifySource_SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpNotifySource_SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) + +#define ISpNotifySource_SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) + +#define ISpNotifySource_SetNotifyWin32Event(This) \ + (This)->lpVtbl -> SetNotifyWin32Event(This) + +#define ISpNotifySource_WaitForNotifyEvent(This,dwMilliseconds) \ + (This)->lpVtbl -> WaitForNotifyEvent(This,dwMilliseconds) + +#define ISpNotifySource_GetNotifyEventHandle(This) \ + (This)->lpVtbl -> GetNotifyEventHandle(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifySink_Proxy( + ISpNotifySource * This, + /* [in] */ ISpNotifySink *pNotifySink); + + +void __RPC_STUB ISpNotifySource_SetNotifySink_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifyWindowMessage_Proxy( + ISpNotifySource * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifySource_SetNotifyWindowMessage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifyCallbackFunction_Proxy( + ISpNotifySource * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifySource_SetNotifyCallbackFunction_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifyCallbackInterface_Proxy( + ISpNotifySource * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifySource_SetNotifyCallbackInterface_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_SetNotifyWin32Event_Proxy( + ISpNotifySource * This); + + +void __RPC_STUB ISpNotifySource_SetNotifyWin32Event_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpNotifySource_WaitForNotifyEvent_Proxy( + ISpNotifySource * This, + /* [in] */ DWORD dwMilliseconds); + + +void __RPC_STUB ISpNotifySource_WaitForNotifyEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HANDLE STDMETHODCALLTYPE ISpNotifySource_GetNotifyEventHandle_Proxy( + ISpNotifySource * This); + + +void __RPC_STUB ISpNotifySource_GetNotifyEventHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpNotifySource_INTERFACE_DEFINED__ */ + + +#ifndef __ISpNotifySink_INTERFACE_DEFINED__ +#define __ISpNotifySink_INTERFACE_DEFINED__ + +/* interface ISpNotifySink */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpNotifySink; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("259684DC-37C3-11D2-9603-00C04F8EE628") + ISpNotifySink : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Notify( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpNotifySinkVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpNotifySink * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpNotifySink * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpNotifySink * This); + + HRESULT ( STDMETHODCALLTYPE *Notify )( + ISpNotifySink * This); + + END_INTERFACE + } ISpNotifySinkVtbl; + + interface ISpNotifySink + { + CONST_VTBL struct ISpNotifySinkVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpNotifySink_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpNotifySink_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpNotifySink_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpNotifySink_Notify(This) \ + (This)->lpVtbl -> Notify(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpNotifySink_Notify_Proxy( + ISpNotifySink * This); + + +void __RPC_STUB ISpNotifySink_Notify_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpNotifySink_INTERFACE_DEFINED__ */ + + +#ifndef __ISpNotifyTranslator_INTERFACE_DEFINED__ +#define __ISpNotifyTranslator_INTERFACE_DEFINED__ + +/* interface ISpNotifyTranslator */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpNotifyTranslator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ACA16614-5D3D-11D2-960E-00C04F8EE628") + ISpNotifyTranslator : public ISpNotifySink + { + public: + virtual HRESULT STDMETHODCALLTYPE InitWindowMessage( + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitCallback( + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitSpNotifyCallback( + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitWin32Event( + HANDLE hEvent, + BOOL fCloseHandleOnRelease) = 0; + + virtual HRESULT STDMETHODCALLTYPE Wait( + /* [in] */ DWORD dwMilliseconds) = 0; + + virtual HANDLE STDMETHODCALLTYPE GetEventHandle( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpNotifyTranslatorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpNotifyTranslator * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpNotifyTranslator * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpNotifyTranslator * This); + + HRESULT ( STDMETHODCALLTYPE *Notify )( + ISpNotifyTranslator * This); + + HRESULT ( STDMETHODCALLTYPE *InitWindowMessage )( + ISpNotifyTranslator * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + HRESULT ( STDMETHODCALLTYPE *InitCallback )( + ISpNotifyTranslator * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + HRESULT ( STDMETHODCALLTYPE *InitSpNotifyCallback )( + ISpNotifyTranslator * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + HRESULT ( STDMETHODCALLTYPE *InitWin32Event )( + ISpNotifyTranslator * This, + HANDLE hEvent, + BOOL fCloseHandleOnRelease); + + HRESULT ( STDMETHODCALLTYPE *Wait )( + ISpNotifyTranslator * This, + /* [in] */ DWORD dwMilliseconds); + + HANDLE ( STDMETHODCALLTYPE *GetEventHandle )( + ISpNotifyTranslator * This); + + END_INTERFACE + } ISpNotifyTranslatorVtbl; + + interface ISpNotifyTranslator + { + CONST_VTBL struct ISpNotifyTranslatorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpNotifyTranslator_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpNotifyTranslator_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpNotifyTranslator_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpNotifyTranslator_Notify(This) \ + (This)->lpVtbl -> Notify(This) + + +#define ISpNotifyTranslator_InitWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> InitWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpNotifyTranslator_InitCallback(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> InitCallback(This,pfnCallback,wParam,lParam) + +#define ISpNotifyTranslator_InitSpNotifyCallback(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> InitSpNotifyCallback(This,pSpCallback,wParam,lParam) + +#define ISpNotifyTranslator_InitWin32Event(This,hEvent,fCloseHandleOnRelease) \ + (This)->lpVtbl -> InitWin32Event(This,hEvent,fCloseHandleOnRelease) + +#define ISpNotifyTranslator_Wait(This,dwMilliseconds) \ + (This)->lpVtbl -> Wait(This,dwMilliseconds) + +#define ISpNotifyTranslator_GetEventHandle(This) \ + (This)->lpVtbl -> GetEventHandle(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_InitWindowMessage_Proxy( + ISpNotifyTranslator * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifyTranslator_InitWindowMessage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_InitCallback_Proxy( + ISpNotifyTranslator * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifyTranslator_InitCallback_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_InitSpNotifyCallback_Proxy( + ISpNotifyTranslator * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + +void __RPC_STUB ISpNotifyTranslator_InitSpNotifyCallback_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_InitWin32Event_Proxy( + ISpNotifyTranslator * This, + HANDLE hEvent, + BOOL fCloseHandleOnRelease); + + +void __RPC_STUB ISpNotifyTranslator_InitWin32Event_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpNotifyTranslator_Wait_Proxy( + ISpNotifyTranslator * This, + /* [in] */ DWORD dwMilliseconds); + + +void __RPC_STUB ISpNotifyTranslator_Wait_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpNotifyTranslator_GetEventHandle_Proxy( + ISpNotifyTranslator * This); + + +void __RPC_STUB ISpNotifyTranslator_GetEventHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpNotifyTranslator_INTERFACE_DEFINED__ */ + + +#ifndef __ISpDataKey_INTERFACE_DEFINED__ +#define __ISpDataKey_INTERFACE_DEFINED__ + +/* interface ISpDataKey */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpDataKey; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("14056581-E16C-11D2-BB90-00C04F8EE6C0") + ISpDataKey : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetData( + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetData( + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetStringValue( + const WCHAR *pszValueName, + const WCHAR *pszValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStringValue( + const WCHAR *pszValueName, + WCHAR **ppszValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDWORD( + const WCHAR *pszValueName, + DWORD dwValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDWORD( + const WCHAR *pszValueName, + DWORD *pdwValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE OpenKey( + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateKey( + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeleteKey( + const WCHAR *pszSubKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeleteValue( + const WCHAR *pszValueName) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumKeys( + ULONG Index, + WCHAR **ppszSubKeyName) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumValues( + ULONG Index, + WCHAR **ppszValueName) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpDataKeyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpDataKey * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpDataKey * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpDataKey * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpDataKey * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpDataKey * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpDataKey * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpDataKey * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpDataKey * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpDataKey * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpDataKey * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpDataKey * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpDataKey * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpDataKey * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpDataKey * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpDataKey * This, + ULONG Index, + WCHAR **ppszValueName); + + END_INTERFACE + } ISpDataKeyVtbl; + + interface ISpDataKey + { + CONST_VTBL struct ISpDataKeyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpDataKey_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpDataKey_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpDataKey_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpDataKey_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpDataKey_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpDataKey_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpDataKey_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpDataKey_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpDataKey_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpDataKey_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpDataKey_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpDataKey_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpDataKey_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpDataKey_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpDataKey_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpDataKey_SetData_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + +void __RPC_STUB ISpDataKey_SetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_GetData_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + +void __RPC_STUB ISpDataKey_GetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_SetStringValue_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + +void __RPC_STUB ISpDataKey_SetStringValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_GetStringValue_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + +void __RPC_STUB ISpDataKey_GetStringValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_SetDWORD_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + DWORD dwValue); + + +void __RPC_STUB ISpDataKey_SetDWORD_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_GetDWORD_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + +void __RPC_STUB ISpDataKey_GetDWORD_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_OpenKey_Proxy( + ISpDataKey * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + +void __RPC_STUB ISpDataKey_OpenKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_CreateKey_Proxy( + ISpDataKey * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + +void __RPC_STUB ISpDataKey_CreateKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_DeleteKey_Proxy( + ISpDataKey * This, + const WCHAR *pszSubKey); + + +void __RPC_STUB ISpDataKey_DeleteKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_DeleteValue_Proxy( + ISpDataKey * This, + const WCHAR *pszValueName); + + +void __RPC_STUB ISpDataKey_DeleteValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_EnumKeys_Proxy( + ISpDataKey * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + +void __RPC_STUB ISpDataKey_EnumKeys_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpDataKey_EnumValues_Proxy( + ISpDataKey * This, + ULONG Index, + WCHAR **ppszValueName); + + +void __RPC_STUB ISpDataKey_EnumValues_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpDataKey_INTERFACE_DEFINED__ */ + + +#ifndef __ISpRegDataKey_INTERFACE_DEFINED__ +#define __ISpRegDataKey_INTERFACE_DEFINED__ + +/* interface ISpRegDataKey */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRegDataKey; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("92A66E2B-C830-4149-83DF-6FC2BA1E7A5B") + ISpRegDataKey : public ISpDataKey + { + public: + virtual /* [local] */ HRESULT STDMETHODCALLTYPE SetKey( + /* [in] */ HKEY hkey, + /* [in] */ BOOL fReadOnly) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRegDataKeyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRegDataKey * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRegDataKey * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRegDataKey * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpRegDataKey * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpRegDataKey * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpRegDataKey * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpRegDataKey * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpRegDataKey * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpRegDataKey * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpRegDataKey * This, + ULONG Index, + WCHAR **ppszValueName); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetKey )( + ISpRegDataKey * This, + /* [in] */ HKEY hkey, + /* [in] */ BOOL fReadOnly); + + END_INTERFACE + } ISpRegDataKeyVtbl; + + interface ISpRegDataKey + { + CONST_VTBL struct ISpRegDataKeyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRegDataKey_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRegDataKey_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRegDataKey_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRegDataKey_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpRegDataKey_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpRegDataKey_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpRegDataKey_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpRegDataKey_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpRegDataKey_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpRegDataKey_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpRegDataKey_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpRegDataKey_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpRegDataKey_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpRegDataKey_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpRegDataKey_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + + +#define ISpRegDataKey_SetKey(This,hkey,fReadOnly) \ + (This)->lpVtbl -> SetKey(This,hkey,fReadOnly) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpRegDataKey_SetKey_Proxy( + ISpRegDataKey * This, + /* [in] */ HKEY hkey, + /* [in] */ BOOL fReadOnly); + + +void __RPC_STUB ISpRegDataKey_SetKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRegDataKey_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectTokenCategory_INTERFACE_DEFINED__ +#define __ISpObjectTokenCategory_INTERFACE_DEFINED__ + +/* interface ISpObjectTokenCategory */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectTokenCategory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2D3D3845-39AF-4850-BBF9-40B49780011D") + ISpObjectTokenCategory : public ISpDataKey + { + public: + virtual HRESULT STDMETHODCALLTYPE SetId( + /* [in] */ const WCHAR *pszCategoryId, + BOOL fCreateIfNotExist) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetId( + /* [out] */ WCHAR **ppszCoMemCategoryId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDataKey( + SPDATAKEYLOCATION spdkl, + ISpDataKey **ppDataKey) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnumTokens( + /* [string][in] */ const WCHAR *pzsReqAttribs, + /* [string][in] */ const WCHAR *pszOptAttribs, + /* [out] */ IEnumSpObjectTokens **ppEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDefaultTokenId( + /* [in] */ const WCHAR *pszTokenId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDefaultTokenId( + /* [out] */ WCHAR **ppszCoMemTokenId) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectTokenCategoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectTokenCategory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectTokenCategory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectTokenCategory * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpObjectTokenCategory * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpObjectTokenCategory * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpObjectTokenCategory * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpObjectTokenCategory * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpObjectTokenCategory * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpObjectTokenCategory * This, + ULONG Index, + WCHAR **ppszValueName); + + HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpObjectTokenCategory * This, + /* [in] */ const WCHAR *pszCategoryId, + BOOL fCreateIfNotExist); + + HRESULT ( STDMETHODCALLTYPE *GetId )( + ISpObjectTokenCategory * This, + /* [out] */ WCHAR **ppszCoMemCategoryId); + + HRESULT ( STDMETHODCALLTYPE *GetDataKey )( + ISpObjectTokenCategory * This, + SPDATAKEYLOCATION spdkl, + ISpDataKey **ppDataKey); + + HRESULT ( STDMETHODCALLTYPE *EnumTokens )( + ISpObjectTokenCategory * This, + /* [string][in] */ const WCHAR *pzsReqAttribs, + /* [string][in] */ const WCHAR *pszOptAttribs, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + HRESULT ( STDMETHODCALLTYPE *SetDefaultTokenId )( + ISpObjectTokenCategory * This, + /* [in] */ const WCHAR *pszTokenId); + + HRESULT ( STDMETHODCALLTYPE *GetDefaultTokenId )( + ISpObjectTokenCategory * This, + /* [out] */ WCHAR **ppszCoMemTokenId); + + END_INTERFACE + } ISpObjectTokenCategoryVtbl; + + interface ISpObjectTokenCategory + { + CONST_VTBL struct ISpObjectTokenCategoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectTokenCategory_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectTokenCategory_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectTokenCategory_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectTokenCategory_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpObjectTokenCategory_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpObjectTokenCategory_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpObjectTokenCategory_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpObjectTokenCategory_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpObjectTokenCategory_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpObjectTokenCategory_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpObjectTokenCategory_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpObjectTokenCategory_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpObjectTokenCategory_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpObjectTokenCategory_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpObjectTokenCategory_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + + +#define ISpObjectTokenCategory_SetId(This,pszCategoryId,fCreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,pszCategoryId,fCreateIfNotExist) + +#define ISpObjectTokenCategory_GetId(This,ppszCoMemCategoryId) \ + (This)->lpVtbl -> GetId(This,ppszCoMemCategoryId) + +#define ISpObjectTokenCategory_GetDataKey(This,spdkl,ppDataKey) \ + (This)->lpVtbl -> GetDataKey(This,spdkl,ppDataKey) + +#define ISpObjectTokenCategory_EnumTokens(This,pzsReqAttribs,pszOptAttribs,ppEnum) \ + (This)->lpVtbl -> EnumTokens(This,pzsReqAttribs,pszOptAttribs,ppEnum) + +#define ISpObjectTokenCategory_SetDefaultTokenId(This,pszTokenId) \ + (This)->lpVtbl -> SetDefaultTokenId(This,pszTokenId) + +#define ISpObjectTokenCategory_GetDefaultTokenId(This,ppszCoMemTokenId) \ + (This)->lpVtbl -> GetDefaultTokenId(This,ppszCoMemTokenId) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_SetId_Proxy( + ISpObjectTokenCategory * This, + /* [in] */ const WCHAR *pszCategoryId, + BOOL fCreateIfNotExist); + + +void __RPC_STUB ISpObjectTokenCategory_SetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_GetId_Proxy( + ISpObjectTokenCategory * This, + /* [out] */ WCHAR **ppszCoMemCategoryId); + + +void __RPC_STUB ISpObjectTokenCategory_GetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_GetDataKey_Proxy( + ISpObjectTokenCategory * This, + SPDATAKEYLOCATION spdkl, + ISpDataKey **ppDataKey); + + +void __RPC_STUB ISpObjectTokenCategory_GetDataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_EnumTokens_Proxy( + ISpObjectTokenCategory * This, + /* [string][in] */ const WCHAR *pzsReqAttribs, + /* [string][in] */ const WCHAR *pszOptAttribs, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + +void __RPC_STUB ISpObjectTokenCategory_EnumTokens_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_SetDefaultTokenId_Proxy( + ISpObjectTokenCategory * This, + /* [in] */ const WCHAR *pszTokenId); + + +void __RPC_STUB ISpObjectTokenCategory_SetDefaultTokenId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenCategory_GetDefaultTokenId_Proxy( + ISpObjectTokenCategory * This, + /* [out] */ WCHAR **ppszCoMemTokenId); + + +void __RPC_STUB ISpObjectTokenCategory_GetDefaultTokenId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectTokenCategory_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectToken_INTERFACE_DEFINED__ +#define __ISpObjectToken_INTERFACE_DEFINED__ + +/* interface ISpObjectToken */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectToken; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("14056589-E16C-11D2-BB90-00C04F8EE6C0") + ISpObjectToken : public ISpDataKey + { + public: + virtual HRESULT STDMETHODCALLTYPE SetId( + const WCHAR *pszCategoryId, + const WCHAR *pszTokenId, + BOOL fCreateIfNotExist) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetId( + WCHAR **ppszCoMemTokenId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCategory( + ISpObjectTokenCategory **ppTokenCategory) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateInstance( + /* [in] */ IUnknown *pUnkOuter, + /* [in] */ DWORD dwClsContext, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStorageFileName( + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszValueName, + /* [in] */ const WCHAR *pszFileNameSpecifier, + /* [in] */ ULONG nFolder, + /* [out] */ WCHAR **ppszFilePath) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemoveStorageFileName( + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszKeyName, + /* [in] */ BOOL fDeleteFile) = 0; + + virtual HRESULT STDMETHODCALLTYPE Remove( + const CLSID *pclsidCaller) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE MatchesAttributes( + /* [in] */ const WCHAR *pszAttributes, + /* [out] */ BOOL *pfMatches) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectTokenVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectToken * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectToken * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectToken * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpObjectToken * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpObjectToken * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpObjectToken * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpObjectToken * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpObjectToken * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpObjectToken * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpObjectToken * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpObjectToken * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpObjectToken * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpObjectToken * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpObjectToken * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpObjectToken * This, + ULONG Index, + WCHAR **ppszValueName); + + HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpObjectToken * This, + const WCHAR *pszCategoryId, + const WCHAR *pszTokenId, + BOOL fCreateIfNotExist); + + HRESULT ( STDMETHODCALLTYPE *GetId )( + ISpObjectToken * This, + WCHAR **ppszCoMemTokenId); + + HRESULT ( STDMETHODCALLTYPE *GetCategory )( + ISpObjectToken * This, + ISpObjectTokenCategory **ppTokenCategory); + + HRESULT ( STDMETHODCALLTYPE *CreateInstance )( + ISpObjectToken * This, + /* [in] */ IUnknown *pUnkOuter, + /* [in] */ DWORD dwClsContext, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + HRESULT ( STDMETHODCALLTYPE *GetStorageFileName )( + ISpObjectToken * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszValueName, + /* [in] */ const WCHAR *pszFileNameSpecifier, + /* [in] */ ULONG nFolder, + /* [out] */ WCHAR **ppszFilePath); + + HRESULT ( STDMETHODCALLTYPE *RemoveStorageFileName )( + ISpObjectToken * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszKeyName, + /* [in] */ BOOL fDeleteFile); + + HRESULT ( STDMETHODCALLTYPE *Remove )( + ISpObjectToken * This, + const CLSID *pclsidCaller); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpObjectToken * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpObjectToken * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject); + + HRESULT ( STDMETHODCALLTYPE *MatchesAttributes )( + ISpObjectToken * This, + /* [in] */ const WCHAR *pszAttributes, + /* [out] */ BOOL *pfMatches); + + END_INTERFACE + } ISpObjectTokenVtbl; + + interface ISpObjectToken + { + CONST_VTBL struct ISpObjectTokenVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectToken_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectToken_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectToken_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectToken_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpObjectToken_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpObjectToken_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpObjectToken_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpObjectToken_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpObjectToken_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpObjectToken_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpObjectToken_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpObjectToken_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpObjectToken_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpObjectToken_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpObjectToken_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + + +#define ISpObjectToken_SetId(This,pszCategoryId,pszTokenId,fCreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,pszCategoryId,pszTokenId,fCreateIfNotExist) + +#define ISpObjectToken_GetId(This,ppszCoMemTokenId) \ + (This)->lpVtbl -> GetId(This,ppszCoMemTokenId) + +#define ISpObjectToken_GetCategory(This,ppTokenCategory) \ + (This)->lpVtbl -> GetCategory(This,ppTokenCategory) + +#define ISpObjectToken_CreateInstance(This,pUnkOuter,dwClsContext,riid,ppvObject) \ + (This)->lpVtbl -> CreateInstance(This,pUnkOuter,dwClsContext,riid,ppvObject) + +#define ISpObjectToken_GetStorageFileName(This,clsidCaller,pszValueName,pszFileNameSpecifier,nFolder,ppszFilePath) \ + (This)->lpVtbl -> GetStorageFileName(This,clsidCaller,pszValueName,pszFileNameSpecifier,nFolder,ppszFilePath) + +#define ISpObjectToken_RemoveStorageFileName(This,clsidCaller,pszKeyName,fDeleteFile) \ + (This)->lpVtbl -> RemoveStorageFileName(This,clsidCaller,pszKeyName,fDeleteFile) + +#define ISpObjectToken_Remove(This,pclsidCaller) \ + (This)->lpVtbl -> Remove(This,pclsidCaller) + +#define ISpObjectToken_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) + +#define ISpObjectToken_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,punkObject) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,punkObject) + +#define ISpObjectToken_MatchesAttributes(This,pszAttributes,pfMatches) \ + (This)->lpVtbl -> MatchesAttributes(This,pszAttributes,pfMatches) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_SetId_Proxy( + ISpObjectToken * This, + const WCHAR *pszCategoryId, + const WCHAR *pszTokenId, + BOOL fCreateIfNotExist); + + +void __RPC_STUB ISpObjectToken_SetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_GetId_Proxy( + ISpObjectToken * This, + WCHAR **ppszCoMemTokenId); + + +void __RPC_STUB ISpObjectToken_GetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_GetCategory_Proxy( + ISpObjectToken * This, + ISpObjectTokenCategory **ppTokenCategory); + + +void __RPC_STUB ISpObjectToken_GetCategory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_CreateInstance_Proxy( + ISpObjectToken * This, + /* [in] */ IUnknown *pUnkOuter, + /* [in] */ DWORD dwClsContext, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + +void __RPC_STUB ISpObjectToken_CreateInstance_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_GetStorageFileName_Proxy( + ISpObjectToken * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszValueName, + /* [in] */ const WCHAR *pszFileNameSpecifier, + /* [in] */ ULONG nFolder, + /* [out] */ WCHAR **ppszFilePath); + + +void __RPC_STUB ISpObjectToken_GetStorageFileName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_RemoveStorageFileName_Proxy( + ISpObjectToken * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszKeyName, + /* [in] */ BOOL fDeleteFile); + + +void __RPC_STUB ISpObjectToken_RemoveStorageFileName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_Remove_Proxy( + ISpObjectToken * This, + const CLSID *pclsidCaller); + + +void __RPC_STUB ISpObjectToken_Remove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpObjectToken_IsUISupported_Proxy( + ISpObjectToken * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + +void __RPC_STUB ISpObjectToken_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpObjectToken_DisplayUI_Proxy( + ISpObjectToken * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject); + + +void __RPC_STUB ISpObjectToken_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectToken_MatchesAttributes_Proxy( + ISpObjectToken * This, + /* [in] */ const WCHAR *pszAttributes, + /* [out] */ BOOL *pfMatches); + + +void __RPC_STUB ISpObjectToken_MatchesAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectToken_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectTokenInit_INTERFACE_DEFINED__ +#define __ISpObjectTokenInit_INTERFACE_DEFINED__ + +/* interface ISpObjectTokenInit */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectTokenInit; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B8AAB0CF-346F-49D8-9499-C8B03F161D51") + ISpObjectTokenInit : public ISpObjectToken + { + public: + virtual HRESULT STDMETHODCALLTYPE InitFromDataKey( + /* [in] */ const WCHAR *pszCategoryId, + /* [in] */ const WCHAR *pszTokenId, + /* [in] */ ISpDataKey *pDataKey) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectTokenInitVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectTokenInit * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectTokenInit * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectTokenInit * This); + + HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + ULONG cbData, + const BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + ULONG *pcbData, + BYTE *pData); + + HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + const WCHAR *pszValue); + + HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + WCHAR **ppszValue); + + HRESULT ( STDMETHODCALLTYPE *SetDWORD )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + DWORD dwValue); + + HRESULT ( STDMETHODCALLTYPE *GetDWORD )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName, + DWORD *pdwValue); + + HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpObjectTokenInit * This, + const WCHAR *pszSubKeyName, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpObjectTokenInit * This, + const WCHAR *pszSubKey, + ISpDataKey **ppSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpObjectTokenInit * This, + const WCHAR *pszSubKey); + + HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpObjectTokenInit * This, + const WCHAR *pszValueName); + + HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpObjectTokenInit * This, + ULONG Index, + WCHAR **ppszSubKeyName); + + HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpObjectTokenInit * This, + ULONG Index, + WCHAR **ppszValueName); + + HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpObjectTokenInit * This, + const WCHAR *pszCategoryId, + const WCHAR *pszTokenId, + BOOL fCreateIfNotExist); + + HRESULT ( STDMETHODCALLTYPE *GetId )( + ISpObjectTokenInit * This, + WCHAR **ppszCoMemTokenId); + + HRESULT ( STDMETHODCALLTYPE *GetCategory )( + ISpObjectTokenInit * This, + ISpObjectTokenCategory **ppTokenCategory); + + HRESULT ( STDMETHODCALLTYPE *CreateInstance )( + ISpObjectTokenInit * This, + /* [in] */ IUnknown *pUnkOuter, + /* [in] */ DWORD dwClsContext, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + HRESULT ( STDMETHODCALLTYPE *GetStorageFileName )( + ISpObjectTokenInit * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszValueName, + /* [in] */ const WCHAR *pszFileNameSpecifier, + /* [in] */ ULONG nFolder, + /* [out] */ WCHAR **ppszFilePath); + + HRESULT ( STDMETHODCALLTYPE *RemoveStorageFileName )( + ISpObjectTokenInit * This, + /* [in] */ REFCLSID clsidCaller, + /* [in] */ const WCHAR *pszKeyName, + /* [in] */ BOOL fDeleteFile); + + HRESULT ( STDMETHODCALLTYPE *Remove )( + ISpObjectTokenInit * This, + const CLSID *pclsidCaller); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpObjectTokenInit * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpObjectTokenInit * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject); + + HRESULT ( STDMETHODCALLTYPE *MatchesAttributes )( + ISpObjectTokenInit * This, + /* [in] */ const WCHAR *pszAttributes, + /* [out] */ BOOL *pfMatches); + + HRESULT ( STDMETHODCALLTYPE *InitFromDataKey )( + ISpObjectTokenInit * This, + /* [in] */ const WCHAR *pszCategoryId, + /* [in] */ const WCHAR *pszTokenId, + /* [in] */ ISpDataKey *pDataKey); + + END_INTERFACE + } ISpObjectTokenInitVtbl; + + interface ISpObjectTokenInit + { + CONST_VTBL struct ISpObjectTokenInitVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectTokenInit_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectTokenInit_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectTokenInit_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectTokenInit_SetData(This,pszValueName,cbData,pData) \ + (This)->lpVtbl -> SetData(This,pszValueName,cbData,pData) + +#define ISpObjectTokenInit_GetData(This,pszValueName,pcbData,pData) \ + (This)->lpVtbl -> GetData(This,pszValueName,pcbData,pData) + +#define ISpObjectTokenInit_SetStringValue(This,pszValueName,pszValue) \ + (This)->lpVtbl -> SetStringValue(This,pszValueName,pszValue) + +#define ISpObjectTokenInit_GetStringValue(This,pszValueName,ppszValue) \ + (This)->lpVtbl -> GetStringValue(This,pszValueName,ppszValue) + +#define ISpObjectTokenInit_SetDWORD(This,pszValueName,dwValue) \ + (This)->lpVtbl -> SetDWORD(This,pszValueName,dwValue) + +#define ISpObjectTokenInit_GetDWORD(This,pszValueName,pdwValue) \ + (This)->lpVtbl -> GetDWORD(This,pszValueName,pdwValue) + +#define ISpObjectTokenInit_OpenKey(This,pszSubKeyName,ppSubKey) \ + (This)->lpVtbl -> OpenKey(This,pszSubKeyName,ppSubKey) + +#define ISpObjectTokenInit_CreateKey(This,pszSubKey,ppSubKey) \ + (This)->lpVtbl -> CreateKey(This,pszSubKey,ppSubKey) + +#define ISpObjectTokenInit_DeleteKey(This,pszSubKey) \ + (This)->lpVtbl -> DeleteKey(This,pszSubKey) + +#define ISpObjectTokenInit_DeleteValue(This,pszValueName) \ + (This)->lpVtbl -> DeleteValue(This,pszValueName) + +#define ISpObjectTokenInit_EnumKeys(This,Index,ppszSubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,ppszSubKeyName) + +#define ISpObjectTokenInit_EnumValues(This,Index,ppszValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ppszValueName) + + +#define ISpObjectTokenInit_SetId(This,pszCategoryId,pszTokenId,fCreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,pszCategoryId,pszTokenId,fCreateIfNotExist) + +#define ISpObjectTokenInit_GetId(This,ppszCoMemTokenId) \ + (This)->lpVtbl -> GetId(This,ppszCoMemTokenId) + +#define ISpObjectTokenInit_GetCategory(This,ppTokenCategory) \ + (This)->lpVtbl -> GetCategory(This,ppTokenCategory) + +#define ISpObjectTokenInit_CreateInstance(This,pUnkOuter,dwClsContext,riid,ppvObject) \ + (This)->lpVtbl -> CreateInstance(This,pUnkOuter,dwClsContext,riid,ppvObject) + +#define ISpObjectTokenInit_GetStorageFileName(This,clsidCaller,pszValueName,pszFileNameSpecifier,nFolder,ppszFilePath) \ + (This)->lpVtbl -> GetStorageFileName(This,clsidCaller,pszValueName,pszFileNameSpecifier,nFolder,ppszFilePath) + +#define ISpObjectTokenInit_RemoveStorageFileName(This,clsidCaller,pszKeyName,fDeleteFile) \ + (This)->lpVtbl -> RemoveStorageFileName(This,clsidCaller,pszKeyName,fDeleteFile) + +#define ISpObjectTokenInit_Remove(This,pclsidCaller) \ + (This)->lpVtbl -> Remove(This,pclsidCaller) + +#define ISpObjectTokenInit_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) + +#define ISpObjectTokenInit_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,punkObject) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,punkObject) + +#define ISpObjectTokenInit_MatchesAttributes(This,pszAttributes,pfMatches) \ + (This)->lpVtbl -> MatchesAttributes(This,pszAttributes,pfMatches) + + +#define ISpObjectTokenInit_InitFromDataKey(This,pszCategoryId,pszTokenId,pDataKey) \ + (This)->lpVtbl -> InitFromDataKey(This,pszCategoryId,pszTokenId,pDataKey) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenInit_InitFromDataKey_Proxy( + ISpObjectTokenInit * This, + /* [in] */ const WCHAR *pszCategoryId, + /* [in] */ const WCHAR *pszTokenId, + /* [in] */ ISpDataKey *pDataKey); + + +void __RPC_STUB ISpObjectTokenInit_InitFromDataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectTokenInit_INTERFACE_DEFINED__ */ + + +#ifndef __IEnumSpObjectTokens_INTERFACE_DEFINED__ +#define __IEnumSpObjectTokens_INTERFACE_DEFINED__ + +/* interface IEnumSpObjectTokens */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IEnumSpObjectTokens; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("06B64F9E-7FDA-11D2-B4F2-00C04F797396") + IEnumSpObjectTokens : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ ISpObjectToken **pelt, + /* [out] */ ULONG *pceltFetched) = 0; + + virtual HRESULT STDMETHODCALLTYPE Skip( + /* [in] */ ULONG celt) = 0; + + virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Clone( + /* [out] */ IEnumSpObjectTokens **ppEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE Item( + /* [in] */ ULONG Index, + /* [out] */ ISpObjectToken **ppToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCount( + /* [out] */ ULONG *pCount) = 0; + + }; + +#else /* C style interface */ + + typedef struct IEnumSpObjectTokensVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IEnumSpObjectTokens * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IEnumSpObjectTokens * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IEnumSpObjectTokens * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IEnumSpObjectTokens * This, + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ ISpObjectToken **pelt, + /* [out] */ ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + IEnumSpObjectTokens * This, + /* [in] */ ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + IEnumSpObjectTokens * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + IEnumSpObjectTokens * This, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + HRESULT ( STDMETHODCALLTYPE *Item )( + IEnumSpObjectTokens * This, + /* [in] */ ULONG Index, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *GetCount )( + IEnumSpObjectTokens * This, + /* [out] */ ULONG *pCount); + + END_INTERFACE + } IEnumSpObjectTokensVtbl; + + interface IEnumSpObjectTokens + { + CONST_VTBL struct IEnumSpObjectTokensVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IEnumSpObjectTokens_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define IEnumSpObjectTokens_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define IEnumSpObjectTokens_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define IEnumSpObjectTokens_Next(This,celt,pelt,pceltFetched) \ + (This)->lpVtbl -> Next(This,celt,pelt,pceltFetched) + +#define IEnumSpObjectTokens_Skip(This,celt) \ + (This)->lpVtbl -> Skip(This,celt) + +#define IEnumSpObjectTokens_Reset(This) \ + (This)->lpVtbl -> Reset(This) + +#define IEnumSpObjectTokens_Clone(This,ppEnum) \ + (This)->lpVtbl -> Clone(This,ppEnum) + +#define IEnumSpObjectTokens_Item(This,Index,ppToken) \ + (This)->lpVtbl -> Item(This,Index,ppToken) + +#define IEnumSpObjectTokens_GetCount(This,pCount) \ + (This)->lpVtbl -> GetCount(This,pCount) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Next_Proxy( + IEnumSpObjectTokens * This, + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ ISpObjectToken **pelt, + /* [out] */ ULONG *pceltFetched); + + +void __RPC_STUB IEnumSpObjectTokens_Next_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Skip_Proxy( + IEnumSpObjectTokens * This, + /* [in] */ ULONG celt); + + +void __RPC_STUB IEnumSpObjectTokens_Skip_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Reset_Proxy( + IEnumSpObjectTokens * This); + + +void __RPC_STUB IEnumSpObjectTokens_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Clone_Proxy( + IEnumSpObjectTokens * This, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + +void __RPC_STUB IEnumSpObjectTokens_Clone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_Item_Proxy( + IEnumSpObjectTokens * This, + /* [in] */ ULONG Index, + /* [out] */ ISpObjectToken **ppToken); + + +void __RPC_STUB IEnumSpObjectTokens_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE IEnumSpObjectTokens_GetCount_Proxy( + IEnumSpObjectTokens * This, + /* [out] */ ULONG *pCount); + + +void __RPC_STUB IEnumSpObjectTokens_GetCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __IEnumSpObjectTokens_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectWithToken_INTERFACE_DEFINED__ +#define __ISpObjectWithToken_INTERFACE_DEFINED__ + +/* interface ISpObjectWithToken */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectWithToken; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5B559F40-E952-11D2-BB91-00C04F8EE6C0") + ISpObjectWithToken : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetObjectToken( + ISpObjectToken *pToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetObjectToken( + ISpObjectToken **ppToken) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectWithTokenVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectWithToken * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectWithToken * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectWithToken * This); + + HRESULT ( STDMETHODCALLTYPE *SetObjectToken )( + ISpObjectWithToken * This, + ISpObjectToken *pToken); + + HRESULT ( STDMETHODCALLTYPE *GetObjectToken )( + ISpObjectWithToken * This, + ISpObjectToken **ppToken); + + END_INTERFACE + } ISpObjectWithTokenVtbl; + + interface ISpObjectWithToken + { + CONST_VTBL struct ISpObjectWithTokenVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectWithToken_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectWithToken_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectWithToken_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectWithToken_SetObjectToken(This,pToken) \ + (This)->lpVtbl -> SetObjectToken(This,pToken) + +#define ISpObjectWithToken_GetObjectToken(This,ppToken) \ + (This)->lpVtbl -> GetObjectToken(This,ppToken) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectWithToken_SetObjectToken_Proxy( + ISpObjectWithToken * This, + ISpObjectToken *pToken); + + +void __RPC_STUB ISpObjectWithToken_SetObjectToken_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectWithToken_GetObjectToken_Proxy( + ISpObjectWithToken * This, + ISpObjectToken **ppToken); + + +void __RPC_STUB ISpObjectWithToken_GetObjectToken_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectWithToken_INTERFACE_DEFINED__ */ + + +#ifndef __ISpResourceManager_INTERFACE_DEFINED__ +#define __ISpResourceManager_INTERFACE_DEFINED__ + +/* interface ISpResourceManager */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpResourceManager; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("93384E18-5014-43D5-ADBB-A78E055926BD") + ISpResourceManager : public IServiceProvider + { + public: + virtual HRESULT STDMETHODCALLTYPE SetObject( + /* [in] */ REFGUID guidServiceId, + /* [in] */ IUnknown *pUnkObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetObject( + /* [in] */ REFGUID guidServiceId, + /* [in] */ REFCLSID ObjectCLSID, + /* [in] */ REFIID ObjectIID, + /* [in] */ BOOL fReleaseWhenLastExternalRefReleased, + /* [iid_is][out] */ void **ppObject) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpResourceManagerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpResourceManager * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpResourceManager * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpResourceManager * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *QueryService )( + ISpResourceManager * This, + /* [in] */ REFGUID guidService, + /* [in] */ REFIID riid, + /* [out] */ void **ppvObject); + + HRESULT ( STDMETHODCALLTYPE *SetObject )( + ISpResourceManager * This, + /* [in] */ REFGUID guidServiceId, + /* [in] */ IUnknown *pUnkObject); + + HRESULT ( STDMETHODCALLTYPE *GetObject )( + ISpResourceManager * This, + /* [in] */ REFGUID guidServiceId, + /* [in] */ REFCLSID ObjectCLSID, + /* [in] */ REFIID ObjectIID, + /* [in] */ BOOL fReleaseWhenLastExternalRefReleased, + /* [iid_is][out] */ void **ppObject); + + END_INTERFACE + } ISpResourceManagerVtbl; + + interface ISpResourceManager + { + CONST_VTBL struct ISpResourceManagerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpResourceManager_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpResourceManager_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpResourceManager_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpResourceManager_QueryService(This,guidService,riid,ppvObject) \ + (This)->lpVtbl -> QueryService(This,guidService,riid,ppvObject) + + +#define ISpResourceManager_SetObject(This,guidServiceId,pUnkObject) \ + (This)->lpVtbl -> SetObject(This,guidServiceId,pUnkObject) + +#define ISpResourceManager_GetObject(This,guidServiceId,ObjectCLSID,ObjectIID,fReleaseWhenLastExternalRefReleased,ppObject) \ + (This)->lpVtbl -> GetObject(This,guidServiceId,ObjectCLSID,ObjectIID,fReleaseWhenLastExternalRefReleased,ppObject) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpResourceManager_SetObject_Proxy( + ISpResourceManager * This, + /* [in] */ REFGUID guidServiceId, + /* [in] */ IUnknown *pUnkObject); + + +void __RPC_STUB ISpResourceManager_SetObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpResourceManager_GetObject_Proxy( + ISpResourceManager * This, + /* [in] */ REFGUID guidServiceId, + /* [in] */ REFCLSID ObjectCLSID, + /* [in] */ REFIID ObjectIID, + /* [in] */ BOOL fReleaseWhenLastExternalRefReleased, + /* [iid_is][out] */ void **ppObject); + + +void __RPC_STUB ISpResourceManager_GetObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpResourceManager_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0262 */ +/* [local] */ + +typedef /* [hidden] */ +enum SPEVENTLPARAMTYPE + { SPET_LPARAM_IS_UNDEFINED = 0, + SPET_LPARAM_IS_TOKEN = SPET_LPARAM_IS_UNDEFINED + 1, + SPET_LPARAM_IS_OBJECT = SPET_LPARAM_IS_TOKEN + 1, + SPET_LPARAM_IS_POINTER = SPET_LPARAM_IS_OBJECT + 1, + SPET_LPARAM_IS_STRING = SPET_LPARAM_IS_POINTER + 1 + } SPEVENTLPARAMTYPE; + +typedef /* [hidden] */ +enum SPEVENTENUM + { SPEI_UNDEFINED = 0, + SPEI_START_INPUT_STREAM = 1, + SPEI_END_INPUT_STREAM = 2, + SPEI_VOICE_CHANGE = 3, + SPEI_TTS_BOOKMARK = 4, + SPEI_WORD_BOUNDARY = 5, + SPEI_PHONEME = 6, + SPEI_SENTENCE_BOUNDARY = 7, + SPEI_VISEME = 8, + SPEI_TTS_AUDIO_LEVEL = 9, + SPEI_TTS_PRIVATE = 15, + SPEI_MIN_TTS = 1, + SPEI_MAX_TTS = 15, + SPEI_END_SR_STREAM = 34, + SPEI_SOUND_START = 35, + SPEI_SOUND_END = 36, + SPEI_PHRASE_START = 37, + SPEI_RECOGNITION = 38, + SPEI_HYPOTHESIS = 39, + SPEI_SR_BOOKMARK = 40, + SPEI_PROPERTY_NUM_CHANGE = 41, + SPEI_PROPERTY_STRING_CHANGE = 42, + SPEI_FALSE_RECOGNITION = 43, + SPEI_INTERFERENCE = 44, + SPEI_REQUEST_UI = 45, + SPEI_RECO_STATE_CHANGE = 46, + SPEI_ADAPTATION = 47, + SPEI_START_SR_STREAM = 48, + SPEI_RECO_OTHER_CONTEXT = 49, + SPEI_SR_AUDIO_LEVEL = 50, + SPEI_SR_PRIVATE = 52, + SPEI_MIN_SR = 34, + SPEI_MAX_SR = 52, + SPEI_RESERVED1 = 30, + SPEI_RESERVED2 = 33, + SPEI_RESERVED3 = 63 + } SPEVENTENUM; + +#define SPFEI_FLAGCHECK ( (1ui64 << SPEI_RESERVED1) | (1ui64 << SPEI_RESERVED2) ) +#define SPFEI_ALL_TTS_EVENTS (0x000000000000FFFEui64 | SPFEI_FLAGCHECK) +#define SPFEI_ALL_SR_EVENTS (0x001FFFFC00000000ui64 | SPFEI_FLAGCHECK) +#define SPFEI_ALL_EVENTS 0xEFFFFFFFFFFFFFFFui64 +#define SPFEI(SPEI_ord) ((1ui64 << SPEI_ord) | SPFEI_FLAGCHECK) +#if 0 +typedef /* [hidden][restricted] */ struct SPEVENT + { + WORD eEventId; + WORD elParamType; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + WPARAM wParam; + LPARAM lParam; + } SPEVENT; + +typedef /* [hidden][restricted] */ struct SPSERIALIZEDEVENT + { + WORD eEventId; + WORD elParamType; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + ULONG SerializedwParam; + LONG SerializedlParam; + } SPSERIALIZEDEVENT; + +typedef /* [hidden][restricted] */ struct SPSERIALIZEDEVENT64 + { + WORD eEventId; + WORD elParamType; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + ULONGLONG SerializedwParam; + LONGLONG SerializedlParam; + } SPSERIALIZEDEVENT64; + +#else +typedef struct SPEVENT +{ + SPEVENTENUM eEventId : 16; + SPEVENTLPARAMTYPE elParamType : 16; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + WPARAM wParam; + LPARAM lParam; +} SPEVENT; +typedef struct SPSERIALIZEDEVENT +{ + SPEVENTENUM eEventId : 16; + SPEVENTLPARAMTYPE elParamType : 16; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + ULONG SerializedwParam; + LONG SerializedlParam; +} SPSERIALIZEDEVENT; +typedef struct SPSERIALIZEDEVENT64 +{ + SPEVENTENUM eEventId : 16; + SPEVENTLPARAMTYPE elParamType : 16; + ULONG ulStreamNum; + ULONGLONG ullAudioStreamOffset; + ULONGLONG SerializedwParam; + LONGLONG SerializedlParam; +} SPSERIALIZEDEVENT64; +#endif +typedef /* [hidden] */ +enum SPINTERFERENCE + { SPINTERFERENCE_NONE = 0, + SPINTERFERENCE_NOISE = SPINTERFERENCE_NONE + 1, + SPINTERFERENCE_NOSIGNAL = SPINTERFERENCE_NOISE + 1, + SPINTERFERENCE_TOOLOUD = SPINTERFERENCE_NOSIGNAL + 1, + SPINTERFERENCE_TOOQUIET = SPINTERFERENCE_TOOLOUD + 1, + SPINTERFERENCE_TOOFAST = SPINTERFERENCE_TOOQUIET + 1, + SPINTERFERENCE_TOOSLOW = SPINTERFERENCE_TOOFAST + 1 + } SPINTERFERENCE; + +typedef /* [hidden] */ +enum SPENDSRSTREAMFLAGS + { SPESF_NONE = 0, + SPESF_STREAM_RELEASED = 1 << 0 + } SPENDSRSTREAMFLAGS; + +typedef /* [hidden] */ +enum SPVFEATURE + { SPVFEATURE_STRESSED = 1L << 0, + SPVFEATURE_EMPHASIS = 1L << 1 + } SPVFEATURE; + +typedef /* [hidden] */ +enum SPVISEMES + { SP_VISEME_0 = 0, + SP_VISEME_1 = SP_VISEME_0 + 1, + SP_VISEME_2 = SP_VISEME_1 + 1, + SP_VISEME_3 = SP_VISEME_2 + 1, + SP_VISEME_4 = SP_VISEME_3 + 1, + SP_VISEME_5 = SP_VISEME_4 + 1, + SP_VISEME_6 = SP_VISEME_5 + 1, + SP_VISEME_7 = SP_VISEME_6 + 1, + SP_VISEME_8 = SP_VISEME_7 + 1, + SP_VISEME_9 = SP_VISEME_8 + 1, + SP_VISEME_10 = SP_VISEME_9 + 1, + SP_VISEME_11 = SP_VISEME_10 + 1, + SP_VISEME_12 = SP_VISEME_11 + 1, + SP_VISEME_13 = SP_VISEME_12 + 1, + SP_VISEME_14 = SP_VISEME_13 + 1, + SP_VISEME_15 = SP_VISEME_14 + 1, + SP_VISEME_16 = SP_VISEME_15 + 1, + SP_VISEME_17 = SP_VISEME_16 + 1, + SP_VISEME_18 = SP_VISEME_17 + 1, + SP_VISEME_19 = SP_VISEME_18 + 1, + SP_VISEME_20 = SP_VISEME_19 + 1, + SP_VISEME_21 = SP_VISEME_20 + 1 + } SPVISEMES; + +typedef /* [hidden][restricted] */ struct SPEVENTSOURCEINFO + { + ULONGLONG ullEventInterest; + ULONGLONG ullQueuedInterest; + ULONG ulCount; + } SPEVENTSOURCEINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0262_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0262_v0_0_s_ifspec; + +#ifndef __ISpEventSource_INTERFACE_DEFINED__ +#define __ISpEventSource_INTERFACE_DEFINED__ + +/* interface ISpEventSource */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpEventSource; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BE7A9CCE-5F9E-11D2-960F-00C04F8EE628") + ISpEventSource : public ISpNotifySource + { + public: + virtual HRESULT STDMETHODCALLTYPE SetInterest( + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetEvents( + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInfo( + /* [out] */ SPEVENTSOURCEINFO *pInfo) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpEventSourceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpEventSource * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpEventSource * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpEventSource * This); + + HRESULT ( STDMETHODCALLTYPE *SetNotifySink )( + ISpEventSource * This, + /* [in] */ ISpNotifySink *pNotifySink); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWindowMessage )( + ISpEventSource * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackFunction )( + ISpEventSource * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackInterface )( + ISpEventSource * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWin32Event )( + ISpEventSource * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForNotifyEvent )( + ISpEventSource * This, + /* [in] */ DWORD dwMilliseconds); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *GetNotifyEventHandle )( + ISpEventSource * This); + + HRESULT ( STDMETHODCALLTYPE *SetInterest )( + ISpEventSource * This, + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest); + + HRESULT ( STDMETHODCALLTYPE *GetEvents )( + ISpEventSource * This, + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched); + + HRESULT ( STDMETHODCALLTYPE *GetInfo )( + ISpEventSource * This, + /* [out] */ SPEVENTSOURCEINFO *pInfo); + + END_INTERFACE + } ISpEventSourceVtbl; + + interface ISpEventSource + { + CONST_VTBL struct ISpEventSourceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpEventSource_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpEventSource_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpEventSource_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpEventSource_SetNotifySink(This,pNotifySink) \ + (This)->lpVtbl -> SetNotifySink(This,pNotifySink) + +#define ISpEventSource_SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpEventSource_SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) + +#define ISpEventSource_SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) + +#define ISpEventSource_SetNotifyWin32Event(This) \ + (This)->lpVtbl -> SetNotifyWin32Event(This) + +#define ISpEventSource_WaitForNotifyEvent(This,dwMilliseconds) \ + (This)->lpVtbl -> WaitForNotifyEvent(This,dwMilliseconds) + +#define ISpEventSource_GetNotifyEventHandle(This) \ + (This)->lpVtbl -> GetNotifyEventHandle(This) + + +#define ISpEventSource_SetInterest(This,ullEventInterest,ullQueuedInterest) \ + (This)->lpVtbl -> SetInterest(This,ullEventInterest,ullQueuedInterest) + +#define ISpEventSource_GetEvents(This,ulCount,pEventArray,pulFetched) \ + (This)->lpVtbl -> GetEvents(This,ulCount,pEventArray,pulFetched) + +#define ISpEventSource_GetInfo(This,pInfo) \ + (This)->lpVtbl -> GetInfo(This,pInfo) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpEventSource_SetInterest_Proxy( + ISpEventSource * This, + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest); + + +void __RPC_STUB ISpEventSource_SetInterest_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpEventSource_GetEvents_Proxy( + ISpEventSource * This, + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched); + + +void __RPC_STUB ISpEventSource_GetEvents_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpEventSource_GetInfo_Proxy( + ISpEventSource * This, + /* [out] */ SPEVENTSOURCEINFO *pInfo); + + +void __RPC_STUB ISpEventSource_GetInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpEventSource_INTERFACE_DEFINED__ */ + + +#ifndef __ISpEventSink_INTERFACE_DEFINED__ +#define __ISpEventSink_INTERFACE_DEFINED__ + +/* interface ISpEventSink */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpEventSink; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BE7A9CC9-5F9E-11D2-960F-00C04F8EE628") + ISpEventSink : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AddEvents( + /* [in] */ const SPEVENT *pEventArray, + /* [in] */ ULONG ulCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetEventInterest( + /* [out] */ ULONGLONG *pullEventInterest) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpEventSinkVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpEventSink * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpEventSink * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpEventSink * This); + + HRESULT ( STDMETHODCALLTYPE *AddEvents )( + ISpEventSink * This, + /* [in] */ const SPEVENT *pEventArray, + /* [in] */ ULONG ulCount); + + HRESULT ( STDMETHODCALLTYPE *GetEventInterest )( + ISpEventSink * This, + /* [out] */ ULONGLONG *pullEventInterest); + + END_INTERFACE + } ISpEventSinkVtbl; + + interface ISpEventSink + { + CONST_VTBL struct ISpEventSinkVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpEventSink_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpEventSink_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpEventSink_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpEventSink_AddEvents(This,pEventArray,ulCount) \ + (This)->lpVtbl -> AddEvents(This,pEventArray,ulCount) + +#define ISpEventSink_GetEventInterest(This,pullEventInterest) \ + (This)->lpVtbl -> GetEventInterest(This,pullEventInterest) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpEventSink_AddEvents_Proxy( + ISpEventSink * This, + /* [in] */ const SPEVENT *pEventArray, + /* [in] */ ULONG ulCount); + + +void __RPC_STUB ISpEventSink_AddEvents_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpEventSink_GetEventInterest_Proxy( + ISpEventSink * This, + /* [out] */ ULONGLONG *pullEventInterest); + + +void __RPC_STUB ISpEventSink_GetEventInterest_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpEventSink_INTERFACE_DEFINED__ */ + + +#ifndef __ISpStreamFormat_INTERFACE_DEFINED__ +#define __ISpStreamFormat_INTERFACE_DEFINED__ + +/* interface ISpStreamFormat */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpStreamFormat; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BED530BE-2606-4F4D-A1C0-54C5CDA5566F") + ISpStreamFormat : public IStream + { + public: + virtual HRESULT STDMETHODCALLTYPE GetFormat( + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpStreamFormatVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpStreamFormat * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpStreamFormat * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpStreamFormat * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpStreamFormat * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpStreamFormat * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpStreamFormat * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpStreamFormat * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpStreamFormat * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpStreamFormat * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpStreamFormat * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpStreamFormat * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpStreamFormat * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpStreamFormat * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpStreamFormat * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpStreamFormat * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + END_INTERFACE + } ISpStreamFormatVtbl; + + interface ISpStreamFormat + { + CONST_VTBL struct ISpStreamFormatVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpStreamFormat_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpStreamFormat_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpStreamFormat_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpStreamFormat_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpStreamFormat_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpStreamFormat_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpStreamFormat_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpStreamFormat_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpStreamFormat_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpStreamFormat_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpStreamFormat_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpStreamFormat_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpStreamFormat_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpStreamFormat_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpStreamFormat_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpStreamFormat_GetFormat_Proxy( + ISpStreamFormat * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + +void __RPC_STUB ISpStreamFormat_GetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpStreamFormat_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0265 */ +/* [local] */ + +typedef /* [hidden] */ +enum SPFILEMODE + { SPFM_OPEN_READONLY = 0, + SPFM_OPEN_READWRITE = SPFM_OPEN_READONLY + 1, + SPFM_CREATE = SPFM_OPEN_READWRITE + 1, + SPFM_CREATE_ALWAYS = SPFM_CREATE + 1, + SPFM_NUM_MODES = SPFM_CREATE_ALWAYS + 1 + } SPFILEMODE; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0265_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0265_v0_0_s_ifspec; + +#ifndef __ISpStream_INTERFACE_DEFINED__ +#define __ISpStream_INTERFACE_DEFINED__ + +/* interface ISpStream */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("12E3CCA9-7518-44C5-A5E7-BA5A79CB929E") + ISpStream : public ISpStreamFormat + { + public: + virtual HRESULT STDMETHODCALLTYPE SetBaseStream( + IStream *pStream, + REFGUID rguidFormat, + const WAVEFORMATEX *pWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBaseStream( + IStream **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE BindToFile( + const WCHAR *pszFileName, + SPFILEMODE eMode, + const GUID *pFormatId, + const WAVEFORMATEX *pWaveFormatEx, + ULONGLONG ullEventInterest) = 0; + + virtual HRESULT STDMETHODCALLTYPE Close( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpStream * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpStream * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpStream * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpStream * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpStream * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpStream * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpStream * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpStream * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpStream * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpStream * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpStream * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpStream * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpStream * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *SetBaseStream )( + ISpStream * This, + IStream *pStream, + REFGUID rguidFormat, + const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetBaseStream )( + ISpStream * This, + IStream **ppStream); + + HRESULT ( STDMETHODCALLTYPE *BindToFile )( + ISpStream * This, + const WCHAR *pszFileName, + SPFILEMODE eMode, + const GUID *pFormatId, + const WAVEFORMATEX *pWaveFormatEx, + ULONGLONG ullEventInterest); + + HRESULT ( STDMETHODCALLTYPE *Close )( + ISpStream * This); + + END_INTERFACE + } ISpStreamVtbl; + + interface ISpStream + { + CONST_VTBL struct ISpStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpStream_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpStream_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpStream_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpStream_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpStream_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpStream_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpStream_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpStream_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpStream_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpStream_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpStream_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpStream_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + + +#define ISpStream_SetBaseStream(This,pStream,rguidFormat,pWaveFormatEx) \ + (This)->lpVtbl -> SetBaseStream(This,pStream,rguidFormat,pWaveFormatEx) + +#define ISpStream_GetBaseStream(This,ppStream) \ + (This)->lpVtbl -> GetBaseStream(This,ppStream) + +#define ISpStream_BindToFile(This,pszFileName,eMode,pFormatId,pWaveFormatEx,ullEventInterest) \ + (This)->lpVtbl -> BindToFile(This,pszFileName,eMode,pFormatId,pWaveFormatEx,ullEventInterest) + +#define ISpStream_Close(This) \ + (This)->lpVtbl -> Close(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpStream_SetBaseStream_Proxy( + ISpStream * This, + IStream *pStream, + REFGUID rguidFormat, + const WAVEFORMATEX *pWaveFormatEx); + + +void __RPC_STUB ISpStream_SetBaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStream_GetBaseStream_Proxy( + ISpStream * This, + IStream **ppStream); + + +void __RPC_STUB ISpStream_GetBaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStream_BindToFile_Proxy( + ISpStream * This, + const WCHAR *pszFileName, + SPFILEMODE eMode, + const GUID *pFormatId, + const WAVEFORMATEX *pWaveFormatEx, + ULONGLONG ullEventInterest); + + +void __RPC_STUB ISpStream_BindToFile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStream_Close_Proxy( + ISpStream * This); + + +void __RPC_STUB ISpStream_Close_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpStreamFormatConverter_INTERFACE_DEFINED__ +#define __ISpStreamFormatConverter_INTERFACE_DEFINED__ + +/* interface ISpStreamFormatConverter */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpStreamFormatConverter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("678A932C-EA71-4446-9B41-78FDA6280A29") + ISpStreamFormatConverter : public ISpStreamFormat + { + public: + virtual HRESULT STDMETHODCALLTYPE SetBaseStream( + /* [in] */ ISpStreamFormat *pStream, + /* [in] */ BOOL fSetFormatToBaseStreamFormat, + /* [in] */ BOOL fWriteToBaseStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBaseStream( + /* [out] */ ISpStreamFormat **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFormat( + /* [in] */ REFGUID rguidFormatIdOfConvertedStream, + /* [in] */ const WAVEFORMATEX *pWaveFormatExOfConvertedStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE ResetSeekPosition( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScaleConvertedToBaseOffset( + /* [in] */ ULONGLONG ullOffsetConvertedStream, + /* [out] */ ULONGLONG *pullOffsetBaseStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScaleBaseToConvertedOffset( + /* [in] */ ULONGLONG ullOffsetBaseStream, + /* [out] */ ULONGLONG *pullOffsetConvertedStream) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpStreamFormatConverterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpStreamFormatConverter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpStreamFormatConverter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpStreamFormatConverter * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpStreamFormatConverter * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpStreamFormatConverter * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpStreamFormatConverter * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpStreamFormatConverter * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpStreamFormatConverter * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpStreamFormatConverter * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpStreamFormatConverter * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpStreamFormatConverter * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpStreamFormatConverter * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpStreamFormatConverter * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpStreamFormatConverter * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpStreamFormatConverter * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *SetBaseStream )( + ISpStreamFormatConverter * This, + /* [in] */ ISpStreamFormat *pStream, + /* [in] */ BOOL fSetFormatToBaseStreamFormat, + /* [in] */ BOOL fWriteToBaseStream); + + HRESULT ( STDMETHODCALLTYPE *GetBaseStream )( + ISpStreamFormatConverter * This, + /* [out] */ ISpStreamFormat **ppStream); + + HRESULT ( STDMETHODCALLTYPE *SetFormat )( + ISpStreamFormatConverter * This, + /* [in] */ REFGUID rguidFormatIdOfConvertedStream, + /* [in] */ const WAVEFORMATEX *pWaveFormatExOfConvertedStream); + + HRESULT ( STDMETHODCALLTYPE *ResetSeekPosition )( + ISpStreamFormatConverter * This); + + HRESULT ( STDMETHODCALLTYPE *ScaleConvertedToBaseOffset )( + ISpStreamFormatConverter * This, + /* [in] */ ULONGLONG ullOffsetConvertedStream, + /* [out] */ ULONGLONG *pullOffsetBaseStream); + + HRESULT ( STDMETHODCALLTYPE *ScaleBaseToConvertedOffset )( + ISpStreamFormatConverter * This, + /* [in] */ ULONGLONG ullOffsetBaseStream, + /* [out] */ ULONGLONG *pullOffsetConvertedStream); + + END_INTERFACE + } ISpStreamFormatConverterVtbl; + + interface ISpStreamFormatConverter + { + CONST_VTBL struct ISpStreamFormatConverterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpStreamFormatConverter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpStreamFormatConverter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpStreamFormatConverter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpStreamFormatConverter_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpStreamFormatConverter_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpStreamFormatConverter_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpStreamFormatConverter_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpStreamFormatConverter_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpStreamFormatConverter_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpStreamFormatConverter_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpStreamFormatConverter_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpStreamFormatConverter_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpStreamFormatConverter_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpStreamFormatConverter_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpStreamFormatConverter_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + + +#define ISpStreamFormatConverter_SetBaseStream(This,pStream,fSetFormatToBaseStreamFormat,fWriteToBaseStream) \ + (This)->lpVtbl -> SetBaseStream(This,pStream,fSetFormatToBaseStreamFormat,fWriteToBaseStream) + +#define ISpStreamFormatConverter_GetBaseStream(This,ppStream) \ + (This)->lpVtbl -> GetBaseStream(This,ppStream) + +#define ISpStreamFormatConverter_SetFormat(This,rguidFormatIdOfConvertedStream,pWaveFormatExOfConvertedStream) \ + (This)->lpVtbl -> SetFormat(This,rguidFormatIdOfConvertedStream,pWaveFormatExOfConvertedStream) + +#define ISpStreamFormatConverter_ResetSeekPosition(This) \ + (This)->lpVtbl -> ResetSeekPosition(This) + +#define ISpStreamFormatConverter_ScaleConvertedToBaseOffset(This,ullOffsetConvertedStream,pullOffsetBaseStream) \ + (This)->lpVtbl -> ScaleConvertedToBaseOffset(This,ullOffsetConvertedStream,pullOffsetBaseStream) + +#define ISpStreamFormatConverter_ScaleBaseToConvertedOffset(This,ullOffsetBaseStream,pullOffsetConvertedStream) \ + (This)->lpVtbl -> ScaleBaseToConvertedOffset(This,ullOffsetBaseStream,pullOffsetConvertedStream) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_SetBaseStream_Proxy( + ISpStreamFormatConverter * This, + /* [in] */ ISpStreamFormat *pStream, + /* [in] */ BOOL fSetFormatToBaseStreamFormat, + /* [in] */ BOOL fWriteToBaseStream); + + +void __RPC_STUB ISpStreamFormatConverter_SetBaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_GetBaseStream_Proxy( + ISpStreamFormatConverter * This, + /* [out] */ ISpStreamFormat **ppStream); + + +void __RPC_STUB ISpStreamFormatConverter_GetBaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_SetFormat_Proxy( + ISpStreamFormatConverter * This, + /* [in] */ REFGUID rguidFormatIdOfConvertedStream, + /* [in] */ const WAVEFORMATEX *pWaveFormatExOfConvertedStream); + + +void __RPC_STUB ISpStreamFormatConverter_SetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_ResetSeekPosition_Proxy( + ISpStreamFormatConverter * This); + + +void __RPC_STUB ISpStreamFormatConverter_ResetSeekPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_ScaleConvertedToBaseOffset_Proxy( + ISpStreamFormatConverter * This, + /* [in] */ ULONGLONG ullOffsetConvertedStream, + /* [out] */ ULONGLONG *pullOffsetBaseStream); + + +void __RPC_STUB ISpStreamFormatConverter_ScaleConvertedToBaseOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpStreamFormatConverter_ScaleBaseToConvertedOffset_Proxy( + ISpStreamFormatConverter * This, + /* [in] */ ULONGLONG ullOffsetBaseStream, + /* [out] */ ULONGLONG *pullOffsetConvertedStream); + + +void __RPC_STUB ISpStreamFormatConverter_ScaleBaseToConvertedOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpStreamFormatConverter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0267 */ +/* [local] */ + +typedef /* [hidden] */ +enum _SPAUDIOSTATE + { SPAS_CLOSED = 0, + SPAS_STOP = SPAS_CLOSED + 1, + SPAS_PAUSE = SPAS_STOP + 1, + SPAS_RUN = SPAS_PAUSE + 1 + } SPAUDIOSTATE; + +typedef /* [hidden][restricted] */ struct SPAUDIOSTATUS + { + long cbFreeBuffSpace; + ULONG cbNonBlockingIO; + SPAUDIOSTATE State; + ULONGLONG CurSeekPos; + ULONGLONG CurDevicePos; + DWORD dwReserved1; + DWORD dwReserved2; + } SPAUDIOSTATUS; + +typedef /* [hidden][restricted] */ struct SPAUDIOBUFFERINFO + { + ULONG ulMsMinNotification; + ULONG ulMsBufferSize; + ULONG ulMsEventBias; + } SPAUDIOBUFFERINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0267_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0267_v0_0_s_ifspec; + +#ifndef __ISpAudio_INTERFACE_DEFINED__ +#define __ISpAudio_INTERFACE_DEFINED__ + +/* interface ISpAudio */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpAudio; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C05C768F-FAE8-4EC2-8E07-338321C12452") + ISpAudio : public ISpStreamFormat + { + public: + virtual HRESULT STDMETHODCALLTYPE SetState( + /* [in] */ SPAUDIOSTATE NewState, + /* [in] */ ULONGLONG ullReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFormat( + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatus( + /* [out] */ SPAUDIOSTATUS *pStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBufferInfo( + /* [in] */ const SPAUDIOBUFFERINFO *pBuffInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferInfo( + /* [out] */ SPAUDIOBUFFERINFO *pBuffInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDefaultFormat( + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWaveFormatEx) = 0; + + virtual HANDLE STDMETHODCALLTYPE EventHandle( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVolumeLevel( + /* [out] */ ULONG *pLevel) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVolumeLevel( + /* [in] */ ULONG Level) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferNotifySize( + /* [out] */ ULONG *pcbSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBufferNotifySize( + /* [in] */ ULONG cbSize) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpAudioVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpAudio * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpAudio * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpAudio * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpAudio * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpAudio * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpAudio * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpAudio * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpAudio * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpAudio * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpAudio * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpAudio * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpAudio * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpAudio * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpAudio * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpAudio * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *SetState )( + ISpAudio * This, + /* [in] */ SPAUDIOSTATE NewState, + /* [in] */ ULONGLONG ullReserved); + + HRESULT ( STDMETHODCALLTYPE *SetFormat )( + ISpAudio * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpAudio * This, + /* [out] */ SPAUDIOSTATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *SetBufferInfo )( + ISpAudio * This, + /* [in] */ const SPAUDIOBUFFERINFO *pBuffInfo); + + HRESULT ( STDMETHODCALLTYPE *GetBufferInfo )( + ISpAudio * This, + /* [out] */ SPAUDIOBUFFERINFO *pBuffInfo); + + HRESULT ( STDMETHODCALLTYPE *GetDefaultFormat )( + ISpAudio * This, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWaveFormatEx); + + HANDLE ( STDMETHODCALLTYPE *EventHandle )( + ISpAudio * This); + + HRESULT ( STDMETHODCALLTYPE *GetVolumeLevel )( + ISpAudio * This, + /* [out] */ ULONG *pLevel); + + HRESULT ( STDMETHODCALLTYPE *SetVolumeLevel )( + ISpAudio * This, + /* [in] */ ULONG Level); + + HRESULT ( STDMETHODCALLTYPE *GetBufferNotifySize )( + ISpAudio * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *SetBufferNotifySize )( + ISpAudio * This, + /* [in] */ ULONG cbSize); + + END_INTERFACE + } ISpAudioVtbl; + + interface ISpAudio + { + CONST_VTBL struct ISpAudioVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpAudio_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpAudio_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpAudio_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpAudio_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpAudio_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpAudio_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpAudio_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpAudio_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpAudio_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpAudio_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpAudio_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpAudio_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpAudio_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpAudio_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpAudio_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + + +#define ISpAudio_SetState(This,NewState,ullReserved) \ + (This)->lpVtbl -> SetState(This,NewState,ullReserved) + +#define ISpAudio_SetFormat(This,rguidFmtId,pWaveFormatEx) \ + (This)->lpVtbl -> SetFormat(This,rguidFmtId,pWaveFormatEx) + +#define ISpAudio_GetStatus(This,pStatus) \ + (This)->lpVtbl -> GetStatus(This,pStatus) + +#define ISpAudio_SetBufferInfo(This,pBuffInfo) \ + (This)->lpVtbl -> SetBufferInfo(This,pBuffInfo) + +#define ISpAudio_GetBufferInfo(This,pBuffInfo) \ + (This)->lpVtbl -> GetBufferInfo(This,pBuffInfo) + +#define ISpAudio_GetDefaultFormat(This,pFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetDefaultFormat(This,pFormatId,ppCoMemWaveFormatEx) + +#define ISpAudio_EventHandle(This) \ + (This)->lpVtbl -> EventHandle(This) + +#define ISpAudio_GetVolumeLevel(This,pLevel) \ + (This)->lpVtbl -> GetVolumeLevel(This,pLevel) + +#define ISpAudio_SetVolumeLevel(This,Level) \ + (This)->lpVtbl -> SetVolumeLevel(This,Level) + +#define ISpAudio_GetBufferNotifySize(This,pcbSize) \ + (This)->lpVtbl -> GetBufferNotifySize(This,pcbSize) + +#define ISpAudio_SetBufferNotifySize(This,cbSize) \ + (This)->lpVtbl -> SetBufferNotifySize(This,cbSize) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetState_Proxy( + ISpAudio * This, + /* [in] */ SPAUDIOSTATE NewState, + /* [in] */ ULONGLONG ullReserved); + + +void __RPC_STUB ISpAudio_SetState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetFormat_Proxy( + ISpAudio * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + +void __RPC_STUB ISpAudio_SetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetStatus_Proxy( + ISpAudio * This, + /* [out] */ SPAUDIOSTATUS *pStatus); + + +void __RPC_STUB ISpAudio_GetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetBufferInfo_Proxy( + ISpAudio * This, + /* [in] */ const SPAUDIOBUFFERINFO *pBuffInfo); + + +void __RPC_STUB ISpAudio_SetBufferInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetBufferInfo_Proxy( + ISpAudio * This, + /* [out] */ SPAUDIOBUFFERINFO *pBuffInfo); + + +void __RPC_STUB ISpAudio_GetBufferInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetDefaultFormat_Proxy( + ISpAudio * This, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWaveFormatEx); + + +void __RPC_STUB ISpAudio_GetDefaultFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpAudio_EventHandle_Proxy( + ISpAudio * This); + + +void __RPC_STUB ISpAudio_EventHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetVolumeLevel_Proxy( + ISpAudio * This, + /* [out] */ ULONG *pLevel); + + +void __RPC_STUB ISpAudio_GetVolumeLevel_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetVolumeLevel_Proxy( + ISpAudio * This, + /* [in] */ ULONG Level); + + +void __RPC_STUB ISpAudio_SetVolumeLevel_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_GetBufferNotifySize_Proxy( + ISpAudio * This, + /* [out] */ ULONG *pcbSize); + + +void __RPC_STUB ISpAudio_GetBufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpAudio_SetBufferNotifySize_Proxy( + ISpAudio * This, + /* [in] */ ULONG cbSize); + + +void __RPC_STUB ISpAudio_SetBufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpAudio_INTERFACE_DEFINED__ */ + + +#ifndef __ISpMMSysAudio_INTERFACE_DEFINED__ +#define __ISpMMSysAudio_INTERFACE_DEFINED__ + +/* interface ISpMMSysAudio */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpMMSysAudio; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("15806F6E-1D70-4B48-98E6-3B1A007509AB") + ISpMMSysAudio : public ISpAudio + { + public: + virtual HRESULT STDMETHODCALLTYPE GetDeviceId( + /* [out] */ UINT *puDeviceId) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDeviceId( + /* [in] */ UINT uDeviceId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMMHandle( + void **pHandle) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetLineId( + /* [out] */ UINT *puLineId) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetLineId( + /* [in] */ UINT uLineId) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpMMSysAudioVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpMMSysAudio * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpMMSysAudio * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpMMSysAudio * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpMMSysAudio * This, + /* [length_is][size_is][out] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpMMSysAudio * This, + /* [size_is][in] */ const void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpMMSysAudio * This, + /* [in] */ LARGE_INTEGER dlibMove, + /* [in] */ DWORD dwOrigin, + /* [out] */ ULARGE_INTEGER *plibNewPosition); + + HRESULT ( STDMETHODCALLTYPE *SetSize )( + ISpMMSysAudio * This, + /* [in] */ ULARGE_INTEGER libNewSize); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( + ISpMMSysAudio * This, + /* [unique][in] */ IStream *pstm, + /* [in] */ ULARGE_INTEGER cb, + /* [out] */ ULARGE_INTEGER *pcbRead, + /* [out] */ ULARGE_INTEGER *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpMMSysAudio * This, + /* [in] */ DWORD grfCommitFlags); + + HRESULT ( STDMETHODCALLTYPE *Revert )( + ISpMMSysAudio * This); + + HRESULT ( STDMETHODCALLTYPE *LockRegion )( + ISpMMSysAudio * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( + ISpMMSysAudio * This, + /* [in] */ ULARGE_INTEGER libOffset, + /* [in] */ ULARGE_INTEGER cb, + /* [in] */ DWORD dwLockType); + + HRESULT ( STDMETHODCALLTYPE *Stat )( + ISpMMSysAudio * This, + /* [out] */ STATSTG *pstatstg, + /* [in] */ DWORD grfStatFlag); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpMMSysAudio * This, + /* [out] */ IStream **ppstm); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpMMSysAudio * This, + GUID *pguidFormatId, + WAVEFORMATEX **ppCoMemWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *SetState )( + ISpMMSysAudio * This, + /* [in] */ SPAUDIOSTATE NewState, + /* [in] */ ULONGLONG ullReserved); + + HRESULT ( STDMETHODCALLTYPE *SetFormat )( + ISpMMSysAudio * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpMMSysAudio * This, + /* [out] */ SPAUDIOSTATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *SetBufferInfo )( + ISpMMSysAudio * This, + /* [in] */ const SPAUDIOBUFFERINFO *pBuffInfo); + + HRESULT ( STDMETHODCALLTYPE *GetBufferInfo )( + ISpMMSysAudio * This, + /* [out] */ SPAUDIOBUFFERINFO *pBuffInfo); + + HRESULT ( STDMETHODCALLTYPE *GetDefaultFormat )( + ISpMMSysAudio * This, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWaveFormatEx); + + HANDLE ( STDMETHODCALLTYPE *EventHandle )( + ISpMMSysAudio * This); + + HRESULT ( STDMETHODCALLTYPE *GetVolumeLevel )( + ISpMMSysAudio * This, + /* [out] */ ULONG *pLevel); + + HRESULT ( STDMETHODCALLTYPE *SetVolumeLevel )( + ISpMMSysAudio * This, + /* [in] */ ULONG Level); + + HRESULT ( STDMETHODCALLTYPE *GetBufferNotifySize )( + ISpMMSysAudio * This, + /* [out] */ ULONG *pcbSize); + + HRESULT ( STDMETHODCALLTYPE *SetBufferNotifySize )( + ISpMMSysAudio * This, + /* [in] */ ULONG cbSize); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceId )( + ISpMMSysAudio * This, + /* [out] */ UINT *puDeviceId); + + HRESULT ( STDMETHODCALLTYPE *SetDeviceId )( + ISpMMSysAudio * This, + /* [in] */ UINT uDeviceId); + + HRESULT ( STDMETHODCALLTYPE *GetMMHandle )( + ISpMMSysAudio * This, + void **pHandle); + + HRESULT ( STDMETHODCALLTYPE *GetLineId )( + ISpMMSysAudio * This, + /* [out] */ UINT *puLineId); + + HRESULT ( STDMETHODCALLTYPE *SetLineId )( + ISpMMSysAudio * This, + /* [in] */ UINT uLineId); + + END_INTERFACE + } ISpMMSysAudioVtbl; + + interface ISpMMSysAudio + { + CONST_VTBL struct ISpMMSysAudioVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpMMSysAudio_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpMMSysAudio_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpMMSysAudio_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpMMSysAudio_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpMMSysAudio_Write(This,pv,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) + + +#define ISpMMSysAudio_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ + (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) + +#define ISpMMSysAudio_SetSize(This,libNewSize) \ + (This)->lpVtbl -> SetSize(This,libNewSize) + +#define ISpMMSysAudio_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ + (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) + +#define ISpMMSysAudio_Commit(This,grfCommitFlags) \ + (This)->lpVtbl -> Commit(This,grfCommitFlags) + +#define ISpMMSysAudio_Revert(This) \ + (This)->lpVtbl -> Revert(This) + +#define ISpMMSysAudio_LockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) + +#define ISpMMSysAudio_UnlockRegion(This,libOffset,cb,dwLockType) \ + (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) + +#define ISpMMSysAudio_Stat(This,pstatstg,grfStatFlag) \ + (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) + +#define ISpMMSysAudio_Clone(This,ppstm) \ + (This)->lpVtbl -> Clone(This,ppstm) + + +#define ISpMMSysAudio_GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetFormat(This,pguidFormatId,ppCoMemWaveFormatEx) + + +#define ISpMMSysAudio_SetState(This,NewState,ullReserved) \ + (This)->lpVtbl -> SetState(This,NewState,ullReserved) + +#define ISpMMSysAudio_SetFormat(This,rguidFmtId,pWaveFormatEx) \ + (This)->lpVtbl -> SetFormat(This,rguidFmtId,pWaveFormatEx) + +#define ISpMMSysAudio_GetStatus(This,pStatus) \ + (This)->lpVtbl -> GetStatus(This,pStatus) + +#define ISpMMSysAudio_SetBufferInfo(This,pBuffInfo) \ + (This)->lpVtbl -> SetBufferInfo(This,pBuffInfo) + +#define ISpMMSysAudio_GetBufferInfo(This,pBuffInfo) \ + (This)->lpVtbl -> GetBufferInfo(This,pBuffInfo) + +#define ISpMMSysAudio_GetDefaultFormat(This,pFormatId,ppCoMemWaveFormatEx) \ + (This)->lpVtbl -> GetDefaultFormat(This,pFormatId,ppCoMemWaveFormatEx) + +#define ISpMMSysAudio_EventHandle(This) \ + (This)->lpVtbl -> EventHandle(This) + +#define ISpMMSysAudio_GetVolumeLevel(This,pLevel) \ + (This)->lpVtbl -> GetVolumeLevel(This,pLevel) + +#define ISpMMSysAudio_SetVolumeLevel(This,Level) \ + (This)->lpVtbl -> SetVolumeLevel(This,Level) + +#define ISpMMSysAudio_GetBufferNotifySize(This,pcbSize) \ + (This)->lpVtbl -> GetBufferNotifySize(This,pcbSize) + +#define ISpMMSysAudio_SetBufferNotifySize(This,cbSize) \ + (This)->lpVtbl -> SetBufferNotifySize(This,cbSize) + + +#define ISpMMSysAudio_GetDeviceId(This,puDeviceId) \ + (This)->lpVtbl -> GetDeviceId(This,puDeviceId) + +#define ISpMMSysAudio_SetDeviceId(This,uDeviceId) \ + (This)->lpVtbl -> SetDeviceId(This,uDeviceId) + +#define ISpMMSysAudio_GetMMHandle(This,pHandle) \ + (This)->lpVtbl -> GetMMHandle(This,pHandle) + +#define ISpMMSysAudio_GetLineId(This,puLineId) \ + (This)->lpVtbl -> GetLineId(This,puLineId) + +#define ISpMMSysAudio_SetLineId(This,uLineId) \ + (This)->lpVtbl -> SetLineId(This,uLineId) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_GetDeviceId_Proxy( + ISpMMSysAudio * This, + /* [out] */ UINT *puDeviceId); + + +void __RPC_STUB ISpMMSysAudio_GetDeviceId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_SetDeviceId_Proxy( + ISpMMSysAudio * This, + /* [in] */ UINT uDeviceId); + + +void __RPC_STUB ISpMMSysAudio_SetDeviceId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_GetMMHandle_Proxy( + ISpMMSysAudio * This, + void **pHandle); + + +void __RPC_STUB ISpMMSysAudio_GetMMHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_GetLineId_Proxy( + ISpMMSysAudio * This, + /* [out] */ UINT *puLineId); + + +void __RPC_STUB ISpMMSysAudio_GetLineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpMMSysAudio_SetLineId_Proxy( + ISpMMSysAudio * This, + /* [in] */ UINT uLineId); + + +void __RPC_STUB ISpMMSysAudio_SetLineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpMMSysAudio_INTERFACE_DEFINED__ */ + + +#ifndef __ISpTranscript_INTERFACE_DEFINED__ +#define __ISpTranscript_INTERFACE_DEFINED__ + +/* interface ISpTranscript */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpTranscript; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("10F63BCE-201A-11D3-AC70-00C04F8EE6C0") + ISpTranscript : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetTranscript( + /* [string][out] */ WCHAR **ppszTranscript) = 0; + + virtual HRESULT STDMETHODCALLTYPE AppendTranscript( + /* [string][in] */ const WCHAR *pszTranscript) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTranscriptVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTranscript * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTranscript * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTranscript * This); + + HRESULT ( STDMETHODCALLTYPE *GetTranscript )( + ISpTranscript * This, + /* [string][out] */ WCHAR **ppszTranscript); + + HRESULT ( STDMETHODCALLTYPE *AppendTranscript )( + ISpTranscript * This, + /* [string][in] */ const WCHAR *pszTranscript); + + END_INTERFACE + } ISpTranscriptVtbl; + + interface ISpTranscript + { + CONST_VTBL struct ISpTranscriptVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTranscript_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTranscript_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTranscript_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTranscript_GetTranscript(This,ppszTranscript) \ + (This)->lpVtbl -> GetTranscript(This,ppszTranscript) + +#define ISpTranscript_AppendTranscript(This,pszTranscript) \ + (This)->lpVtbl -> AppendTranscript(This,pszTranscript) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpTranscript_GetTranscript_Proxy( + ISpTranscript * This, + /* [string][out] */ WCHAR **ppszTranscript); + + +void __RPC_STUB ISpTranscript_GetTranscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTranscript_AppendTranscript_Proxy( + ISpTranscript * This, + /* [string][in] */ const WCHAR *pszTranscript); + + +void __RPC_STUB ISpTranscript_AppendTranscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTranscript_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0270 */ +/* [local] */ + +typedef /* [hidden] */ +enum SPDISPLYATTRIBUTES + { SPAF_ONE_TRAILING_SPACE = 0x2, + SPAF_TWO_TRAILING_SPACES = 0x4, + SPAF_CONSUME_LEADING_SPACES = 0x8, + SPAF_ALL = 0xf + } SPDISPLAYATTRIBUTES; + +typedef unsigned short SPPHONEID; + +typedef /* [hidden][restricted] */ struct SPPHRASEELEMENT + { + ULONG ulAudioTimeOffset; + ULONG ulAudioSizeTime; + ULONG ulAudioStreamOffset; + ULONG ulAudioSizeBytes; + ULONG ulRetainedStreamOffset; + ULONG ulRetainedSizeBytes; + const WCHAR *pszDisplayText; + const WCHAR *pszLexicalForm; + const SPPHONEID *pszPronunciation; + BYTE bDisplayAttributes; + signed char RequiredConfidence; + signed char ActualConfidence; + BYTE Reserved; + float SREngineConfidence; + } SPPHRASEELEMENT; + +typedef /* [hidden][restricted] */ struct SPPHRASERULE SPPHRASERULE; + +/* [hidden] */ struct SPPHRASERULE + { + const WCHAR *pszName; + ULONG ulId; + ULONG ulFirstElement; + ULONG ulCountOfElements; + const SPPHRASERULE *pNextSibling; + const SPPHRASERULE *pFirstChild; + float SREngineConfidence; + signed char Confidence; + } ; +typedef /* [hidden][restricted] */ struct SPPHRASEPROPERTY SPPHRASEPROPERTY; + +/* [hidden] */ struct SPPHRASEPROPERTY + { + const WCHAR *pszName; + ULONG ulId; + const WCHAR *pszValue; + VARIANT vValue; + ULONG ulFirstElement; + ULONG ulCountOfElements; + const SPPHRASEPROPERTY *pNextSibling; + const SPPHRASEPROPERTY *pFirstChild; + float SREngineConfidence; + signed char Confidence; + } ; +typedef /* [hidden][restricted] */ struct SPPHRASEREPLACEMENT + { + BYTE bDisplayAttributes; + const WCHAR *pszReplacementText; + ULONG ulFirstElement; + ULONG ulCountOfElements; + } SPPHRASEREPLACEMENT; + +typedef /* [hidden][restricted] */ struct SPPHRASE + { + ULONG cbSize; + WORD LangID; + WORD wReserved; + ULONGLONG ullGrammarID; + ULONGLONG ftStartTime; + ULONGLONG ullAudioStreamPosition; + ULONG ulAudioSizeBytes; + ULONG ulRetainedSizeBytes; + ULONG ulAudioSizeTime; + SPPHRASERULE Rule; + const SPPHRASEPROPERTY *pProperties; + const SPPHRASEELEMENT *pElements; + ULONG cReplacements; + const SPPHRASEREPLACEMENT *pReplacements; + GUID SREngineID; + ULONG ulSREnginePrivateDataSize; + const BYTE *pSREnginePrivateData; + } SPPHRASE; + +typedef /* [hidden][restricted] */ struct SPSERIALIZEDPHRASE + { + ULONG ulSerializedSize; + } SPSERIALIZEDPHRASE; + +typedef /* [hidden] */ +enum SPVALUETYPE + { SPDF_PROPERTY = 0x1, + SPDF_REPLACEMENT = 0x2, + SPDF_RULE = 0x4, + SPDF_DISPLAYTEXT = 0x8, + SPDF_LEXICALFORM = 0x10, + SPDF_PRONUNCIATION = 0x20, + SPDF_AUDIO = 0x40, + SPDF_ALTERNATES = 0x80, + SPDF_ALL = 0xff + } SPVALUETYPE; + +typedef /* [hidden] */ struct SPBINARYGRAMMAR + { + ULONG ulTotalSerializedSize; + } SPBINARYGRAMMAR; + +typedef /* [hidden] */ +enum SPPHRASERNG + { SPPR_ALL_ELEMENTS = -1 + } SPPHRASERNG; + +#define SP_GETWHOLEPHRASE SPPR_ALL_ELEMENTS +#define SPRR_ALL_ELEMENTS SPPR_ALL_ELEMENTS +#if 0 +typedef void *SPSTATEHANDLE; + +#else +DECLARE_HANDLE(SPSTATEHANDLE); +#endif +typedef /* [hidden] */ +enum SPRECOEVENTFLAGS + { SPREF_AutoPause = 1 << 0, + SPREF_Emulated = 1 << 1 + } SPRECOEVENTFLAGS; + +typedef /* [hidden] */ +enum SPPARTOFSPEECH + { SPPS_NotOverriden = -1, + SPPS_Unknown = 0, + SPPS_Noun = 0x1000, + SPPS_Verb = 0x2000, + SPPS_Modifier = 0x3000, + SPPS_Function = 0x4000, + SPPS_Interjection = 0x5000 + } SPPARTOFSPEECH; + +typedef /* [hidden] */ +enum SPLEXICONTYPE + { eLEXTYPE_USER = 1L << 0, + eLEXTYPE_APP = 1L << 1, + eLEXTYPE_RESERVED1 = 1L << 2, + eLEXTYPE_RESERVED2 = 1L << 3, + eLEXTYPE_RESERVED3 = 1L << 4, + eLEXTYPE_RESERVED4 = 1L << 5, + eLEXTYPE_RESERVED5 = 1L << 6, + eLEXTYPE_RESERVED6 = 1L << 7, + eLEXTYPE_RESERVED7 = 1L << 8, + eLEXTYPE_RESERVED8 = 1L << 9, + eLEXTYPE_RESERVED9 = 1L << 10, + eLEXTYPE_RESERVED10 = 1L << 11, + eLEXTYPE_PRIVATE1 = 1L << 12, + eLEXTYPE_PRIVATE2 = 1L << 13, + eLEXTYPE_PRIVATE3 = 1L << 14, + eLEXTYPE_PRIVATE4 = 1L << 15, + eLEXTYPE_PRIVATE5 = 1L << 16, + eLEXTYPE_PRIVATE6 = 1L << 17, + eLEXTYPE_PRIVATE7 = 1L << 18, + eLEXTYPE_PRIVATE8 = 1L << 19, + eLEXTYPE_PRIVATE9 = 1L << 20, + eLEXTYPE_PRIVATE10 = 1L << 21, + eLEXTYPE_PRIVATE11 = 1L << 22, + eLEXTYPE_PRIVATE12 = 1L << 23, + eLEXTYPE_PRIVATE13 = 1L << 24, + eLEXTYPE_PRIVATE14 = 1L << 25, + eLEXTYPE_PRIVATE15 = 1L << 26, + eLEXTYPE_PRIVATE16 = 1L << 27, + eLEXTYPE_PRIVATE17 = 1L << 28, + eLEXTYPE_PRIVATE18 = 1L << 29, + eLEXTYPE_PRIVATE19 = 1L << 30, + eLEXTYPE_PRIVATE20 = 1L << 31 + } SPLEXICONTYPE; + +typedef /* [hidden] */ +enum SPWORDTYPE + { eWORDTYPE_ADDED = 1L << 0, + eWORDTYPE_DELETED = 1L << 1 + } SPWORDTYPE; + +typedef /* [hidden][restricted] */ struct SPWORDPRONUNCIATION + { + struct SPWORDPRONUNCIATION *pNextWordPronunciation; + SPLEXICONTYPE eLexiconType; + WORD LangID; + WORD wReserved; + SPPARTOFSPEECH ePartOfSpeech; + SPPHONEID szPronunciation[ 1 ]; + } SPWORDPRONUNCIATION; + +typedef /* [hidden][restricted] */ struct SPWORDPRONUNCIATIONLIST + { + ULONG ulSize; + BYTE *pvBuffer; + SPWORDPRONUNCIATION *pFirstWordPronunciation; + } SPWORDPRONUNCIATIONLIST; + +typedef /* [hidden][restricted] */ struct SPWORD + { + struct SPWORD *pNextWord; + WORD LangID; + WORD wReserved; + SPWORDTYPE eWordType; + WCHAR *pszWord; + SPWORDPRONUNCIATION *pFirstWordPronunciation; + } SPWORD; + +typedef /* [hidden][restricted] */ struct SPWORDLIST + { + ULONG ulSize; + BYTE *pvBuffer; + SPWORD *pFirstWord; + } SPWORDLIST; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0270_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0270_v0_0_s_ifspec; + +#ifndef __ISpLexicon_INTERFACE_DEFINED__ +#define __ISpLexicon_INTERFACE_DEFINED__ + +/* interface ISpLexicon */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpLexicon; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DA41A7C2-5383-4DB2-916B-6C1719E3DB58") + ISpLexicon : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetPronunciations( + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ DWORD dwFlags, + /* [out][in] */ SPWORDPRONUNCIATIONLIST *pWordPronunciationList) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddPronunciation( + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation) = 0; + + virtual HRESULT STDMETHODCALLTYPE RemovePronunciation( + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGeneration( + DWORD *pdwGeneration) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGenerationChange( + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ SPWORDLIST *pWordList) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetWords( + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ DWORD *pdwCookie, + /* [out][in] */ SPWORDLIST *pWordList) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpLexiconVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpLexicon * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpLexicon * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpLexicon * This); + + HRESULT ( STDMETHODCALLTYPE *GetPronunciations )( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ DWORD dwFlags, + /* [out][in] */ SPWORDPRONUNCIATIONLIST *pWordPronunciationList); + + HRESULT ( STDMETHODCALLTYPE *AddPronunciation )( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + HRESULT ( STDMETHODCALLTYPE *RemovePronunciation )( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + HRESULT ( STDMETHODCALLTYPE *GetGeneration )( + ISpLexicon * This, + DWORD *pdwGeneration); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationChange )( + ISpLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ SPWORDLIST *pWordList); + + HRESULT ( STDMETHODCALLTYPE *GetWords )( + ISpLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ DWORD *pdwCookie, + /* [out][in] */ SPWORDLIST *pWordList); + + END_INTERFACE + } ISpLexiconVtbl; + + interface ISpLexicon + { + CONST_VTBL struct ISpLexiconVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpLexicon_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpLexicon_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpLexicon_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpLexicon_GetPronunciations(This,pszWord,LangID,dwFlags,pWordPronunciationList) \ + (This)->lpVtbl -> GetPronunciations(This,pszWord,LangID,dwFlags,pWordPronunciationList) + +#define ISpLexicon_AddPronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) \ + (This)->lpVtbl -> AddPronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) + +#define ISpLexicon_RemovePronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) \ + (This)->lpVtbl -> RemovePronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) + +#define ISpLexicon_GetGeneration(This,pdwGeneration) \ + (This)->lpVtbl -> GetGeneration(This,pdwGeneration) + +#define ISpLexicon_GetGenerationChange(This,dwFlags,pdwGeneration,pWordList) \ + (This)->lpVtbl -> GetGenerationChange(This,dwFlags,pdwGeneration,pWordList) + +#define ISpLexicon_GetWords(This,dwFlags,pdwGeneration,pdwCookie,pWordList) \ + (This)->lpVtbl -> GetWords(This,dwFlags,pdwGeneration,pdwCookie,pWordList) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpLexicon_GetPronunciations_Proxy( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ DWORD dwFlags, + /* [out][in] */ SPWORDPRONUNCIATIONLIST *pWordPronunciationList); + + +void __RPC_STUB ISpLexicon_GetPronunciations_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_AddPronunciation_Proxy( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + +void __RPC_STUB ISpLexicon_AddPronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_RemovePronunciation_Proxy( + ISpLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + +void __RPC_STUB ISpLexicon_RemovePronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_GetGeneration_Proxy( + ISpLexicon * This, + DWORD *pdwGeneration); + + +void __RPC_STUB ISpLexicon_GetGeneration_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_GetGenerationChange_Proxy( + ISpLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ SPWORDLIST *pWordList); + + +void __RPC_STUB ISpLexicon_GetGenerationChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpLexicon_GetWords_Proxy( + ISpLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ DWORD *pdwCookie, + /* [out][in] */ SPWORDLIST *pWordList); + + +void __RPC_STUB ISpLexicon_GetWords_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpLexicon_INTERFACE_DEFINED__ */ + + +#ifndef __ISpContainerLexicon_INTERFACE_DEFINED__ +#define __ISpContainerLexicon_INTERFACE_DEFINED__ + +/* interface ISpContainerLexicon */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpContainerLexicon; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8565572F-C094-41CC-B56E-10BD9C3FF044") + ISpContainerLexicon : public ISpLexicon + { + public: + virtual HRESULT STDMETHODCALLTYPE AddLexicon( + /* [in] */ ISpLexicon *pAddLexicon, + /* [in] */ DWORD dwFlags) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpContainerLexiconVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpContainerLexicon * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpContainerLexicon * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpContainerLexicon * This); + + HRESULT ( STDMETHODCALLTYPE *GetPronunciations )( + ISpContainerLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ DWORD dwFlags, + /* [out][in] */ SPWORDPRONUNCIATIONLIST *pWordPronunciationList); + + HRESULT ( STDMETHODCALLTYPE *AddPronunciation )( + ISpContainerLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + HRESULT ( STDMETHODCALLTYPE *RemovePronunciation )( + ISpContainerLexicon * This, + /* [in] */ const WCHAR *pszWord, + /* [in] */ WORD LangID, + /* [in] */ SPPARTOFSPEECH ePartOfSpeech, + /* [in] */ const SPPHONEID *pszPronunciation); + + HRESULT ( STDMETHODCALLTYPE *GetGeneration )( + ISpContainerLexicon * This, + DWORD *pdwGeneration); + + HRESULT ( STDMETHODCALLTYPE *GetGenerationChange )( + ISpContainerLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ SPWORDLIST *pWordList); + + HRESULT ( STDMETHODCALLTYPE *GetWords )( + ISpContainerLexicon * This, + /* [in] */ DWORD dwFlags, + /* [out][in] */ DWORD *pdwGeneration, + /* [out][in] */ DWORD *pdwCookie, + /* [out][in] */ SPWORDLIST *pWordList); + + HRESULT ( STDMETHODCALLTYPE *AddLexicon )( + ISpContainerLexicon * This, + /* [in] */ ISpLexicon *pAddLexicon, + /* [in] */ DWORD dwFlags); + + END_INTERFACE + } ISpContainerLexiconVtbl; + + interface ISpContainerLexicon + { + CONST_VTBL struct ISpContainerLexiconVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpContainerLexicon_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpContainerLexicon_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpContainerLexicon_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpContainerLexicon_GetPronunciations(This,pszWord,LangID,dwFlags,pWordPronunciationList) \ + (This)->lpVtbl -> GetPronunciations(This,pszWord,LangID,dwFlags,pWordPronunciationList) + +#define ISpContainerLexicon_AddPronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) \ + (This)->lpVtbl -> AddPronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) + +#define ISpContainerLexicon_RemovePronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) \ + (This)->lpVtbl -> RemovePronunciation(This,pszWord,LangID,ePartOfSpeech,pszPronunciation) + +#define ISpContainerLexicon_GetGeneration(This,pdwGeneration) \ + (This)->lpVtbl -> GetGeneration(This,pdwGeneration) + +#define ISpContainerLexicon_GetGenerationChange(This,dwFlags,pdwGeneration,pWordList) \ + (This)->lpVtbl -> GetGenerationChange(This,dwFlags,pdwGeneration,pWordList) + +#define ISpContainerLexicon_GetWords(This,dwFlags,pdwGeneration,pdwCookie,pWordList) \ + (This)->lpVtbl -> GetWords(This,dwFlags,pdwGeneration,pdwCookie,pWordList) + + +#define ISpContainerLexicon_AddLexicon(This,pAddLexicon,dwFlags) \ + (This)->lpVtbl -> AddLexicon(This,pAddLexicon,dwFlags) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpContainerLexicon_AddLexicon_Proxy( + ISpContainerLexicon * This, + /* [in] */ ISpLexicon *pAddLexicon, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB ISpContainerLexicon_AddLexicon_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpContainerLexicon_INTERFACE_DEFINED__ */ + + +#ifndef __ISpPhoneConverter_INTERFACE_DEFINED__ +#define __ISpPhoneConverter_INTERFACE_DEFINED__ + +/* interface ISpPhoneConverter */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpPhoneConverter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8445C581-0CAC-4A38-ABFE-9B2CE2826455") + ISpPhoneConverter : public ISpObjectWithToken + { + public: + virtual HRESULT STDMETHODCALLTYPE PhoneToId( + /* [in] */ const WCHAR *pszPhone, + /* [out] */ SPPHONEID *pId) = 0; + + virtual HRESULT STDMETHODCALLTYPE IdToPhone( + /* [in] */ const SPPHONEID *pId, + /* [out] */ WCHAR *pszPhone) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPhoneConverterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpPhoneConverter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpPhoneConverter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpPhoneConverter * This); + + HRESULT ( STDMETHODCALLTYPE *SetObjectToken )( + ISpPhoneConverter * This, + ISpObjectToken *pToken); + + HRESULT ( STDMETHODCALLTYPE *GetObjectToken )( + ISpPhoneConverter * This, + ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *PhoneToId )( + ISpPhoneConverter * This, + /* [in] */ const WCHAR *pszPhone, + /* [out] */ SPPHONEID *pId); + + HRESULT ( STDMETHODCALLTYPE *IdToPhone )( + ISpPhoneConverter * This, + /* [in] */ const SPPHONEID *pId, + /* [out] */ WCHAR *pszPhone); + + END_INTERFACE + } ISpPhoneConverterVtbl; + + interface ISpPhoneConverter + { + CONST_VTBL struct ISpPhoneConverterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpPhoneConverter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpPhoneConverter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpPhoneConverter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpPhoneConverter_SetObjectToken(This,pToken) \ + (This)->lpVtbl -> SetObjectToken(This,pToken) + +#define ISpPhoneConverter_GetObjectToken(This,ppToken) \ + (This)->lpVtbl -> GetObjectToken(This,ppToken) + + +#define ISpPhoneConverter_PhoneToId(This,pszPhone,pId) \ + (This)->lpVtbl -> PhoneToId(This,pszPhone,pId) + +#define ISpPhoneConverter_IdToPhone(This,pId,pszPhone) \ + (This)->lpVtbl -> IdToPhone(This,pId,pszPhone) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpPhoneConverter_PhoneToId_Proxy( + ISpPhoneConverter * This, + /* [in] */ const WCHAR *pszPhone, + /* [out] */ SPPHONEID *pId); + + +void __RPC_STUB ISpPhoneConverter_PhoneToId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhoneConverter_IdToPhone_Proxy( + ISpPhoneConverter * This, + /* [in] */ const SPPHONEID *pId, + /* [out] */ WCHAR *pszPhone); + + +void __RPC_STUB ISpPhoneConverter_IdToPhone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpPhoneConverter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0273 */ +/* [local] */ + +typedef /* [hidden][restricted] */ struct SPVPITCH + { + long MiddleAdj; + long RangeAdj; + } SPVPITCH; + +typedef /* [hidden] */ +enum SPVACTIONS + { SPVA_Speak = 0, + SPVA_Silence = SPVA_Speak + 1, + SPVA_Pronounce = SPVA_Silence + 1, + SPVA_Bookmark = SPVA_Pronounce + 1, + SPVA_SpellOut = SPVA_Bookmark + 1, + SPVA_Section = SPVA_SpellOut + 1, + SPVA_ParseUnknownTag = SPVA_Section + 1 + } SPVACTIONS; + +typedef /* [hidden][restricted] */ struct SPVCONTEXT + { + LPCWSTR pCategory; + LPCWSTR pBefore; + LPCWSTR pAfter; + } SPVCONTEXT; + +typedef /* [hidden][restricted] */ struct SPVSTATE + { + SPVACTIONS eAction; + WORD LangID; + WORD wReserved; + long EmphAdj; + long RateAdj; + ULONG Volume; + SPVPITCH PitchAdj; + ULONG SilenceMSecs; + SPPHONEID *pPhoneIds; + SPPARTOFSPEECH ePartOfSpeech; + SPVCONTEXT Context; + } SPVSTATE; + +typedef /* [hidden] */ +enum SPRUNSTATE + { SPRS_DONE = 1L << 0, + SPRS_IS_SPEAKING = 1L << 1 + } SPRUNSTATE; + +typedef /* [hidden] */ +enum SPVLIMITS + { SPMIN_VOLUME = 0, + SPMAX_VOLUME = 100, + SPMIN_RATE = -10, + SPMAX_RATE = 10 + } SPVLIMITS; + +typedef /* [hidden] */ +enum SPVPRIORITY + { SPVPRI_NORMAL = 0, + SPVPRI_ALERT = 1L << 0, + SPVPRI_OVER = 1L << 1 + } SPVPRIORITY; + +typedef /* [hidden][restricted] */ struct SPVOICESTATUS + { + ULONG ulCurrentStream; + ULONG ulLastStreamQueued; + HRESULT hrLastResult; + DWORD dwRunningState; + ULONG ulInputWordPos; + ULONG ulInputWordLen; + ULONG ulInputSentPos; + ULONG ulInputSentLen; + LONG lBookmarkId; + SPPHONEID PhonemeId; + SPVISEMES VisemeId; + DWORD dwReserved1; + DWORD dwReserved2; + } SPVOICESTATUS; + +typedef /* [hidden] */ +enum SPEAKFLAGS + { SPF_DEFAULT = 0, + SPF_ASYNC = 1L << 0, + SPF_PURGEBEFORESPEAK = 1L << 1, + SPF_IS_FILENAME = 1L << 2, + SPF_IS_XML = 1L << 3, + SPF_IS_NOT_XML = 1L << 4, + SPF_PERSIST_XML = 1L << 5, + SPF_NLP_SPEAK_PUNC = 1L << 6, + SPF_NLP_MASK = SPF_NLP_SPEAK_PUNC, + SPF_VOICE_MASK = SPF_ASYNC | SPF_PURGEBEFORESPEAK | SPF_IS_FILENAME | SPF_IS_XML | SPF_IS_NOT_XML | SPF_NLP_MASK | SPF_PERSIST_XML, + SPF_UNUSED_FLAGS = ~SPF_VOICE_MASK + } SPEAKFLAGS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0273_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0273_v0_0_s_ifspec; + +#ifndef __ISpVoice_INTERFACE_DEFINED__ +#define __ISpVoice_INTERFACE_DEFINED__ + +/* interface ISpVoice */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpVoice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6C44DF74-72B9-4992-A1EC-EF996E0422D4") + ISpVoice : public ISpEventSource + { + public: + virtual HRESULT STDMETHODCALLTYPE SetOutput( + /* [in] */ IUnknown *pUnkOutput, + /* [in] */ BOOL fAllowFormatChanges) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOutputObjectToken( + /* [out] */ ISpObjectToken **ppObjectToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOutputStream( + /* [out] */ ISpStreamFormat **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE Pause( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Resume( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVoice( + /* [in] */ ISpObjectToken *pToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVoice( + /* [out] */ ISpObjectToken **ppToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE Speak( + /* [string][in] */ const WCHAR *pwcs, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber) = 0; + + virtual HRESULT STDMETHODCALLTYPE SpeakStream( + /* [in] */ IStream *pStream, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatus( + /* [out] */ SPVOICESTATUS *pStatus, + /* [string][out] */ WCHAR **ppszLastBookmark) = 0; + + virtual HRESULT STDMETHODCALLTYPE Skip( + /* [string][in] */ WCHAR *pItemType, + /* [in] */ long lNumItems, + /* [out] */ ULONG *pulNumSkipped) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPriority( + /* [in] */ SPVPRIORITY ePriority) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPriority( + /* [out] */ SPVPRIORITY *pePriority) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAlertBoundary( + /* [in] */ SPEVENTENUM eBoundary) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAlertBoundary( + /* [out] */ SPEVENTENUM *peBoundary) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRate( + /* [in] */ long RateAdjust) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRate( + /* [out] */ long *pRateAdjust) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVolume( + /* [in] */ USHORT usVolume) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVolume( + /* [out] */ USHORT *pusVolume) = 0; + + virtual HRESULT STDMETHODCALLTYPE WaitUntilDone( + /* [in] */ ULONG msTimeout) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetSyncSpeakTimeout( + /* [in] */ ULONG msTimeout) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSyncSpeakTimeout( + /* [out] */ ULONG *pmsTimeout) = 0; + + virtual /* [local] */ HANDLE STDMETHODCALLTYPE SpeakCompleteEvent( void) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpVoiceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpVoice * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpVoice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpVoice * This); + + HRESULT ( STDMETHODCALLTYPE *SetNotifySink )( + ISpVoice * This, + /* [in] */ ISpNotifySink *pNotifySink); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWindowMessage )( + ISpVoice * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackFunction )( + ISpVoice * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackInterface )( + ISpVoice * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWin32Event )( + ISpVoice * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForNotifyEvent )( + ISpVoice * This, + /* [in] */ DWORD dwMilliseconds); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *GetNotifyEventHandle )( + ISpVoice * This); + + HRESULT ( STDMETHODCALLTYPE *SetInterest )( + ISpVoice * This, + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest); + + HRESULT ( STDMETHODCALLTYPE *GetEvents )( + ISpVoice * This, + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched); + + HRESULT ( STDMETHODCALLTYPE *GetInfo )( + ISpVoice * This, + /* [out] */ SPEVENTSOURCEINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *SetOutput )( + ISpVoice * This, + /* [in] */ IUnknown *pUnkOutput, + /* [in] */ BOOL fAllowFormatChanges); + + HRESULT ( STDMETHODCALLTYPE *GetOutputObjectToken )( + ISpVoice * This, + /* [out] */ ISpObjectToken **ppObjectToken); + + HRESULT ( STDMETHODCALLTYPE *GetOutputStream )( + ISpVoice * This, + /* [out] */ ISpStreamFormat **ppStream); + + HRESULT ( STDMETHODCALLTYPE *Pause )( + ISpVoice * This); + + HRESULT ( STDMETHODCALLTYPE *Resume )( + ISpVoice * This); + + HRESULT ( STDMETHODCALLTYPE *SetVoice )( + ISpVoice * This, + /* [in] */ ISpObjectToken *pToken); + + HRESULT ( STDMETHODCALLTYPE *GetVoice )( + ISpVoice * This, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *Speak )( + ISpVoice * This, + /* [string][in] */ const WCHAR *pwcs, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + HRESULT ( STDMETHODCALLTYPE *SpeakStream )( + ISpVoice * This, + /* [in] */ IStream *pStream, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpVoice * This, + /* [out] */ SPVOICESTATUS *pStatus, + /* [string][out] */ WCHAR **ppszLastBookmark); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + ISpVoice * This, + /* [string][in] */ WCHAR *pItemType, + /* [in] */ long lNumItems, + /* [out] */ ULONG *pulNumSkipped); + + HRESULT ( STDMETHODCALLTYPE *SetPriority )( + ISpVoice * This, + /* [in] */ SPVPRIORITY ePriority); + + HRESULT ( STDMETHODCALLTYPE *GetPriority )( + ISpVoice * This, + /* [out] */ SPVPRIORITY *pePriority); + + HRESULT ( STDMETHODCALLTYPE *SetAlertBoundary )( + ISpVoice * This, + /* [in] */ SPEVENTENUM eBoundary); + + HRESULT ( STDMETHODCALLTYPE *GetAlertBoundary )( + ISpVoice * This, + /* [out] */ SPEVENTENUM *peBoundary); + + HRESULT ( STDMETHODCALLTYPE *SetRate )( + ISpVoice * This, + /* [in] */ long RateAdjust); + + HRESULT ( STDMETHODCALLTYPE *GetRate )( + ISpVoice * This, + /* [out] */ long *pRateAdjust); + + HRESULT ( STDMETHODCALLTYPE *SetVolume )( + ISpVoice * This, + /* [in] */ USHORT usVolume); + + HRESULT ( STDMETHODCALLTYPE *GetVolume )( + ISpVoice * This, + /* [out] */ USHORT *pusVolume); + + HRESULT ( STDMETHODCALLTYPE *WaitUntilDone )( + ISpVoice * This, + /* [in] */ ULONG msTimeout); + + HRESULT ( STDMETHODCALLTYPE *SetSyncSpeakTimeout )( + ISpVoice * This, + /* [in] */ ULONG msTimeout); + + HRESULT ( STDMETHODCALLTYPE *GetSyncSpeakTimeout )( + ISpVoice * This, + /* [out] */ ULONG *pmsTimeout); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *SpeakCompleteEvent )( + ISpVoice * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpVoice * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpVoice * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData); + + END_INTERFACE + } ISpVoiceVtbl; + + interface ISpVoice + { + CONST_VTBL struct ISpVoiceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpVoice_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpVoice_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpVoice_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpVoice_SetNotifySink(This,pNotifySink) \ + (This)->lpVtbl -> SetNotifySink(This,pNotifySink) + +#define ISpVoice_SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpVoice_SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) + +#define ISpVoice_SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) + +#define ISpVoice_SetNotifyWin32Event(This) \ + (This)->lpVtbl -> SetNotifyWin32Event(This) + +#define ISpVoice_WaitForNotifyEvent(This,dwMilliseconds) \ + (This)->lpVtbl -> WaitForNotifyEvent(This,dwMilliseconds) + +#define ISpVoice_GetNotifyEventHandle(This) \ + (This)->lpVtbl -> GetNotifyEventHandle(This) + + +#define ISpVoice_SetInterest(This,ullEventInterest,ullQueuedInterest) \ + (This)->lpVtbl -> SetInterest(This,ullEventInterest,ullQueuedInterest) + +#define ISpVoice_GetEvents(This,ulCount,pEventArray,pulFetched) \ + (This)->lpVtbl -> GetEvents(This,ulCount,pEventArray,pulFetched) + +#define ISpVoice_GetInfo(This,pInfo) \ + (This)->lpVtbl -> GetInfo(This,pInfo) + + +#define ISpVoice_SetOutput(This,pUnkOutput,fAllowFormatChanges) \ + (This)->lpVtbl -> SetOutput(This,pUnkOutput,fAllowFormatChanges) + +#define ISpVoice_GetOutputObjectToken(This,ppObjectToken) \ + (This)->lpVtbl -> GetOutputObjectToken(This,ppObjectToken) + +#define ISpVoice_GetOutputStream(This,ppStream) \ + (This)->lpVtbl -> GetOutputStream(This,ppStream) + +#define ISpVoice_Pause(This) \ + (This)->lpVtbl -> Pause(This) + +#define ISpVoice_Resume(This) \ + (This)->lpVtbl -> Resume(This) + +#define ISpVoice_SetVoice(This,pToken) \ + (This)->lpVtbl -> SetVoice(This,pToken) + +#define ISpVoice_GetVoice(This,ppToken) \ + (This)->lpVtbl -> GetVoice(This,ppToken) + +#define ISpVoice_Speak(This,pwcs,dwFlags,pulStreamNumber) \ + (This)->lpVtbl -> Speak(This,pwcs,dwFlags,pulStreamNumber) + +#define ISpVoice_SpeakStream(This,pStream,dwFlags,pulStreamNumber) \ + (This)->lpVtbl -> SpeakStream(This,pStream,dwFlags,pulStreamNumber) + +#define ISpVoice_GetStatus(This,pStatus,ppszLastBookmark) \ + (This)->lpVtbl -> GetStatus(This,pStatus,ppszLastBookmark) + +#define ISpVoice_Skip(This,pItemType,lNumItems,pulNumSkipped) \ + (This)->lpVtbl -> Skip(This,pItemType,lNumItems,pulNumSkipped) + +#define ISpVoice_SetPriority(This,ePriority) \ + (This)->lpVtbl -> SetPriority(This,ePriority) + +#define ISpVoice_GetPriority(This,pePriority) \ + (This)->lpVtbl -> GetPriority(This,pePriority) + +#define ISpVoice_SetAlertBoundary(This,eBoundary) \ + (This)->lpVtbl -> SetAlertBoundary(This,eBoundary) + +#define ISpVoice_GetAlertBoundary(This,peBoundary) \ + (This)->lpVtbl -> GetAlertBoundary(This,peBoundary) + +#define ISpVoice_SetRate(This,RateAdjust) \ + (This)->lpVtbl -> SetRate(This,RateAdjust) + +#define ISpVoice_GetRate(This,pRateAdjust) \ + (This)->lpVtbl -> GetRate(This,pRateAdjust) + +#define ISpVoice_SetVolume(This,usVolume) \ + (This)->lpVtbl -> SetVolume(This,usVolume) + +#define ISpVoice_GetVolume(This,pusVolume) \ + (This)->lpVtbl -> GetVolume(This,pusVolume) + +#define ISpVoice_WaitUntilDone(This,msTimeout) \ + (This)->lpVtbl -> WaitUntilDone(This,msTimeout) + +#define ISpVoice_SetSyncSpeakTimeout(This,msTimeout) \ + (This)->lpVtbl -> SetSyncSpeakTimeout(This,msTimeout) + +#define ISpVoice_GetSyncSpeakTimeout(This,pmsTimeout) \ + (This)->lpVtbl -> GetSyncSpeakTimeout(This,pmsTimeout) + +#define ISpVoice_SpeakCompleteEvent(This) \ + (This)->lpVtbl -> SpeakCompleteEvent(This) + +#define ISpVoice_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,pfSupported) + +#define ISpVoice_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetOutput_Proxy( + ISpVoice * This, + /* [in] */ IUnknown *pUnkOutput, + /* [in] */ BOOL fAllowFormatChanges); + + +void __RPC_STUB ISpVoice_SetOutput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetOutputObjectToken_Proxy( + ISpVoice * This, + /* [out] */ ISpObjectToken **ppObjectToken); + + +void __RPC_STUB ISpVoice_GetOutputObjectToken_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetOutputStream_Proxy( + ISpVoice * This, + /* [out] */ ISpStreamFormat **ppStream); + + +void __RPC_STUB ISpVoice_GetOutputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_Pause_Proxy( + ISpVoice * This); + + +void __RPC_STUB ISpVoice_Pause_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_Resume_Proxy( + ISpVoice * This); + + +void __RPC_STUB ISpVoice_Resume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetVoice_Proxy( + ISpVoice * This, + /* [in] */ ISpObjectToken *pToken); + + +void __RPC_STUB ISpVoice_SetVoice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetVoice_Proxy( + ISpVoice * This, + /* [out] */ ISpObjectToken **ppToken); + + +void __RPC_STUB ISpVoice_GetVoice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_Speak_Proxy( + ISpVoice * This, + /* [string][in] */ const WCHAR *pwcs, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + +void __RPC_STUB ISpVoice_Speak_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SpeakStream_Proxy( + ISpVoice * This, + /* [in] */ IStream *pStream, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + +void __RPC_STUB ISpVoice_SpeakStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetStatus_Proxy( + ISpVoice * This, + /* [out] */ SPVOICESTATUS *pStatus, + /* [string][out] */ WCHAR **ppszLastBookmark); + + +void __RPC_STUB ISpVoice_GetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_Skip_Proxy( + ISpVoice * This, + /* [string][in] */ WCHAR *pItemType, + /* [in] */ long lNumItems, + /* [out] */ ULONG *pulNumSkipped); + + +void __RPC_STUB ISpVoice_Skip_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetPriority_Proxy( + ISpVoice * This, + /* [in] */ SPVPRIORITY ePriority); + + +void __RPC_STUB ISpVoice_SetPriority_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetPriority_Proxy( + ISpVoice * This, + /* [out] */ SPVPRIORITY *pePriority); + + +void __RPC_STUB ISpVoice_GetPriority_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetAlertBoundary_Proxy( + ISpVoice * This, + /* [in] */ SPEVENTENUM eBoundary); + + +void __RPC_STUB ISpVoice_SetAlertBoundary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetAlertBoundary_Proxy( + ISpVoice * This, + /* [out] */ SPEVENTENUM *peBoundary); + + +void __RPC_STUB ISpVoice_GetAlertBoundary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetRate_Proxy( + ISpVoice * This, + /* [in] */ long RateAdjust); + + +void __RPC_STUB ISpVoice_SetRate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetRate_Proxy( + ISpVoice * This, + /* [out] */ long *pRateAdjust); + + +void __RPC_STUB ISpVoice_GetRate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetVolume_Proxy( + ISpVoice * This, + /* [in] */ USHORT usVolume); + + +void __RPC_STUB ISpVoice_SetVolume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetVolume_Proxy( + ISpVoice * This, + /* [out] */ USHORT *pusVolume); + + +void __RPC_STUB ISpVoice_GetVolume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_WaitUntilDone_Proxy( + ISpVoice * This, + /* [in] */ ULONG msTimeout); + + +void __RPC_STUB ISpVoice_WaitUntilDone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_SetSyncSpeakTimeout_Proxy( + ISpVoice * This, + /* [in] */ ULONG msTimeout); + + +void __RPC_STUB ISpVoice_SetSyncSpeakTimeout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpVoice_GetSyncSpeakTimeout_Proxy( + ISpVoice * This, + /* [out] */ ULONG *pmsTimeout); + + +void __RPC_STUB ISpVoice_GetSyncSpeakTimeout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HANDLE STDMETHODCALLTYPE ISpVoice_SpeakCompleteEvent_Proxy( + ISpVoice * This); + + +void __RPC_STUB ISpVoice_SpeakCompleteEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpVoice_IsUISupported_Proxy( + ISpVoice * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported); + + +void __RPC_STUB ISpVoice_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpVoice_DisplayUI_Proxy( + ISpVoice * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData); + + +void __RPC_STUB ISpVoice_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpVoice_INTERFACE_DEFINED__ */ + + +#ifndef __ISpPhrase_INTERFACE_DEFINED__ +#define __ISpPhrase_INTERFACE_DEFINED__ + +/* interface ISpPhrase */ +/* [restricted][unique][helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_ISpPhrase; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1A5C0354-B621-4b5a-8791-D306ED379E53") + ISpPhrase : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetPhrase( + /* [out] */ SPPHRASE **ppCoMemPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSerializedPhrase( + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetText( + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes) = 0; + + virtual HRESULT STDMETHODCALLTYPE Discard( + /* [in] */ DWORD dwValueTypes) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPhraseVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpPhrase * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpPhrase * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpPhrase * This); + + HRESULT ( STDMETHODCALLTYPE *GetPhrase )( + ISpPhrase * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetSerializedPhrase )( + ISpPhrase * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpPhrase * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + HRESULT ( STDMETHODCALLTYPE *Discard )( + ISpPhrase * This, + /* [in] */ DWORD dwValueTypes); + + END_INTERFACE + } ISpPhraseVtbl; + + interface ISpPhrase + { + CONST_VTBL struct ISpPhraseVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpPhrase_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpPhrase_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpPhrase_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpPhrase_GetPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetPhrase(This,ppCoMemPhrase) + +#define ISpPhrase_GetSerializedPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetSerializedPhrase(This,ppCoMemPhrase) + +#define ISpPhrase_GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) \ + (This)->lpVtbl -> GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) + +#define ISpPhrase_Discard(This,dwValueTypes) \ + (This)->lpVtbl -> Discard(This,dwValueTypes) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpPhrase_GetPhrase_Proxy( + ISpPhrase * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + +void __RPC_STUB ISpPhrase_GetPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhrase_GetSerializedPhrase_Proxy( + ISpPhrase * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + +void __RPC_STUB ISpPhrase_GetSerializedPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhrase_GetText_Proxy( + ISpPhrase * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + +void __RPC_STUB ISpPhrase_GetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhrase_Discard_Proxy( + ISpPhrase * This, + /* [in] */ DWORD dwValueTypes); + + +void __RPC_STUB ISpPhrase_Discard_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpPhrase_INTERFACE_DEFINED__ */ + + +#ifndef __ISpPhraseAlt_INTERFACE_DEFINED__ +#define __ISpPhraseAlt_INTERFACE_DEFINED__ + +/* interface ISpPhraseAlt */ +/* [restricted][unique][helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_ISpPhraseAlt; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8FCEBC98-4E49-4067-9C6C-D86A0E092E3D") + ISpPhraseAlt : public ISpPhrase + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAltInfo( + ISpPhrase **ppParent, + ULONG *pulStartElementInParent, + ULONG *pcElementsInParent, + ULONG *pcElementsInAlt) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPhraseAltVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpPhraseAlt * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpPhraseAlt * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpPhraseAlt * This); + + HRESULT ( STDMETHODCALLTYPE *GetPhrase )( + ISpPhraseAlt * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetSerializedPhrase )( + ISpPhraseAlt * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpPhraseAlt * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + HRESULT ( STDMETHODCALLTYPE *Discard )( + ISpPhraseAlt * This, + /* [in] */ DWORD dwValueTypes); + + HRESULT ( STDMETHODCALLTYPE *GetAltInfo )( + ISpPhraseAlt * This, + ISpPhrase **ppParent, + ULONG *pulStartElementInParent, + ULONG *pcElementsInParent, + ULONG *pcElementsInAlt); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpPhraseAlt * This); + + END_INTERFACE + } ISpPhraseAltVtbl; + + interface ISpPhraseAlt + { + CONST_VTBL struct ISpPhraseAltVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpPhraseAlt_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpPhraseAlt_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpPhraseAlt_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpPhraseAlt_GetPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetPhrase(This,ppCoMemPhrase) + +#define ISpPhraseAlt_GetSerializedPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetSerializedPhrase(This,ppCoMemPhrase) + +#define ISpPhraseAlt_GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) \ + (This)->lpVtbl -> GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) + +#define ISpPhraseAlt_Discard(This,dwValueTypes) \ + (This)->lpVtbl -> Discard(This,dwValueTypes) + + +#define ISpPhraseAlt_GetAltInfo(This,ppParent,pulStartElementInParent,pcElementsInParent,pcElementsInAlt) \ + (This)->lpVtbl -> GetAltInfo(This,ppParent,pulStartElementInParent,pcElementsInParent,pcElementsInAlt) + +#define ISpPhraseAlt_Commit(This) \ + (This)->lpVtbl -> Commit(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpPhraseAlt_GetAltInfo_Proxy( + ISpPhraseAlt * This, + ISpPhrase **ppParent, + ULONG *pulStartElementInParent, + ULONG *pcElementsInParent, + ULONG *pcElementsInAlt); + + +void __RPC_STUB ISpPhraseAlt_GetAltInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseAlt_Commit_Proxy( + ISpPhraseAlt * This); + + +void __RPC_STUB ISpPhraseAlt_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpPhraseAlt_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0276 */ +/* [local] */ + +typedef /* [hidden][restricted] */ struct SPRECORESULTTIMES + { + FILETIME ftStreamTime; + ULONGLONG ullLength; + DWORD dwTickCount; + ULONGLONG ullStart; + } SPRECORESULTTIMES; + +typedef /* [hidden] */ struct SPSERIALIZEDRESULT + { + ULONG ulSerializedSize; + } SPSERIALIZEDRESULT; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0276_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0276_v0_0_s_ifspec; + +#ifndef __ISpRecoResult_INTERFACE_DEFINED__ +#define __ISpRecoResult_INTERFACE_DEFINED__ + +/* interface ISpRecoResult */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRecoResult; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("20B053BE-E235-43cd-9A2A-8D17A48B7842") + ISpRecoResult : public ISpPhrase + { + public: + virtual HRESULT STDMETHODCALLTYPE GetResultTimes( + /* [out] */ SPRECORESULTTIMES *pTimes) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAlternates( + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ ULONG ulRequestCount, + /* [out] */ ISpPhraseAlt **ppPhrases, + /* [out] */ ULONG *pcPhrasesReturned) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAudio( + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [out] */ ISpStreamFormat **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE SpeakAudio( + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber) = 0; + + virtual HRESULT STDMETHODCALLTYPE Serialize( + /* [out] */ SPSERIALIZEDRESULT **ppCoMemSerializedResult) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScaleAudio( + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecoContext( + /* [out] */ ISpRecoContext **ppRecoContext) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRecoResultVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRecoResult * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRecoResult * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRecoResult * This); + + HRESULT ( STDMETHODCALLTYPE *GetPhrase )( + ISpRecoResult * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetSerializedPhrase )( + ISpRecoResult * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpRecoResult * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + HRESULT ( STDMETHODCALLTYPE *Discard )( + ISpRecoResult * This, + /* [in] */ DWORD dwValueTypes); + + HRESULT ( STDMETHODCALLTYPE *GetResultTimes )( + ISpRecoResult * This, + /* [out] */ SPRECORESULTTIMES *pTimes); + + HRESULT ( STDMETHODCALLTYPE *GetAlternates )( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ ULONG ulRequestCount, + /* [out] */ ISpPhraseAlt **ppPhrases, + /* [out] */ ULONG *pcPhrasesReturned); + + HRESULT ( STDMETHODCALLTYPE *GetAudio )( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [out] */ ISpStreamFormat **ppStream); + + HRESULT ( STDMETHODCALLTYPE *SpeakAudio )( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + HRESULT ( STDMETHODCALLTYPE *Serialize )( + ISpRecoResult * This, + /* [out] */ SPSERIALIZEDRESULT **ppCoMemSerializedResult); + + HRESULT ( STDMETHODCALLTYPE *ScaleAudio )( + ISpRecoResult * This, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetRecoContext )( + ISpRecoResult * This, + /* [out] */ ISpRecoContext **ppRecoContext); + + END_INTERFACE + } ISpRecoResultVtbl; + + interface ISpRecoResult + { + CONST_VTBL struct ISpRecoResultVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRecoResult_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRecoResult_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRecoResult_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRecoResult_GetPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetPhrase(This,ppCoMemPhrase) + +#define ISpRecoResult_GetSerializedPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetSerializedPhrase(This,ppCoMemPhrase) + +#define ISpRecoResult_GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) \ + (This)->lpVtbl -> GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) + +#define ISpRecoResult_Discard(This,dwValueTypes) \ + (This)->lpVtbl -> Discard(This,dwValueTypes) + + +#define ISpRecoResult_GetResultTimes(This,pTimes) \ + (This)->lpVtbl -> GetResultTimes(This,pTimes) + +#define ISpRecoResult_GetAlternates(This,ulStartElement,cElements,ulRequestCount,ppPhrases,pcPhrasesReturned) \ + (This)->lpVtbl -> GetAlternates(This,ulStartElement,cElements,ulRequestCount,ppPhrases,pcPhrasesReturned) + +#define ISpRecoResult_GetAudio(This,ulStartElement,cElements,ppStream) \ + (This)->lpVtbl -> GetAudio(This,ulStartElement,cElements,ppStream) + +#define ISpRecoResult_SpeakAudio(This,ulStartElement,cElements,dwFlags,pulStreamNumber) \ + (This)->lpVtbl -> SpeakAudio(This,ulStartElement,cElements,dwFlags,pulStreamNumber) + +#define ISpRecoResult_Serialize(This,ppCoMemSerializedResult) \ + (This)->lpVtbl -> Serialize(This,ppCoMemSerializedResult) + +#define ISpRecoResult_ScaleAudio(This,pAudioFormatId,pWaveFormatEx) \ + (This)->lpVtbl -> ScaleAudio(This,pAudioFormatId,pWaveFormatEx) + +#define ISpRecoResult_GetRecoContext(This,ppRecoContext) \ + (This)->lpVtbl -> GetRecoContext(This,ppRecoContext) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_GetResultTimes_Proxy( + ISpRecoResult * This, + /* [out] */ SPRECORESULTTIMES *pTimes); + + +void __RPC_STUB ISpRecoResult_GetResultTimes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_GetAlternates_Proxy( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ ULONG ulRequestCount, + /* [out] */ ISpPhraseAlt **ppPhrases, + /* [out] */ ULONG *pcPhrasesReturned); + + +void __RPC_STUB ISpRecoResult_GetAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_GetAudio_Proxy( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [out] */ ISpStreamFormat **ppStream); + + +void __RPC_STUB ISpRecoResult_GetAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_SpeakAudio_Proxy( + ISpRecoResult * This, + /* [in] */ ULONG ulStartElement, + /* [in] */ ULONG cElements, + /* [in] */ DWORD dwFlags, + /* [out] */ ULONG *pulStreamNumber); + + +void __RPC_STUB ISpRecoResult_SpeakAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_Serialize_Proxy( + ISpRecoResult * This, + /* [out] */ SPSERIALIZEDRESULT **ppCoMemSerializedResult); + + +void __RPC_STUB ISpRecoResult_Serialize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_ScaleAudio_Proxy( + ISpRecoResult * This, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + +void __RPC_STUB ISpRecoResult_ScaleAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoResult_GetRecoContext_Proxy( + ISpRecoResult * This, + /* [out] */ ISpRecoContext **ppRecoContext); + + +void __RPC_STUB ISpRecoResult_GetRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRecoResult_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0277 */ +/* [local] */ + +typedef /* [hidden] */ struct tagSPTEXTSELECTIONINFO + { + ULONG ulStartActiveOffset; + ULONG cchActiveChars; + ULONG ulStartSelection; + ULONG cchSelection; + } SPTEXTSELECTIONINFO; + +typedef /* [hidden] */ +enum SPWORDPRONOUNCEABLE + { SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE = 0, + SPWP_UNKNOWN_WORD_PRONOUNCEABLE = 1, + SPWP_KNOWN_WORD_PRONOUNCEABLE = 2 + } SPWORDPRONOUNCEABLE; + +typedef /* [hidden] */ +enum SPGRAMMARSTATE + { SPGS_DISABLED = 0, + SPGS_ENABLED = 1, + SPGS_EXCLUSIVE = 3 + } SPGRAMMARSTATE; + +typedef /* [hidden] */ +enum SPCONTEXTSTATE + { SPCS_DISABLED = 0, + SPCS_ENABLED = 1 + } SPCONTEXTSTATE; + +typedef /* [hidden] */ +enum SPRULESTATE + { SPRS_INACTIVE = 0, + SPRS_ACTIVE = 1, + SPRS_ACTIVE_WITH_AUTO_PAUSE = 3 + } SPRULESTATE; + +#define SP_STREAMPOS_ASAP ( 0 ) + +#define SP_STREAMPOS_REALTIME ( -1 ) + +#define SPRULETRANS_TEXTBUFFER (SPSTATEHANDLE)(-1) +#define SPRULETRANS_WILDCARD (SPSTATEHANDLE)(-2) +#define SPRULETRANS_DICTATION (SPSTATEHANDLE)(-3) +typedef /* [hidden] */ +enum SPGRAMMARWORDTYPE + { SPWT_DISPLAY = 0, + SPWT_LEXICAL = SPWT_DISPLAY + 1, + SPWT_PRONUNCIATION = SPWT_LEXICAL + 1 + } SPGRAMMARWORDTYPE; + +typedef /* [hidden] */ struct tagSPPROPERTYINFO + { + const WCHAR *pszName; + ULONG ulId; + const WCHAR *pszValue; + VARIANT vValue; + } SPPROPERTYINFO; + +typedef /* [hidden] */ +enum SPCFGRULEATTRIBUTES + { SPRAF_TopLevel = 1 << 0, + SPRAF_Active = 1 << 1, + SPRAF_Export = 1 << 2, + SPRAF_Import = 1 << 3, + SPRAF_Interpreter = 1 << 4, + SPRAF_Dynamic = 1 << 5, + SPRAF_AutoPause = 1 << 16 + } SPCFGRULEATTRIBUTES; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0277_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0277_v0_0_s_ifspec; + +#ifndef __ISpGrammarBuilder_INTERFACE_DEFINED__ +#define __ISpGrammarBuilder_INTERFACE_DEFINED__ + +/* interface ISpGrammarBuilder */ +/* [local][restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpGrammarBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8137828F-591A-4A42-BE58-49EA7EBAAC68") + ISpGrammarBuilder : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ResetGrammar( + /* [in] */ WORD NewLanguage) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRule( + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState) = 0; + + virtual HRESULT STDMETHODCALLTYPE ClearRule( + SPSTATEHANDLE hState) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateNewState( + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddWordTransition( + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddRuleTransition( + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddResource( + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( + DWORD dwReserved) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpGrammarBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpGrammarBuilder * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpGrammarBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpGrammarBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *ResetGrammar )( + ISpGrammarBuilder * This, + /* [in] */ WORD NewLanguage); + + HRESULT ( STDMETHODCALLTYPE *GetRule )( + ISpGrammarBuilder * This, + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState); + + HRESULT ( STDMETHODCALLTYPE *ClearRule )( + ISpGrammarBuilder * This, + SPSTATEHANDLE hState); + + HRESULT ( STDMETHODCALLTYPE *CreateNewState )( + ISpGrammarBuilder * This, + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState); + + HRESULT ( STDMETHODCALLTYPE *AddWordTransition )( + ISpGrammarBuilder * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddRuleTransition )( + ISpGrammarBuilder * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddResource )( + ISpGrammarBuilder * This, + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpGrammarBuilder * This, + DWORD dwReserved); + + END_INTERFACE + } ISpGrammarBuilderVtbl; + + interface ISpGrammarBuilder + { + CONST_VTBL struct ISpGrammarBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpGrammarBuilder_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpGrammarBuilder_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpGrammarBuilder_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpGrammarBuilder_ResetGrammar(This,NewLanguage) \ + (This)->lpVtbl -> ResetGrammar(This,NewLanguage) + +#define ISpGrammarBuilder_GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) \ + (This)->lpVtbl -> GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) + +#define ISpGrammarBuilder_ClearRule(This,hState) \ + (This)->lpVtbl -> ClearRule(This,hState) + +#define ISpGrammarBuilder_CreateNewState(This,hState,phState) \ + (This)->lpVtbl -> CreateNewState(This,hState,phState) + +#define ISpGrammarBuilder_AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) \ + (This)->lpVtbl -> AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) + +#define ISpGrammarBuilder_AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) \ + (This)->lpVtbl -> AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) + +#define ISpGrammarBuilder_AddResource(This,hRuleState,pszResourceName,pszResourceValue) \ + (This)->lpVtbl -> AddResource(This,hRuleState,pszResourceName,pszResourceValue) + +#define ISpGrammarBuilder_Commit(This,dwReserved) \ + (This)->lpVtbl -> Commit(This,dwReserved) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_ResetGrammar_Proxy( + ISpGrammarBuilder * This, + /* [in] */ WORD NewLanguage); + + +void __RPC_STUB ISpGrammarBuilder_ResetGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_GetRule_Proxy( + ISpGrammarBuilder * This, + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState); + + +void __RPC_STUB ISpGrammarBuilder_GetRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_ClearRule_Proxy( + ISpGrammarBuilder * This, + SPSTATEHANDLE hState); + + +void __RPC_STUB ISpGrammarBuilder_ClearRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_CreateNewState_Proxy( + ISpGrammarBuilder * This, + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState); + + +void __RPC_STUB ISpGrammarBuilder_CreateNewState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_AddWordTransition_Proxy( + ISpGrammarBuilder * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + +void __RPC_STUB ISpGrammarBuilder_AddWordTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_AddRuleTransition_Proxy( + ISpGrammarBuilder * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + +void __RPC_STUB ISpGrammarBuilder_AddRuleTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_AddResource_Proxy( + ISpGrammarBuilder * This, + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue); + + +void __RPC_STUB ISpGrammarBuilder_AddResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGrammarBuilder_Commit_Proxy( + ISpGrammarBuilder * This, + DWORD dwReserved); + + +void __RPC_STUB ISpGrammarBuilder_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpGrammarBuilder_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0278 */ +/* [local] */ + +typedef /* [hidden] */ +enum SPLOADOPTIONS + { SPLO_STATIC = 0, + SPLO_DYNAMIC = 1 + } SPLOADOPTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0278_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0278_v0_0_s_ifspec; + +#ifndef __ISpRecoGrammar_INTERFACE_DEFINED__ +#define __ISpRecoGrammar_INTERFACE_DEFINED__ + +/* interface ISpRecoGrammar */ +/* [local][restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRecoGrammar; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2177DB29-7F45-47D0-8554-067E91C80502") + ISpRecoGrammar : public ISpGrammarBuilder + { + public: + virtual HRESULT STDMETHODCALLTYPE GetGrammarId( + /* [out] */ ULONGLONG *pullGrammarId) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecoContext( + /* [out] */ ISpRecoContext **ppRecoCtxt) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromFile( + /* [string][in] */ const WCHAR *pszFileName, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromObject( + /* [in] */ REFCLSID rcid, + /* [string][in] */ const WCHAR *pszGrammarName, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromResource( + /* [in] */ HMODULE hModule, + /* [string][in] */ const WCHAR *pszResourceName, + /* [string][in] */ const WCHAR *pszResourceType, + /* [in] */ WORD wLanguage, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromMemory( + /* [in] */ const SPBINARYGRAMMAR *pGrammar, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadCmdFromProprietaryGrammar( + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataPrarm, + /* [in] */ ULONG cbDataSize, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRuleState( + /* [string][in] */ const WCHAR *pszName, + void *pReserved, + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRuleIdState( + /* [in] */ ULONG ulRuleId, + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadDictation( + /* [string][in] */ const WCHAR *pszTopicName, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnloadDictation( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDictationState( + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetWordSequenceData( + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTextSelection( + /* [in] */ const SPTEXTSELECTIONINFO *pInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsPronounceable( + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetGrammarState( + /* [in] */ SPGRAMMARSTATE eGrammarState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SaveCmd( + /* [in] */ IStream *pStream, + /* [optional][out] */ WCHAR **ppszCoMemErrorText) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetGrammarState( + /* [out] */ SPGRAMMARSTATE *peGrammarState) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRecoGrammarVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRecoGrammar * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRecoGrammar * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRecoGrammar * This); + + HRESULT ( STDMETHODCALLTYPE *ResetGrammar )( + ISpRecoGrammar * This, + /* [in] */ WORD NewLanguage); + + HRESULT ( STDMETHODCALLTYPE *GetRule )( + ISpRecoGrammar * This, + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState); + + HRESULT ( STDMETHODCALLTYPE *ClearRule )( + ISpRecoGrammar * This, + SPSTATEHANDLE hState); + + HRESULT ( STDMETHODCALLTYPE *CreateNewState )( + ISpRecoGrammar * This, + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState); + + HRESULT ( STDMETHODCALLTYPE *AddWordTransition )( + ISpRecoGrammar * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddRuleTransition )( + ISpRecoGrammar * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddResource )( + ISpRecoGrammar * This, + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpRecoGrammar * This, + DWORD dwReserved); + + HRESULT ( STDMETHODCALLTYPE *GetGrammarId )( + ISpRecoGrammar * This, + /* [out] */ ULONGLONG *pullGrammarId); + + HRESULT ( STDMETHODCALLTYPE *GetRecoContext )( + ISpRecoGrammar * This, + /* [out] */ ISpRecoContext **ppRecoCtxt); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromFile )( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszFileName, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromObject )( + ISpRecoGrammar * This, + /* [in] */ REFCLSID rcid, + /* [string][in] */ const WCHAR *pszGrammarName, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromResource )( + ISpRecoGrammar * This, + /* [in] */ HMODULE hModule, + /* [string][in] */ const WCHAR *pszResourceName, + /* [string][in] */ const WCHAR *pszResourceType, + /* [in] */ WORD wLanguage, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromMemory )( + ISpRecoGrammar * This, + /* [in] */ const SPBINARYGRAMMAR *pGrammar, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *LoadCmdFromProprietaryGrammar )( + ISpRecoGrammar * This, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataPrarm, + /* [in] */ ULONG cbDataSize, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *SetRuleState )( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszName, + void *pReserved, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *SetRuleIdState )( + ISpRecoGrammar * This, + /* [in] */ ULONG ulRuleId, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *LoadDictation )( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszTopicName, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *UnloadDictation )( + ISpRecoGrammar * This); + + HRESULT ( STDMETHODCALLTYPE *SetDictationState )( + ISpRecoGrammar * This, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *SetWordSequenceData )( + ISpRecoGrammar * This, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *SetTextSelection )( + ISpRecoGrammar * This, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *IsPronounceable )( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable); + + HRESULT ( STDMETHODCALLTYPE *SetGrammarState )( + ISpRecoGrammar * This, + /* [in] */ SPGRAMMARSTATE eGrammarState); + + HRESULT ( STDMETHODCALLTYPE *SaveCmd )( + ISpRecoGrammar * This, + /* [in] */ IStream *pStream, + /* [optional][out] */ WCHAR **ppszCoMemErrorText); + + HRESULT ( STDMETHODCALLTYPE *GetGrammarState )( + ISpRecoGrammar * This, + /* [out] */ SPGRAMMARSTATE *peGrammarState); + + END_INTERFACE + } ISpRecoGrammarVtbl; + + interface ISpRecoGrammar + { + CONST_VTBL struct ISpRecoGrammarVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRecoGrammar_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRecoGrammar_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRecoGrammar_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRecoGrammar_ResetGrammar(This,NewLanguage) \ + (This)->lpVtbl -> ResetGrammar(This,NewLanguage) + +#define ISpRecoGrammar_GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) \ + (This)->lpVtbl -> GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) + +#define ISpRecoGrammar_ClearRule(This,hState) \ + (This)->lpVtbl -> ClearRule(This,hState) + +#define ISpRecoGrammar_CreateNewState(This,hState,phState) \ + (This)->lpVtbl -> CreateNewState(This,hState,phState) + +#define ISpRecoGrammar_AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) \ + (This)->lpVtbl -> AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) + +#define ISpRecoGrammar_AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) \ + (This)->lpVtbl -> AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) + +#define ISpRecoGrammar_AddResource(This,hRuleState,pszResourceName,pszResourceValue) \ + (This)->lpVtbl -> AddResource(This,hRuleState,pszResourceName,pszResourceValue) + +#define ISpRecoGrammar_Commit(This,dwReserved) \ + (This)->lpVtbl -> Commit(This,dwReserved) + + +#define ISpRecoGrammar_GetGrammarId(This,pullGrammarId) \ + (This)->lpVtbl -> GetGrammarId(This,pullGrammarId) + +#define ISpRecoGrammar_GetRecoContext(This,ppRecoCtxt) \ + (This)->lpVtbl -> GetRecoContext(This,ppRecoCtxt) + +#define ISpRecoGrammar_LoadCmdFromFile(This,pszFileName,Options) \ + (This)->lpVtbl -> LoadCmdFromFile(This,pszFileName,Options) + +#define ISpRecoGrammar_LoadCmdFromObject(This,rcid,pszGrammarName,Options) \ + (This)->lpVtbl -> LoadCmdFromObject(This,rcid,pszGrammarName,Options) + +#define ISpRecoGrammar_LoadCmdFromResource(This,hModule,pszResourceName,pszResourceType,wLanguage,Options) \ + (This)->lpVtbl -> LoadCmdFromResource(This,hModule,pszResourceName,pszResourceType,wLanguage,Options) + +#define ISpRecoGrammar_LoadCmdFromMemory(This,pGrammar,Options) \ + (This)->lpVtbl -> LoadCmdFromMemory(This,pGrammar,Options) + +#define ISpRecoGrammar_LoadCmdFromProprietaryGrammar(This,rguidParam,pszStringParam,pvDataPrarm,cbDataSize,Options) \ + (This)->lpVtbl -> LoadCmdFromProprietaryGrammar(This,rguidParam,pszStringParam,pvDataPrarm,cbDataSize,Options) + +#define ISpRecoGrammar_SetRuleState(This,pszName,pReserved,NewState) \ + (This)->lpVtbl -> SetRuleState(This,pszName,pReserved,NewState) + +#define ISpRecoGrammar_SetRuleIdState(This,ulRuleId,NewState) \ + (This)->lpVtbl -> SetRuleIdState(This,ulRuleId,NewState) + +#define ISpRecoGrammar_LoadDictation(This,pszTopicName,Options) \ + (This)->lpVtbl -> LoadDictation(This,pszTopicName,Options) + +#define ISpRecoGrammar_UnloadDictation(This) \ + (This)->lpVtbl -> UnloadDictation(This) + +#define ISpRecoGrammar_SetDictationState(This,NewState) \ + (This)->lpVtbl -> SetDictationState(This,NewState) + +#define ISpRecoGrammar_SetWordSequenceData(This,pText,cchText,pInfo) \ + (This)->lpVtbl -> SetWordSequenceData(This,pText,cchText,pInfo) + +#define ISpRecoGrammar_SetTextSelection(This,pInfo) \ + (This)->lpVtbl -> SetTextSelection(This,pInfo) + +#define ISpRecoGrammar_IsPronounceable(This,pszWord,pWordPronounceable) \ + (This)->lpVtbl -> IsPronounceable(This,pszWord,pWordPronounceable) + +#define ISpRecoGrammar_SetGrammarState(This,eGrammarState) \ + (This)->lpVtbl -> SetGrammarState(This,eGrammarState) + +#define ISpRecoGrammar_SaveCmd(This,pStream,ppszCoMemErrorText) \ + (This)->lpVtbl -> SaveCmd(This,pStream,ppszCoMemErrorText) + +#define ISpRecoGrammar_GetGrammarState(This,peGrammarState) \ + (This)->lpVtbl -> GetGrammarState(This,peGrammarState) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_GetGrammarId_Proxy( + ISpRecoGrammar * This, + /* [out] */ ULONGLONG *pullGrammarId); + + +void __RPC_STUB ISpRecoGrammar_GetGrammarId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_GetRecoContext_Proxy( + ISpRecoGrammar * This, + /* [out] */ ISpRecoContext **ppRecoCtxt); + + +void __RPC_STUB ISpRecoGrammar_GetRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromFile_Proxy( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszFileName, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromFile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromObject_Proxy( + ISpRecoGrammar * This, + /* [in] */ REFCLSID rcid, + /* [string][in] */ const WCHAR *pszGrammarName, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromResource_Proxy( + ISpRecoGrammar * This, + /* [in] */ HMODULE hModule, + /* [string][in] */ const WCHAR *pszResourceName, + /* [string][in] */ const WCHAR *pszResourceType, + /* [in] */ WORD wLanguage, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromMemory_Proxy( + ISpRecoGrammar * This, + /* [in] */ const SPBINARYGRAMMAR *pGrammar, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadCmdFromProprietaryGrammar_Proxy( + ISpRecoGrammar * This, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataPrarm, + /* [in] */ ULONG cbDataSize, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadCmdFromProprietaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetRuleState_Proxy( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszName, + void *pReserved, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpRecoGrammar_SetRuleState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetRuleIdState_Proxy( + ISpRecoGrammar * This, + /* [in] */ ULONG ulRuleId, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpRecoGrammar_SetRuleIdState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_LoadDictation_Proxy( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszTopicName, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpRecoGrammar_LoadDictation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_UnloadDictation_Proxy( + ISpRecoGrammar * This); + + +void __RPC_STUB ISpRecoGrammar_UnloadDictation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetDictationState_Proxy( + ISpRecoGrammar * This, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpRecoGrammar_SetDictationState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetWordSequenceData_Proxy( + ISpRecoGrammar * This, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + +void __RPC_STUB ISpRecoGrammar_SetWordSequenceData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetTextSelection_Proxy( + ISpRecoGrammar * This, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + +void __RPC_STUB ISpRecoGrammar_SetTextSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_IsPronounceable_Proxy( + ISpRecoGrammar * This, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable); + + +void __RPC_STUB ISpRecoGrammar_IsPronounceable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SetGrammarState_Proxy( + ISpRecoGrammar * This, + /* [in] */ SPGRAMMARSTATE eGrammarState); + + +void __RPC_STUB ISpRecoGrammar_SetGrammarState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_SaveCmd_Proxy( + ISpRecoGrammar * This, + /* [in] */ IStream *pStream, + /* [optional][out] */ WCHAR **ppszCoMemErrorText); + + +void __RPC_STUB ISpRecoGrammar_SaveCmd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoGrammar_GetGrammarState_Proxy( + ISpRecoGrammar * This, + /* [out] */ SPGRAMMARSTATE *peGrammarState); + + +void __RPC_STUB ISpRecoGrammar_GetGrammarState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRecoGrammar_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0279 */ +/* [local] */ + +typedef /* [hidden][restricted] */ struct SPRECOCONTEXTSTATUS + { + SPINTERFERENCE eInterference; + WCHAR szRequestTypeOfUI[ 255 ]; + DWORD dwReserved1; + DWORD dwReserved2; + } SPRECOCONTEXTSTATUS; + +typedef /* [hidden] */ +enum SPBOOKMARKOPTIONS + { SPBO_NONE = 0, + SPBO_PAUSE = 1 + } SPBOOKMARKOPTIONS; + +typedef /* [hidden] */ +enum SPAUDIOOPTIONS + { SPAO_NONE = 0, + SPAO_RETAIN_AUDIO = 1 << 0 + } SPAUDIOOPTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0279_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0279_v0_0_s_ifspec; + +#ifndef __ISpRecoContext_INTERFACE_DEFINED__ +#define __ISpRecoContext_INTERFACE_DEFINED__ + +/* interface ISpRecoContext */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRecoContext; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F740A62F-7C15-489E-8234-940A33D9272D") + ISpRecoContext : public ISpEventSource + { + public: + virtual HRESULT STDMETHODCALLTYPE GetRecognizer( + /* [out] */ ISpRecognizer **ppRecognizer) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateGrammar( + /* [in] */ ULONGLONG ullGrammarId, + /* [out] */ ISpRecoGrammar **ppGrammar) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatus( + /* [out] */ SPRECOCONTEXTSTATUS *pStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMaxAlternates( + /* [in] */ ULONG *pcAlternates) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetMaxAlternates( + /* [in] */ ULONG cAlternates) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioOptions( + /* [in] */ SPAUDIOOPTIONS Options, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAudioOptions( + /* [in] */ SPAUDIOOPTIONS *pOptions, + /* [out] */ GUID *pAudioFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeserializeResult( + /* [in] */ const SPSERIALIZEDRESULT *pSerializedResult, + /* [out] */ ISpRecoResult **ppResult) = 0; + + virtual HRESULT STDMETHODCALLTYPE Bookmark( + /* [in] */ SPBOOKMARKOPTIONS Options, + /* [in] */ ULONGLONG ullStreamPosition, + /* [in] */ LPARAM lparamEvent) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAdaptationData( + /* [string][in] */ const WCHAR *pAdaptationData, + /* [in] */ const ULONG cch) = 0; + + virtual HRESULT STDMETHODCALLTYPE Pause( + DWORD dwReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE Resume( + DWORD dwReserved) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVoice( + /* [in] */ ISpVoice *pVoice, + /* [in] */ BOOL fAllowFormatChanges) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVoice( + /* [out] */ ISpVoice **ppVoice) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVoicePurgeEvent( + /* [in] */ ULONGLONG ullEventInterest) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVoicePurgeEvent( + /* [out] */ ULONGLONG *pullEventInterest) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetContextState( + /* [in] */ SPCONTEXTSTATE eContextState) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetContextState( + /* [in] */ SPCONTEXTSTATE *peContextState) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRecoContextVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRecoContext * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRecoContext * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRecoContext * This); + + HRESULT ( STDMETHODCALLTYPE *SetNotifySink )( + ISpRecoContext * This, + /* [in] */ ISpNotifySink *pNotifySink); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWindowMessage )( + ISpRecoContext * This, + /* [in] */ HWND hWnd, + /* [in] */ UINT Msg, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackFunction )( + ISpRecoContext * This, + /* [in] */ SPNOTIFYCALLBACK *pfnCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyCallbackInterface )( + ISpRecoContext * This, + /* [in] */ ISpNotifyCallback *pSpCallback, + /* [in] */ WPARAM wParam, + /* [in] */ LPARAM lParam); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *SetNotifyWin32Event )( + ISpRecoContext * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *WaitForNotifyEvent )( + ISpRecoContext * This, + /* [in] */ DWORD dwMilliseconds); + + /* [local] */ HANDLE ( STDMETHODCALLTYPE *GetNotifyEventHandle )( + ISpRecoContext * This); + + HRESULT ( STDMETHODCALLTYPE *SetInterest )( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullEventInterest, + /* [in] */ ULONGLONG ullQueuedInterest); + + HRESULT ( STDMETHODCALLTYPE *GetEvents )( + ISpRecoContext * This, + /* [in] */ ULONG ulCount, + /* [size_is][out] */ SPEVENT *pEventArray, + /* [out] */ ULONG *pulFetched); + + HRESULT ( STDMETHODCALLTYPE *GetInfo )( + ISpRecoContext * This, + /* [out] */ SPEVENTSOURCEINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *GetRecognizer )( + ISpRecoContext * This, + /* [out] */ ISpRecognizer **ppRecognizer); + + HRESULT ( STDMETHODCALLTYPE *CreateGrammar )( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullGrammarId, + /* [out] */ ISpRecoGrammar **ppGrammar); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpRecoContext * This, + /* [out] */ SPRECOCONTEXTSTATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *GetMaxAlternates )( + ISpRecoContext * This, + /* [in] */ ULONG *pcAlternates); + + HRESULT ( STDMETHODCALLTYPE *SetMaxAlternates )( + ISpRecoContext * This, + /* [in] */ ULONG cAlternates); + + HRESULT ( STDMETHODCALLTYPE *SetAudioOptions )( + ISpRecoContext * This, + /* [in] */ SPAUDIOOPTIONS Options, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *GetAudioOptions )( + ISpRecoContext * This, + /* [in] */ SPAUDIOOPTIONS *pOptions, + /* [out] */ GUID *pAudioFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX); + + HRESULT ( STDMETHODCALLTYPE *DeserializeResult )( + ISpRecoContext * This, + /* [in] */ const SPSERIALIZEDRESULT *pSerializedResult, + /* [out] */ ISpRecoResult **ppResult); + + HRESULT ( STDMETHODCALLTYPE *Bookmark )( + ISpRecoContext * This, + /* [in] */ SPBOOKMARKOPTIONS Options, + /* [in] */ ULONGLONG ullStreamPosition, + /* [in] */ LPARAM lparamEvent); + + HRESULT ( STDMETHODCALLTYPE *SetAdaptationData )( + ISpRecoContext * This, + /* [string][in] */ const WCHAR *pAdaptationData, + /* [in] */ const ULONG cch); + + HRESULT ( STDMETHODCALLTYPE *Pause )( + ISpRecoContext * This, + DWORD dwReserved); + + HRESULT ( STDMETHODCALLTYPE *Resume )( + ISpRecoContext * This, + DWORD dwReserved); + + HRESULT ( STDMETHODCALLTYPE *SetVoice )( + ISpRecoContext * This, + /* [in] */ ISpVoice *pVoice, + /* [in] */ BOOL fAllowFormatChanges); + + HRESULT ( STDMETHODCALLTYPE *GetVoice )( + ISpRecoContext * This, + /* [out] */ ISpVoice **ppVoice); + + HRESULT ( STDMETHODCALLTYPE *SetVoicePurgeEvent )( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullEventInterest); + + HRESULT ( STDMETHODCALLTYPE *GetVoicePurgeEvent )( + ISpRecoContext * This, + /* [out] */ ULONGLONG *pullEventInterest); + + HRESULT ( STDMETHODCALLTYPE *SetContextState )( + ISpRecoContext * This, + /* [in] */ SPCONTEXTSTATE eContextState); + + HRESULT ( STDMETHODCALLTYPE *GetContextState )( + ISpRecoContext * This, + /* [in] */ SPCONTEXTSTATE *peContextState); + + END_INTERFACE + } ISpRecoContextVtbl; + + interface ISpRecoContext + { + CONST_VTBL struct ISpRecoContextVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRecoContext_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRecoContext_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRecoContext_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRecoContext_SetNotifySink(This,pNotifySink) \ + (This)->lpVtbl -> SetNotifySink(This,pNotifySink) + +#define ISpRecoContext_SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyWindowMessage(This,hWnd,Msg,wParam,lParam) + +#define ISpRecoContext_SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackFunction(This,pfnCallback,wParam,lParam) + +#define ISpRecoContext_SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) \ + (This)->lpVtbl -> SetNotifyCallbackInterface(This,pSpCallback,wParam,lParam) + +#define ISpRecoContext_SetNotifyWin32Event(This) \ + (This)->lpVtbl -> SetNotifyWin32Event(This) + +#define ISpRecoContext_WaitForNotifyEvent(This,dwMilliseconds) \ + (This)->lpVtbl -> WaitForNotifyEvent(This,dwMilliseconds) + +#define ISpRecoContext_GetNotifyEventHandle(This) \ + (This)->lpVtbl -> GetNotifyEventHandle(This) + + +#define ISpRecoContext_SetInterest(This,ullEventInterest,ullQueuedInterest) \ + (This)->lpVtbl -> SetInterest(This,ullEventInterest,ullQueuedInterest) + +#define ISpRecoContext_GetEvents(This,ulCount,pEventArray,pulFetched) \ + (This)->lpVtbl -> GetEvents(This,ulCount,pEventArray,pulFetched) + +#define ISpRecoContext_GetInfo(This,pInfo) \ + (This)->lpVtbl -> GetInfo(This,pInfo) + + +#define ISpRecoContext_GetRecognizer(This,ppRecognizer) \ + (This)->lpVtbl -> GetRecognizer(This,ppRecognizer) + +#define ISpRecoContext_CreateGrammar(This,ullGrammarId,ppGrammar) \ + (This)->lpVtbl -> CreateGrammar(This,ullGrammarId,ppGrammar) + +#define ISpRecoContext_GetStatus(This,pStatus) \ + (This)->lpVtbl -> GetStatus(This,pStatus) + +#define ISpRecoContext_GetMaxAlternates(This,pcAlternates) \ + (This)->lpVtbl -> GetMaxAlternates(This,pcAlternates) + +#define ISpRecoContext_SetMaxAlternates(This,cAlternates) \ + (This)->lpVtbl -> SetMaxAlternates(This,cAlternates) + +#define ISpRecoContext_SetAudioOptions(This,Options,pAudioFormatId,pWaveFormatEx) \ + (This)->lpVtbl -> SetAudioOptions(This,Options,pAudioFormatId,pWaveFormatEx) + +#define ISpRecoContext_GetAudioOptions(This,pOptions,pAudioFormatId,ppCoMemWFEX) \ + (This)->lpVtbl -> GetAudioOptions(This,pOptions,pAudioFormatId,ppCoMemWFEX) + +#define ISpRecoContext_DeserializeResult(This,pSerializedResult,ppResult) \ + (This)->lpVtbl -> DeserializeResult(This,pSerializedResult,ppResult) + +#define ISpRecoContext_Bookmark(This,Options,ullStreamPosition,lparamEvent) \ + (This)->lpVtbl -> Bookmark(This,Options,ullStreamPosition,lparamEvent) + +#define ISpRecoContext_SetAdaptationData(This,pAdaptationData,cch) \ + (This)->lpVtbl -> SetAdaptationData(This,pAdaptationData,cch) + +#define ISpRecoContext_Pause(This,dwReserved) \ + (This)->lpVtbl -> Pause(This,dwReserved) + +#define ISpRecoContext_Resume(This,dwReserved) \ + (This)->lpVtbl -> Resume(This,dwReserved) + +#define ISpRecoContext_SetVoice(This,pVoice,fAllowFormatChanges) \ + (This)->lpVtbl -> SetVoice(This,pVoice,fAllowFormatChanges) + +#define ISpRecoContext_GetVoice(This,ppVoice) \ + (This)->lpVtbl -> GetVoice(This,ppVoice) + +#define ISpRecoContext_SetVoicePurgeEvent(This,ullEventInterest) \ + (This)->lpVtbl -> SetVoicePurgeEvent(This,ullEventInterest) + +#define ISpRecoContext_GetVoicePurgeEvent(This,pullEventInterest) \ + (This)->lpVtbl -> GetVoicePurgeEvent(This,pullEventInterest) + +#define ISpRecoContext_SetContextState(This,eContextState) \ + (This)->lpVtbl -> SetContextState(This,eContextState) + +#define ISpRecoContext_GetContextState(This,peContextState) \ + (This)->lpVtbl -> GetContextState(This,peContextState) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetRecognizer_Proxy( + ISpRecoContext * This, + /* [out] */ ISpRecognizer **ppRecognizer); + + +void __RPC_STUB ISpRecoContext_GetRecognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_CreateGrammar_Proxy( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullGrammarId, + /* [out] */ ISpRecoGrammar **ppGrammar); + + +void __RPC_STUB ISpRecoContext_CreateGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetStatus_Proxy( + ISpRecoContext * This, + /* [out] */ SPRECOCONTEXTSTATUS *pStatus); + + +void __RPC_STUB ISpRecoContext_GetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetMaxAlternates_Proxy( + ISpRecoContext * This, + /* [in] */ ULONG *pcAlternates); + + +void __RPC_STUB ISpRecoContext_GetMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetMaxAlternates_Proxy( + ISpRecoContext * This, + /* [in] */ ULONG cAlternates); + + +void __RPC_STUB ISpRecoContext_SetMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetAudioOptions_Proxy( + ISpRecoContext * This, + /* [in] */ SPAUDIOOPTIONS Options, + /* [in] */ const GUID *pAudioFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx); + + +void __RPC_STUB ISpRecoContext_SetAudioOptions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetAudioOptions_Proxy( + ISpRecoContext * This, + /* [in] */ SPAUDIOOPTIONS *pOptions, + /* [out] */ GUID *pAudioFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX); + + +void __RPC_STUB ISpRecoContext_GetAudioOptions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_DeserializeResult_Proxy( + ISpRecoContext * This, + /* [in] */ const SPSERIALIZEDRESULT *pSerializedResult, + /* [out] */ ISpRecoResult **ppResult); + + +void __RPC_STUB ISpRecoContext_DeserializeResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_Bookmark_Proxy( + ISpRecoContext * This, + /* [in] */ SPBOOKMARKOPTIONS Options, + /* [in] */ ULONGLONG ullStreamPosition, + /* [in] */ LPARAM lparamEvent); + + +void __RPC_STUB ISpRecoContext_Bookmark_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetAdaptationData_Proxy( + ISpRecoContext * This, + /* [string][in] */ const WCHAR *pAdaptationData, + /* [in] */ const ULONG cch); + + +void __RPC_STUB ISpRecoContext_SetAdaptationData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_Pause_Proxy( + ISpRecoContext * This, + DWORD dwReserved); + + +void __RPC_STUB ISpRecoContext_Pause_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_Resume_Proxy( + ISpRecoContext * This, + DWORD dwReserved); + + +void __RPC_STUB ISpRecoContext_Resume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetVoice_Proxy( + ISpRecoContext * This, + /* [in] */ ISpVoice *pVoice, + /* [in] */ BOOL fAllowFormatChanges); + + +void __RPC_STUB ISpRecoContext_SetVoice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetVoice_Proxy( + ISpRecoContext * This, + /* [out] */ ISpVoice **ppVoice); + + +void __RPC_STUB ISpRecoContext_GetVoice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetVoicePurgeEvent_Proxy( + ISpRecoContext * This, + /* [in] */ ULONGLONG ullEventInterest); + + +void __RPC_STUB ISpRecoContext_SetVoicePurgeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetVoicePurgeEvent_Proxy( + ISpRecoContext * This, + /* [out] */ ULONGLONG *pullEventInterest); + + +void __RPC_STUB ISpRecoContext_GetVoicePurgeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_SetContextState_Proxy( + ISpRecoContext * This, + /* [in] */ SPCONTEXTSTATE eContextState); + + +void __RPC_STUB ISpRecoContext_SetContextState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecoContext_GetContextState_Proxy( + ISpRecoContext * This, + /* [in] */ SPCONTEXTSTATE *peContextState); + + +void __RPC_STUB ISpRecoContext_GetContextState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRecoContext_INTERFACE_DEFINED__ */ + + +#ifndef __ISpProperties_INTERFACE_DEFINED__ +#define __ISpProperties_INTERFACE_DEFINED__ + +/* interface ISpProperties */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5B4FB971-B115-4DE1-AD97-E482E3BF6EE4") + ISpProperties : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetPropertyNum( + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyNum( + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *plValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPropertyString( + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyString( + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPropertiesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpProperties * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpProperties * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpProperties * This); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyNum )( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyNum )( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *plValue); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyString )( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyString )( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + END_INTERFACE + } ISpPropertiesVtbl; + + interface ISpProperties + { + CONST_VTBL struct ISpPropertiesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpProperties_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpProperties_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpProperties_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpProperties_SetPropertyNum(This,pName,lValue) \ + (This)->lpVtbl -> SetPropertyNum(This,pName,lValue) + +#define ISpProperties_GetPropertyNum(This,pName,plValue) \ + (This)->lpVtbl -> GetPropertyNum(This,pName,plValue) + +#define ISpProperties_SetPropertyString(This,pName,pValue) \ + (This)->lpVtbl -> SetPropertyString(This,pName,pValue) + +#define ISpProperties_GetPropertyString(This,pName,ppCoMemValue) \ + (This)->lpVtbl -> GetPropertyString(This,pName,ppCoMemValue) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpProperties_SetPropertyNum_Proxy( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + +void __RPC_STUB ISpProperties_SetPropertyNum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpProperties_GetPropertyNum_Proxy( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *plValue); + + +void __RPC_STUB ISpProperties_GetPropertyNum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpProperties_SetPropertyString_Proxy( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + +void __RPC_STUB ISpProperties_SetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpProperties_GetPropertyString_Proxy( + ISpProperties * This, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + +void __RPC_STUB ISpProperties_GetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpProperties_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapi_0281 */ +/* [local] */ + +#define SP_MAX_LANGIDS ( 20 ) + +typedef /* [hidden][restricted] */ struct SPRECOGNIZERSTATUS + { + SPAUDIOSTATUS AudioStatus; + ULONGLONG ullRecognitionStreamPos; + ULONG ulStreamNumber; + ULONG ulNumActive; + CLSID clsidEngine; + ULONG cLangIDs; + WORD aLangID[ 20 ]; + DWORD dwReserved1; + DWORD dwReserved2; + } SPRECOGNIZERSTATUS; + +typedef /* [hidden] */ +enum SPWAVEFORMATTYPE + { SPWF_INPUT = 0, + SPWF_SRENGINE = SPWF_INPUT + 1 + } SPSTREAMFORMATTYPE; + +typedef /* [hidden] */ +enum SPRECOSTATE + { SPRST_INACTIVE = 0, + SPRST_ACTIVE = SPRST_INACTIVE + 1, + SPRST_ACTIVE_ALWAYS = SPRST_ACTIVE + 1, + SPRST_INACTIVE_WITH_PURGE = SPRST_ACTIVE_ALWAYS + 1, + SPRST_NUM_STATES = SPRST_INACTIVE_WITH_PURGE + 1 + } SPRECOSTATE; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapi_0281_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapi_0281_v0_0_s_ifspec; + +#ifndef __ISpRecognizer_INTERFACE_DEFINED__ +#define __ISpRecognizer_INTERFACE_DEFINED__ + +/* interface ISpRecognizer */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpRecognizer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C2B5F241-DAA0-4507-9E16-5A1EAA2B7A5C") + ISpRecognizer : public ISpProperties + { + public: + virtual HRESULT STDMETHODCALLTYPE SetRecognizer( + /* [in] */ ISpObjectToken *pRecognizer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecognizer( + /* [out] */ ISpObjectToken **ppRecognizer) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetInput( + /* [in] */ IUnknown *pUnkInput, + /* [in] */ BOOL fAllowFormatChanges) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInputObjectToken( + /* [out] */ ISpObjectToken **ppToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInputStream( + /* [out] */ ISpStreamFormat **ppStream) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateRecoContext( + /* [out] */ ISpRecoContext **ppNewCtxt) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecoProfile( + /* [out] */ ISpObjectToken **ppToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRecoProfile( + /* [in] */ ISpObjectToken *pToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsSharedInstance( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRecoState( + /* [out] */ SPRECOSTATE *pState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRecoState( + /* [in] */ SPRECOSTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStatus( + /* [out] */ SPRECOGNIZERSTATUS *pStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFormat( + /* [in] */ SPSTREAMFORMATTYPE WaveFormatType, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData) = 0; + + virtual HRESULT STDMETHODCALLTYPE EmulateRecognition( + /* [in] */ ISpPhrase *pPhrase) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpRecognizerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpRecognizer * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpRecognizer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyNum )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyNum )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *plValue); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyString )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyString )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + HRESULT ( STDMETHODCALLTYPE *SetRecognizer )( + ISpRecognizer * This, + /* [in] */ ISpObjectToken *pRecognizer); + + HRESULT ( STDMETHODCALLTYPE *GetRecognizer )( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppRecognizer); + + HRESULT ( STDMETHODCALLTYPE *SetInput )( + ISpRecognizer * This, + /* [in] */ IUnknown *pUnkInput, + /* [in] */ BOOL fAllowFormatChanges); + + HRESULT ( STDMETHODCALLTYPE *GetInputObjectToken )( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *GetInputStream )( + ISpRecognizer * This, + /* [out] */ ISpStreamFormat **ppStream); + + HRESULT ( STDMETHODCALLTYPE *CreateRecoContext )( + ISpRecognizer * This, + /* [out] */ ISpRecoContext **ppNewCtxt); + + HRESULT ( STDMETHODCALLTYPE *GetRecoProfile )( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *SetRecoProfile )( + ISpRecognizer * This, + /* [in] */ ISpObjectToken *pToken); + + HRESULT ( STDMETHODCALLTYPE *IsSharedInstance )( + ISpRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *GetRecoState )( + ISpRecognizer * This, + /* [out] */ SPRECOSTATE *pState); + + HRESULT ( STDMETHODCALLTYPE *SetRecoState )( + ISpRecognizer * This, + /* [in] */ SPRECOSTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *GetStatus )( + ISpRecognizer * This, + /* [out] */ SPRECOGNIZERSTATUS *pStatus); + + HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpRecognizer * This, + /* [in] */ SPSTREAMFORMATTYPE WaveFormatType, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpRecognizer * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpRecognizer * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData); + + HRESULT ( STDMETHODCALLTYPE *EmulateRecognition )( + ISpRecognizer * This, + /* [in] */ ISpPhrase *pPhrase); + + END_INTERFACE + } ISpRecognizerVtbl; + + interface ISpRecognizer + { + CONST_VTBL struct ISpRecognizerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpRecognizer_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpRecognizer_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpRecognizer_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpRecognizer_SetPropertyNum(This,pName,lValue) \ + (This)->lpVtbl -> SetPropertyNum(This,pName,lValue) + +#define ISpRecognizer_GetPropertyNum(This,pName,plValue) \ + (This)->lpVtbl -> GetPropertyNum(This,pName,plValue) + +#define ISpRecognizer_SetPropertyString(This,pName,pValue) \ + (This)->lpVtbl -> SetPropertyString(This,pName,pValue) + +#define ISpRecognizer_GetPropertyString(This,pName,ppCoMemValue) \ + (This)->lpVtbl -> GetPropertyString(This,pName,ppCoMemValue) + + +#define ISpRecognizer_SetRecognizer(This,pRecognizer) \ + (This)->lpVtbl -> SetRecognizer(This,pRecognizer) + +#define ISpRecognizer_GetRecognizer(This,ppRecognizer) \ + (This)->lpVtbl -> GetRecognizer(This,ppRecognizer) + +#define ISpRecognizer_SetInput(This,pUnkInput,fAllowFormatChanges) \ + (This)->lpVtbl -> SetInput(This,pUnkInput,fAllowFormatChanges) + +#define ISpRecognizer_GetInputObjectToken(This,ppToken) \ + (This)->lpVtbl -> GetInputObjectToken(This,ppToken) + +#define ISpRecognizer_GetInputStream(This,ppStream) \ + (This)->lpVtbl -> GetInputStream(This,ppStream) + +#define ISpRecognizer_CreateRecoContext(This,ppNewCtxt) \ + (This)->lpVtbl -> CreateRecoContext(This,ppNewCtxt) + +#define ISpRecognizer_GetRecoProfile(This,ppToken) \ + (This)->lpVtbl -> GetRecoProfile(This,ppToken) + +#define ISpRecognizer_SetRecoProfile(This,pToken) \ + (This)->lpVtbl -> SetRecoProfile(This,pToken) + +#define ISpRecognizer_IsSharedInstance(This) \ + (This)->lpVtbl -> IsSharedInstance(This) + +#define ISpRecognizer_GetRecoState(This,pState) \ + (This)->lpVtbl -> GetRecoState(This,pState) + +#define ISpRecognizer_SetRecoState(This,NewState) \ + (This)->lpVtbl -> SetRecoState(This,NewState) + +#define ISpRecognizer_GetStatus(This,pStatus) \ + (This)->lpVtbl -> GetStatus(This,pStatus) + +#define ISpRecognizer_GetFormat(This,WaveFormatType,pFormatId,ppCoMemWFEX) \ + (This)->lpVtbl -> GetFormat(This,WaveFormatType,pFormatId,ppCoMemWFEX) + +#define ISpRecognizer_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,pfSupported) + +#define ISpRecognizer_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData) + +#define ISpRecognizer_EmulateRecognition(This,pPhrase) \ + (This)->lpVtbl -> EmulateRecognition(This,pPhrase) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_SetRecognizer_Proxy( + ISpRecognizer * This, + /* [in] */ ISpObjectToken *pRecognizer); + + +void __RPC_STUB ISpRecognizer_SetRecognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetRecognizer_Proxy( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppRecognizer); + + +void __RPC_STUB ISpRecognizer_GetRecognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_SetInput_Proxy( + ISpRecognizer * This, + /* [in] */ IUnknown *pUnkInput, + /* [in] */ BOOL fAllowFormatChanges); + + +void __RPC_STUB ISpRecognizer_SetInput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetInputObjectToken_Proxy( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppToken); + + +void __RPC_STUB ISpRecognizer_GetInputObjectToken_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetInputStream_Proxy( + ISpRecognizer * This, + /* [out] */ ISpStreamFormat **ppStream); + + +void __RPC_STUB ISpRecognizer_GetInputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_CreateRecoContext_Proxy( + ISpRecognizer * This, + /* [out] */ ISpRecoContext **ppNewCtxt); + + +void __RPC_STUB ISpRecognizer_CreateRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetRecoProfile_Proxy( + ISpRecognizer * This, + /* [out] */ ISpObjectToken **ppToken); + + +void __RPC_STUB ISpRecognizer_GetRecoProfile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_SetRecoProfile_Proxy( + ISpRecognizer * This, + /* [in] */ ISpObjectToken *pToken); + + +void __RPC_STUB ISpRecognizer_SetRecoProfile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_IsSharedInstance_Proxy( + ISpRecognizer * This); + + +void __RPC_STUB ISpRecognizer_IsSharedInstance_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetRecoState_Proxy( + ISpRecognizer * This, + /* [out] */ SPRECOSTATE *pState); + + +void __RPC_STUB ISpRecognizer_GetRecoState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_SetRecoState_Proxy( + ISpRecognizer * This, + /* [in] */ SPRECOSTATE NewState); + + +void __RPC_STUB ISpRecognizer_SetRecoState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetStatus_Proxy( + ISpRecognizer * This, + /* [out] */ SPRECOGNIZERSTATUS *pStatus); + + +void __RPC_STUB ISpRecognizer_GetStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_GetFormat_Proxy( + ISpRecognizer * This, + /* [in] */ SPSTREAMFORMATTYPE WaveFormatType, + /* [out] */ GUID *pFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemWFEX); + + +void __RPC_STUB ISpRecognizer_GetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpRecognizer_IsUISupported_Proxy( + ISpRecognizer * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [out] */ BOOL *pfSupported); + + +void __RPC_STUB ISpRecognizer_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpRecognizer_DisplayUI_Proxy( + ISpRecognizer * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData); + + +void __RPC_STUB ISpRecognizer_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpRecognizer_EmulateRecognition_Proxy( + ISpRecognizer * This, + /* [in] */ ISpPhrase *pPhrase); + + +void __RPC_STUB ISpRecognizer_EmulateRecognition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpRecognizer_INTERFACE_DEFINED__ */ + + + +#ifndef __SpeechLib_LIBRARY_DEFINED__ +#define __SpeechLib_LIBRARY_DEFINED__ + +/* library SpeechLib */ +/* [version][uuid][helpstring] */ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +typedef long SpeechLanguageId; + +#define __SpeechStringConstants_MODULE_DEFINED__ +typedef /* [hidden] */ +enum DISPID_SpeechDataKey + { DISPID_SDKSetBinaryValue = 1, + DISPID_SDKGetBinaryValue = DISPID_SDKSetBinaryValue + 1, + DISPID_SDKSetStringValue = DISPID_SDKGetBinaryValue + 1, + DISPID_SDKGetStringValue = DISPID_SDKSetStringValue + 1, + DISPID_SDKSetLongValue = DISPID_SDKGetStringValue + 1, + DISPID_SDKGetlongValue = DISPID_SDKSetLongValue + 1, + DISPID_SDKOpenKey = DISPID_SDKGetlongValue + 1, + DISPID_SDKCreateKey = DISPID_SDKOpenKey + 1, + DISPID_SDKDeleteKey = DISPID_SDKCreateKey + 1, + DISPID_SDKDeleteValue = DISPID_SDKDeleteKey + 1, + DISPID_SDKEnumKeys = DISPID_SDKDeleteValue + 1, + DISPID_SDKEnumValues = DISPID_SDKEnumKeys + 1 + } DISPID_SpeechDataKey; + +typedef /* [hidden] */ +enum DISPID_SpeechObjectToken + { DISPID_SOTId = 1, + DISPID_SOTDataKey = DISPID_SOTId + 1, + DISPID_SOTCategory = DISPID_SOTDataKey + 1, + DISPID_SOTGetDescription = DISPID_SOTCategory + 1, + DISPID_SOTSetId = DISPID_SOTGetDescription + 1, + DISPID_SOTGetAttribute = DISPID_SOTSetId + 1, + DISPID_SOTCreateInstance = DISPID_SOTGetAttribute + 1, + DISPID_SOTRemove = DISPID_SOTCreateInstance + 1, + DISPID_SOTGetStorageFileName = DISPID_SOTRemove + 1, + DISPID_SOTRemoveStorageFileName = DISPID_SOTGetStorageFileName + 1, + DISPID_SOTIsUISupported = DISPID_SOTRemoveStorageFileName + 1, + DISPID_SOTDisplayUI = DISPID_SOTIsUISupported + 1, + DISPID_SOTMatchesAttributes = DISPID_SOTDisplayUI + 1 + } DISPID_SpeechObjectToken; + +typedef +enum SpeechDataKeyLocation + { SDKLDefaultLocation = SPDKL_DefaultLocation, + SDKLCurrentUser = SPDKL_CurrentUser, + SDKLLocalMachine = SPDKL_LocalMachine, + SDKLCurrentConfig = SPDKL_CurrentConfig + } SpeechDataKeyLocation; + +typedef +enum SpeechTokenContext + { STCInprocServer = CLSCTX_INPROC_SERVER, + STCInprocHandler = CLSCTX_INPROC_HANDLER, + STCLocalServer = CLSCTX_LOCAL_SERVER, + STCRemoteServer = CLSCTX_REMOTE_SERVER, + STCAll = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER + } SpeechTokenContext; + +typedef +enum SpeechTokenShellFolder + { STSF_AppData = 0x1a, + STSF_LocalAppData = 0x1c, + STSF_CommonAppData = 0x23, + STSF_FlagCreate = 0x8000 + } SpeechTokenShellFolder; + +typedef /* [hidden] */ +enum DISPID_SpeechObjectTokens + { DISPID_SOTsCount = 1, + DISPID_SOTsItem = DISPID_VALUE, + DISPID_SOTs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechObjectTokens; + +typedef /* [hidden] */ +enum DISPID_SpeechObjectTokenCategory + { DISPID_SOTCId = 1, + DISPID_SOTCDefault = DISPID_SOTCId + 1, + DISPID_SOTCSetId = DISPID_SOTCDefault + 1, + DISPID_SOTCGetDataKey = DISPID_SOTCSetId + 1, + DISPID_SOTCEnumerateTokens = DISPID_SOTCGetDataKey + 1 + } DISPID_SpeechObjectTokenCategory; + +typedef +enum SpeechAudioFormatType + { SAFTDefault = -1, + SAFTNoAssignedFormat = 0, + SAFTText = SAFTNoAssignedFormat + 1, + SAFTNonStandardFormat = SAFTText + 1, + SAFTExtendedAudioFormat = SAFTNonStandardFormat + 1, + SAFT8kHz8BitMono = SAFTExtendedAudioFormat + 1, + SAFT8kHz8BitStereo = SAFT8kHz8BitMono + 1, + SAFT8kHz16BitMono = SAFT8kHz8BitStereo + 1, + SAFT8kHz16BitStereo = SAFT8kHz16BitMono + 1, + SAFT11kHz8BitMono = SAFT8kHz16BitStereo + 1, + SAFT11kHz8BitStereo = SAFT11kHz8BitMono + 1, + SAFT11kHz16BitMono = SAFT11kHz8BitStereo + 1, + SAFT11kHz16BitStereo = SAFT11kHz16BitMono + 1, + SAFT12kHz8BitMono = SAFT11kHz16BitStereo + 1, + SAFT12kHz8BitStereo = SAFT12kHz8BitMono + 1, + SAFT12kHz16BitMono = SAFT12kHz8BitStereo + 1, + SAFT12kHz16BitStereo = SAFT12kHz16BitMono + 1, + SAFT16kHz8BitMono = SAFT12kHz16BitStereo + 1, + SAFT16kHz8BitStereo = SAFT16kHz8BitMono + 1, + SAFT16kHz16BitMono = SAFT16kHz8BitStereo + 1, + SAFT16kHz16BitStereo = SAFT16kHz16BitMono + 1, + SAFT22kHz8BitMono = SAFT16kHz16BitStereo + 1, + SAFT22kHz8BitStereo = SAFT22kHz8BitMono + 1, + SAFT22kHz16BitMono = SAFT22kHz8BitStereo + 1, + SAFT22kHz16BitStereo = SAFT22kHz16BitMono + 1, + SAFT24kHz8BitMono = SAFT22kHz16BitStereo + 1, + SAFT24kHz8BitStereo = SAFT24kHz8BitMono + 1, + SAFT24kHz16BitMono = SAFT24kHz8BitStereo + 1, + SAFT24kHz16BitStereo = SAFT24kHz16BitMono + 1, + SAFT32kHz8BitMono = SAFT24kHz16BitStereo + 1, + SAFT32kHz8BitStereo = SAFT32kHz8BitMono + 1, + SAFT32kHz16BitMono = SAFT32kHz8BitStereo + 1, + SAFT32kHz16BitStereo = SAFT32kHz16BitMono + 1, + SAFT44kHz8BitMono = SAFT32kHz16BitStereo + 1, + SAFT44kHz8BitStereo = SAFT44kHz8BitMono + 1, + SAFT44kHz16BitMono = SAFT44kHz8BitStereo + 1, + SAFT44kHz16BitStereo = SAFT44kHz16BitMono + 1, + SAFT48kHz8BitMono = SAFT44kHz16BitStereo + 1, + SAFT48kHz8BitStereo = SAFT48kHz8BitMono + 1, + SAFT48kHz16BitMono = SAFT48kHz8BitStereo + 1, + SAFT48kHz16BitStereo = SAFT48kHz16BitMono + 1, + SAFTTrueSpeech_8kHz1BitMono = SAFT48kHz16BitStereo + 1, + SAFTCCITT_ALaw_8kHzMono = SAFTTrueSpeech_8kHz1BitMono + 1, + SAFTCCITT_ALaw_8kHzStereo = SAFTCCITT_ALaw_8kHzMono + 1, + SAFTCCITT_ALaw_11kHzMono = SAFTCCITT_ALaw_8kHzStereo + 1, + SAFTCCITT_ALaw_11kHzStereo = SAFTCCITT_ALaw_11kHzMono + 1, + SAFTCCITT_ALaw_22kHzMono = SAFTCCITT_ALaw_11kHzStereo + 1, + SAFTCCITT_ALaw_22kHzStereo = SAFTCCITT_ALaw_22kHzMono + 1, + SAFTCCITT_ALaw_44kHzMono = SAFTCCITT_ALaw_22kHzStereo + 1, + SAFTCCITT_ALaw_44kHzStereo = SAFTCCITT_ALaw_44kHzMono + 1, + SAFTCCITT_uLaw_8kHzMono = SAFTCCITT_ALaw_44kHzStereo + 1, + SAFTCCITT_uLaw_8kHzStereo = SAFTCCITT_uLaw_8kHzMono + 1, + SAFTCCITT_uLaw_11kHzMono = SAFTCCITT_uLaw_8kHzStereo + 1, + SAFTCCITT_uLaw_11kHzStereo = SAFTCCITT_uLaw_11kHzMono + 1, + SAFTCCITT_uLaw_22kHzMono = SAFTCCITT_uLaw_11kHzStereo + 1, + SAFTCCITT_uLaw_22kHzStereo = SAFTCCITT_uLaw_22kHzMono + 1, + SAFTCCITT_uLaw_44kHzMono = SAFTCCITT_uLaw_22kHzStereo + 1, + SAFTCCITT_uLaw_44kHzStereo = SAFTCCITT_uLaw_44kHzMono + 1, + SAFTADPCM_8kHzMono = SAFTCCITT_uLaw_44kHzStereo + 1, + SAFTADPCM_8kHzStereo = SAFTADPCM_8kHzMono + 1, + SAFTADPCM_11kHzMono = SAFTADPCM_8kHzStereo + 1, + SAFTADPCM_11kHzStereo = SAFTADPCM_11kHzMono + 1, + SAFTADPCM_22kHzMono = SAFTADPCM_11kHzStereo + 1, + SAFTADPCM_22kHzStereo = SAFTADPCM_22kHzMono + 1, + SAFTADPCM_44kHzMono = SAFTADPCM_22kHzStereo + 1, + SAFTADPCM_44kHzStereo = SAFTADPCM_44kHzMono + 1, + SAFTGSM610_8kHzMono = SAFTADPCM_44kHzStereo + 1, + SAFTGSM610_11kHzMono = SAFTGSM610_8kHzMono + 1, + SAFTGSM610_22kHzMono = SAFTGSM610_11kHzMono + 1, + SAFTGSM610_44kHzMono = SAFTGSM610_22kHzMono + 1 + } SpeechAudioFormatType; + +typedef /* [hidden] */ +enum DISPID_SpeechAudioFormat + { DISPID_SAFType = 1, + DISPID_SAFGuid = DISPID_SAFType + 1, + DISPID_SAFGetWaveFormatEx = DISPID_SAFGuid + 1, + DISPID_SAFSetWaveFormatEx = DISPID_SAFGetWaveFormatEx + 1 + } DISPID_SpeechAudioFormat; + +typedef /* [hidden] */ +enum DISPID_SpeechBaseStream + { DISPID_SBSFormat = 1, + DISPID_SBSRead = DISPID_SBSFormat + 1, + DISPID_SBSWrite = DISPID_SBSRead + 1, + DISPID_SBSSeek = DISPID_SBSWrite + 1 + } DISPID_SpeechBaseStream; + +typedef +enum SpeechStreamSeekPositionType + { SSSPTRelativeToStart = STREAM_SEEK_SET, + SSSPTRelativeToCurrentPosition = STREAM_SEEK_CUR, + SSSPTRelativeToEnd = STREAM_SEEK_END + } SpeechStreamSeekPositionType; + +typedef /* [hidden] */ +enum DISPID_SpeechAudio + { DISPID_SAStatus = 200, + DISPID_SABufferInfo = DISPID_SAStatus + 1, + DISPID_SADefaultFormat = DISPID_SABufferInfo + 1, + DISPID_SAVolume = DISPID_SADefaultFormat + 1, + DISPID_SABufferNotifySize = DISPID_SAVolume + 1, + DISPID_SAEventHandle = DISPID_SABufferNotifySize + 1, + DISPID_SASetState = DISPID_SAEventHandle + 1 + } DISPID_SpeechAudio; + +typedef +enum SpeechAudioState + { SASClosed = SPAS_CLOSED, + SASStop = SPAS_STOP, + SASPause = SPAS_PAUSE, + SASRun = SPAS_RUN + } SpeechAudioState; + +typedef /* [hidden] */ +enum DISPID_SpeechMMSysAudio + { DISPID_SMSADeviceId = 300, + DISPID_SMSALineId = DISPID_SMSADeviceId + 1, + DISPID_SMSAMMHandle = DISPID_SMSALineId + 1 + } DISPID_SpeechMMSysAudio; + +typedef /* [hidden] */ +enum DISPID_SpeechFileStream + { DISPID_SFSOpen = 100, + DISPID_SFSClose = DISPID_SFSOpen + 1 + } DISPID_SpeechFileStream; + +typedef +enum SpeechStreamFileMode + { SSFMOpenForRead = SPFM_OPEN_READONLY, + SSFMOpenReadWrite = SPFM_OPEN_READWRITE, + SSFMCreate = SPFM_CREATE, + SSFMCreateForWrite = SPFM_CREATE_ALWAYS + } SpeechStreamFileMode; + +typedef /* [hidden] */ +enum DISPID_SpeechCustomStream + { DISPID_SCSBaseStream = 100 + } DISPID_SpeechCustomStream; + +typedef /* [hidden] */ +enum DISPID_SpeechMemoryStream + { DISPID_SMSSetData = 100, + DISPID_SMSGetData = DISPID_SMSSetData + 1 + } DISPID_SpeechMemoryStream; + +typedef /* [hidden] */ +enum DISPID_SpeechAudioStatus + { DISPID_SASFreeBufferSpace = 1, + DISPID_SASNonBlockingIO = DISPID_SASFreeBufferSpace + 1, + DISPID_SASState = DISPID_SASNonBlockingIO + 1, + DISPID_SASCurrentSeekPosition = DISPID_SASState + 1, + DISPID_SASCurrentDevicePosition = DISPID_SASCurrentSeekPosition + 1 + } DISPID_SpeechAudioStatus; + +typedef /* [hidden] */ +enum DISPID_SpeechAudioBufferInfo + { DISPID_SABIMinNotification = 1, + DISPID_SABIBufferSize = DISPID_SABIMinNotification + 1, + DISPID_SABIEventBias = DISPID_SABIBufferSize + 1 + } DISPID_SpeechAudioBufferInfo; + +typedef /* [hidden] */ +enum DISPID_SpeechWaveFormatEx + { DISPID_SWFEFormatTag = 1, + DISPID_SWFEChannels = DISPID_SWFEFormatTag + 1, + DISPID_SWFESamplesPerSec = DISPID_SWFEChannels + 1, + DISPID_SWFEAvgBytesPerSec = DISPID_SWFESamplesPerSec + 1, + DISPID_SWFEBlockAlign = DISPID_SWFEAvgBytesPerSec + 1, + DISPID_SWFEBitsPerSample = DISPID_SWFEBlockAlign + 1, + DISPID_SWFEExtraData = DISPID_SWFEBitsPerSample + 1 + } DISPID_SpeechWaveFormatEx; + +typedef /* [hidden] */ +enum DISPID_SpeechVoice + { DISPID_SVStatus = 1, + DISPID_SVVoice = DISPID_SVStatus + 1, + DISPID_SVAudioOutput = DISPID_SVVoice + 1, + DISPID_SVAudioOutputStream = DISPID_SVAudioOutput + 1, + DISPID_SVRate = DISPID_SVAudioOutputStream + 1, + DISPID_SVVolume = DISPID_SVRate + 1, + DISPID_SVAllowAudioOuputFormatChangesOnNextSet = DISPID_SVVolume + 1, + DISPID_SVEventInterests = DISPID_SVAllowAudioOuputFormatChangesOnNextSet + 1, + DISPID_SVPriority = DISPID_SVEventInterests + 1, + DISPID_SVAlertBoundary = DISPID_SVPriority + 1, + DISPID_SVSyncronousSpeakTimeout = DISPID_SVAlertBoundary + 1, + DISPID_SVSpeak = DISPID_SVSyncronousSpeakTimeout + 1, + DISPID_SVSpeakStream = DISPID_SVSpeak + 1, + DISPID_SVPause = DISPID_SVSpeakStream + 1, + DISPID_SVResume = DISPID_SVPause + 1, + DISPID_SVSkip = DISPID_SVResume + 1, + DISPID_SVGetVoices = DISPID_SVSkip + 1, + DISPID_SVGetAudioOutputs = DISPID_SVGetVoices + 1, + DISPID_SVWaitUntilDone = DISPID_SVGetAudioOutputs + 1, + DISPID_SVSpeakCompleteEvent = DISPID_SVWaitUntilDone + 1, + DISPID_SVIsUISupported = DISPID_SVSpeakCompleteEvent + 1, + DISPID_SVDisplayUI = DISPID_SVIsUISupported + 1 + } DISPID_SpeechVoice; + +typedef +enum SpeechVoicePriority + { SVPNormal = SPVPRI_NORMAL, + SVPAlert = SPVPRI_ALERT, + SVPOver = SPVPRI_OVER + } SpeechVoicePriority; + +typedef +enum SpeechVoiceSpeakFlags + { SVSFDefault = SPF_DEFAULT, + SVSFlagsAsync = SPF_ASYNC, + SVSFPurgeBeforeSpeak = SPF_PURGEBEFORESPEAK, + SVSFIsFilename = SPF_IS_FILENAME, + SVSFIsXML = SPF_IS_XML, + SVSFIsNotXML = SPF_IS_NOT_XML, + SVSFPersistXML = SPF_PERSIST_XML, + SVSFNLPSpeakPunc = SPF_NLP_SPEAK_PUNC, + SVSFNLPMask = SPF_NLP_MASK, + SVSFVoiceMask = SPF_VOICE_MASK, + SVSFUnusedFlags = SPF_UNUSED_FLAGS + } SpeechVoiceSpeakFlags; + +typedef +enum SpeechVoiceEvents + { SVEStartInputStream = 1L << 1, + SVEEndInputStream = 1L << 2, + SVEVoiceChange = 1L << 3, + SVEBookmark = 1L << 4, + SVEWordBoundary = 1L << 5, + SVEPhoneme = 1L << 6, + SVESentenceBoundary = 1L << 7, + SVEViseme = 1L << 8, + SVEAudioLevel = 1L << 9, + SVEPrivate = 1L << 15, + SVEAllEvents = 0x83fe + } SpeechVoiceEvents; + +typedef /* [hidden] */ +enum DISPID_SpeechVoiceStatus + { DISPID_SVSCurrentStreamNumber = 1, + DISPID_SVSLastStreamNumberQueued = DISPID_SVSCurrentStreamNumber + 1, + DISPID_SVSLastResult = DISPID_SVSLastStreamNumberQueued + 1, + DISPID_SVSRunningState = DISPID_SVSLastResult + 1, + DISPID_SVSInputWordPosition = DISPID_SVSRunningState + 1, + DISPID_SVSInputWordLength = DISPID_SVSInputWordPosition + 1, + DISPID_SVSInputSentencePosition = DISPID_SVSInputWordLength + 1, + DISPID_SVSInputSentenceLength = DISPID_SVSInputSentencePosition + 1, + DISPID_SVSLastBookmark = DISPID_SVSInputSentenceLength + 1, + DISPID_SVSLastBookmarkId = DISPID_SVSLastBookmark + 1, + DISPID_SVSPhonemeId = DISPID_SVSLastBookmarkId + 1, + DISPID_SVSVisemeId = DISPID_SVSPhonemeId + 1 + } DISPID_SpeechVoiceStatus; + +typedef +enum SpeechRunState + { SRSEDone = SPRS_DONE, + SRSEIsSpeaking = SPRS_IS_SPEAKING + } SpeechRunState; + +typedef +enum SpeechVisemeType + { SVP_0 = 0, + SVP_1 = SVP_0 + 1, + SVP_2 = SVP_1 + 1, + SVP_3 = SVP_2 + 1, + SVP_4 = SVP_3 + 1, + SVP_5 = SVP_4 + 1, + SVP_6 = SVP_5 + 1, + SVP_7 = SVP_6 + 1, + SVP_8 = SVP_7 + 1, + SVP_9 = SVP_8 + 1, + SVP_10 = SVP_9 + 1, + SVP_11 = SVP_10 + 1, + SVP_12 = SVP_11 + 1, + SVP_13 = SVP_12 + 1, + SVP_14 = SVP_13 + 1, + SVP_15 = SVP_14 + 1, + SVP_16 = SVP_15 + 1, + SVP_17 = SVP_16 + 1, + SVP_18 = SVP_17 + 1, + SVP_19 = SVP_18 + 1, + SVP_20 = SVP_19 + 1, + SVP_21 = SVP_20 + 1 + } SpeechVisemeType; + +typedef +enum SpeechVisemeFeature + { SVF_None = 0, + SVF_Stressed = SPVFEATURE_STRESSED, + SVF_Emphasis = SPVFEATURE_EMPHASIS + } SpeechVisemeFeature; + +typedef /* [hidden] */ +enum DISPID_SpeechVoiceEvent + { DISPID_SVEStreamStart = 1, + DISPID_SVEStreamEnd = DISPID_SVEStreamStart + 1, + DISPID_SVEVoiceChange = DISPID_SVEStreamEnd + 1, + DISPID_SVEBookmark = DISPID_SVEVoiceChange + 1, + DISPID_SVEWord = DISPID_SVEBookmark + 1, + DISPID_SVEPhoneme = DISPID_SVEWord + 1, + DISPID_SVESentenceBoundary = DISPID_SVEPhoneme + 1, + DISPID_SVEViseme = DISPID_SVESentenceBoundary + 1, + DISPID_SVEAudioLevel = DISPID_SVEViseme + 1, + DISPID_SVEEnginePrivate = DISPID_SVEAudioLevel + 1 + } DISPID_SpeechVoiceEvent; + +typedef /* [hidden] */ +enum DISPID_SpeechRecognizer + { DISPID_SRRecognizer = 1, + DISPID_SRAllowAudioInputFormatChangesOnNextSet = DISPID_SRRecognizer + 1, + DISPID_SRAudioInput = DISPID_SRAllowAudioInputFormatChangesOnNextSet + 1, + DISPID_SRAudioInputStream = DISPID_SRAudioInput + 1, + DISPID_SRIsShared = DISPID_SRAudioInputStream + 1, + DISPID_SRState = DISPID_SRIsShared + 1, + DISPID_SRStatus = DISPID_SRState + 1, + DISPID_SRProfile = DISPID_SRStatus + 1, + DISPID_SREmulateRecognition = DISPID_SRProfile + 1, + DISPID_SRCreateRecoContext = DISPID_SREmulateRecognition + 1, + DISPID_SRGetFormat = DISPID_SRCreateRecoContext + 1, + DISPID_SRSetPropertyNumber = DISPID_SRGetFormat + 1, + DISPID_SRGetPropertyNumber = DISPID_SRSetPropertyNumber + 1, + DISPID_SRSetPropertyString = DISPID_SRGetPropertyNumber + 1, + DISPID_SRGetPropertyString = DISPID_SRSetPropertyString + 1, + DISPID_SRIsUISupported = DISPID_SRGetPropertyString + 1, + DISPID_SRDisplayUI = DISPID_SRIsUISupported + 1, + DISPID_SRGetRecognizers = DISPID_SRDisplayUI + 1, + DISPID_SVGetAudioInputs = DISPID_SRGetRecognizers + 1, + DISPID_SVGetProfiles = DISPID_SVGetAudioInputs + 1 + } DISPID_SpeechRecognizer; + +typedef +enum SpeechRecognizerState + { SRSInactive = SPRST_INACTIVE, + SRSActive = SPRST_ACTIVE, + SRSActiveAlways = SPRST_ACTIVE_ALWAYS, + SRSInactiveWithPurge = SPRST_INACTIVE_WITH_PURGE + } SpeechRecognizerState; + +typedef +enum SpeechDisplayAttributes + { SDA_No_Trailing_Space = 0, + SDA_One_Trailing_Space = SPAF_ONE_TRAILING_SPACE, + SDA_Two_Trailing_Spaces = SPAF_TWO_TRAILING_SPACES, + SDA_Consume_Leading_Spaces = SPAF_CONSUME_LEADING_SPACES + } SpeechDisplayAttributes; + +typedef +enum SpeechFormatType + { SFTInput = SPWF_INPUT, + SFTSREngine = SPWF_SRENGINE + } SpeechFormatType; + +typedef /* [hidden] */ +enum DISPID_SpeechRecognizerStatus + { DISPID_SRSAudioStatus = 1, + DISPID_SRSCurrentStreamPosition = DISPID_SRSAudioStatus + 1, + DISPID_SRSCurrentStreamNumber = DISPID_SRSCurrentStreamPosition + 1, + DISPID_SRSNumberOfActiveRules = DISPID_SRSCurrentStreamNumber + 1, + DISPID_SRSClsidEngine = DISPID_SRSNumberOfActiveRules + 1, + DISPID_SRSSupportedLanguages = DISPID_SRSClsidEngine + 1 + } DISPID_SpeechRecognizerStatus; + +typedef /* [hidden] */ +enum DISPID_SpeechRecoContext + { DISPID_SRCRecognizer = 1, + DISPID_SRCAudioInInterferenceStatus = DISPID_SRCRecognizer + 1, + DISPID_SRCRequestedUIType = DISPID_SRCAudioInInterferenceStatus + 1, + DISPID_SRCVoice = DISPID_SRCRequestedUIType + 1, + DISPID_SRAllowVoiceFormatMatchingOnNextSet = DISPID_SRCVoice + 1, + DISPID_SRCVoicePurgeEvent = DISPID_SRAllowVoiceFormatMatchingOnNextSet + 1, + DISPID_SRCEventInterests = DISPID_SRCVoicePurgeEvent + 1, + DISPID_SRCCmdMaxAlternates = DISPID_SRCEventInterests + 1, + DISPID_SRCState = DISPID_SRCCmdMaxAlternates + 1, + DISPID_SRCRetainedAudio = DISPID_SRCState + 1, + DISPID_SRCRetainedAudioFormat = DISPID_SRCRetainedAudio + 1, + DISPID_SRCPause = DISPID_SRCRetainedAudioFormat + 1, + DISPID_SRCResume = DISPID_SRCPause + 1, + DISPID_SRCCreateGrammar = DISPID_SRCResume + 1, + DISPID_SRCCreateResultFromMemory = DISPID_SRCCreateGrammar + 1, + DISPID_SRCBookmark = DISPID_SRCCreateResultFromMemory + 1, + DISPID_SRCSetAdaptationData = DISPID_SRCBookmark + 1 + } DISPID_SpeechRecoContext; + +typedef +enum SpeechRetainedAudioOptions + { SRAONone = SPAO_NONE, + SRAORetainAudio = SPAO_RETAIN_AUDIO + } SpeechRetainedAudioOptions; + +typedef +enum SpeechBookmarkOptions + { SBONone = SPBO_NONE, + SBOPause = SPBO_PAUSE + } SpeechBookmarkOptions; + +typedef +enum SpeechInterference + { SINone = SPINTERFERENCE_NONE, + SINoise = SPINTERFERENCE_NOISE, + SINoSignal = SPINTERFERENCE_NOSIGNAL, + SITooLoud = SPINTERFERENCE_TOOLOUD, + SITooQuiet = SPINTERFERENCE_TOOQUIET, + SITooFast = SPINTERFERENCE_TOOFAST, + SITooSlow = SPINTERFERENCE_TOOSLOW + } SpeechInterference; + +typedef +enum SpeechRecoEvents + { SREStreamEnd = 1L << 0, + SRESoundStart = 1L << 1, + SRESoundEnd = 1L << 2, + SREPhraseStart = 1L << 3, + SRERecognition = 1L << 4, + SREHypothesis = 1L << 5, + SREBookmark = 1L << 6, + SREPropertyNumChange = 1L << 7, + SREPropertyStringChange = 1L << 8, + SREFalseRecognition = 1L << 9, + SREInterference = 1L << 10, + SRERequestUI = 1L << 11, + SREStateChange = 1L << 12, + SREAdaptation = 1L << 13, + SREStreamStart = 1L << 14, + SRERecoOtherContext = 1L << 15, + SREAudioLevel = 1L << 16, + SREPrivate = 1L << 18, + SREAllEvents = 0x5ffff + } SpeechRecoEvents; + +typedef +enum SpeechRecoContextState + { SRCS_Disabled = SPCS_DISABLED, + SRCS_Enabled = SPCS_ENABLED + } SpeechRecoContextState; + +typedef /* [hidden] */ +enum DISPIDSPRG + { DISPID_SRGId = 1, + DISPID_SRGRecoContext = DISPID_SRGId + 1, + DISPID_SRGState = DISPID_SRGRecoContext + 1, + DISPID_SRGRules = DISPID_SRGState + 1, + DISPID_SRGReset = DISPID_SRGRules + 1, + DISPID_SRGCommit = DISPID_SRGReset + 1, + DISPID_SRGCmdLoadFromFile = DISPID_SRGCommit + 1, + DISPID_SRGCmdLoadFromObject = DISPID_SRGCmdLoadFromFile + 1, + DISPID_SRGCmdLoadFromResource = DISPID_SRGCmdLoadFromObject + 1, + DISPID_SRGCmdLoadFromMemory = DISPID_SRGCmdLoadFromResource + 1, + DISPID_SRGCmdLoadFromProprietaryGrammar = DISPID_SRGCmdLoadFromMemory + 1, + DISPID_SRGCmdSetRuleState = DISPID_SRGCmdLoadFromProprietaryGrammar + 1, + DISPID_SRGCmdSetRuleIdState = DISPID_SRGCmdSetRuleState + 1, + DISPID_SRGDictationLoad = DISPID_SRGCmdSetRuleIdState + 1, + DISPID_SRGDictationUnload = DISPID_SRGDictationLoad + 1, + DISPID_SRGDictationSetState = DISPID_SRGDictationUnload + 1, + DISPID_SRGSetWordSequenceData = DISPID_SRGDictationSetState + 1, + DISPID_SRGSetTextSelection = DISPID_SRGSetWordSequenceData + 1, + DISPID_SRGIsPronounceable = DISPID_SRGSetTextSelection + 1 + } DISPIDSPRG; + +typedef +enum SpeechLoadOption + { SLOStatic = SPLO_STATIC, + SLODynamic = SPLO_DYNAMIC + } SpeechLoadOption; + +typedef +enum SpeechWordPronounceable + { SWPUnknownWordUnpronounceable = SPWP_UNKNOWN_WORD_UNPRONOUNCEABLE, + SWPUnknownWordPronounceable = SPWP_UNKNOWN_WORD_PRONOUNCEABLE, + SWPKnownWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE + } SpeechWordPronounceable; + +typedef +enum SpeechGrammarState + { SGSEnabled = SPGS_ENABLED, + SGSDisabled = SPGS_DISABLED, + SGSExclusive = SPGS_EXCLUSIVE + } SpeechGrammarState; + +typedef +enum SpeechRuleState + { SGDSInactive = SPRS_INACTIVE, + SGDSActive = SPRS_ACTIVE, + SGDSActiveWithAutoPause = SPRS_ACTIVE_WITH_AUTO_PAUSE + } SpeechRuleState; + +typedef +enum SpeechRuleAttributes + { SRATopLevel = SPRAF_TopLevel, + SRADefaultToActive = SPRAF_Active, + SRAExport = SPRAF_Export, + SRAImport = SPRAF_Import, + SRAInterpreter = SPRAF_Interpreter, + SRADynamic = SPRAF_Dynamic + } SpeechRuleAttributes; + +typedef +enum SpeechGrammarWordType + { SGDisplay = SPWT_DISPLAY, + SGLexical = SPWT_LEXICAL, + SGPronounciation = SPWT_PRONUNCIATION + } SpeechGrammarWordType; + +typedef /* [hidden] */ +enum DISPID_SpeechRecoContextEvents + { DISPID_SRCEStartStream = 1, + DISPID_SRCEEndStream = DISPID_SRCEStartStream + 1, + DISPID_SRCEBookmark = DISPID_SRCEEndStream + 1, + DISPID_SRCESoundStart = DISPID_SRCEBookmark + 1, + DISPID_SRCESoundEnd = DISPID_SRCESoundStart + 1, + DISPID_SRCEPhraseStart = DISPID_SRCESoundEnd + 1, + DISPID_SRCERecognition = DISPID_SRCEPhraseStart + 1, + DISPID_SRCEHypothesis = DISPID_SRCERecognition + 1, + DISPID_SRCEPropertyNumberChange = DISPID_SRCEHypothesis + 1, + DISPID_SRCEPropertyStringChange = DISPID_SRCEPropertyNumberChange + 1, + DISPID_SRCEFalseRecognition = DISPID_SRCEPropertyStringChange + 1, + DISPID_SRCEInterference = DISPID_SRCEFalseRecognition + 1, + DISPID_SRCERequestUI = DISPID_SRCEInterference + 1, + DISPID_SRCERecognizerStateChange = DISPID_SRCERequestUI + 1, + DISPID_SRCEAdaptation = DISPID_SRCERecognizerStateChange + 1, + DISPID_SRCERecognitionForOtherContext = DISPID_SRCEAdaptation + 1, + DISPID_SRCEAudioLevel = DISPID_SRCERecognitionForOtherContext + 1, + DISPID_SRCEEnginePrivate = DISPID_SRCEAudioLevel + 1 + } DISPID_SpeechRecoContextEvents; + +typedef +enum SpeechRecognitionType + { SRTStandard = 0, + SRTAutopause = SPREF_AutoPause, + SRTEmulated = SPREF_Emulated + } SpeechRecognitionType; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRule + { DISPID_SGRAttributes = 1, + DISPID_SGRInitialState = DISPID_SGRAttributes + 1, + DISPID_SGRName = DISPID_SGRInitialState + 1, + DISPID_SGRId = DISPID_SGRName + 1, + DISPID_SGRClear = DISPID_SGRId + 1, + DISPID_SGRAddResource = DISPID_SGRClear + 1, + DISPID_SGRAddState = DISPID_SGRAddResource + 1 + } DISPID_SpeechGrammarRule; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRules + { DISPID_SGRsCount = 1, + DISPID_SGRsDynamic = DISPID_SGRsCount + 1, + DISPID_SGRsAdd = DISPID_SGRsDynamic + 1, + DISPID_SGRsCommit = DISPID_SGRsAdd + 1, + DISPID_SGRsCommitAndSave = DISPID_SGRsCommit + 1, + DISPID_SGRsFindRule = DISPID_SGRsCommitAndSave + 1, + DISPID_SGRsItem = DISPID_VALUE, + DISPID_SGRs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechGrammarRules; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRuleState + { DISPID_SGRSRule = 1, + DISPID_SGRSTransitions = DISPID_SGRSRule + 1, + DISPID_SGRSAddWordTransition = DISPID_SGRSTransitions + 1, + DISPID_SGRSAddRuleTransition = DISPID_SGRSAddWordTransition + 1, + DISPID_SGRSAddSpecialTransition = DISPID_SGRSAddRuleTransition + 1 + } DISPID_SpeechGrammarRuleState; + +typedef +enum SpeechSpecialTransitionType + { SSTTWildcard = 1, + SSTTDictation = SSTTWildcard + 1, + SSTTTextBuffer = SSTTDictation + 1 + } SpeechSpecialTransitionType; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRuleStateTransitions + { DISPID_SGRSTsCount = 1, + DISPID_SGRSTsItem = DISPID_VALUE, + DISPID_SGRSTs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechGrammarRuleStateTransitions; + +typedef /* [hidden] */ +enum DISPID_SpeechGrammarRuleStateTransition + { DISPID_SGRSTType = 1, + DISPID_SGRSTText = DISPID_SGRSTType + 1, + DISPID_SGRSTRule = DISPID_SGRSTText + 1, + DISPID_SGRSTWeight = DISPID_SGRSTRule + 1, + DISPID_SGRSTPropertyName = DISPID_SGRSTWeight + 1, + DISPID_SGRSTPropertyId = DISPID_SGRSTPropertyName + 1, + DISPID_SGRSTPropertyValue = DISPID_SGRSTPropertyId + 1, + DISPID_SGRSTNextState = DISPID_SGRSTPropertyValue + 1 + } DISPID_SpeechGrammarRuleStateTransition; + +typedef +enum SpeechGrammarRuleStateTransitionType + { SGRSTTEpsilon = 0, + SGRSTTWord = SGRSTTEpsilon + 1, + SGRSTTRule = SGRSTTWord + 1, + SGRSTTDictation = SGRSTTRule + 1, + SGRSTTWildcard = SGRSTTDictation + 1, + SGRSTTTextBuffer = SGRSTTWildcard + 1 + } SpeechGrammarRuleStateTransitionType; + +typedef /* [hidden] */ +enum DISPIDSPTSI + { DISPIDSPTSI_ActiveOffset = 1, + DISPIDSPTSI_ActiveLength = DISPIDSPTSI_ActiveOffset + 1, + DISPIDSPTSI_SelectionOffset = DISPIDSPTSI_ActiveLength + 1, + DISPIDSPTSI_SelectionLength = DISPIDSPTSI_SelectionOffset + 1 + } DISPIDSPTSI; + +typedef /* [hidden] */ +enum DISPID_SpeechRecoResult + { DISPID_SRRRecoContext = 1, + DISPID_SRRTimes = DISPID_SRRRecoContext + 1, + DISPID_SRRAudioFormat = DISPID_SRRTimes + 1, + DISPID_SRRPhraseInfo = DISPID_SRRAudioFormat + 1, + DISPID_SRRAlternates = DISPID_SRRPhraseInfo + 1, + DISPID_SRRAudio = DISPID_SRRAlternates + 1, + DISPID_SRRSpeakAudio = DISPID_SRRAudio + 1, + DISPID_SRRSaveToMemory = DISPID_SRRSpeakAudio + 1, + DISPID_SRRDiscardResultInfo = DISPID_SRRSaveToMemory + 1 + } DISPID_SpeechRecoResult; + +typedef +enum SpeechDiscardType + { SDTProperty = SPDF_PROPERTY, + SDTReplacement = SPDF_REPLACEMENT, + SDTRule = SPDF_RULE, + SDTDisplayText = SPDF_DISPLAYTEXT, + SDTLexicalForm = SPDF_LEXICALFORM, + SDTPronunciation = SPDF_PRONUNCIATION, + SDTAudio = SPDF_AUDIO, + SDTAlternates = SPDF_ALTERNATES, + SDTAll = SPDF_ALL + } SpeechDiscardType; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseBuilder + { DISPID_SPPBRestorePhraseFromMemory = 1 + } DISPID_SpeechPhraseBuilder; + +typedef /* [hidden] */ +enum DISPID_SpeechRecoResultTimes + { DISPID_SRRTStreamTime = 1, + DISPID_SRRTLength = DISPID_SRRTStreamTime + 1, + DISPID_SRRTTickCount = DISPID_SRRTLength + 1, + DISPID_SRRTOffsetFromStart = DISPID_SRRTTickCount + 1 + } DISPID_SpeechRecoResultTimes; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseAlternate + { DISPID_SPARecoResult = 1, + DISPID_SPAStartElementInResult = DISPID_SPARecoResult + 1, + DISPID_SPANumberOfElementsInResult = DISPID_SPAStartElementInResult + 1, + DISPID_SPAPhraseInfo = DISPID_SPANumberOfElementsInResult + 1, + DISPID_SPACommit = DISPID_SPAPhraseInfo + 1 + } DISPID_SpeechPhraseAlternate; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseAlternates + { DISPID_SPAsCount = 1, + DISPID_SPAsItem = DISPID_VALUE, + DISPID_SPAs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseAlternates; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseInfo + { DISPID_SPILanguageId = 1, + DISPID_SPIGrammarId = DISPID_SPILanguageId + 1, + DISPID_SPIStartTime = DISPID_SPIGrammarId + 1, + DISPID_SPIAudioStreamPosition = DISPID_SPIStartTime + 1, + DISPID_SPIAudioSizeBytes = DISPID_SPIAudioStreamPosition + 1, + DISPID_SPIRetainedSizeBytes = DISPID_SPIAudioSizeBytes + 1, + DISPID_SPIAudioSizeTime = DISPID_SPIRetainedSizeBytes + 1, + DISPID_SPIRule = DISPID_SPIAudioSizeTime + 1, + DISPID_SPIProperties = DISPID_SPIRule + 1, + DISPID_SPIElements = DISPID_SPIProperties + 1, + DISPID_SPIReplacements = DISPID_SPIElements + 1, + DISPID_SPIEngineId = DISPID_SPIReplacements + 1, + DISPID_SPIEnginePrivateData = DISPID_SPIEngineId + 1, + DISPID_SPISaveToMemory = DISPID_SPIEnginePrivateData + 1, + DISPID_SPIGetText = DISPID_SPISaveToMemory + 1, + DISPID_SPIGetDisplayAttributes = DISPID_SPIGetText + 1 + } DISPID_SpeechPhraseInfo; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseElement + { DISPID_SPEAudioTimeOffset = 1, + DISPID_SPEAudioSizeTime = DISPID_SPEAudioTimeOffset + 1, + DISPID_SPEAudioStreamOffset = DISPID_SPEAudioSizeTime + 1, + DISPID_SPEAudioSizeBytes = DISPID_SPEAudioStreamOffset + 1, + DISPID_SPERetainedStreamOffset = DISPID_SPEAudioSizeBytes + 1, + DISPID_SPERetainedSizeBytes = DISPID_SPERetainedStreamOffset + 1, + DISPID_SPEDisplayText = DISPID_SPERetainedSizeBytes + 1, + DISPID_SPELexicalForm = DISPID_SPEDisplayText + 1, + DISPID_SPEPronunciation = DISPID_SPELexicalForm + 1, + DISPID_SPEDisplayAttributes = DISPID_SPEPronunciation + 1, + DISPID_SPERequiredConfidence = DISPID_SPEDisplayAttributes + 1, + DISPID_SPEActualConfidence = DISPID_SPERequiredConfidence + 1, + DISPID_SPEEngineConfidence = DISPID_SPEActualConfidence + 1 + } DISPID_SpeechPhraseElement; + +typedef +enum SpeechEngineConfidence + { SECLowConfidence = -1, + SECNormalConfidence = 0, + SECHighConfidence = 1 + } SpeechEngineConfidence; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseElements + { DISPID_SPEsCount = 1, + DISPID_SPEsItem = DISPID_VALUE, + DISPID_SPEs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseElements; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseReplacement + { DISPID_SPRDisplayAttributes = 1, + DISPID_SPRText = DISPID_SPRDisplayAttributes + 1, + DISPID_SPRFirstElement = DISPID_SPRText + 1, + DISPID_SPRNumberOfElements = DISPID_SPRFirstElement + 1 + } DISPID_SpeechPhraseReplacement; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseReplacements + { DISPID_SPRsCount = 1, + DISPID_SPRsItem = DISPID_VALUE, + DISPID_SPRs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseReplacements; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseProperty + { DISPID_SPPName = 1, + DISPID_SPPId = DISPID_SPPName + 1, + DISPID_SPPValue = DISPID_SPPId + 1, + DISPID_SPPFirstElement = DISPID_SPPValue + 1, + DISPID_SPPNumberOfElements = DISPID_SPPFirstElement + 1, + DISPID_SPPEngineConfidence = DISPID_SPPNumberOfElements + 1, + DISPID_SPPConfidence = DISPID_SPPEngineConfidence + 1, + DISPID_SPPParent = DISPID_SPPConfidence + 1, + DISPID_SPPChildren = DISPID_SPPParent + 1 + } DISPID_SpeechPhraseProperty; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseProperties + { DISPID_SPPsCount = 1, + DISPID_SPPsItem = DISPID_VALUE, + DISPID_SPPs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseProperties; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseRule + { DISPID_SPRuleName = 1, + DISPID_SPRuleId = DISPID_SPRuleName + 1, + DISPID_SPRuleFirstElement = DISPID_SPRuleId + 1, + DISPID_SPRuleNumberOfElements = DISPID_SPRuleFirstElement + 1, + DISPID_SPRuleParent = DISPID_SPRuleNumberOfElements + 1, + DISPID_SPRuleChildren = DISPID_SPRuleParent + 1, + DISPID_SPRuleConfidence = DISPID_SPRuleChildren + 1, + DISPID_SPRuleEngineConfidence = DISPID_SPRuleConfidence + 1 + } DISPID_SpeechPhraseRule; + +typedef /* [hidden] */ +enum DISPID_SpeechPhraseRules + { DISPID_SPRulesCount = 1, + DISPID_SPRulesItem = DISPID_VALUE, + DISPID_SPRules_NewEnum = DISPID_NEWENUM + } DISPID_SpeechPhraseRules; + +typedef /* [hidden] */ +enum DISPID_SpeechLexicon + { DISPID_SLGenerationId = 1, + DISPID_SLGetWords = DISPID_SLGenerationId + 1, + DISPID_SLAddPronunciation = DISPID_SLGetWords + 1, + DISPID_SLAddPronunciationByPhoneIds = DISPID_SLAddPronunciation + 1, + DISPID_SLRemovePronunciation = DISPID_SLAddPronunciationByPhoneIds + 1, + DISPID_SLRemovePronunciationByPhoneIds = DISPID_SLRemovePronunciation + 1, + DISPID_SLGetPronunciations = DISPID_SLRemovePronunciationByPhoneIds + 1, + DISPID_SLGetGenerationChange = DISPID_SLGetPronunciations + 1 + } DISPID_SpeechLexicon; + +typedef +enum SpeechLexiconType + { SLTUser = eLEXTYPE_USER, + SLTApp = eLEXTYPE_APP + } SpeechLexiconType; + +typedef +enum SpeechPartOfSpeech + { SPSNotOverriden = SPPS_NotOverriden, + SPSUnknown = SPPS_Unknown, + SPSNoun = SPPS_Noun, + SPSVerb = SPPS_Verb, + SPSModifier = SPPS_Modifier, + SPSFunction = SPPS_Function, + SPSInterjection = SPPS_Interjection + } SpeechPartOfSpeech; + +typedef /* [hidden] */ +enum DISPID_SpeechLexiconWords + { DISPID_SLWsCount = 1, + DISPID_SLWsItem = DISPID_VALUE, + DISPID_SLWs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechLexiconWords; + +typedef +enum SpeechWordType + { SWTAdded = eWORDTYPE_ADDED, + SWTDeleted = eWORDTYPE_DELETED + } SpeechWordType; + +typedef /* [hidden] */ +enum DISPID_SpeechLexiconWord + { DISPID_SLWLangId = 1, + DISPID_SLWType = DISPID_SLWLangId + 1, + DISPID_SLWWord = DISPID_SLWType + 1, + DISPID_SLWPronunciations = DISPID_SLWWord + 1 + } DISPID_SpeechLexiconWord; + +typedef /* [hidden] */ +enum DISPID_SpeechLexiconProns + { DISPID_SLPsCount = 1, + DISPID_SLPsItem = DISPID_VALUE, + DISPID_SLPs_NewEnum = DISPID_NEWENUM + } DISPID_SpeechLexiconProns; + +typedef /* [hidden] */ +enum DISPID_SpeechLexiconPronunciation + { DISPID_SLPType = 1, + DISPID_SLPLangId = DISPID_SLPType + 1, + DISPID_SLPPartOfSpeech = DISPID_SLPLangId + 1, + DISPID_SLPPhoneIds = DISPID_SLPPartOfSpeech + 1, + DISPID_SLPSymbolic = DISPID_SLPPhoneIds + 1 + } DISPID_SpeechLexiconPronunciation; + +typedef /* [hidden] */ +enum DISPID_SpeechPhoneConverter + { DISPID_SPCLangId = 1, + DISPID_SPCPhoneToId = DISPID_SPCLangId + 1, + DISPID_SPCIdToPhone = DISPID_SPCPhoneToId + 1 + } DISPID_SpeechPhoneConverter; + + +EXTERN_C const IID LIBID_SpeechLib; + +#ifndef __ISpeechDataKey_INTERFACE_DEFINED__ +#define __ISpeechDataKey_INTERFACE_DEFINED__ + +/* interface ISpeechDataKey */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechDataKey; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CE17C09B-4EFA-44d5-A4C9-59D9585AB0CD") + ISpeechDataKey : public IDispatch + { + public: + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetBinaryValue( + /* [in] */ const BSTR ValueName, + /* [in] */ VARIANT Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetBinaryValue( + /* [in] */ const BSTR ValueName, + /* [retval][out] */ VARIANT *Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetStringValue( + /* [in] */ const BSTR ValueName, + /* [in] */ const BSTR Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetStringValue( + /* [in] */ const BSTR ValueName, + /* [retval][out] */ BSTR *Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetLongValue( + /* [in] */ const BSTR ValueName, + /* [in] */ long Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetLongValue( + /* [in] */ const BSTR ValueName, + /* [retval][out] */ long *Value) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE OpenKey( + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateKey( + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DeleteKey( + /* [in] */ const BSTR SubKeyName) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DeleteValue( + /* [in] */ const BSTR ValueName) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE EnumKeys( + /* [in] */ long Index, + /* [retval][out] */ BSTR *SubKeyName) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE EnumValues( + /* [in] */ long Index, + /* [retval][out] */ BSTR *ValueName) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechDataKeyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechDataKey * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechDataKey * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechDataKey * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechDataKey * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechDataKey * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechDataKey * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechDataKey * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetBinaryValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ VARIANT Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetBinaryValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ VARIANT *Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetStringValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ const BSTR Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStringValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ BSTR *Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetLongValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ long Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetLongValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ long *Value); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *OpenKey )( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateKey )( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeleteKey )( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DeleteValue )( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumKeys )( + ISpeechDataKey * This, + /* [in] */ long Index, + /* [retval][out] */ BSTR *SubKeyName); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumValues )( + ISpeechDataKey * This, + /* [in] */ long Index, + /* [retval][out] */ BSTR *ValueName); + + END_INTERFACE + } ISpeechDataKeyVtbl; + + interface ISpeechDataKey + { + CONST_VTBL struct ISpeechDataKeyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechDataKey_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechDataKey_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechDataKey_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechDataKey_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechDataKey_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechDataKey_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechDataKey_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechDataKey_SetBinaryValue(This,ValueName,Value) \ + (This)->lpVtbl -> SetBinaryValue(This,ValueName,Value) + +#define ISpeechDataKey_GetBinaryValue(This,ValueName,Value) \ + (This)->lpVtbl -> GetBinaryValue(This,ValueName,Value) + +#define ISpeechDataKey_SetStringValue(This,ValueName,Value) \ + (This)->lpVtbl -> SetStringValue(This,ValueName,Value) + +#define ISpeechDataKey_GetStringValue(This,ValueName,Value) \ + (This)->lpVtbl -> GetStringValue(This,ValueName,Value) + +#define ISpeechDataKey_SetLongValue(This,ValueName,Value) \ + (This)->lpVtbl -> SetLongValue(This,ValueName,Value) + +#define ISpeechDataKey_GetLongValue(This,ValueName,Value) \ + (This)->lpVtbl -> GetLongValue(This,ValueName,Value) + +#define ISpeechDataKey_OpenKey(This,SubKeyName,SubKey) \ + (This)->lpVtbl -> OpenKey(This,SubKeyName,SubKey) + +#define ISpeechDataKey_CreateKey(This,SubKeyName,SubKey) \ + (This)->lpVtbl -> CreateKey(This,SubKeyName,SubKey) + +#define ISpeechDataKey_DeleteKey(This,SubKeyName) \ + (This)->lpVtbl -> DeleteKey(This,SubKeyName) + +#define ISpeechDataKey_DeleteValue(This,ValueName) \ + (This)->lpVtbl -> DeleteValue(This,ValueName) + +#define ISpeechDataKey_EnumKeys(This,Index,SubKeyName) \ + (This)->lpVtbl -> EnumKeys(This,Index,SubKeyName) + +#define ISpeechDataKey_EnumValues(This,Index,ValueName) \ + (This)->lpVtbl -> EnumValues(This,Index,ValueName) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_SetBinaryValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ VARIANT Value); + + +void __RPC_STUB ISpeechDataKey_SetBinaryValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_GetBinaryValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ VARIANT *Value); + + +void __RPC_STUB ISpeechDataKey_GetBinaryValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_SetStringValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ const BSTR Value); + + +void __RPC_STUB ISpeechDataKey_SetStringValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_GetStringValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ BSTR *Value); + + +void __RPC_STUB ISpeechDataKey_GetStringValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_SetLongValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [in] */ long Value); + + +void __RPC_STUB ISpeechDataKey_SetLongValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_GetLongValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName, + /* [retval][out] */ long *Value); + + +void __RPC_STUB ISpeechDataKey_GetLongValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_OpenKey_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey); + + +void __RPC_STUB ISpeechDataKey_OpenKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_CreateKey_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName, + /* [retval][out] */ ISpeechDataKey **SubKey); + + +void __RPC_STUB ISpeechDataKey_CreateKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_DeleteKey_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR SubKeyName); + + +void __RPC_STUB ISpeechDataKey_DeleteKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_DeleteValue_Proxy( + ISpeechDataKey * This, + /* [in] */ const BSTR ValueName); + + +void __RPC_STUB ISpeechDataKey_DeleteValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_EnumKeys_Proxy( + ISpeechDataKey * This, + /* [in] */ long Index, + /* [retval][out] */ BSTR *SubKeyName); + + +void __RPC_STUB ISpeechDataKey_EnumKeys_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechDataKey_EnumValues_Proxy( + ISpeechDataKey * This, + /* [in] */ long Index, + /* [retval][out] */ BSTR *ValueName); + + +void __RPC_STUB ISpeechDataKey_EnumValues_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechDataKey_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechObjectToken_INTERFACE_DEFINED__ +#define __ISpeechObjectToken_INTERFACE_DEFINED__ + +/* interface ISpeechObjectToken */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechObjectToken; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C74A3ADC-B727-4500-A84A-B526721C8B8C") + ISpeechObjectToken : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ BSTR *ObjectId) = 0; + + virtual /* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DataKey( + /* [retval][out] */ ISpeechDataKey **DataKey) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Category( + /* [retval][out] */ ISpeechObjectTokenCategory **Category) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetDescription( + /* [defaultvalue][in] */ long Locale, + /* [retval][out] */ BSTR *Description) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE SetId( + /* [in] */ BSTR Id, + /* [defaultvalue][in] */ BSTR CategoryID = L"", + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetAttribute( + /* [in] */ BSTR AttributeName, + /* [retval][out] */ BSTR *AttributeValue) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateInstance( + /* [defaultvalue][in] */ IUnknown *pUnkOuter, + /* [defaultvalue][in] */ SpeechTokenContext ClsContext, + /* [retval][out] */ IUnknown **Object) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE Remove( + /* [in] */ BSTR ObjectStorageCLSID) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE GetStorageFileName( + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ BSTR FileName, + /* [in] */ SpeechTokenShellFolder Folder, + /* [retval][out] */ BSTR *FilePath) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE RemoveStorageFileName( + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ VARIANT_BOOL DeleteFile) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ long hWnd, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData = 0, + /* [defaultvalue][in] */ IUnknown *Object = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE MatchesAttributes( + /* [in] */ BSTR Attributes, + /* [retval][out] */ VARIANT_BOOL *Matches) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechObjectTokenVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechObjectToken * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechObjectToken * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechObjectToken * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechObjectToken * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechObjectToken * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechObjectToken * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechObjectToken * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechObjectToken * This, + /* [retval][out] */ BSTR *ObjectId); + + /* [hidden][id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DataKey )( + ISpeechObjectToken * This, + /* [retval][out] */ ISpeechDataKey **DataKey); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Category )( + ISpeechObjectToken * This, + /* [retval][out] */ ISpeechObjectTokenCategory **Category); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDescription )( + ISpeechObjectToken * This, + /* [defaultvalue][in] */ long Locale, + /* [retval][out] */ BSTR *Description); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpeechObjectToken * This, + /* [in] */ BSTR Id, + /* [defaultvalue][in] */ BSTR CategoryID, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetAttribute )( + ISpeechObjectToken * This, + /* [in] */ BSTR AttributeName, + /* [retval][out] */ BSTR *AttributeValue); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateInstance )( + ISpeechObjectToken * This, + /* [defaultvalue][in] */ IUnknown *pUnkOuter, + /* [defaultvalue][in] */ SpeechTokenContext ClsContext, + /* [retval][out] */ IUnknown **Object); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Remove )( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetStorageFileName )( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ BSTR FileName, + /* [in] */ SpeechTokenShellFolder Folder, + /* [retval][out] */ BSTR *FilePath); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemoveStorageFileName )( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ VARIANT_BOOL DeleteFile); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpeechObjectToken * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpeechObjectToken * This, + /* [in] */ long hWnd, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *MatchesAttributes )( + ISpeechObjectToken * This, + /* [in] */ BSTR Attributes, + /* [retval][out] */ VARIANT_BOOL *Matches); + + END_INTERFACE + } ISpeechObjectTokenVtbl; + + interface ISpeechObjectToken + { + CONST_VTBL struct ISpeechObjectTokenVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechObjectToken_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechObjectToken_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechObjectToken_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechObjectToken_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechObjectToken_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechObjectToken_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechObjectToken_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechObjectToken_get_Id(This,ObjectId) \ + (This)->lpVtbl -> get_Id(This,ObjectId) + +#define ISpeechObjectToken_get_DataKey(This,DataKey) \ + (This)->lpVtbl -> get_DataKey(This,DataKey) + +#define ISpeechObjectToken_get_Category(This,Category) \ + (This)->lpVtbl -> get_Category(This,Category) + +#define ISpeechObjectToken_GetDescription(This,Locale,Description) \ + (This)->lpVtbl -> GetDescription(This,Locale,Description) + +#define ISpeechObjectToken_SetId(This,Id,CategoryID,CreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,Id,CategoryID,CreateIfNotExist) + +#define ISpeechObjectToken_GetAttribute(This,AttributeName,AttributeValue) \ + (This)->lpVtbl -> GetAttribute(This,AttributeName,AttributeValue) + +#define ISpeechObjectToken_CreateInstance(This,pUnkOuter,ClsContext,Object) \ + (This)->lpVtbl -> CreateInstance(This,pUnkOuter,ClsContext,Object) + +#define ISpeechObjectToken_Remove(This,ObjectStorageCLSID) \ + (This)->lpVtbl -> Remove(This,ObjectStorageCLSID) + +#define ISpeechObjectToken_GetStorageFileName(This,ObjectStorageCLSID,KeyName,FileName,Folder,FilePath) \ + (This)->lpVtbl -> GetStorageFileName(This,ObjectStorageCLSID,KeyName,FileName,Folder,FilePath) + +#define ISpeechObjectToken_RemoveStorageFileName(This,ObjectStorageCLSID,KeyName,DeleteFile) \ + (This)->lpVtbl -> RemoveStorageFileName(This,ObjectStorageCLSID,KeyName,DeleteFile) + +#define ISpeechObjectToken_IsUISupported(This,TypeOfUI,ExtraData,Object,Supported) \ + (This)->lpVtbl -> IsUISupported(This,TypeOfUI,ExtraData,Object,Supported) + +#define ISpeechObjectToken_DisplayUI(This,hWnd,Title,TypeOfUI,ExtraData,Object) \ + (This)->lpVtbl -> DisplayUI(This,hWnd,Title,TypeOfUI,ExtraData,Object) + +#define ISpeechObjectToken_MatchesAttributes(This,Attributes,Matches) \ + (This)->lpVtbl -> MatchesAttributes(This,Attributes,Matches) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_get_Id_Proxy( + ISpeechObjectToken * This, + /* [retval][out] */ BSTR *ObjectId); + + +void __RPC_STUB ISpeechObjectToken_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_get_DataKey_Proxy( + ISpeechObjectToken * This, + /* [retval][out] */ ISpeechDataKey **DataKey); + + +void __RPC_STUB ISpeechObjectToken_get_DataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_get_Category_Proxy( + ISpeechObjectToken * This, + /* [retval][out] */ ISpeechObjectTokenCategory **Category); + + +void __RPC_STUB ISpeechObjectToken_get_Category_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_GetDescription_Proxy( + ISpeechObjectToken * This, + /* [defaultvalue][in] */ long Locale, + /* [retval][out] */ BSTR *Description); + + +void __RPC_STUB ISpeechObjectToken_GetDescription_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_SetId_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR Id, + /* [defaultvalue][in] */ BSTR CategoryID, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist); + + +void __RPC_STUB ISpeechObjectToken_SetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_GetAttribute_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR AttributeName, + /* [retval][out] */ BSTR *AttributeValue); + + +void __RPC_STUB ISpeechObjectToken_GetAttribute_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_CreateInstance_Proxy( + ISpeechObjectToken * This, + /* [defaultvalue][in] */ IUnknown *pUnkOuter, + /* [defaultvalue][in] */ SpeechTokenContext ClsContext, + /* [retval][out] */ IUnknown **Object); + + +void __RPC_STUB ISpeechObjectToken_CreateInstance_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_Remove_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID); + + +void __RPC_STUB ISpeechObjectToken_Remove_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_GetStorageFileName_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ BSTR FileName, + /* [in] */ SpeechTokenShellFolder Folder, + /* [retval][out] */ BSTR *FilePath); + + +void __RPC_STUB ISpeechObjectToken_GetStorageFileName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_RemoveStorageFileName_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR ObjectStorageCLSID, + /* [in] */ BSTR KeyName, + /* [in] */ VARIANT_BOOL DeleteFile); + + +void __RPC_STUB ISpeechObjectToken_RemoveStorageFileName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_IsUISupported_Proxy( + ISpeechObjectToken * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechObjectToken_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_DisplayUI_Proxy( + ISpeechObjectToken * This, + /* [in] */ long hWnd, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [defaultvalue][in] */ IUnknown *Object); + + +void __RPC_STUB ISpeechObjectToken_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectToken_MatchesAttributes_Proxy( + ISpeechObjectToken * This, + /* [in] */ BSTR Attributes, + /* [retval][out] */ VARIANT_BOOL *Matches); + + +void __RPC_STUB ISpeechObjectToken_MatchesAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechObjectToken_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechObjectTokens_INTERFACE_DEFINED__ +#define __ISpeechObjectTokens_INTERFACE_DEFINED__ + +/* interface ISpeechObjectTokens */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechObjectTokens; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9285B776-2E7B-4bc0-B53E-580EB6FA967F") + ISpeechObjectTokens : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechObjectToken **Token) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **ppEnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechObjectTokensVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechObjectTokens * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechObjectTokens * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechObjectTokens * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechObjectTokens * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechObjectTokens * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechObjectTokens * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechObjectTokens * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechObjectTokens * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechObjectTokens * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechObjectToken **Token); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechObjectTokens * This, + /* [retval][out] */ IUnknown **ppEnumVARIANT); + + END_INTERFACE + } ISpeechObjectTokensVtbl; + + interface ISpeechObjectTokens + { + CONST_VTBL struct ISpeechObjectTokensVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechObjectTokens_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechObjectTokens_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechObjectTokens_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechObjectTokens_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechObjectTokens_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechObjectTokens_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechObjectTokens_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechObjectTokens_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechObjectTokens_Item(This,Index,Token) \ + (This)->lpVtbl -> Item(This,Index,Token) + +#define ISpeechObjectTokens_get__NewEnum(This,ppEnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,ppEnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokens_get_Count_Proxy( + ISpeechObjectTokens * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechObjectTokens_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokens_Item_Proxy( + ISpeechObjectTokens * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechObjectToken **Token); + + +void __RPC_STUB ISpeechObjectTokens_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokens_get__NewEnum_Proxy( + ISpeechObjectTokens * This, + /* [retval][out] */ IUnknown **ppEnumVARIANT); + + +void __RPC_STUB ISpeechObjectTokens_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechObjectTokens_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechObjectTokenCategory_INTERFACE_DEFINED__ +#define __ISpeechObjectTokenCategory_INTERFACE_DEFINED__ + +/* interface ISpeechObjectTokenCategory */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechObjectTokenCategory; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CA7EAC50-2D01-4145-86D4-5AE7D70F4469") + ISpeechObjectTokenCategory : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ BSTR *Id) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Default( + /* [in] */ const BSTR TokenId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Default( + /* [retval][out] */ BSTR *TokenId) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetId( + /* [in] */ const BSTR Id, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist = 0) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE GetDataKey( + /* [defaultvalue][in] */ SpeechDataKeyLocation Location, + /* [retval][out] */ ISpeechDataKey **DataKey) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE EnumerateTokens( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **Tokens) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechObjectTokenCategoryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechObjectTokenCategory * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechObjectTokenCategory * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechObjectTokenCategory * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechObjectTokenCategory * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechObjectTokenCategory * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechObjectTokenCategory * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechObjectTokenCategory * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechObjectTokenCategory * This, + /* [retval][out] */ BSTR *Id); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Default )( + ISpeechObjectTokenCategory * This, + /* [in] */ const BSTR TokenId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Default )( + ISpeechObjectTokenCategory * This, + /* [retval][out] */ BSTR *TokenId); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetId )( + ISpeechObjectTokenCategory * This, + /* [in] */ const BSTR Id, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDataKey )( + ISpeechObjectTokenCategory * This, + /* [defaultvalue][in] */ SpeechDataKeyLocation Location, + /* [retval][out] */ ISpeechDataKey **DataKey); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *EnumerateTokens )( + ISpeechObjectTokenCategory * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **Tokens); + + END_INTERFACE + } ISpeechObjectTokenCategoryVtbl; + + interface ISpeechObjectTokenCategory + { + CONST_VTBL struct ISpeechObjectTokenCategoryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechObjectTokenCategory_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechObjectTokenCategory_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechObjectTokenCategory_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechObjectTokenCategory_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechObjectTokenCategory_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechObjectTokenCategory_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechObjectTokenCategory_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechObjectTokenCategory_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechObjectTokenCategory_put_Default(This,TokenId) \ + (This)->lpVtbl -> put_Default(This,TokenId) + +#define ISpeechObjectTokenCategory_get_Default(This,TokenId) \ + (This)->lpVtbl -> get_Default(This,TokenId) + +#define ISpeechObjectTokenCategory_SetId(This,Id,CreateIfNotExist) \ + (This)->lpVtbl -> SetId(This,Id,CreateIfNotExist) + +#define ISpeechObjectTokenCategory_GetDataKey(This,Location,DataKey) \ + (This)->lpVtbl -> GetDataKey(This,Location,DataKey) + +#define ISpeechObjectTokenCategory_EnumerateTokens(This,RequiredAttributes,OptionalAttributes,Tokens) \ + (This)->lpVtbl -> EnumerateTokens(This,RequiredAttributes,OptionalAttributes,Tokens) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_get_Id_Proxy( + ISpeechObjectTokenCategory * This, + /* [retval][out] */ BSTR *Id); + + +void __RPC_STUB ISpeechObjectTokenCategory_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_put_Default_Proxy( + ISpeechObjectTokenCategory * This, + /* [in] */ const BSTR TokenId); + + +void __RPC_STUB ISpeechObjectTokenCategory_put_Default_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_get_Default_Proxy( + ISpeechObjectTokenCategory * This, + /* [retval][out] */ BSTR *TokenId); + + +void __RPC_STUB ISpeechObjectTokenCategory_get_Default_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_SetId_Proxy( + ISpeechObjectTokenCategory * This, + /* [in] */ const BSTR Id, + /* [defaultvalue][in] */ VARIANT_BOOL CreateIfNotExist); + + +void __RPC_STUB ISpeechObjectTokenCategory_SetId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_GetDataKey_Proxy( + ISpeechObjectTokenCategory * This, + /* [defaultvalue][in] */ SpeechDataKeyLocation Location, + /* [retval][out] */ ISpeechDataKey **DataKey); + + +void __RPC_STUB ISpeechObjectTokenCategory_GetDataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechObjectTokenCategory_EnumerateTokens_Proxy( + ISpeechObjectTokenCategory * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **Tokens); + + +void __RPC_STUB ISpeechObjectTokenCategory_EnumerateTokens_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechObjectTokenCategory_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechAudioBufferInfo_INTERFACE_DEFINED__ +#define __ISpeechAudioBufferInfo_INTERFACE_DEFINED__ + +/* interface ISpeechAudioBufferInfo */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechAudioBufferInfo; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("11B103D8-1142-4edf-A093-82FB3915F8CC") + ISpeechAudioBufferInfo : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_MinNotification( + /* [retval][out] */ long *MinNotification) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_MinNotification( + /* [in] */ long MinNotification) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BufferSize( + /* [retval][out] */ long *BufferSize) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_BufferSize( + /* [in] */ long BufferSize) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EventBias( + /* [retval][out] */ long *EventBias) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_EventBias( + /* [in] */ long EventBias) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechAudioBufferInfoVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechAudioBufferInfo * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechAudioBufferInfo * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechAudioBufferInfo * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechAudioBufferInfo * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechAudioBufferInfo * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechAudioBufferInfo * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechAudioBufferInfo * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinNotification )( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *MinNotification); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_MinNotification )( + ISpeechAudioBufferInfo * This, + /* [in] */ long MinNotification); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferSize )( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *BufferSize); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BufferSize )( + ISpeechAudioBufferInfo * This, + /* [in] */ long BufferSize); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventBias )( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *EventBias); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventBias )( + ISpeechAudioBufferInfo * This, + /* [in] */ long EventBias); + + END_INTERFACE + } ISpeechAudioBufferInfoVtbl; + + interface ISpeechAudioBufferInfo + { + CONST_VTBL struct ISpeechAudioBufferInfoVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechAudioBufferInfo_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechAudioBufferInfo_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechAudioBufferInfo_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechAudioBufferInfo_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechAudioBufferInfo_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechAudioBufferInfo_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechAudioBufferInfo_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechAudioBufferInfo_get_MinNotification(This,MinNotification) \ + (This)->lpVtbl -> get_MinNotification(This,MinNotification) + +#define ISpeechAudioBufferInfo_put_MinNotification(This,MinNotification) \ + (This)->lpVtbl -> put_MinNotification(This,MinNotification) + +#define ISpeechAudioBufferInfo_get_BufferSize(This,BufferSize) \ + (This)->lpVtbl -> get_BufferSize(This,BufferSize) + +#define ISpeechAudioBufferInfo_put_BufferSize(This,BufferSize) \ + (This)->lpVtbl -> put_BufferSize(This,BufferSize) + +#define ISpeechAudioBufferInfo_get_EventBias(This,EventBias) \ + (This)->lpVtbl -> get_EventBias(This,EventBias) + +#define ISpeechAudioBufferInfo_put_EventBias(This,EventBias) \ + (This)->lpVtbl -> put_EventBias(This,EventBias) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_get_MinNotification_Proxy( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *MinNotification); + + +void __RPC_STUB ISpeechAudioBufferInfo_get_MinNotification_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_put_MinNotification_Proxy( + ISpeechAudioBufferInfo * This, + /* [in] */ long MinNotification); + + +void __RPC_STUB ISpeechAudioBufferInfo_put_MinNotification_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_get_BufferSize_Proxy( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *BufferSize); + + +void __RPC_STUB ISpeechAudioBufferInfo_get_BufferSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_put_BufferSize_Proxy( + ISpeechAudioBufferInfo * This, + /* [in] */ long BufferSize); + + +void __RPC_STUB ISpeechAudioBufferInfo_put_BufferSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_get_EventBias_Proxy( + ISpeechAudioBufferInfo * This, + /* [retval][out] */ long *EventBias); + + +void __RPC_STUB ISpeechAudioBufferInfo_get_EventBias_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioBufferInfo_put_EventBias_Proxy( + ISpeechAudioBufferInfo * This, + /* [in] */ long EventBias); + + +void __RPC_STUB ISpeechAudioBufferInfo_put_EventBias_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechAudioBufferInfo_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechAudioStatus_INTERFACE_DEFINED__ +#define __ISpeechAudioStatus_INTERFACE_DEFINED__ + +/* interface ISpeechAudioStatus */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechAudioStatus; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C62D9C91-7458-47f6-862D-1EF86FB0B278") + ISpeechAudioStatus : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FreeBufferSpace( + /* [retval][out] */ long *FreeBufferSpace) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NonBlockingIO( + /* [retval][out] */ long *NonBlockingIO) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_State( + /* [retval][out] */ SpeechAudioState *State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentSeekPosition( + /* [retval][out] */ VARIANT *CurrentSeekPosition) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentDevicePosition( + /* [retval][out] */ VARIANT *CurrentDevicePosition) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechAudioStatusVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechAudioStatus * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechAudioStatus * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechAudioStatus * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechAudioStatus * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechAudioStatus * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechAudioStatus * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechAudioStatus * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FreeBufferSpace )( + ISpeechAudioStatus * This, + /* [retval][out] */ long *FreeBufferSpace); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NonBlockingIO )( + ISpeechAudioStatus * This, + /* [retval][out] */ long *NonBlockingIO); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )( + ISpeechAudioStatus * This, + /* [retval][out] */ SpeechAudioState *State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentSeekPosition )( + ISpeechAudioStatus * This, + /* [retval][out] */ VARIANT *CurrentSeekPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentDevicePosition )( + ISpeechAudioStatus * This, + /* [retval][out] */ VARIANT *CurrentDevicePosition); + + END_INTERFACE + } ISpeechAudioStatusVtbl; + + interface ISpeechAudioStatus + { + CONST_VTBL struct ISpeechAudioStatusVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechAudioStatus_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechAudioStatus_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechAudioStatus_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechAudioStatus_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechAudioStatus_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechAudioStatus_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechAudioStatus_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechAudioStatus_get_FreeBufferSpace(This,FreeBufferSpace) \ + (This)->lpVtbl -> get_FreeBufferSpace(This,FreeBufferSpace) + +#define ISpeechAudioStatus_get_NonBlockingIO(This,NonBlockingIO) \ + (This)->lpVtbl -> get_NonBlockingIO(This,NonBlockingIO) + +#define ISpeechAudioStatus_get_State(This,State) \ + (This)->lpVtbl -> get_State(This,State) + +#define ISpeechAudioStatus_get_CurrentSeekPosition(This,CurrentSeekPosition) \ + (This)->lpVtbl -> get_CurrentSeekPosition(This,CurrentSeekPosition) + +#define ISpeechAudioStatus_get_CurrentDevicePosition(This,CurrentDevicePosition) \ + (This)->lpVtbl -> get_CurrentDevicePosition(This,CurrentDevicePosition) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_FreeBufferSpace_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ long *FreeBufferSpace); + + +void __RPC_STUB ISpeechAudioStatus_get_FreeBufferSpace_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_NonBlockingIO_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ long *NonBlockingIO); + + +void __RPC_STUB ISpeechAudioStatus_get_NonBlockingIO_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_State_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ SpeechAudioState *State); + + +void __RPC_STUB ISpeechAudioStatus_get_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_CurrentSeekPosition_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ VARIANT *CurrentSeekPosition); + + +void __RPC_STUB ISpeechAudioStatus_get_CurrentSeekPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioStatus_get_CurrentDevicePosition_Proxy( + ISpeechAudioStatus * This, + /* [retval][out] */ VARIANT *CurrentDevicePosition); + + +void __RPC_STUB ISpeechAudioStatus_get_CurrentDevicePosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechAudioStatus_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechAudioFormat_INTERFACE_DEFINED__ +#define __ISpeechAudioFormat_INTERFACE_DEFINED__ + +/* interface ISpeechAudioFormat */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechAudioFormat; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E6E9C590-3E18-40e3-8299-061F98BDE7C7") + ISpeechAudioFormat : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ SpeechAudioFormatType *AudioFormat) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Type( + /* [in] */ SpeechAudioFormatType AudioFormat) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_Guid( + /* [retval][out] */ BSTR *Guid) = 0; + + virtual /* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_Guid( + /* [in] */ BSTR Guid) = 0; + + virtual /* [id][helpstring][hidden] */ HRESULT STDMETHODCALLTYPE GetWaveFormatEx( + /* [retval][out] */ ISpeechWaveFormatEx **WaveFormatEx) = 0; + + virtual /* [id][helpstring][hidden] */ HRESULT STDMETHODCALLTYPE SetWaveFormatEx( + /* [in] */ ISpeechWaveFormatEx *WaveFormatEx) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechAudioFormatVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechAudioFormat * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechAudioFormat * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechAudioFormat * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechAudioFormat * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechAudioFormat * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechAudioFormat * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechAudioFormat * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Type )( + ISpeechAudioFormat * This, + /* [retval][out] */ SpeechAudioFormatType *AudioFormat); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Type )( + ISpeechAudioFormat * This, + /* [in] */ SpeechAudioFormatType AudioFormat); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Guid )( + ISpeechAudioFormat * This, + /* [retval][out] */ BSTR *Guid); + + /* [id][helpstring][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Guid )( + ISpeechAudioFormat * This, + /* [in] */ BSTR Guid); + + /* [id][helpstring][hidden] */ HRESULT ( STDMETHODCALLTYPE *GetWaveFormatEx )( + ISpeechAudioFormat * This, + /* [retval][out] */ ISpeechWaveFormatEx **WaveFormatEx); + + /* [id][helpstring][hidden] */ HRESULT ( STDMETHODCALLTYPE *SetWaveFormatEx )( + ISpeechAudioFormat * This, + /* [in] */ ISpeechWaveFormatEx *WaveFormatEx); + + END_INTERFACE + } ISpeechAudioFormatVtbl; + + interface ISpeechAudioFormat + { + CONST_VTBL struct ISpeechAudioFormatVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechAudioFormat_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechAudioFormat_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechAudioFormat_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechAudioFormat_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechAudioFormat_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechAudioFormat_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechAudioFormat_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechAudioFormat_get_Type(This,AudioFormat) \ + (This)->lpVtbl -> get_Type(This,AudioFormat) + +#define ISpeechAudioFormat_put_Type(This,AudioFormat) \ + (This)->lpVtbl -> put_Type(This,AudioFormat) + +#define ISpeechAudioFormat_get_Guid(This,Guid) \ + (This)->lpVtbl -> get_Guid(This,Guid) + +#define ISpeechAudioFormat_put_Guid(This,Guid) \ + (This)->lpVtbl -> put_Guid(This,Guid) + +#define ISpeechAudioFormat_GetWaveFormatEx(This,WaveFormatEx) \ + (This)->lpVtbl -> GetWaveFormatEx(This,WaveFormatEx) + +#define ISpeechAudioFormat_SetWaveFormatEx(This,WaveFormatEx) \ + (This)->lpVtbl -> SetWaveFormatEx(This,WaveFormatEx) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_get_Type_Proxy( + ISpeechAudioFormat * This, + /* [retval][out] */ SpeechAudioFormatType *AudioFormat); + + +void __RPC_STUB ISpeechAudioFormat_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_put_Type_Proxy( + ISpeechAudioFormat * This, + /* [in] */ SpeechAudioFormatType AudioFormat); + + +void __RPC_STUB ISpeechAudioFormat_put_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_get_Guid_Proxy( + ISpeechAudioFormat * This, + /* [retval][out] */ BSTR *Guid); + + +void __RPC_STUB ISpeechAudioFormat_get_Guid_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_put_Guid_Proxy( + ISpeechAudioFormat * This, + /* [in] */ BSTR Guid); + + +void __RPC_STUB ISpeechAudioFormat_put_Guid_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_GetWaveFormatEx_Proxy( + ISpeechAudioFormat * This, + /* [retval][out] */ ISpeechWaveFormatEx **WaveFormatEx); + + +void __RPC_STUB ISpeechAudioFormat_GetWaveFormatEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden] */ HRESULT STDMETHODCALLTYPE ISpeechAudioFormat_SetWaveFormatEx_Proxy( + ISpeechAudioFormat * This, + /* [in] */ ISpeechWaveFormatEx *WaveFormatEx); + + +void __RPC_STUB ISpeechAudioFormat_SetWaveFormatEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechAudioFormat_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechWaveFormatEx_INTERFACE_DEFINED__ +#define __ISpeechWaveFormatEx_INTERFACE_DEFINED__ + +/* interface ISpeechWaveFormatEx */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechWaveFormatEx; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7A1EF0D5-1581-4741-88E4-209A49F11A10") + ISpeechWaveFormatEx : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FormatTag( + /* [retval][out] */ short *FormatTag) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_FormatTag( + /* [in] */ short FormatTag) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Channels( + /* [retval][out] */ short *Channels) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Channels( + /* [in] */ short Channels) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SamplesPerSec( + /* [retval][out] */ long *SamplesPerSec) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_SamplesPerSec( + /* [in] */ long SamplesPerSec) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AvgBytesPerSec( + /* [retval][out] */ long *AvgBytesPerSec) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_AvgBytesPerSec( + /* [in] */ long AvgBytesPerSec) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BlockAlign( + /* [retval][out] */ short *BlockAlign) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_BlockAlign( + /* [in] */ short BlockAlign) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BitsPerSample( + /* [retval][out] */ short *BitsPerSample) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_BitsPerSample( + /* [in] */ short BitsPerSample) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ExtraData( + /* [retval][out] */ VARIANT *ExtraData) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ExtraData( + /* [in] */ VARIANT ExtraData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechWaveFormatExVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechWaveFormatEx * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechWaveFormatEx * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechWaveFormatEx * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechWaveFormatEx * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechWaveFormatEx * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechWaveFormatEx * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechWaveFormatEx * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FormatTag )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *FormatTag); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_FormatTag )( + ISpeechWaveFormatEx * This, + /* [in] */ short FormatTag); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Channels )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *Channels); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Channels )( + ISpeechWaveFormatEx * This, + /* [in] */ short Channels); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SamplesPerSec )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ long *SamplesPerSec); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SamplesPerSec )( + ISpeechWaveFormatEx * This, + /* [in] */ long SamplesPerSec); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AvgBytesPerSec )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ long *AvgBytesPerSec); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AvgBytesPerSec )( + ISpeechWaveFormatEx * This, + /* [in] */ long AvgBytesPerSec); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BlockAlign )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *BlockAlign); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BlockAlign )( + ISpeechWaveFormatEx * This, + /* [in] */ short BlockAlign); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BitsPerSample )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *BitsPerSample); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BitsPerSample )( + ISpeechWaveFormatEx * This, + /* [in] */ short BitsPerSample); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ExtraData )( + ISpeechWaveFormatEx * This, + /* [retval][out] */ VARIANT *ExtraData); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ExtraData )( + ISpeechWaveFormatEx * This, + /* [in] */ VARIANT ExtraData); + + END_INTERFACE + } ISpeechWaveFormatExVtbl; + + interface ISpeechWaveFormatEx + { + CONST_VTBL struct ISpeechWaveFormatExVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechWaveFormatEx_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechWaveFormatEx_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechWaveFormatEx_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechWaveFormatEx_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechWaveFormatEx_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechWaveFormatEx_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechWaveFormatEx_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechWaveFormatEx_get_FormatTag(This,FormatTag) \ + (This)->lpVtbl -> get_FormatTag(This,FormatTag) + +#define ISpeechWaveFormatEx_put_FormatTag(This,FormatTag) \ + (This)->lpVtbl -> put_FormatTag(This,FormatTag) + +#define ISpeechWaveFormatEx_get_Channels(This,Channels) \ + (This)->lpVtbl -> get_Channels(This,Channels) + +#define ISpeechWaveFormatEx_put_Channels(This,Channels) \ + (This)->lpVtbl -> put_Channels(This,Channels) + +#define ISpeechWaveFormatEx_get_SamplesPerSec(This,SamplesPerSec) \ + (This)->lpVtbl -> get_SamplesPerSec(This,SamplesPerSec) + +#define ISpeechWaveFormatEx_put_SamplesPerSec(This,SamplesPerSec) \ + (This)->lpVtbl -> put_SamplesPerSec(This,SamplesPerSec) + +#define ISpeechWaveFormatEx_get_AvgBytesPerSec(This,AvgBytesPerSec) \ + (This)->lpVtbl -> get_AvgBytesPerSec(This,AvgBytesPerSec) + +#define ISpeechWaveFormatEx_put_AvgBytesPerSec(This,AvgBytesPerSec) \ + (This)->lpVtbl -> put_AvgBytesPerSec(This,AvgBytesPerSec) + +#define ISpeechWaveFormatEx_get_BlockAlign(This,BlockAlign) \ + (This)->lpVtbl -> get_BlockAlign(This,BlockAlign) + +#define ISpeechWaveFormatEx_put_BlockAlign(This,BlockAlign) \ + (This)->lpVtbl -> put_BlockAlign(This,BlockAlign) + +#define ISpeechWaveFormatEx_get_BitsPerSample(This,BitsPerSample) \ + (This)->lpVtbl -> get_BitsPerSample(This,BitsPerSample) + +#define ISpeechWaveFormatEx_put_BitsPerSample(This,BitsPerSample) \ + (This)->lpVtbl -> put_BitsPerSample(This,BitsPerSample) + +#define ISpeechWaveFormatEx_get_ExtraData(This,ExtraData) \ + (This)->lpVtbl -> get_ExtraData(This,ExtraData) + +#define ISpeechWaveFormatEx_put_ExtraData(This,ExtraData) \ + (This)->lpVtbl -> put_ExtraData(This,ExtraData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_FormatTag_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *FormatTag); + + +void __RPC_STUB ISpeechWaveFormatEx_get_FormatTag_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_FormatTag_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ short FormatTag); + + +void __RPC_STUB ISpeechWaveFormatEx_put_FormatTag_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_Channels_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *Channels); + + +void __RPC_STUB ISpeechWaveFormatEx_get_Channels_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_Channels_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ short Channels); + + +void __RPC_STUB ISpeechWaveFormatEx_put_Channels_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_SamplesPerSec_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ long *SamplesPerSec); + + +void __RPC_STUB ISpeechWaveFormatEx_get_SamplesPerSec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_SamplesPerSec_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ long SamplesPerSec); + + +void __RPC_STUB ISpeechWaveFormatEx_put_SamplesPerSec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_AvgBytesPerSec_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ long *AvgBytesPerSec); + + +void __RPC_STUB ISpeechWaveFormatEx_get_AvgBytesPerSec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_AvgBytesPerSec_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ long AvgBytesPerSec); + + +void __RPC_STUB ISpeechWaveFormatEx_put_AvgBytesPerSec_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_BlockAlign_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *BlockAlign); + + +void __RPC_STUB ISpeechWaveFormatEx_get_BlockAlign_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_BlockAlign_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ short BlockAlign); + + +void __RPC_STUB ISpeechWaveFormatEx_put_BlockAlign_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_BitsPerSample_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ short *BitsPerSample); + + +void __RPC_STUB ISpeechWaveFormatEx_get_BitsPerSample_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_BitsPerSample_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ short BitsPerSample); + + +void __RPC_STUB ISpeechWaveFormatEx_put_BitsPerSample_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_get_ExtraData_Proxy( + ISpeechWaveFormatEx * This, + /* [retval][out] */ VARIANT *ExtraData); + + +void __RPC_STUB ISpeechWaveFormatEx_get_ExtraData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechWaveFormatEx_put_ExtraData_Proxy( + ISpeechWaveFormatEx * This, + /* [in] */ VARIANT ExtraData); + + +void __RPC_STUB ISpeechWaveFormatEx_put_ExtraData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechWaveFormatEx_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechBaseStream_INTERFACE_DEFINED__ +#define __ISpeechBaseStream_INTERFACE_DEFINED__ + +/* interface ISpeechBaseStream */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechBaseStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6450336F-7D49-4ced-8097-49D6DEE37294") + ISpeechBaseStream : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Format( + /* [retval][out] */ ISpeechAudioFormat **AudioFormat) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Format( + /* [in] */ ISpeechAudioFormat *AudioFormat) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Read( + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Write( + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Seek( + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechBaseStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechBaseStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechBaseStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechBaseStream * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechBaseStream * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechBaseStream * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechBaseStream * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechBaseStream * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechBaseStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechBaseStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechBaseStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechBaseStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechBaseStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + END_INTERFACE + } ISpeechBaseStreamVtbl; + + interface ISpeechBaseStream + { + CONST_VTBL struct ISpeechBaseStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechBaseStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechBaseStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechBaseStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechBaseStream_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechBaseStream_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechBaseStream_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechBaseStream_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechBaseStream_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechBaseStream_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechBaseStream_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechBaseStream_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechBaseStream_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_get_Format_Proxy( + ISpeechBaseStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + +void __RPC_STUB ISpeechBaseStream_get_Format_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_putref_Format_Proxy( + ISpeechBaseStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + +void __RPC_STUB ISpeechBaseStream_putref_Format_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_Read_Proxy( + ISpeechBaseStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + +void __RPC_STUB ISpeechBaseStream_Read_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_Write_Proxy( + ISpeechBaseStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + +void __RPC_STUB ISpeechBaseStream_Write_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechBaseStream_Seek_Proxy( + ISpeechBaseStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + +void __RPC_STUB ISpeechBaseStream_Seek_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechBaseStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechFileStream_INTERFACE_DEFINED__ +#define __ISpeechFileStream_INTERFACE_DEFINED__ + +/* interface ISpeechFileStream */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechFileStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AF67F125-AB39-4e93-B4A2-CC2E66E182A7") + ISpeechFileStream : public ISpeechBaseStream + { + public: + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Open( + /* [in] */ BSTR FileName, + /* [defaultvalue][in] */ SpeechStreamFileMode FileMode = SSFMOpenForRead, + /* [defaultvalue][in] */ VARIANT_BOOL DoEvents = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Close( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechFileStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechFileStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechFileStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechFileStream * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechFileStream * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechFileStream * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechFileStream * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechFileStream * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechFileStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechFileStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechFileStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechFileStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechFileStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Open )( + ISpeechFileStream * This, + /* [in] */ BSTR FileName, + /* [defaultvalue][in] */ SpeechStreamFileMode FileMode, + /* [defaultvalue][in] */ VARIANT_BOOL DoEvents); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Close )( + ISpeechFileStream * This); + + END_INTERFACE + } ISpeechFileStreamVtbl; + + interface ISpeechFileStream + { + CONST_VTBL struct ISpeechFileStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechFileStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechFileStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechFileStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechFileStream_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechFileStream_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechFileStream_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechFileStream_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechFileStream_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechFileStream_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechFileStream_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechFileStream_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechFileStream_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechFileStream_Open(This,FileName,FileMode,DoEvents) \ + (This)->lpVtbl -> Open(This,FileName,FileMode,DoEvents) + +#define ISpeechFileStream_Close(This) \ + (This)->lpVtbl -> Close(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechFileStream_Open_Proxy( + ISpeechFileStream * This, + /* [in] */ BSTR FileName, + /* [defaultvalue][in] */ SpeechStreamFileMode FileMode, + /* [defaultvalue][in] */ VARIANT_BOOL DoEvents); + + +void __RPC_STUB ISpeechFileStream_Open_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechFileStream_Close_Proxy( + ISpeechFileStream * This); + + +void __RPC_STUB ISpeechFileStream_Close_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechFileStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechMemoryStream_INTERFACE_DEFINED__ +#define __ISpeechMemoryStream_INTERFACE_DEFINED__ + +/* interface ISpeechMemoryStream */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechMemoryStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EEB14B68-808B-4abe-A5EA-B51DA7588008") + ISpeechMemoryStream : public ISpeechBaseStream + { + public: + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetData( + /* [in] */ VARIANT Data) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetData( + /* [retval][out] */ VARIANT *pData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechMemoryStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechMemoryStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechMemoryStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechMemoryStream * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechMemoryStream * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechMemoryStream * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechMemoryStream * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechMemoryStream * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechMemoryStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechMemoryStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechMemoryStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechMemoryStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechMemoryStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetData )( + ISpeechMemoryStream * This, + /* [in] */ VARIANT Data); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetData )( + ISpeechMemoryStream * This, + /* [retval][out] */ VARIANT *pData); + + END_INTERFACE + } ISpeechMemoryStreamVtbl; + + interface ISpeechMemoryStream + { + CONST_VTBL struct ISpeechMemoryStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechMemoryStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechMemoryStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechMemoryStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechMemoryStream_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechMemoryStream_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechMemoryStream_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechMemoryStream_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechMemoryStream_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechMemoryStream_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechMemoryStream_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechMemoryStream_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechMemoryStream_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechMemoryStream_SetData(This,Data) \ + (This)->lpVtbl -> SetData(This,Data) + +#define ISpeechMemoryStream_GetData(This,pData) \ + (This)->lpVtbl -> GetData(This,pData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechMemoryStream_SetData_Proxy( + ISpeechMemoryStream * This, + /* [in] */ VARIANT Data); + + +void __RPC_STUB ISpeechMemoryStream_SetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechMemoryStream_GetData_Proxy( + ISpeechMemoryStream * This, + /* [retval][out] */ VARIANT *pData); + + +void __RPC_STUB ISpeechMemoryStream_GetData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechMemoryStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechCustomStream_INTERFACE_DEFINED__ +#define __ISpeechCustomStream_INTERFACE_DEFINED__ + +/* interface ISpeechCustomStream */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechCustomStream; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1A9E9F4F-104F-4db8-A115-EFD7FD0C97AE") + ISpeechCustomStream : public ISpeechBaseStream + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BaseStream( + /* [retval][out] */ IUnknown **ppUnkStream) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_BaseStream( + /* [in] */ IUnknown *pUnkStream) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechCustomStreamVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechCustomStream * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechCustomStream * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechCustomStream * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechCustomStream * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechCustomStream * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechCustomStream * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechCustomStream * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechCustomStream * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechCustomStream * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechCustomStream * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechCustomStream * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechCustomStream * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BaseStream )( + ISpeechCustomStream * This, + /* [retval][out] */ IUnknown **ppUnkStream); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_BaseStream )( + ISpeechCustomStream * This, + /* [in] */ IUnknown *pUnkStream); + + END_INTERFACE + } ISpeechCustomStreamVtbl; + + interface ISpeechCustomStream + { + CONST_VTBL struct ISpeechCustomStreamVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechCustomStream_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechCustomStream_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechCustomStream_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechCustomStream_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechCustomStream_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechCustomStream_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechCustomStream_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechCustomStream_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechCustomStream_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechCustomStream_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechCustomStream_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechCustomStream_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechCustomStream_get_BaseStream(This,ppUnkStream) \ + (This)->lpVtbl -> get_BaseStream(This,ppUnkStream) + +#define ISpeechCustomStream_putref_BaseStream(This,pUnkStream) \ + (This)->lpVtbl -> putref_BaseStream(This,pUnkStream) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechCustomStream_get_BaseStream_Proxy( + ISpeechCustomStream * This, + /* [retval][out] */ IUnknown **ppUnkStream); + + +void __RPC_STUB ISpeechCustomStream_get_BaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechCustomStream_putref_BaseStream_Proxy( + ISpeechCustomStream * This, + /* [in] */ IUnknown *pUnkStream); + + +void __RPC_STUB ISpeechCustomStream_putref_BaseStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechCustomStream_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechAudio_INTERFACE_DEFINED__ +#define __ISpeechAudio_INTERFACE_DEFINED__ + +/* interface ISpeechAudio */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechAudio; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CFF8E175-019E-11d3-A08E-00C04F8EF9B5") + ISpeechAudio : public ISpeechBaseStream + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Status( + /* [retval][out] */ ISpeechAudioStatus **Status) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BufferInfo( + /* [retval][out] */ ISpeechAudioBufferInfo **BufferInfo) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DefaultFormat( + /* [retval][out] */ ISpeechAudioFormat **StreamFormat) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Volume( + /* [retval][out] */ long *Volume) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Volume( + /* [in] */ long Volume) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_BufferNotifySize( + /* [retval][out] */ long *BufferNotifySize) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_BufferNotifySize( + /* [in] */ long BufferNotifySize) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_EventHandle( + /* [retval][out] */ long *EventHandle) = 0; + + virtual /* [hidden][id][helpstring] */ HRESULT STDMETHODCALLTYPE SetState( + /* [in] */ SpeechAudioState State) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechAudioVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechAudio * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechAudio * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechAudio * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechAudio * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechAudio * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechAudio * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechAudio * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechAudio * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechAudio * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechAudio * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechAudio * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioStatus **Status); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferInfo )( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioBufferInfo **BufferInfo); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DefaultFormat )( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioFormat **StreamFormat); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Volume )( + ISpeechAudio * This, + /* [retval][out] */ long *Volume); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Volume )( + ISpeechAudio * This, + /* [in] */ long Volume); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferNotifySize )( + ISpeechAudio * This, + /* [retval][out] */ long *BufferNotifySize); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BufferNotifySize )( + ISpeechAudio * This, + /* [in] */ long BufferNotifySize); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventHandle )( + ISpeechAudio * This, + /* [retval][out] */ long *EventHandle); + + /* [hidden][id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetState )( + ISpeechAudio * This, + /* [in] */ SpeechAudioState State); + + END_INTERFACE + } ISpeechAudioVtbl; + + interface ISpeechAudio + { + CONST_VTBL struct ISpeechAudioVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechAudio_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechAudio_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechAudio_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechAudio_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechAudio_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechAudio_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechAudio_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechAudio_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechAudio_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechAudio_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechAudio_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechAudio_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechAudio_get_Status(This,Status) \ + (This)->lpVtbl -> get_Status(This,Status) + +#define ISpeechAudio_get_BufferInfo(This,BufferInfo) \ + (This)->lpVtbl -> get_BufferInfo(This,BufferInfo) + +#define ISpeechAudio_get_DefaultFormat(This,StreamFormat) \ + (This)->lpVtbl -> get_DefaultFormat(This,StreamFormat) + +#define ISpeechAudio_get_Volume(This,Volume) \ + (This)->lpVtbl -> get_Volume(This,Volume) + +#define ISpeechAudio_put_Volume(This,Volume) \ + (This)->lpVtbl -> put_Volume(This,Volume) + +#define ISpeechAudio_get_BufferNotifySize(This,BufferNotifySize) \ + (This)->lpVtbl -> get_BufferNotifySize(This,BufferNotifySize) + +#define ISpeechAudio_put_BufferNotifySize(This,BufferNotifySize) \ + (This)->lpVtbl -> put_BufferNotifySize(This,BufferNotifySize) + +#define ISpeechAudio_get_EventHandle(This,EventHandle) \ + (This)->lpVtbl -> get_EventHandle(This,EventHandle) + +#define ISpeechAudio_SetState(This,State) \ + (This)->lpVtbl -> SetState(This,State) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_Status_Proxy( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioStatus **Status); + + +void __RPC_STUB ISpeechAudio_get_Status_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_BufferInfo_Proxy( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioBufferInfo **BufferInfo); + + +void __RPC_STUB ISpeechAudio_get_BufferInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_DefaultFormat_Proxy( + ISpeechAudio * This, + /* [retval][out] */ ISpeechAudioFormat **StreamFormat); + + +void __RPC_STUB ISpeechAudio_get_DefaultFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_Volume_Proxy( + ISpeechAudio * This, + /* [retval][out] */ long *Volume); + + +void __RPC_STUB ISpeechAudio_get_Volume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_put_Volume_Proxy( + ISpeechAudio * This, + /* [in] */ long Volume); + + +void __RPC_STUB ISpeechAudio_put_Volume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_BufferNotifySize_Proxy( + ISpeechAudio * This, + /* [retval][out] */ long *BufferNotifySize); + + +void __RPC_STUB ISpeechAudio_get_BufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_put_BufferNotifySize_Proxy( + ISpeechAudio * This, + /* [in] */ long BufferNotifySize); + + +void __RPC_STUB ISpeechAudio_put_BufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_get_EventHandle_Proxy( + ISpeechAudio * This, + /* [retval][out] */ long *EventHandle); + + +void __RPC_STUB ISpeechAudio_get_EventHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechAudio_SetState_Proxy( + ISpeechAudio * This, + /* [in] */ SpeechAudioState State); + + +void __RPC_STUB ISpeechAudio_SetState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechAudio_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechMMSysAudio_INTERFACE_DEFINED__ +#define __ISpeechMMSysAudio_INTERFACE_DEFINED__ + +/* interface ISpeechMMSysAudio */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechMMSysAudio; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3C76AF6D-1FD7-4831-81D1-3B71D5A13C44") + ISpeechMMSysAudio : public ISpeechAudio + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DeviceId( + /* [retval][out] */ long *DeviceId) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_DeviceId( + /* [in] */ long DeviceId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LineId( + /* [retval][out] */ long *LineId) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_LineId( + /* [in] */ long LineId) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_MMHandle( + /* [retval][out] */ long *Handle) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechMMSysAudioVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechMMSysAudio * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechMMSysAudio * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechMMSysAudio * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechMMSysAudio * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechMMSysAudio * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechMMSysAudio * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechMMSysAudio * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Format )( + ISpeechMMSysAudio * This, + /* [retval][out] */ ISpeechAudioFormat **AudioFormat); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Format )( + ISpeechMMSysAudio * This, + /* [in] */ ISpeechAudioFormat *AudioFormat); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Read )( + ISpeechMMSysAudio * This, + /* [out] */ VARIANT *Buffer, + /* [in] */ long NumberOfBytes, + /* [retval][out] */ long *BytesRead); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Write )( + ISpeechMMSysAudio * This, + /* [in] */ VARIANT Buffer, + /* [retval][out] */ long *BytesWritten); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Seek )( + ISpeechMMSysAudio * This, + /* [in] */ VARIANT Position, + /* [defaultvalue][in] */ SpeechStreamSeekPositionType Origin, + /* [retval][out] */ VARIANT *NewPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ISpeechMMSysAudio * This, + /* [retval][out] */ ISpeechAudioStatus **Status); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferInfo )( + ISpeechMMSysAudio * This, + /* [retval][out] */ ISpeechAudioBufferInfo **BufferInfo); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DefaultFormat )( + ISpeechMMSysAudio * This, + /* [retval][out] */ ISpeechAudioFormat **StreamFormat); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Volume )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *Volume); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Volume )( + ISpeechMMSysAudio * This, + /* [in] */ long Volume); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_BufferNotifySize )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *BufferNotifySize); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_BufferNotifySize )( + ISpeechMMSysAudio * This, + /* [in] */ long BufferNotifySize); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventHandle )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *EventHandle); + + /* [hidden][id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetState )( + ISpeechMMSysAudio * This, + /* [in] */ SpeechAudioState State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeviceId )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *DeviceId); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_DeviceId )( + ISpeechMMSysAudio * This, + /* [in] */ long DeviceId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LineId )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *LineId); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_LineId )( + ISpeechMMSysAudio * This, + /* [in] */ long LineId); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MMHandle )( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *Handle); + + END_INTERFACE + } ISpeechMMSysAudioVtbl; + + interface ISpeechMMSysAudio + { + CONST_VTBL struct ISpeechMMSysAudioVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechMMSysAudio_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechMMSysAudio_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechMMSysAudio_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechMMSysAudio_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechMMSysAudio_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechMMSysAudio_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechMMSysAudio_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechMMSysAudio_get_Format(This,AudioFormat) \ + (This)->lpVtbl -> get_Format(This,AudioFormat) + +#define ISpeechMMSysAudio_putref_Format(This,AudioFormat) \ + (This)->lpVtbl -> putref_Format(This,AudioFormat) + +#define ISpeechMMSysAudio_Read(This,Buffer,NumberOfBytes,BytesRead) \ + (This)->lpVtbl -> Read(This,Buffer,NumberOfBytes,BytesRead) + +#define ISpeechMMSysAudio_Write(This,Buffer,BytesWritten) \ + (This)->lpVtbl -> Write(This,Buffer,BytesWritten) + +#define ISpeechMMSysAudio_Seek(This,Position,Origin,NewPosition) \ + (This)->lpVtbl -> Seek(This,Position,Origin,NewPosition) + + +#define ISpeechMMSysAudio_get_Status(This,Status) \ + (This)->lpVtbl -> get_Status(This,Status) + +#define ISpeechMMSysAudio_get_BufferInfo(This,BufferInfo) \ + (This)->lpVtbl -> get_BufferInfo(This,BufferInfo) + +#define ISpeechMMSysAudio_get_DefaultFormat(This,StreamFormat) \ + (This)->lpVtbl -> get_DefaultFormat(This,StreamFormat) + +#define ISpeechMMSysAudio_get_Volume(This,Volume) \ + (This)->lpVtbl -> get_Volume(This,Volume) + +#define ISpeechMMSysAudio_put_Volume(This,Volume) \ + (This)->lpVtbl -> put_Volume(This,Volume) + +#define ISpeechMMSysAudio_get_BufferNotifySize(This,BufferNotifySize) \ + (This)->lpVtbl -> get_BufferNotifySize(This,BufferNotifySize) + +#define ISpeechMMSysAudio_put_BufferNotifySize(This,BufferNotifySize) \ + (This)->lpVtbl -> put_BufferNotifySize(This,BufferNotifySize) + +#define ISpeechMMSysAudio_get_EventHandle(This,EventHandle) \ + (This)->lpVtbl -> get_EventHandle(This,EventHandle) + +#define ISpeechMMSysAudio_SetState(This,State) \ + (This)->lpVtbl -> SetState(This,State) + + +#define ISpeechMMSysAudio_get_DeviceId(This,DeviceId) \ + (This)->lpVtbl -> get_DeviceId(This,DeviceId) + +#define ISpeechMMSysAudio_put_DeviceId(This,DeviceId) \ + (This)->lpVtbl -> put_DeviceId(This,DeviceId) + +#define ISpeechMMSysAudio_get_LineId(This,LineId) \ + (This)->lpVtbl -> get_LineId(This,LineId) + +#define ISpeechMMSysAudio_put_LineId(This,LineId) \ + (This)->lpVtbl -> put_LineId(This,LineId) + +#define ISpeechMMSysAudio_get_MMHandle(This,Handle) \ + (This)->lpVtbl -> get_MMHandle(This,Handle) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_get_DeviceId_Proxy( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *DeviceId); + + +void __RPC_STUB ISpeechMMSysAudio_get_DeviceId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_put_DeviceId_Proxy( + ISpeechMMSysAudio * This, + /* [in] */ long DeviceId); + + +void __RPC_STUB ISpeechMMSysAudio_put_DeviceId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_get_LineId_Proxy( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *LineId); + + +void __RPC_STUB ISpeechMMSysAudio_get_LineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_put_LineId_Proxy( + ISpeechMMSysAudio * This, + /* [in] */ long LineId); + + +void __RPC_STUB ISpeechMMSysAudio_put_LineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechMMSysAudio_get_MMHandle_Proxy( + ISpeechMMSysAudio * This, + /* [retval][out] */ long *Handle); + + +void __RPC_STUB ISpeechMMSysAudio_get_MMHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechMMSysAudio_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechVoice_INTERFACE_DEFINED__ +#define __ISpeechVoice_INTERFACE_DEFINED__ + +/* interface ISpeechVoice */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechVoice; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("269316D8-57BD-11D2-9EEE-00C04F797396") + ISpeechVoice : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Status( + /* [retval][out] */ ISpeechVoiceStatus **Status) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Voice( + /* [retval][out] */ ISpeechObjectToken **Voice) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Voice( + /* [in] */ ISpeechObjectToken *Voice) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioOutput( + /* [retval][out] */ ISpeechObjectToken **AudioOutput) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioOutput( + /* [in] */ ISpeechObjectToken *AudioOutput) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioOutputStream( + /* [retval][out] */ ISpeechBaseStream **AudioOutputStream) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioOutputStream( + /* [in] */ ISpeechBaseStream *AudioOutputStream) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rate( + /* [retval][out] */ long *Rate) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Rate( + /* [in] */ long Rate) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Volume( + /* [retval][out] */ long *Volume) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Volume( + /* [in] */ long Volume) = 0; + + virtual /* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_AllowAudioOutputFormatChangesOnNextSet( + /* [in] */ VARIANT_BOOL Allow) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_AllowAudioOutputFormatChangesOnNextSet( + /* [retval][out] */ VARIANT_BOOL *Allow) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EventInterests( + /* [retval][out] */ SpeechVoiceEvents *EventInterestFlags) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_EventInterests( + /* [in] */ SpeechVoiceEvents EventInterestFlags) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_Priority( + /* [in] */ SpeechVoicePriority Priority) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Priority( + /* [retval][out] */ SpeechVoicePriority *Priority) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_AlertBoundary( + /* [in] */ SpeechVoiceEvents Boundary) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AlertBoundary( + /* [retval][out] */ SpeechVoiceEvents *Boundary) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_SynchronousSpeakTimeout( + /* [in] */ long msTimeout) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SynchronousSpeakTimeout( + /* [retval][out] */ long *msTimeout) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Speak( + /* [in] */ BSTR Text, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SpeakStream( + /* [in] */ ISpeechBaseStream *Stream, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Resume( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Skip( + /* [in] */ const BSTR Type, + /* [in] */ long NumItems, + /* [retval][out] */ long *NumSkipped) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetVoices( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetAudioOutputs( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE WaitUntilDone( + /* [in] */ long msTimeout, + /* [retval][out] */ VARIANT_BOOL *Done) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE SpeakCompleteEvent( + /* [retval][out] */ long *Handle) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData = 0) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechVoiceVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechVoice * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechVoice * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechVoice * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechVoice * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechVoice * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechVoice * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechVoice * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ISpeechVoice * This, + /* [retval][out] */ ISpeechVoiceStatus **Status); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Voice )( + ISpeechVoice * This, + /* [retval][out] */ ISpeechObjectToken **Voice); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Voice )( + ISpeechVoice * This, + /* [in] */ ISpeechObjectToken *Voice); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioOutput )( + ISpeechVoice * This, + /* [retval][out] */ ISpeechObjectToken **AudioOutput); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioOutput )( + ISpeechVoice * This, + /* [in] */ ISpeechObjectToken *AudioOutput); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioOutputStream )( + ISpeechVoice * This, + /* [retval][out] */ ISpeechBaseStream **AudioOutputStream); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioOutputStream )( + ISpeechVoice * This, + /* [in] */ ISpeechBaseStream *AudioOutputStream); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rate )( + ISpeechVoice * This, + /* [retval][out] */ long *Rate); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Rate )( + ISpeechVoice * This, + /* [in] */ long Rate); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Volume )( + ISpeechVoice * This, + /* [retval][out] */ long *Volume); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Volume )( + ISpeechVoice * This, + /* [in] */ long Volume); + + /* [id][helpstring][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AllowAudioOutputFormatChangesOnNextSet )( + ISpeechVoice * This, + /* [in] */ VARIANT_BOOL Allow); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllowAudioOutputFormatChangesOnNextSet )( + ISpeechVoice * This, + /* [retval][out] */ VARIANT_BOOL *Allow); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventInterests )( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoiceEvents *EventInterestFlags); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventInterests )( + ISpeechVoice * This, + /* [in] */ SpeechVoiceEvents EventInterestFlags); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_Priority )( + ISpeechVoice * This, + /* [in] */ SpeechVoicePriority Priority); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Priority )( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoicePriority *Priority); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AlertBoundary )( + ISpeechVoice * This, + /* [in] */ SpeechVoiceEvents Boundary); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AlertBoundary )( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoiceEvents *Boundary); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SynchronousSpeakTimeout )( + ISpeechVoice * This, + /* [in] */ long msTimeout); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SynchronousSpeakTimeout )( + ISpeechVoice * This, + /* [retval][out] */ long *msTimeout); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Speak )( + ISpeechVoice * This, + /* [in] */ BSTR Text, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SpeakStream )( + ISpeechVoice * This, + /* [in] */ ISpeechBaseStream *Stream, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Pause )( + ISpeechVoice * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Resume )( + ISpeechVoice * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Skip )( + ISpeechVoice * This, + /* [in] */ const BSTR Type, + /* [in] */ long NumItems, + /* [retval][out] */ long *NumSkipped); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetVoices )( + ISpeechVoice * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetAudioOutputs )( + ISpeechVoice * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *WaitUntilDone )( + ISpeechVoice * This, + /* [in] */ long msTimeout, + /* [retval][out] */ VARIANT_BOOL *Done); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SpeakCompleteEvent )( + ISpeechVoice * This, + /* [retval][out] */ long *Handle); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpeechVoice * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpeechVoice * This, + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData); + + END_INTERFACE + } ISpeechVoiceVtbl; + + interface ISpeechVoice + { + CONST_VTBL struct ISpeechVoiceVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechVoice_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechVoice_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechVoice_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechVoice_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechVoice_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechVoice_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechVoice_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechVoice_get_Status(This,Status) \ + (This)->lpVtbl -> get_Status(This,Status) + +#define ISpeechVoice_get_Voice(This,Voice) \ + (This)->lpVtbl -> get_Voice(This,Voice) + +#define ISpeechVoice_putref_Voice(This,Voice) \ + (This)->lpVtbl -> putref_Voice(This,Voice) + +#define ISpeechVoice_get_AudioOutput(This,AudioOutput) \ + (This)->lpVtbl -> get_AudioOutput(This,AudioOutput) + +#define ISpeechVoice_putref_AudioOutput(This,AudioOutput) \ + (This)->lpVtbl -> putref_AudioOutput(This,AudioOutput) + +#define ISpeechVoice_get_AudioOutputStream(This,AudioOutputStream) \ + (This)->lpVtbl -> get_AudioOutputStream(This,AudioOutputStream) + +#define ISpeechVoice_putref_AudioOutputStream(This,AudioOutputStream) \ + (This)->lpVtbl -> putref_AudioOutputStream(This,AudioOutputStream) + +#define ISpeechVoice_get_Rate(This,Rate) \ + (This)->lpVtbl -> get_Rate(This,Rate) + +#define ISpeechVoice_put_Rate(This,Rate) \ + (This)->lpVtbl -> put_Rate(This,Rate) + +#define ISpeechVoice_get_Volume(This,Volume) \ + (This)->lpVtbl -> get_Volume(This,Volume) + +#define ISpeechVoice_put_Volume(This,Volume) \ + (This)->lpVtbl -> put_Volume(This,Volume) + +#define ISpeechVoice_put_AllowAudioOutputFormatChangesOnNextSet(This,Allow) \ + (This)->lpVtbl -> put_AllowAudioOutputFormatChangesOnNextSet(This,Allow) + +#define ISpeechVoice_get_AllowAudioOutputFormatChangesOnNextSet(This,Allow) \ + (This)->lpVtbl -> get_AllowAudioOutputFormatChangesOnNextSet(This,Allow) + +#define ISpeechVoice_get_EventInterests(This,EventInterestFlags) \ + (This)->lpVtbl -> get_EventInterests(This,EventInterestFlags) + +#define ISpeechVoice_put_EventInterests(This,EventInterestFlags) \ + (This)->lpVtbl -> put_EventInterests(This,EventInterestFlags) + +#define ISpeechVoice_put_Priority(This,Priority) \ + (This)->lpVtbl -> put_Priority(This,Priority) + +#define ISpeechVoice_get_Priority(This,Priority) \ + (This)->lpVtbl -> get_Priority(This,Priority) + +#define ISpeechVoice_put_AlertBoundary(This,Boundary) \ + (This)->lpVtbl -> put_AlertBoundary(This,Boundary) + +#define ISpeechVoice_get_AlertBoundary(This,Boundary) \ + (This)->lpVtbl -> get_AlertBoundary(This,Boundary) + +#define ISpeechVoice_put_SynchronousSpeakTimeout(This,msTimeout) \ + (This)->lpVtbl -> put_SynchronousSpeakTimeout(This,msTimeout) + +#define ISpeechVoice_get_SynchronousSpeakTimeout(This,msTimeout) \ + (This)->lpVtbl -> get_SynchronousSpeakTimeout(This,msTimeout) + +#define ISpeechVoice_Speak(This,Text,Flags,StreamNumber) \ + (This)->lpVtbl -> Speak(This,Text,Flags,StreamNumber) + +#define ISpeechVoice_SpeakStream(This,Stream,Flags,StreamNumber) \ + (This)->lpVtbl -> SpeakStream(This,Stream,Flags,StreamNumber) + +#define ISpeechVoice_Pause(This) \ + (This)->lpVtbl -> Pause(This) + +#define ISpeechVoice_Resume(This) \ + (This)->lpVtbl -> Resume(This) + +#define ISpeechVoice_Skip(This,Type,NumItems,NumSkipped) \ + (This)->lpVtbl -> Skip(This,Type,NumItems,NumSkipped) + +#define ISpeechVoice_GetVoices(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetVoices(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#define ISpeechVoice_GetAudioOutputs(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetAudioOutputs(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#define ISpeechVoice_WaitUntilDone(This,msTimeout,Done) \ + (This)->lpVtbl -> WaitUntilDone(This,msTimeout,Done) + +#define ISpeechVoice_SpeakCompleteEvent(This,Handle) \ + (This)->lpVtbl -> SpeakCompleteEvent(This,Handle) + +#define ISpeechVoice_IsUISupported(This,TypeOfUI,ExtraData,Supported) \ + (This)->lpVtbl -> IsUISupported(This,TypeOfUI,ExtraData,Supported) + +#define ISpeechVoice_DisplayUI(This,hWndParent,Title,TypeOfUI,ExtraData) \ + (This)->lpVtbl -> DisplayUI(This,hWndParent,Title,TypeOfUI,ExtraData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Status_Proxy( + ISpeechVoice * This, + /* [retval][out] */ ISpeechVoiceStatus **Status); + + +void __RPC_STUB ISpeechVoice_get_Status_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Voice_Proxy( + ISpeechVoice * This, + /* [retval][out] */ ISpeechObjectToken **Voice); + + +void __RPC_STUB ISpeechVoice_get_Voice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_putref_Voice_Proxy( + ISpeechVoice * This, + /* [in] */ ISpeechObjectToken *Voice); + + +void __RPC_STUB ISpeechVoice_putref_Voice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_AudioOutput_Proxy( + ISpeechVoice * This, + /* [retval][out] */ ISpeechObjectToken **AudioOutput); + + +void __RPC_STUB ISpeechVoice_get_AudioOutput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_putref_AudioOutput_Proxy( + ISpeechVoice * This, + /* [in] */ ISpeechObjectToken *AudioOutput); + + +void __RPC_STUB ISpeechVoice_putref_AudioOutput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_AudioOutputStream_Proxy( + ISpeechVoice * This, + /* [retval][out] */ ISpeechBaseStream **AudioOutputStream); + + +void __RPC_STUB ISpeechVoice_get_AudioOutputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_putref_AudioOutputStream_Proxy( + ISpeechVoice * This, + /* [in] */ ISpeechBaseStream *AudioOutputStream); + + +void __RPC_STUB ISpeechVoice_putref_AudioOutputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Rate_Proxy( + ISpeechVoice * This, + /* [retval][out] */ long *Rate); + + +void __RPC_STUB ISpeechVoice_get_Rate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_Rate_Proxy( + ISpeechVoice * This, + /* [in] */ long Rate); + + +void __RPC_STUB ISpeechVoice_put_Rate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Volume_Proxy( + ISpeechVoice * This, + /* [retval][out] */ long *Volume); + + +void __RPC_STUB ISpeechVoice_get_Volume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_Volume_Proxy( + ISpeechVoice * This, + /* [in] */ long Volume); + + +void __RPC_STUB ISpeechVoice_put_Volume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_AllowAudioOutputFormatChangesOnNextSet_Proxy( + ISpeechVoice * This, + /* [in] */ VARIANT_BOOL Allow); + + +void __RPC_STUB ISpeechVoice_put_AllowAudioOutputFormatChangesOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_AllowAudioOutputFormatChangesOnNextSet_Proxy( + ISpeechVoice * This, + /* [retval][out] */ VARIANT_BOOL *Allow); + + +void __RPC_STUB ISpeechVoice_get_AllowAudioOutputFormatChangesOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_EventInterests_Proxy( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoiceEvents *EventInterestFlags); + + +void __RPC_STUB ISpeechVoice_get_EventInterests_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_EventInterests_Proxy( + ISpeechVoice * This, + /* [in] */ SpeechVoiceEvents EventInterestFlags); + + +void __RPC_STUB ISpeechVoice_put_EventInterests_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_Priority_Proxy( + ISpeechVoice * This, + /* [in] */ SpeechVoicePriority Priority); + + +void __RPC_STUB ISpeechVoice_put_Priority_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_Priority_Proxy( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoicePriority *Priority); + + +void __RPC_STUB ISpeechVoice_get_Priority_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_AlertBoundary_Proxy( + ISpeechVoice * This, + /* [in] */ SpeechVoiceEvents Boundary); + + +void __RPC_STUB ISpeechVoice_put_AlertBoundary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_AlertBoundary_Proxy( + ISpeechVoice * This, + /* [retval][out] */ SpeechVoiceEvents *Boundary); + + +void __RPC_STUB ISpeechVoice_get_AlertBoundary_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_put_SynchronousSpeakTimeout_Proxy( + ISpeechVoice * This, + /* [in] */ long msTimeout); + + +void __RPC_STUB ISpeechVoice_put_SynchronousSpeakTimeout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_get_SynchronousSpeakTimeout_Proxy( + ISpeechVoice * This, + /* [retval][out] */ long *msTimeout); + + +void __RPC_STUB ISpeechVoice_get_SynchronousSpeakTimeout_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_Speak_Proxy( + ISpeechVoice * This, + /* [in] */ BSTR Text, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechVoice_Speak_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_SpeakStream_Proxy( + ISpeechVoice * This, + /* [in] */ ISpeechBaseStream *Stream, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechVoice_SpeakStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_Pause_Proxy( + ISpeechVoice * This); + + +void __RPC_STUB ISpeechVoice_Pause_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_Resume_Proxy( + ISpeechVoice * This); + + +void __RPC_STUB ISpeechVoice_Resume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_Skip_Proxy( + ISpeechVoice * This, + /* [in] */ const BSTR Type, + /* [in] */ long NumItems, + /* [retval][out] */ long *NumSkipped); + + +void __RPC_STUB ISpeechVoice_Skip_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_GetVoices_Proxy( + ISpeechVoice * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechVoice_GetVoices_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_GetAudioOutputs_Proxy( + ISpeechVoice * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechVoice_GetAudioOutputs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_WaitUntilDone_Proxy( + ISpeechVoice * This, + /* [in] */ long msTimeout, + /* [retval][out] */ VARIANT_BOOL *Done); + + +void __RPC_STUB ISpeechVoice_WaitUntilDone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_SpeakCompleteEvent_Proxy( + ISpeechVoice * This, + /* [retval][out] */ long *Handle); + + +void __RPC_STUB ISpeechVoice_SpeakCompleteEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_IsUISupported_Proxy( + ISpeechVoice * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechVoice_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechVoice_DisplayUI_Proxy( + ISpeechVoice * This, + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData); + + +void __RPC_STUB ISpeechVoice_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechVoice_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechVoiceStatus_INTERFACE_DEFINED__ +#define __ISpeechVoiceStatus_INTERFACE_DEFINED__ + +/* interface ISpeechVoiceStatus */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechVoiceStatus; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8BE47B07-57F6-11d2-9EEE-00C04F797396") + ISpeechVoiceStatus : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentStreamNumber( + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LastStreamNumberQueued( + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LastHResult( + /* [retval][out] */ long *HResult) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RunningState( + /* [retval][out] */ SpeechRunState *State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InputWordPosition( + /* [retval][out] */ long *Position) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InputWordLength( + /* [retval][out] */ long *Length) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InputSentencePosition( + /* [retval][out] */ long *Position) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InputSentenceLength( + /* [retval][out] */ long *Length) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LastBookmark( + /* [retval][out] */ BSTR *Bookmark) = 0; + + virtual /* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LastBookmarkId( + /* [retval][out] */ long *BookmarkId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PhonemeId( + /* [retval][out] */ short *PhoneId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_VisemeId( + /* [retval][out] */ short *VisemeId) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechVoiceStatusVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechVoiceStatus * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechVoiceStatus * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechVoiceStatus * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechVoiceStatus * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechVoiceStatus * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechVoiceStatus * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechVoiceStatus * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentStreamNumber )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LastStreamNumberQueued )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LastHResult )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *HResult); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RunningState )( + ISpeechVoiceStatus * This, + /* [retval][out] */ SpeechRunState *State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InputWordPosition )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Position); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InputWordLength )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Length); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InputSentencePosition )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Position); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InputSentenceLength )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Length); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LastBookmark )( + ISpeechVoiceStatus * This, + /* [retval][out] */ BSTR *Bookmark); + + /* [hidden][id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LastBookmarkId )( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *BookmarkId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PhonemeId )( + ISpeechVoiceStatus * This, + /* [retval][out] */ short *PhoneId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_VisemeId )( + ISpeechVoiceStatus * This, + /* [retval][out] */ short *VisemeId); + + END_INTERFACE + } ISpeechVoiceStatusVtbl; + + interface ISpeechVoiceStatus + { + CONST_VTBL struct ISpeechVoiceStatusVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechVoiceStatus_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechVoiceStatus_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechVoiceStatus_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechVoiceStatus_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechVoiceStatus_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechVoiceStatus_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechVoiceStatus_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechVoiceStatus_get_CurrentStreamNumber(This,StreamNumber) \ + (This)->lpVtbl -> get_CurrentStreamNumber(This,StreamNumber) + +#define ISpeechVoiceStatus_get_LastStreamNumberQueued(This,StreamNumber) \ + (This)->lpVtbl -> get_LastStreamNumberQueued(This,StreamNumber) + +#define ISpeechVoiceStatus_get_LastHResult(This,HResult) \ + (This)->lpVtbl -> get_LastHResult(This,HResult) + +#define ISpeechVoiceStatus_get_RunningState(This,State) \ + (This)->lpVtbl -> get_RunningState(This,State) + +#define ISpeechVoiceStatus_get_InputWordPosition(This,Position) \ + (This)->lpVtbl -> get_InputWordPosition(This,Position) + +#define ISpeechVoiceStatus_get_InputWordLength(This,Length) \ + (This)->lpVtbl -> get_InputWordLength(This,Length) + +#define ISpeechVoiceStatus_get_InputSentencePosition(This,Position) \ + (This)->lpVtbl -> get_InputSentencePosition(This,Position) + +#define ISpeechVoiceStatus_get_InputSentenceLength(This,Length) \ + (This)->lpVtbl -> get_InputSentenceLength(This,Length) + +#define ISpeechVoiceStatus_get_LastBookmark(This,Bookmark) \ + (This)->lpVtbl -> get_LastBookmark(This,Bookmark) + +#define ISpeechVoiceStatus_get_LastBookmarkId(This,BookmarkId) \ + (This)->lpVtbl -> get_LastBookmarkId(This,BookmarkId) + +#define ISpeechVoiceStatus_get_PhonemeId(This,PhoneId) \ + (This)->lpVtbl -> get_PhonemeId(This,PhoneId) + +#define ISpeechVoiceStatus_get_VisemeId(This,VisemeId) \ + (This)->lpVtbl -> get_VisemeId(This,VisemeId) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_CurrentStreamNumber_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechVoiceStatus_get_CurrentStreamNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_LastStreamNumberQueued_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechVoiceStatus_get_LastStreamNumberQueued_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_LastHResult_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *HResult); + + +void __RPC_STUB ISpeechVoiceStatus_get_LastHResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_RunningState_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ SpeechRunState *State); + + +void __RPC_STUB ISpeechVoiceStatus_get_RunningState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_InputWordPosition_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Position); + + +void __RPC_STUB ISpeechVoiceStatus_get_InputWordPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_InputWordLength_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Length); + + +void __RPC_STUB ISpeechVoiceStatus_get_InputWordLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_InputSentencePosition_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Position); + + +void __RPC_STUB ISpeechVoiceStatus_get_InputSentencePosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_InputSentenceLength_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *Length); + + +void __RPC_STUB ISpeechVoiceStatus_get_InputSentenceLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_LastBookmark_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ BSTR *Bookmark); + + +void __RPC_STUB ISpeechVoiceStatus_get_LastBookmark_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_LastBookmarkId_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ long *BookmarkId); + + +void __RPC_STUB ISpeechVoiceStatus_get_LastBookmarkId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_PhonemeId_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ short *PhoneId); + + +void __RPC_STUB ISpeechVoiceStatus_get_PhonemeId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechVoiceStatus_get_VisemeId_Proxy( + ISpeechVoiceStatus * This, + /* [retval][out] */ short *VisemeId); + + +void __RPC_STUB ISpeechVoiceStatus_get_VisemeId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechVoiceStatus_INTERFACE_DEFINED__ */ + + +#ifndef ___ISpeechVoiceEvents_DISPINTERFACE_DEFINED__ +#define ___ISpeechVoiceEvents_DISPINTERFACE_DEFINED__ + +/* dispinterface _ISpeechVoiceEvents */ +/* [uuid] */ + + +EXTERN_C const IID DIID__ISpeechVoiceEvents; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A372ACD1-3BEF-4bbd-8FFB-CB3E2B416AF8") + _ISpeechVoiceEvents : public IDispatch + { + }; + +#else /* C style interface */ + + typedef struct _ISpeechVoiceEventsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + _ISpeechVoiceEvents * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + _ISpeechVoiceEvents * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + _ISpeechVoiceEvents * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + _ISpeechVoiceEvents * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + _ISpeechVoiceEvents * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + _ISpeechVoiceEvents * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + _ISpeechVoiceEvents * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + END_INTERFACE + } _ISpeechVoiceEventsVtbl; + + interface _ISpeechVoiceEvents + { + CONST_VTBL struct _ISpeechVoiceEventsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define _ISpeechVoiceEvents_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define _ISpeechVoiceEvents_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define _ISpeechVoiceEvents_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define _ISpeechVoiceEvents_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define _ISpeechVoiceEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define _ISpeechVoiceEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define _ISpeechVoiceEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + +#endif /* ___ISpeechVoiceEvents_DISPINTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecognizer_INTERFACE_DEFINED__ +#define __ISpeechRecognizer_INTERFACE_DEFINED__ + +/* interface ISpeechRecognizer */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecognizer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2D5F1C0C-BD75-4b08-9478-3B11FEA2586C") + ISpeechRecognizer : public IDispatch + { + public: + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Recognizer( + /* [in] */ ISpeechObjectToken *Recognizer) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Recognizer( + /* [retval][out] */ ISpeechObjectToken **Recognizer) = 0; + + virtual /* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_AllowAudioInputFormatChangesOnNextSet( + /* [in] */ VARIANT_BOOL Allow) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_AllowAudioInputFormatChangesOnNextSet( + /* [retval][out] */ VARIANT_BOOL *Allow) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioInput( + /* [defaultvalue][in] */ ISpeechObjectToken *AudioInput = 0) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioInput( + /* [retval][out] */ ISpeechObjectToken **AudioInput) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioInputStream( + /* [defaultvalue][in] */ ISpeechBaseStream *AudioInputStream = 0) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioInputStream( + /* [retval][out] */ ISpeechBaseStream **AudioInputStream) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_IsShared( + /* [retval][out] */ VARIANT_BOOL *Shared) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_State( + /* [in] */ SpeechRecognizerState State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_State( + /* [retval][out] */ SpeechRecognizerState *State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Status( + /* [retval][out] */ ISpeechRecognizerStatus **Status) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Profile( + /* [defaultvalue][in] */ ISpeechObjectToken *Profile = 0) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Profile( + /* [retval][out] */ ISpeechObjectToken **Profile) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE EmulateRecognition( + /* [in] */ VARIANT TextElements, + /* [defaultvalue][in] */ VARIANT *ElementDisplayAttributes = 0, + /* [defaultvalue][in] */ long LanguageId = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateRecoContext( + /* [retval][out] */ ISpeechRecoContext **NewContext) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetFormat( + /* [in] */ SpeechFormatType Type, + /* [retval][out] */ ISpeechAudioFormat **Format) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE SetPropertyNumber( + /* [in] */ const BSTR Name, + /* [in] */ long Value, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertyNumber( + /* [in] */ const BSTR Name, + /* [out][in] */ long *Value, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE SetPropertyString( + /* [in] */ const BSTR Name, + /* [in] */ const BSTR Value, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE GetPropertyString( + /* [in] */ const BSTR Name, + /* [out][in] */ BSTR *Value, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetRecognizers( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetAudioInputs( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetProfiles( + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecognizerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecognizer * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecognizer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecognizer * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecognizer * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecognizer * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecognizer * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecognizer * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Recognizer )( + ISpeechRecognizer * This, + /* [in] */ ISpeechObjectToken *Recognizer); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Recognizer )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **Recognizer); + + /* [id][helpstring][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AllowAudioInputFormatChangesOnNextSet )( + ISpeechRecognizer * This, + /* [in] */ VARIANT_BOOL Allow); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllowAudioInputFormatChangesOnNextSet )( + ISpeechRecognizer * This, + /* [retval][out] */ VARIANT_BOOL *Allow); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioInput )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechObjectToken *AudioInput); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioInput )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **AudioInput); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioInputStream )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechBaseStream *AudioInputStream); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioInputStream )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechBaseStream **AudioInputStream); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsShared )( + ISpeechRecognizer * This, + /* [retval][out] */ VARIANT_BOOL *Shared); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_State )( + ISpeechRecognizer * This, + /* [in] */ SpeechRecognizerState State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )( + ISpeechRecognizer * This, + /* [retval][out] */ SpeechRecognizerState *State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechRecognizerStatus **Status); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Profile )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechObjectToken *Profile); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Profile )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **Profile); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *EmulateRecognition )( + ISpeechRecognizer * This, + /* [in] */ VARIANT TextElements, + /* [defaultvalue][in] */ VARIANT *ElementDisplayAttributes, + /* [defaultvalue][in] */ long LanguageId); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateRecoContext )( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechRecoContext **NewContext); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetFormat )( + ISpeechRecognizer * This, + /* [in] */ SpeechFormatType Type, + /* [retval][out] */ ISpeechAudioFormat **Format); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetPropertyNumber )( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [in] */ long Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertyNumber )( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [out][in] */ long *Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetPropertyString )( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [in] */ const BSTR Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPropertyString )( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [out][in] */ BSTR *Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpeechRecognizer * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpeechRecognizer * This, + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetRecognizers )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetAudioInputs )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetProfiles )( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + END_INTERFACE + } ISpeechRecognizerVtbl; + + interface ISpeechRecognizer + { + CONST_VTBL struct ISpeechRecognizerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecognizer_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecognizer_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecognizer_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecognizer_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecognizer_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecognizer_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecognizer_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecognizer_putref_Recognizer(This,Recognizer) \ + (This)->lpVtbl -> putref_Recognizer(This,Recognizer) + +#define ISpeechRecognizer_get_Recognizer(This,Recognizer) \ + (This)->lpVtbl -> get_Recognizer(This,Recognizer) + +#define ISpeechRecognizer_put_AllowAudioInputFormatChangesOnNextSet(This,Allow) \ + (This)->lpVtbl -> put_AllowAudioInputFormatChangesOnNextSet(This,Allow) + +#define ISpeechRecognizer_get_AllowAudioInputFormatChangesOnNextSet(This,Allow) \ + (This)->lpVtbl -> get_AllowAudioInputFormatChangesOnNextSet(This,Allow) + +#define ISpeechRecognizer_putref_AudioInput(This,AudioInput) \ + (This)->lpVtbl -> putref_AudioInput(This,AudioInput) + +#define ISpeechRecognizer_get_AudioInput(This,AudioInput) \ + (This)->lpVtbl -> get_AudioInput(This,AudioInput) + +#define ISpeechRecognizer_putref_AudioInputStream(This,AudioInputStream) \ + (This)->lpVtbl -> putref_AudioInputStream(This,AudioInputStream) + +#define ISpeechRecognizer_get_AudioInputStream(This,AudioInputStream) \ + (This)->lpVtbl -> get_AudioInputStream(This,AudioInputStream) + +#define ISpeechRecognizer_get_IsShared(This,Shared) \ + (This)->lpVtbl -> get_IsShared(This,Shared) + +#define ISpeechRecognizer_put_State(This,State) \ + (This)->lpVtbl -> put_State(This,State) + +#define ISpeechRecognizer_get_State(This,State) \ + (This)->lpVtbl -> get_State(This,State) + +#define ISpeechRecognizer_get_Status(This,Status) \ + (This)->lpVtbl -> get_Status(This,Status) + +#define ISpeechRecognizer_putref_Profile(This,Profile) \ + (This)->lpVtbl -> putref_Profile(This,Profile) + +#define ISpeechRecognizer_get_Profile(This,Profile) \ + (This)->lpVtbl -> get_Profile(This,Profile) + +#define ISpeechRecognizer_EmulateRecognition(This,TextElements,ElementDisplayAttributes,LanguageId) \ + (This)->lpVtbl -> EmulateRecognition(This,TextElements,ElementDisplayAttributes,LanguageId) + +#define ISpeechRecognizer_CreateRecoContext(This,NewContext) \ + (This)->lpVtbl -> CreateRecoContext(This,NewContext) + +#define ISpeechRecognizer_GetFormat(This,Type,Format) \ + (This)->lpVtbl -> GetFormat(This,Type,Format) + +#define ISpeechRecognizer_SetPropertyNumber(This,Name,Value,Supported) \ + (This)->lpVtbl -> SetPropertyNumber(This,Name,Value,Supported) + +#define ISpeechRecognizer_GetPropertyNumber(This,Name,Value,Supported) \ + (This)->lpVtbl -> GetPropertyNumber(This,Name,Value,Supported) + +#define ISpeechRecognizer_SetPropertyString(This,Name,Value,Supported) \ + (This)->lpVtbl -> SetPropertyString(This,Name,Value,Supported) + +#define ISpeechRecognizer_GetPropertyString(This,Name,Value,Supported) \ + (This)->lpVtbl -> GetPropertyString(This,Name,Value,Supported) + +#define ISpeechRecognizer_IsUISupported(This,TypeOfUI,ExtraData,Supported) \ + (This)->lpVtbl -> IsUISupported(This,TypeOfUI,ExtraData,Supported) + +#define ISpeechRecognizer_DisplayUI(This,hWndParent,Title,TypeOfUI,ExtraData) \ + (This)->lpVtbl -> DisplayUI(This,hWndParent,Title,TypeOfUI,ExtraData) + +#define ISpeechRecognizer_GetRecognizers(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetRecognizers(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#define ISpeechRecognizer_GetAudioInputs(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetAudioInputs(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#define ISpeechRecognizer_GetProfiles(This,RequiredAttributes,OptionalAttributes,ObjectTokens) \ + (This)->lpVtbl -> GetProfiles(This,RequiredAttributes,OptionalAttributes,ObjectTokens) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_putref_Recognizer_Proxy( + ISpeechRecognizer * This, + /* [in] */ ISpeechObjectToken *Recognizer); + + +void __RPC_STUB ISpeechRecognizer_putref_Recognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_Recognizer_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **Recognizer); + + +void __RPC_STUB ISpeechRecognizer_get_Recognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_put_AllowAudioInputFormatChangesOnNextSet_Proxy( + ISpeechRecognizer * This, + /* [in] */ VARIANT_BOOL Allow); + + +void __RPC_STUB ISpeechRecognizer_put_AllowAudioInputFormatChangesOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_AllowAudioInputFormatChangesOnNextSet_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ VARIANT_BOOL *Allow); + + +void __RPC_STUB ISpeechRecognizer_get_AllowAudioInputFormatChangesOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_putref_AudioInput_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechObjectToken *AudioInput); + + +void __RPC_STUB ISpeechRecognizer_putref_AudioInput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_AudioInput_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **AudioInput); + + +void __RPC_STUB ISpeechRecognizer_get_AudioInput_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_putref_AudioInputStream_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechBaseStream *AudioInputStream); + + +void __RPC_STUB ISpeechRecognizer_putref_AudioInputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_AudioInputStream_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechBaseStream **AudioInputStream); + + +void __RPC_STUB ISpeechRecognizer_get_AudioInputStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_IsShared_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ VARIANT_BOOL *Shared); + + +void __RPC_STUB ISpeechRecognizer_get_IsShared_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_put_State_Proxy( + ISpeechRecognizer * This, + /* [in] */ SpeechRecognizerState State); + + +void __RPC_STUB ISpeechRecognizer_put_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_State_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ SpeechRecognizerState *State); + + +void __RPC_STUB ISpeechRecognizer_get_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_Status_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechRecognizerStatus **Status); + + +void __RPC_STUB ISpeechRecognizer_get_Status_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_putref_Profile_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ ISpeechObjectToken *Profile); + + +void __RPC_STUB ISpeechRecognizer_putref_Profile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_get_Profile_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechObjectToken **Profile); + + +void __RPC_STUB ISpeechRecognizer_get_Profile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_EmulateRecognition_Proxy( + ISpeechRecognizer * This, + /* [in] */ VARIANT TextElements, + /* [defaultvalue][in] */ VARIANT *ElementDisplayAttributes, + /* [defaultvalue][in] */ long LanguageId); + + +void __RPC_STUB ISpeechRecognizer_EmulateRecognition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_CreateRecoContext_Proxy( + ISpeechRecognizer * This, + /* [retval][out] */ ISpeechRecoContext **NewContext); + + +void __RPC_STUB ISpeechRecognizer_CreateRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetFormat_Proxy( + ISpeechRecognizer * This, + /* [in] */ SpeechFormatType Type, + /* [retval][out] */ ISpeechAudioFormat **Format); + + +void __RPC_STUB ISpeechRecognizer_GetFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_SetPropertyNumber_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [in] */ long Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_SetPropertyNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetPropertyNumber_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [out][in] */ long *Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_GetPropertyNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_SetPropertyString_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [in] */ const BSTR Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_SetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetPropertyString_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR Name, + /* [out][in] */ BSTR *Value, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_GetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_IsUISupported_Proxy( + ISpeechRecognizer * This, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData, + /* [retval][out] */ VARIANT_BOOL *Supported); + + +void __RPC_STUB ISpeechRecognizer_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_DisplayUI_Proxy( + ISpeechRecognizer * This, + /* [in] */ long hWndParent, + /* [in] */ BSTR Title, + /* [in] */ const BSTR TypeOfUI, + /* [defaultvalue][in] */ const VARIANT *ExtraData); + + +void __RPC_STUB ISpeechRecognizer_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetRecognizers_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechRecognizer_GetRecognizers_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetAudioInputs_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechRecognizer_GetAudioInputs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizer_GetProfiles_Proxy( + ISpeechRecognizer * This, + /* [defaultvalue][in] */ BSTR RequiredAttributes, + /* [defaultvalue][in] */ BSTR OptionalAttributes, + /* [retval][out] */ ISpeechObjectTokens **ObjectTokens); + + +void __RPC_STUB ISpeechRecognizer_GetProfiles_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecognizer_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecognizerStatus_INTERFACE_DEFINED__ +#define __ISpeechRecognizerStatus_INTERFACE_DEFINED__ + +/* interface ISpeechRecognizerStatus */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecognizerStatus; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BFF9E781-53EC-484e-BB8A-0E1B5551E35C") + ISpeechRecognizerStatus : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStatus( + /* [retval][out] */ ISpeechAudioStatus **AudioStatus) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentStreamPosition( + /* [retval][out] */ VARIANT *pCurrentStreamPos) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentStreamNumber( + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfActiveRules( + /* [retval][out] */ long *NumberOfActiveRules) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ClsidEngine( + /* [retval][out] */ BSTR *ClsidEngine) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SupportedLanguages( + /* [retval][out] */ VARIANT *SupportedLanguages) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecognizerStatusVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecognizerStatus * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecognizerStatus * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecognizerStatus * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecognizerStatus * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecognizerStatus * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecognizerStatus * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecognizerStatus * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioStatus )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ ISpeechAudioStatus **AudioStatus); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentStreamPosition )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ VARIANT *pCurrentStreamPos); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CurrentStreamNumber )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfActiveRules )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ long *NumberOfActiveRules); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClsidEngine )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ BSTR *ClsidEngine); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportedLanguages )( + ISpeechRecognizerStatus * This, + /* [retval][out] */ VARIANT *SupportedLanguages); + + END_INTERFACE + } ISpeechRecognizerStatusVtbl; + + interface ISpeechRecognizerStatus + { + CONST_VTBL struct ISpeechRecognizerStatusVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecognizerStatus_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecognizerStatus_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecognizerStatus_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecognizerStatus_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecognizerStatus_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecognizerStatus_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecognizerStatus_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecognizerStatus_get_AudioStatus(This,AudioStatus) \ + (This)->lpVtbl -> get_AudioStatus(This,AudioStatus) + +#define ISpeechRecognizerStatus_get_CurrentStreamPosition(This,pCurrentStreamPos) \ + (This)->lpVtbl -> get_CurrentStreamPosition(This,pCurrentStreamPos) + +#define ISpeechRecognizerStatus_get_CurrentStreamNumber(This,StreamNumber) \ + (This)->lpVtbl -> get_CurrentStreamNumber(This,StreamNumber) + +#define ISpeechRecognizerStatus_get_NumberOfActiveRules(This,NumberOfActiveRules) \ + (This)->lpVtbl -> get_NumberOfActiveRules(This,NumberOfActiveRules) + +#define ISpeechRecognizerStatus_get_ClsidEngine(This,ClsidEngine) \ + (This)->lpVtbl -> get_ClsidEngine(This,ClsidEngine) + +#define ISpeechRecognizerStatus_get_SupportedLanguages(This,SupportedLanguages) \ + (This)->lpVtbl -> get_SupportedLanguages(This,SupportedLanguages) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_AudioStatus_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ ISpeechAudioStatus **AudioStatus); + + +void __RPC_STUB ISpeechRecognizerStatus_get_AudioStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_CurrentStreamPosition_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ VARIANT *pCurrentStreamPos); + + +void __RPC_STUB ISpeechRecognizerStatus_get_CurrentStreamPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_CurrentStreamNumber_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechRecognizerStatus_get_CurrentStreamNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_NumberOfActiveRules_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ long *NumberOfActiveRules); + + +void __RPC_STUB ISpeechRecognizerStatus_get_NumberOfActiveRules_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_ClsidEngine_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ BSTR *ClsidEngine); + + +void __RPC_STUB ISpeechRecognizerStatus_get_ClsidEngine_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecognizerStatus_get_SupportedLanguages_Proxy( + ISpeechRecognizerStatus * This, + /* [retval][out] */ VARIANT *SupportedLanguages); + + +void __RPC_STUB ISpeechRecognizerStatus_get_SupportedLanguages_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecognizerStatus_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecoContext_INTERFACE_DEFINED__ +#define __ISpeechRecoContext_INTERFACE_DEFINED__ + +/* interface ISpeechRecoContext */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecoContext; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("580AA49D-7E1E-4809-B8E2-57DA806104B8") + ISpeechRecoContext : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Recognizer( + /* [retval][out] */ ISpeechRecognizer **Recognizer) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioInputInterferenceStatus( + /* [retval][out] */ SpeechInterference *Interference) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RequestedUIType( + /* [retval][out] */ BSTR *UIType) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_Voice( + /* [in] */ ISpeechVoice *Voice) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Voice( + /* [retval][out] */ ISpeechVoice **Voice) = 0; + + virtual /* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE put_AllowVoiceFormatMatchingOnNextSet( + /* [in] */ VARIANT_BOOL Allow) = 0; + + virtual /* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE get_AllowVoiceFormatMatchingOnNextSet( + /* [retval][out] */ VARIANT_BOOL *pAllow) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_VoicePurgeEvent( + /* [in] */ SpeechRecoEvents EventInterest) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_VoicePurgeEvent( + /* [retval][out] */ SpeechRecoEvents *EventInterest) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_EventInterests( + /* [in] */ SpeechRecoEvents EventInterest) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EventInterests( + /* [retval][out] */ SpeechRecoEvents *EventInterest) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_CmdMaxAlternates( + /* [in] */ long MaxAlternates) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_CmdMaxAlternates( + /* [retval][out] */ long *MaxAlternates) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_State( + /* [in] */ SpeechRecoContextState State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_State( + /* [retval][out] */ SpeechRecoContextState *State) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_RetainedAudio( + /* [in] */ SpeechRetainedAudioOptions Option) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedAudio( + /* [retval][out] */ SpeechRetainedAudioOptions *Option) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_RetainedAudioFormat( + /* [in] */ ISpeechAudioFormat *Format) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedAudioFormat( + /* [retval][out] */ ISpeechAudioFormat **Format) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Resume( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateGrammar( + /* [defaultvalue][in] */ VARIANT GrammarId, + /* [retval][out] */ ISpeechRecoGrammar **Grammar) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CreateResultFromMemory( + /* [in] */ VARIANT *ResultBlock, + /* [retval][out] */ ISpeechRecoResult **Result) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Bookmark( + /* [in] */ SpeechBookmarkOptions Options, + /* [in] */ VARIANT StreamPos, + /* [in] */ VARIANT BookmarkId) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetAdaptationData( + /* [in] */ BSTR AdaptationString) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecoContextVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecoContext * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecoContext * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecoContext * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecoContext * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecoContext * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecoContext * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecoContext * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Recognizer )( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechRecognizer **Recognizer); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioInputInterferenceStatus )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechInterference *Interference); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequestedUIType )( + ISpeechRecoContext * This, + /* [retval][out] */ BSTR *UIType); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_Voice )( + ISpeechRecoContext * This, + /* [in] */ ISpeechVoice *Voice); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Voice )( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechVoice **Voice); + + /* [id][helpstring][hidden][propput] */ HRESULT ( STDMETHODCALLTYPE *put_AllowVoiceFormatMatchingOnNextSet )( + ISpeechRecoContext * This, + /* [in] */ VARIANT_BOOL Allow); + + /* [id][helpstring][hidden][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllowVoiceFormatMatchingOnNextSet )( + ISpeechRecoContext * This, + /* [retval][out] */ VARIANT_BOOL *pAllow); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_VoicePurgeEvent )( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoEvents EventInterest); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_VoicePurgeEvent )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoEvents *EventInterest); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_EventInterests )( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoEvents EventInterest); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventInterests )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoEvents *EventInterest); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_CmdMaxAlternates )( + ISpeechRecoContext * This, + /* [in] */ long MaxAlternates); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CmdMaxAlternates )( + ISpeechRecoContext * This, + /* [retval][out] */ long *MaxAlternates); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_State )( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoContextState State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoContextState *State); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_RetainedAudio )( + ISpeechRecoContext * This, + /* [in] */ SpeechRetainedAudioOptions Option); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedAudio )( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRetainedAudioOptions *Option); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_RetainedAudioFormat )( + ISpeechRecoContext * This, + /* [in] */ ISpeechAudioFormat *Format); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedAudioFormat )( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechAudioFormat **Format); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Pause )( + ISpeechRecoContext * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Resume )( + ISpeechRecoContext * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateGrammar )( + ISpeechRecoContext * This, + /* [defaultvalue][in] */ VARIANT GrammarId, + /* [retval][out] */ ISpeechRecoGrammar **Grammar); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CreateResultFromMemory )( + ISpeechRecoContext * This, + /* [in] */ VARIANT *ResultBlock, + /* [retval][out] */ ISpeechRecoResult **Result); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Bookmark )( + ISpeechRecoContext * This, + /* [in] */ SpeechBookmarkOptions Options, + /* [in] */ VARIANT StreamPos, + /* [in] */ VARIANT BookmarkId); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetAdaptationData )( + ISpeechRecoContext * This, + /* [in] */ BSTR AdaptationString); + + END_INTERFACE + } ISpeechRecoContextVtbl; + + interface ISpeechRecoContext + { + CONST_VTBL struct ISpeechRecoContextVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecoContext_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecoContext_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecoContext_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecoContext_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecoContext_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecoContext_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecoContext_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecoContext_get_Recognizer(This,Recognizer) \ + (This)->lpVtbl -> get_Recognizer(This,Recognizer) + +#define ISpeechRecoContext_get_AudioInputInterferenceStatus(This,Interference) \ + (This)->lpVtbl -> get_AudioInputInterferenceStatus(This,Interference) + +#define ISpeechRecoContext_get_RequestedUIType(This,UIType) \ + (This)->lpVtbl -> get_RequestedUIType(This,UIType) + +#define ISpeechRecoContext_putref_Voice(This,Voice) \ + (This)->lpVtbl -> putref_Voice(This,Voice) + +#define ISpeechRecoContext_get_Voice(This,Voice) \ + (This)->lpVtbl -> get_Voice(This,Voice) + +#define ISpeechRecoContext_put_AllowVoiceFormatMatchingOnNextSet(This,Allow) \ + (This)->lpVtbl -> put_AllowVoiceFormatMatchingOnNextSet(This,Allow) + +#define ISpeechRecoContext_get_AllowVoiceFormatMatchingOnNextSet(This,pAllow) \ + (This)->lpVtbl -> get_AllowVoiceFormatMatchingOnNextSet(This,pAllow) + +#define ISpeechRecoContext_put_VoicePurgeEvent(This,EventInterest) \ + (This)->lpVtbl -> put_VoicePurgeEvent(This,EventInterest) + +#define ISpeechRecoContext_get_VoicePurgeEvent(This,EventInterest) \ + (This)->lpVtbl -> get_VoicePurgeEvent(This,EventInterest) + +#define ISpeechRecoContext_put_EventInterests(This,EventInterest) \ + (This)->lpVtbl -> put_EventInterests(This,EventInterest) + +#define ISpeechRecoContext_get_EventInterests(This,EventInterest) \ + (This)->lpVtbl -> get_EventInterests(This,EventInterest) + +#define ISpeechRecoContext_put_CmdMaxAlternates(This,MaxAlternates) \ + (This)->lpVtbl -> put_CmdMaxAlternates(This,MaxAlternates) + +#define ISpeechRecoContext_get_CmdMaxAlternates(This,MaxAlternates) \ + (This)->lpVtbl -> get_CmdMaxAlternates(This,MaxAlternates) + +#define ISpeechRecoContext_put_State(This,State) \ + (This)->lpVtbl -> put_State(This,State) + +#define ISpeechRecoContext_get_State(This,State) \ + (This)->lpVtbl -> get_State(This,State) + +#define ISpeechRecoContext_put_RetainedAudio(This,Option) \ + (This)->lpVtbl -> put_RetainedAudio(This,Option) + +#define ISpeechRecoContext_get_RetainedAudio(This,Option) \ + (This)->lpVtbl -> get_RetainedAudio(This,Option) + +#define ISpeechRecoContext_putref_RetainedAudioFormat(This,Format) \ + (This)->lpVtbl -> putref_RetainedAudioFormat(This,Format) + +#define ISpeechRecoContext_get_RetainedAudioFormat(This,Format) \ + (This)->lpVtbl -> get_RetainedAudioFormat(This,Format) + +#define ISpeechRecoContext_Pause(This) \ + (This)->lpVtbl -> Pause(This) + +#define ISpeechRecoContext_Resume(This) \ + (This)->lpVtbl -> Resume(This) + +#define ISpeechRecoContext_CreateGrammar(This,GrammarId,Grammar) \ + (This)->lpVtbl -> CreateGrammar(This,GrammarId,Grammar) + +#define ISpeechRecoContext_CreateResultFromMemory(This,ResultBlock,Result) \ + (This)->lpVtbl -> CreateResultFromMemory(This,ResultBlock,Result) + +#define ISpeechRecoContext_Bookmark(This,Options,StreamPos,BookmarkId) \ + (This)->lpVtbl -> Bookmark(This,Options,StreamPos,BookmarkId) + +#define ISpeechRecoContext_SetAdaptationData(This,AdaptationString) \ + (This)->lpVtbl -> SetAdaptationData(This,AdaptationString) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_Recognizer_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechRecognizer **Recognizer); + + +void __RPC_STUB ISpeechRecoContext_get_Recognizer_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_AudioInputInterferenceStatus_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechInterference *Interference); + + +void __RPC_STUB ISpeechRecoContext_get_AudioInputInterferenceStatus_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_RequestedUIType_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ BSTR *UIType); + + +void __RPC_STUB ISpeechRecoContext_get_RequestedUIType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_putref_Voice_Proxy( + ISpeechRecoContext * This, + /* [in] */ ISpeechVoice *Voice); + + +void __RPC_STUB ISpeechRecoContext_putref_Voice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_Voice_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechVoice **Voice); + + +void __RPC_STUB ISpeechRecoContext_get_Voice_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_AllowVoiceFormatMatchingOnNextSet_Proxy( + ISpeechRecoContext * This, + /* [in] */ VARIANT_BOOL Allow); + + +void __RPC_STUB ISpeechRecoContext_put_AllowVoiceFormatMatchingOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][hidden][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_AllowVoiceFormatMatchingOnNextSet_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ VARIANT_BOOL *pAllow); + + +void __RPC_STUB ISpeechRecoContext_get_AllowVoiceFormatMatchingOnNextSet_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_VoicePurgeEvent_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoEvents EventInterest); + + +void __RPC_STUB ISpeechRecoContext_put_VoicePurgeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_VoicePurgeEvent_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoEvents *EventInterest); + + +void __RPC_STUB ISpeechRecoContext_get_VoicePurgeEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_EventInterests_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoEvents EventInterest); + + +void __RPC_STUB ISpeechRecoContext_put_EventInterests_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_EventInterests_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoEvents *EventInterest); + + +void __RPC_STUB ISpeechRecoContext_get_EventInterests_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_CmdMaxAlternates_Proxy( + ISpeechRecoContext * This, + /* [in] */ long MaxAlternates); + + +void __RPC_STUB ISpeechRecoContext_put_CmdMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_CmdMaxAlternates_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ long *MaxAlternates); + + +void __RPC_STUB ISpeechRecoContext_get_CmdMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_State_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechRecoContextState State); + + +void __RPC_STUB ISpeechRecoContext_put_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_State_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRecoContextState *State); + + +void __RPC_STUB ISpeechRecoContext_get_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_put_RetainedAudio_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechRetainedAudioOptions Option); + + +void __RPC_STUB ISpeechRecoContext_put_RetainedAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_RetainedAudio_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ SpeechRetainedAudioOptions *Option); + + +void __RPC_STUB ISpeechRecoContext_get_RetainedAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_putref_RetainedAudioFormat_Proxy( + ISpeechRecoContext * This, + /* [in] */ ISpeechAudioFormat *Format); + + +void __RPC_STUB ISpeechRecoContext_putref_RetainedAudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_get_RetainedAudioFormat_Proxy( + ISpeechRecoContext * This, + /* [retval][out] */ ISpeechAudioFormat **Format); + + +void __RPC_STUB ISpeechRecoContext_get_RetainedAudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_Pause_Proxy( + ISpeechRecoContext * This); + + +void __RPC_STUB ISpeechRecoContext_Pause_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_Resume_Proxy( + ISpeechRecoContext * This); + + +void __RPC_STUB ISpeechRecoContext_Resume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_CreateGrammar_Proxy( + ISpeechRecoContext * This, + /* [defaultvalue][in] */ VARIANT GrammarId, + /* [retval][out] */ ISpeechRecoGrammar **Grammar); + + +void __RPC_STUB ISpeechRecoContext_CreateGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_CreateResultFromMemory_Proxy( + ISpeechRecoContext * This, + /* [in] */ VARIANT *ResultBlock, + /* [retval][out] */ ISpeechRecoResult **Result); + + +void __RPC_STUB ISpeechRecoContext_CreateResultFromMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_Bookmark_Proxy( + ISpeechRecoContext * This, + /* [in] */ SpeechBookmarkOptions Options, + /* [in] */ VARIANT StreamPos, + /* [in] */ VARIANT BookmarkId); + + +void __RPC_STUB ISpeechRecoContext_Bookmark_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoContext_SetAdaptationData_Proxy( + ISpeechRecoContext * This, + /* [in] */ BSTR AdaptationString); + + +void __RPC_STUB ISpeechRecoContext_SetAdaptationData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecoContext_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecoGrammar_INTERFACE_DEFINED__ +#define __ISpeechRecoGrammar_INTERFACE_DEFINED__ + +/* interface ISpeechRecoGrammar */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecoGrammar; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B6D6F79F-2158-4e50-B5BC-9A9CCD852A09") + ISpeechRecoGrammar : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ VARIANT *Id) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RecoContext( + /* [retval][out] */ ISpeechRecoContext **RecoContext) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_State( + /* [in] */ SpeechGrammarState State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_State( + /* [retval][out] */ SpeechGrammarState *State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rules( + /* [retval][out] */ ISpeechGrammarRules **Rules) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Reset( + /* [defaultvalue][in] */ SpeechLanguageId NewLanguage = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromFile( + /* [in] */ const BSTR FileName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromObject( + /* [in] */ const BSTR ClassId, + /* [in] */ const BSTR GrammarName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromResource( + /* [in] */ long hModule, + /* [in] */ VARIANT ResourceName, + /* [in] */ VARIANT ResourceType, + /* [in] */ SpeechLanguageId LanguageId, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromMemory( + /* [in] */ VARIANT GrammarData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdLoadFromProprietaryGrammar( + /* [in] */ const BSTR ProprietaryGuid, + /* [in] */ const BSTR ProprietaryString, + /* [in] */ VARIANT ProprietaryData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdSetRuleState( + /* [in] */ const BSTR Name, + /* [in] */ SpeechRuleState State) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CmdSetRuleIdState( + /* [in] */ long RuleId, + /* [in] */ SpeechRuleState State) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DictationLoad( + /* [defaultvalue][in] */ const BSTR TopicName = L"", + /* [defaultvalue][in] */ SpeechLoadOption LoadOption = SLOStatic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DictationUnload( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DictationSetState( + /* [in] */ SpeechRuleState State) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetWordSequenceData( + /* [in] */ const BSTR Text, + /* [in] */ long TextLength, + /* [in] */ ISpeechTextSelectionInformation *Info) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SetTextSelection( + /* [in] */ ISpeechTextSelectionInformation *Info) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE IsPronounceable( + /* [in] */ const BSTR Word, + /* [retval][out] */ SpeechWordPronounceable *WordPronounceable) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecoGrammarVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecoGrammar * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecoGrammar * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecoGrammar * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecoGrammar * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecoGrammar * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecoGrammar * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecoGrammar * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechRecoGrammar * This, + /* [retval][out] */ VARIANT *Id); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RecoContext )( + ISpeechRecoGrammar * This, + /* [retval][out] */ ISpeechRecoContext **RecoContext); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_State )( + ISpeechRecoGrammar * This, + /* [in] */ SpeechGrammarState State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_State )( + ISpeechRecoGrammar * This, + /* [retval][out] */ SpeechGrammarState *State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rules )( + ISpeechRecoGrammar * This, + /* [retval][out] */ ISpeechGrammarRules **Rules); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Reset )( + ISpeechRecoGrammar * This, + /* [defaultvalue][in] */ SpeechLanguageId NewLanguage); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromFile )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR FileName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromObject )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR ClassId, + /* [in] */ const BSTR GrammarName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromResource )( + ISpeechRecoGrammar * This, + /* [in] */ long hModule, + /* [in] */ VARIANT ResourceName, + /* [in] */ VARIANT ResourceType, + /* [in] */ SpeechLanguageId LanguageId, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromMemory )( + ISpeechRecoGrammar * This, + /* [in] */ VARIANT GrammarData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdLoadFromProprietaryGrammar )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR ProprietaryGuid, + /* [in] */ const BSTR ProprietaryString, + /* [in] */ VARIANT ProprietaryData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdSetRuleState )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Name, + /* [in] */ SpeechRuleState State); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CmdSetRuleIdState )( + ISpeechRecoGrammar * This, + /* [in] */ long RuleId, + /* [in] */ SpeechRuleState State); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DictationLoad )( + ISpeechRecoGrammar * This, + /* [defaultvalue][in] */ const BSTR TopicName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DictationUnload )( + ISpeechRecoGrammar * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DictationSetState )( + ISpeechRecoGrammar * This, + /* [in] */ SpeechRuleState State); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetWordSequenceData )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Text, + /* [in] */ long TextLength, + /* [in] */ ISpeechTextSelectionInformation *Info); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SetTextSelection )( + ISpeechRecoGrammar * This, + /* [in] */ ISpeechTextSelectionInformation *Info); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *IsPronounceable )( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Word, + /* [retval][out] */ SpeechWordPronounceable *WordPronounceable); + + END_INTERFACE + } ISpeechRecoGrammarVtbl; + + interface ISpeechRecoGrammar + { + CONST_VTBL struct ISpeechRecoGrammarVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecoGrammar_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecoGrammar_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecoGrammar_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecoGrammar_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecoGrammar_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecoGrammar_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecoGrammar_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecoGrammar_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechRecoGrammar_get_RecoContext(This,RecoContext) \ + (This)->lpVtbl -> get_RecoContext(This,RecoContext) + +#define ISpeechRecoGrammar_put_State(This,State) \ + (This)->lpVtbl -> put_State(This,State) + +#define ISpeechRecoGrammar_get_State(This,State) \ + (This)->lpVtbl -> get_State(This,State) + +#define ISpeechRecoGrammar_get_Rules(This,Rules) \ + (This)->lpVtbl -> get_Rules(This,Rules) + +#define ISpeechRecoGrammar_Reset(This,NewLanguage) \ + (This)->lpVtbl -> Reset(This,NewLanguage) + +#define ISpeechRecoGrammar_CmdLoadFromFile(This,FileName,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromFile(This,FileName,LoadOption) + +#define ISpeechRecoGrammar_CmdLoadFromObject(This,ClassId,GrammarName,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromObject(This,ClassId,GrammarName,LoadOption) + +#define ISpeechRecoGrammar_CmdLoadFromResource(This,hModule,ResourceName,ResourceType,LanguageId,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromResource(This,hModule,ResourceName,ResourceType,LanguageId,LoadOption) + +#define ISpeechRecoGrammar_CmdLoadFromMemory(This,GrammarData,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromMemory(This,GrammarData,LoadOption) + +#define ISpeechRecoGrammar_CmdLoadFromProprietaryGrammar(This,ProprietaryGuid,ProprietaryString,ProprietaryData,LoadOption) \ + (This)->lpVtbl -> CmdLoadFromProprietaryGrammar(This,ProprietaryGuid,ProprietaryString,ProprietaryData,LoadOption) + +#define ISpeechRecoGrammar_CmdSetRuleState(This,Name,State) \ + (This)->lpVtbl -> CmdSetRuleState(This,Name,State) + +#define ISpeechRecoGrammar_CmdSetRuleIdState(This,RuleId,State) \ + (This)->lpVtbl -> CmdSetRuleIdState(This,RuleId,State) + +#define ISpeechRecoGrammar_DictationLoad(This,TopicName,LoadOption) \ + (This)->lpVtbl -> DictationLoad(This,TopicName,LoadOption) + +#define ISpeechRecoGrammar_DictationUnload(This) \ + (This)->lpVtbl -> DictationUnload(This) + +#define ISpeechRecoGrammar_DictationSetState(This,State) \ + (This)->lpVtbl -> DictationSetState(This,State) + +#define ISpeechRecoGrammar_SetWordSequenceData(This,Text,TextLength,Info) \ + (This)->lpVtbl -> SetWordSequenceData(This,Text,TextLength,Info) + +#define ISpeechRecoGrammar_SetTextSelection(This,Info) \ + (This)->lpVtbl -> SetTextSelection(This,Info) + +#define ISpeechRecoGrammar_IsPronounceable(This,Word,WordPronounceable) \ + (This)->lpVtbl -> IsPronounceable(This,Word,WordPronounceable) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_get_Id_Proxy( + ISpeechRecoGrammar * This, + /* [retval][out] */ VARIANT *Id); + + +void __RPC_STUB ISpeechRecoGrammar_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_get_RecoContext_Proxy( + ISpeechRecoGrammar * This, + /* [retval][out] */ ISpeechRecoContext **RecoContext); + + +void __RPC_STUB ISpeechRecoGrammar_get_RecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_put_State_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ SpeechGrammarState State); + + +void __RPC_STUB ISpeechRecoGrammar_put_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_get_State_Proxy( + ISpeechRecoGrammar * This, + /* [retval][out] */ SpeechGrammarState *State); + + +void __RPC_STUB ISpeechRecoGrammar_get_State_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_get_Rules_Proxy( + ISpeechRecoGrammar * This, + /* [retval][out] */ ISpeechGrammarRules **Rules); + + +void __RPC_STUB ISpeechRecoGrammar_get_Rules_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_Reset_Proxy( + ISpeechRecoGrammar * This, + /* [defaultvalue][in] */ SpeechLanguageId NewLanguage); + + +void __RPC_STUB ISpeechRecoGrammar_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromFile_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR FileName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromFile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromObject_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR ClassId, + /* [in] */ const BSTR GrammarName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromResource_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ long hModule, + /* [in] */ VARIANT ResourceName, + /* [in] */ VARIANT ResourceType, + /* [in] */ SpeechLanguageId LanguageId, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromMemory_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ VARIANT GrammarData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdLoadFromProprietaryGrammar_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR ProprietaryGuid, + /* [in] */ const BSTR ProprietaryString, + /* [in] */ VARIANT ProprietaryData, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_CmdLoadFromProprietaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdSetRuleState_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Name, + /* [in] */ SpeechRuleState State); + + +void __RPC_STUB ISpeechRecoGrammar_CmdSetRuleState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_CmdSetRuleIdState_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ long RuleId, + /* [in] */ SpeechRuleState State); + + +void __RPC_STUB ISpeechRecoGrammar_CmdSetRuleIdState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_DictationLoad_Proxy( + ISpeechRecoGrammar * This, + /* [defaultvalue][in] */ const BSTR TopicName, + /* [defaultvalue][in] */ SpeechLoadOption LoadOption); + + +void __RPC_STUB ISpeechRecoGrammar_DictationLoad_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_DictationUnload_Proxy( + ISpeechRecoGrammar * This); + + +void __RPC_STUB ISpeechRecoGrammar_DictationUnload_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_DictationSetState_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ SpeechRuleState State); + + +void __RPC_STUB ISpeechRecoGrammar_DictationSetState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_SetWordSequenceData_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Text, + /* [in] */ long TextLength, + /* [in] */ ISpeechTextSelectionInformation *Info); + + +void __RPC_STUB ISpeechRecoGrammar_SetWordSequenceData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_SetTextSelection_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ ISpeechTextSelectionInformation *Info); + + +void __RPC_STUB ISpeechRecoGrammar_SetTextSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoGrammar_IsPronounceable_Proxy( + ISpeechRecoGrammar * This, + /* [in] */ const BSTR Word, + /* [retval][out] */ SpeechWordPronounceable *WordPronounceable); + + +void __RPC_STUB ISpeechRecoGrammar_IsPronounceable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecoGrammar_INTERFACE_DEFINED__ */ + + +#ifndef ___ISpeechRecoContextEvents_DISPINTERFACE_DEFINED__ +#define ___ISpeechRecoContextEvents_DISPINTERFACE_DEFINED__ + +/* dispinterface _ISpeechRecoContextEvents */ +/* [uuid] */ + + +EXTERN_C const IID DIID__ISpeechRecoContextEvents; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7B8FCB42-0E9D-4f00-A048-7B04D6179D3D") + _ISpeechRecoContextEvents : public IDispatch + { + }; + +#else /* C style interface */ + + typedef struct _ISpeechRecoContextEventsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + _ISpeechRecoContextEvents * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + _ISpeechRecoContextEvents * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + _ISpeechRecoContextEvents * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + _ISpeechRecoContextEvents * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + _ISpeechRecoContextEvents * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + _ISpeechRecoContextEvents * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + _ISpeechRecoContextEvents * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + END_INTERFACE + } _ISpeechRecoContextEventsVtbl; + + interface _ISpeechRecoContextEvents + { + CONST_VTBL struct _ISpeechRecoContextEventsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define _ISpeechRecoContextEvents_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define _ISpeechRecoContextEvents_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define _ISpeechRecoContextEvents_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define _ISpeechRecoContextEvents_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define _ISpeechRecoContextEvents_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define _ISpeechRecoContextEvents_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define _ISpeechRecoContextEvents_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + +#endif /* ___ISpeechRecoContextEvents_DISPINTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRule_INTERFACE_DEFINED__ +#define __ISpeechGrammarRule_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRule */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRule; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AFE719CF-5DD1-44f2-999C-7A399F1CFCCC") + ISpeechGrammarRule : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Attributes( + /* [retval][out] */ SpeechRuleAttributes *Attributes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_InitialState( + /* [retval][out] */ ISpeechGrammarRuleState **State) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR *Name) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ long *Id) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Clear( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddResource( + /* [in] */ const BSTR ResourceName, + /* [in] */ const BSTR ResourceValue) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddState( + /* [retval][out] */ ISpeechGrammarRuleState **State) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRuleVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRule * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRule * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRule * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRule * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRule * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRule * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRule * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Attributes )( + ISpeechGrammarRule * This, + /* [retval][out] */ SpeechRuleAttributes *Attributes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InitialState )( + ISpeechGrammarRule * This, + /* [retval][out] */ ISpeechGrammarRuleState **State); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( + ISpeechGrammarRule * This, + /* [retval][out] */ BSTR *Name); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechGrammarRule * This, + /* [retval][out] */ long *Id); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Clear )( + ISpeechGrammarRule * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddResource )( + ISpeechGrammarRule * This, + /* [in] */ const BSTR ResourceName, + /* [in] */ const BSTR ResourceValue); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddState )( + ISpeechGrammarRule * This, + /* [retval][out] */ ISpeechGrammarRuleState **State); + + END_INTERFACE + } ISpeechGrammarRuleVtbl; + + interface ISpeechGrammarRule + { + CONST_VTBL struct ISpeechGrammarRuleVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRule_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRule_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRule_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRule_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRule_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRule_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRule_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRule_get_Attributes(This,Attributes) \ + (This)->lpVtbl -> get_Attributes(This,Attributes) + +#define ISpeechGrammarRule_get_InitialState(This,State) \ + (This)->lpVtbl -> get_InitialState(This,State) + +#define ISpeechGrammarRule_get_Name(This,Name) \ + (This)->lpVtbl -> get_Name(This,Name) + +#define ISpeechGrammarRule_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechGrammarRule_Clear(This) \ + (This)->lpVtbl -> Clear(This) + +#define ISpeechGrammarRule_AddResource(This,ResourceName,ResourceValue) \ + (This)->lpVtbl -> AddResource(This,ResourceName,ResourceValue) + +#define ISpeechGrammarRule_AddState(This,State) \ + (This)->lpVtbl -> AddState(This,State) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_get_Attributes_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ SpeechRuleAttributes *Attributes); + + +void __RPC_STUB ISpeechGrammarRule_get_Attributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_get_InitialState_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ ISpeechGrammarRuleState **State); + + +void __RPC_STUB ISpeechGrammarRule_get_InitialState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_get_Name_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ BSTR *Name); + + +void __RPC_STUB ISpeechGrammarRule_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_get_Id_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ long *Id); + + +void __RPC_STUB ISpeechGrammarRule_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_Clear_Proxy( + ISpeechGrammarRule * This); + + +void __RPC_STUB ISpeechGrammarRule_Clear_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_AddResource_Proxy( + ISpeechGrammarRule * This, + /* [in] */ const BSTR ResourceName, + /* [in] */ const BSTR ResourceValue); + + +void __RPC_STUB ISpeechGrammarRule_AddResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRule_AddState_Proxy( + ISpeechGrammarRule * This, + /* [retval][out] */ ISpeechGrammarRuleState **State); + + +void __RPC_STUB ISpeechGrammarRule_AddState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRule_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRules_INTERFACE_DEFINED__ +#define __ISpeechGrammarRules_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRules */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRules; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6FFA3B44-FC2D-40d1-8AFC-32911C7F1AD1") + ISpeechGrammarRules : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE FindRule( + /* [in] */ VARIANT RuleNameOrId, + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Dynamic( + /* [retval][out] */ VARIANT_BOOL *Dynamic) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Add( + /* [in] */ BSTR RuleName, + /* [in] */ SpeechRuleAttributes Attributes, + /* [defaultvalue][in] */ long RuleId, + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Commit( void) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE CommitAndSave( + /* [out] */ BSTR *ErrorText, + /* [retval][out] */ VARIANT *SaveStream) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRulesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRules * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRules * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRules * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRules * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRules * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRules * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRules * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechGrammarRules * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *FindRule )( + ISpeechGrammarRules * This, + /* [in] */ VARIANT RuleNameOrId, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechGrammarRules * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [restricted][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechGrammarRules * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Dynamic )( + ISpeechGrammarRules * This, + /* [retval][out] */ VARIANT_BOOL *Dynamic); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Add )( + ISpeechGrammarRules * This, + /* [in] */ BSTR RuleName, + /* [in] */ SpeechRuleAttributes Attributes, + /* [defaultvalue][in] */ long RuleId, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpeechGrammarRules * This); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *CommitAndSave )( + ISpeechGrammarRules * This, + /* [out] */ BSTR *ErrorText, + /* [retval][out] */ VARIANT *SaveStream); + + END_INTERFACE + } ISpeechGrammarRulesVtbl; + + interface ISpeechGrammarRules + { + CONST_VTBL struct ISpeechGrammarRulesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRules_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRules_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRules_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRules_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRules_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRules_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRules_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRules_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechGrammarRules_FindRule(This,RuleNameOrId,Rule) \ + (This)->lpVtbl -> FindRule(This,RuleNameOrId,Rule) + +#define ISpeechGrammarRules_Item(This,Index,Rule) \ + (This)->lpVtbl -> Item(This,Index,Rule) + +#define ISpeechGrammarRules_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#define ISpeechGrammarRules_get_Dynamic(This,Dynamic) \ + (This)->lpVtbl -> get_Dynamic(This,Dynamic) + +#define ISpeechGrammarRules_Add(This,RuleName,Attributes,RuleId,Rule) \ + (This)->lpVtbl -> Add(This,RuleName,Attributes,RuleId,Rule) + +#define ISpeechGrammarRules_Commit(This) \ + (This)->lpVtbl -> Commit(This) + +#define ISpeechGrammarRules_CommitAndSave(This,ErrorText,SaveStream) \ + (This)->lpVtbl -> CommitAndSave(This,ErrorText,SaveStream) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_get_Count_Proxy( + ISpeechGrammarRules * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechGrammarRules_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_FindRule_Proxy( + ISpeechGrammarRules * This, + /* [in] */ VARIANT RuleNameOrId, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRules_FindRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_Item_Proxy( + ISpeechGrammarRules * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRules_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_get__NewEnum_Proxy( + ISpeechGrammarRules * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechGrammarRules_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_get_Dynamic_Proxy( + ISpeechGrammarRules * This, + /* [retval][out] */ VARIANT_BOOL *Dynamic); + + +void __RPC_STUB ISpeechGrammarRules_get_Dynamic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_Add_Proxy( + ISpeechGrammarRules * This, + /* [in] */ BSTR RuleName, + /* [in] */ SpeechRuleAttributes Attributes, + /* [defaultvalue][in] */ long RuleId, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRules_Add_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_Commit_Proxy( + ISpeechGrammarRules * This); + + +void __RPC_STUB ISpeechGrammarRules_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRules_CommitAndSave_Proxy( + ISpeechGrammarRules * This, + /* [out] */ BSTR *ErrorText, + /* [retval][out] */ VARIANT *SaveStream); + + +void __RPC_STUB ISpeechGrammarRules_CommitAndSave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRules_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleState_INTERFACE_DEFINED__ +#define __ISpeechGrammarRuleState_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRuleState */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRuleState; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D4286F2C-EE67-45ae-B928-28D695362EDA") + ISpeechGrammarRuleState : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rule( + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Transitions( + /* [retval][out] */ ISpeechGrammarRuleStateTransitions **Transitions) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddWordTransition( + /* [in] */ ISpeechGrammarRuleState *DestState, + /* [in] */ const BSTR Words, + /* [defaultvalue][in] */ const BSTR Separators = L" ", + /* [defaultvalue][in] */ SpeechGrammarWordType Type = SGLexical, + /* [defaultvalue][in] */ const BSTR PropertyName = L"", + /* [defaultvalue][in] */ long PropertyId = 0, + /* [defaultvalue][in] */ VARIANT *PropertyValue = 0, + /* [defaultvalue][in] */ float Weight = 1) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddRuleTransition( + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ ISpeechGrammarRule *Rule, + /* [defaultvalue][in] */ const BSTR PropertyName = L"", + /* [defaultvalue][in] */ long PropertyId = 0, + /* [defaultvalue][in] */ VARIANT *PropertyValue = 0, + /* [defaultvalue][in] */ float Weight = 1) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddSpecialTransition( + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ SpeechSpecialTransitionType Type, + /* [defaultvalue][in] */ const BSTR PropertyName = L"", + /* [defaultvalue][in] */ long PropertyId = 0, + /* [defaultvalue][in] */ VARIANT *PropertyValue = 0, + /* [defaultvalue][in] */ float Weight = 1) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRuleStateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRuleState * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRuleState * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRuleState * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRuleState * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRuleState * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRuleState * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRuleState * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rule )( + ISpeechGrammarRuleState * This, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Transitions )( + ISpeechGrammarRuleState * This, + /* [retval][out] */ ISpeechGrammarRuleStateTransitions **Transitions); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddWordTransition )( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestState, + /* [in] */ const BSTR Words, + /* [defaultvalue][in] */ const BSTR Separators, + /* [defaultvalue][in] */ SpeechGrammarWordType Type, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddRuleTransition )( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ ISpeechGrammarRule *Rule, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddSpecialTransition )( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ SpeechSpecialTransitionType Type, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + END_INTERFACE + } ISpeechGrammarRuleStateVtbl; + + interface ISpeechGrammarRuleState + { + CONST_VTBL struct ISpeechGrammarRuleStateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRuleState_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRuleState_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRuleState_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRuleState_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRuleState_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRuleState_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRuleState_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRuleState_get_Rule(This,Rule) \ + (This)->lpVtbl -> get_Rule(This,Rule) + +#define ISpeechGrammarRuleState_get_Transitions(This,Transitions) \ + (This)->lpVtbl -> get_Transitions(This,Transitions) + +#define ISpeechGrammarRuleState_AddWordTransition(This,DestState,Words,Separators,Type,PropertyName,PropertyId,PropertyValue,Weight) \ + (This)->lpVtbl -> AddWordTransition(This,DestState,Words,Separators,Type,PropertyName,PropertyId,PropertyValue,Weight) + +#define ISpeechGrammarRuleState_AddRuleTransition(This,DestinationState,Rule,PropertyName,PropertyId,PropertyValue,Weight) \ + (This)->lpVtbl -> AddRuleTransition(This,DestinationState,Rule,PropertyName,PropertyId,PropertyValue,Weight) + +#define ISpeechGrammarRuleState_AddSpecialTransition(This,DestinationState,Type,PropertyName,PropertyId,PropertyValue,Weight) \ + (This)->lpVtbl -> AddSpecialTransition(This,DestinationState,Type,PropertyName,PropertyId,PropertyValue,Weight) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_get_Rule_Proxy( + ISpeechGrammarRuleState * This, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRuleState_get_Rule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_get_Transitions_Proxy( + ISpeechGrammarRuleState * This, + /* [retval][out] */ ISpeechGrammarRuleStateTransitions **Transitions); + + +void __RPC_STUB ISpeechGrammarRuleState_get_Transitions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_AddWordTransition_Proxy( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestState, + /* [in] */ const BSTR Words, + /* [defaultvalue][in] */ const BSTR Separators, + /* [defaultvalue][in] */ SpeechGrammarWordType Type, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + +void __RPC_STUB ISpeechGrammarRuleState_AddWordTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_AddRuleTransition_Proxy( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ ISpeechGrammarRule *Rule, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + +void __RPC_STUB ISpeechGrammarRuleState_AddRuleTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleState_AddSpecialTransition_Proxy( + ISpeechGrammarRuleState * This, + /* [in] */ ISpeechGrammarRuleState *DestinationState, + /* [in] */ SpeechSpecialTransitionType Type, + /* [defaultvalue][in] */ const BSTR PropertyName, + /* [defaultvalue][in] */ long PropertyId, + /* [defaultvalue][in] */ VARIANT *PropertyValue, + /* [defaultvalue][in] */ float Weight); + + +void __RPC_STUB ISpeechGrammarRuleState_AddSpecialTransition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRuleState_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleStateTransition_INTERFACE_DEFINED__ +#define __ISpeechGrammarRuleStateTransition_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRuleStateTransition */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRuleStateTransition; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CAFD1DB1-41D1-4a06-9863-E2E81DA17A9A") + ISpeechGrammarRuleStateTransition : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ SpeechGrammarRuleStateTransitionType *Type) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Text( + /* [retval][out] */ BSTR *Text) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rule( + /* [retval][out] */ ISpeechGrammarRule **Rule) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Weight( + /* [retval][out] */ VARIANT *Weight) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PropertyName( + /* [retval][out] */ BSTR *PropertyName) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PropertyId( + /* [retval][out] */ long *PropertyId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PropertyValue( + /* [retval][out] */ VARIANT *PropertyValue) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NextState( + /* [retval][out] */ ISpeechGrammarRuleState **NextState) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRuleStateTransitionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRuleStateTransition * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRuleStateTransition * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRuleStateTransition * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRuleStateTransition * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRuleStateTransition * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRuleStateTransition * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRuleStateTransition * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Type )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ SpeechGrammarRuleStateTransitionType *Type); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Text )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ BSTR *Text); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rule )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Weight )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ VARIANT *Weight); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PropertyName )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ BSTR *PropertyName); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PropertyId )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ long *PropertyId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PropertyValue )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ VARIANT *PropertyValue); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NextState )( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ ISpeechGrammarRuleState **NextState); + + END_INTERFACE + } ISpeechGrammarRuleStateTransitionVtbl; + + interface ISpeechGrammarRuleStateTransition + { + CONST_VTBL struct ISpeechGrammarRuleStateTransitionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRuleStateTransition_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRuleStateTransition_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRuleStateTransition_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRuleStateTransition_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRuleStateTransition_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRuleStateTransition_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRuleStateTransition_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRuleStateTransition_get_Type(This,Type) \ + (This)->lpVtbl -> get_Type(This,Type) + +#define ISpeechGrammarRuleStateTransition_get_Text(This,Text) \ + (This)->lpVtbl -> get_Text(This,Text) + +#define ISpeechGrammarRuleStateTransition_get_Rule(This,Rule) \ + (This)->lpVtbl -> get_Rule(This,Rule) + +#define ISpeechGrammarRuleStateTransition_get_Weight(This,Weight) \ + (This)->lpVtbl -> get_Weight(This,Weight) + +#define ISpeechGrammarRuleStateTransition_get_PropertyName(This,PropertyName) \ + (This)->lpVtbl -> get_PropertyName(This,PropertyName) + +#define ISpeechGrammarRuleStateTransition_get_PropertyId(This,PropertyId) \ + (This)->lpVtbl -> get_PropertyId(This,PropertyId) + +#define ISpeechGrammarRuleStateTransition_get_PropertyValue(This,PropertyValue) \ + (This)->lpVtbl -> get_PropertyValue(This,PropertyValue) + +#define ISpeechGrammarRuleStateTransition_get_NextState(This,NextState) \ + (This)->lpVtbl -> get_NextState(This,NextState) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_Type_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ SpeechGrammarRuleStateTransitionType *Type); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_Text_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ BSTR *Text); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_Text_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_Rule_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ ISpeechGrammarRule **Rule); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_Rule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_Weight_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ VARIANT *Weight); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_Weight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_PropertyName_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ BSTR *PropertyName); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_PropertyName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_PropertyId_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ long *PropertyId); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_PropertyId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_PropertyValue_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ VARIANT *PropertyValue); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_PropertyValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransition_get_NextState_Proxy( + ISpeechGrammarRuleStateTransition * This, + /* [retval][out] */ ISpeechGrammarRuleState **NextState); + + +void __RPC_STUB ISpeechGrammarRuleStateTransition_get_NextState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRuleStateTransition_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechGrammarRuleStateTransitions_INTERFACE_DEFINED__ +#define __ISpeechGrammarRuleStateTransitions_INTERFACE_DEFINED__ + +/* interface ISpeechGrammarRuleStateTransitions */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechGrammarRuleStateTransitions; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EABCE657-75BC-44a2-AA7F-C56476742963") + ISpeechGrammarRuleStateTransitions : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRuleStateTransition **Transition) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechGrammarRuleStateTransitionsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechGrammarRuleStateTransitions * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechGrammarRuleStateTransitions * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechGrammarRuleStateTransitions * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechGrammarRuleStateTransitions * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRuleStateTransition **Transition); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechGrammarRuleStateTransitions * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechGrammarRuleStateTransitionsVtbl; + + interface ISpeechGrammarRuleStateTransitions + { + CONST_VTBL struct ISpeechGrammarRuleStateTransitionsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechGrammarRuleStateTransitions_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechGrammarRuleStateTransitions_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechGrammarRuleStateTransitions_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechGrammarRuleStateTransitions_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechGrammarRuleStateTransitions_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechGrammarRuleStateTransitions_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechGrammarRuleStateTransitions_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechGrammarRuleStateTransitions_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechGrammarRuleStateTransitions_Item(This,Index,Transition) \ + (This)->lpVtbl -> Item(This,Index,Transition) + +#define ISpeechGrammarRuleStateTransitions_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransitions_get_Count_Proxy( + ISpeechGrammarRuleStateTransitions * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechGrammarRuleStateTransitions_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransitions_Item_Proxy( + ISpeechGrammarRuleStateTransitions * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechGrammarRuleStateTransition **Transition); + + +void __RPC_STUB ISpeechGrammarRuleStateTransitions_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechGrammarRuleStateTransitions_get__NewEnum_Proxy( + ISpeechGrammarRuleStateTransitions * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechGrammarRuleStateTransitions_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechGrammarRuleStateTransitions_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechTextSelectionInformation_INTERFACE_DEFINED__ +#define __ISpeechTextSelectionInformation_INTERFACE_DEFINED__ + +/* interface ISpeechTextSelectionInformation */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechTextSelectionInformation; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3B9C7E7A-6EEE-4DED-9092-11657279ADBE") + ISpeechTextSelectionInformation : public IDispatch + { + public: + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ActiveOffset( + /* [in] */ long ActiveOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ActiveOffset( + /* [retval][out] */ long *ActiveOffset) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_ActiveLength( + /* [in] */ long ActiveLength) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ActiveLength( + /* [retval][out] */ long *ActiveLength) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionOffset( + /* [in] */ long SelectionOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionOffset( + /* [retval][out] */ long *SelectionOffset) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionLength( + /* [in] */ long SelectionLength) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionLength( + /* [retval][out] */ long *SelectionLength) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechTextSelectionInformationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechTextSelectionInformation * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechTextSelectionInformation * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechTextSelectionInformation * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechTextSelectionInformation * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechTextSelectionInformation * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechTextSelectionInformation * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechTextSelectionInformation * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ActiveOffset )( + ISpeechTextSelectionInformation * This, + /* [in] */ long ActiveOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ActiveOffset )( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *ActiveOffset); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ActiveLength )( + ISpeechTextSelectionInformation * This, + /* [in] */ long ActiveLength); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ActiveLength )( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *ActiveLength); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SelectionOffset )( + ISpeechTextSelectionInformation * This, + /* [in] */ long SelectionOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SelectionOffset )( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *SelectionOffset); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SelectionLength )( + ISpeechTextSelectionInformation * This, + /* [in] */ long SelectionLength); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SelectionLength )( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *SelectionLength); + + END_INTERFACE + } ISpeechTextSelectionInformationVtbl; + + interface ISpeechTextSelectionInformation + { + CONST_VTBL struct ISpeechTextSelectionInformationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechTextSelectionInformation_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechTextSelectionInformation_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechTextSelectionInformation_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechTextSelectionInformation_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechTextSelectionInformation_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechTextSelectionInformation_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechTextSelectionInformation_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechTextSelectionInformation_put_ActiveOffset(This,ActiveOffset) \ + (This)->lpVtbl -> put_ActiveOffset(This,ActiveOffset) + +#define ISpeechTextSelectionInformation_get_ActiveOffset(This,ActiveOffset) \ + (This)->lpVtbl -> get_ActiveOffset(This,ActiveOffset) + +#define ISpeechTextSelectionInformation_put_ActiveLength(This,ActiveLength) \ + (This)->lpVtbl -> put_ActiveLength(This,ActiveLength) + +#define ISpeechTextSelectionInformation_get_ActiveLength(This,ActiveLength) \ + (This)->lpVtbl -> get_ActiveLength(This,ActiveLength) + +#define ISpeechTextSelectionInformation_put_SelectionOffset(This,SelectionOffset) \ + (This)->lpVtbl -> put_SelectionOffset(This,SelectionOffset) + +#define ISpeechTextSelectionInformation_get_SelectionOffset(This,SelectionOffset) \ + (This)->lpVtbl -> get_SelectionOffset(This,SelectionOffset) + +#define ISpeechTextSelectionInformation_put_SelectionLength(This,SelectionLength) \ + (This)->lpVtbl -> put_SelectionLength(This,SelectionLength) + +#define ISpeechTextSelectionInformation_get_SelectionLength(This,SelectionLength) \ + (This)->lpVtbl -> get_SelectionLength(This,SelectionLength) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_put_ActiveOffset_Proxy( + ISpeechTextSelectionInformation * This, + /* [in] */ long ActiveOffset); + + +void __RPC_STUB ISpeechTextSelectionInformation_put_ActiveOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_get_ActiveOffset_Proxy( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *ActiveOffset); + + +void __RPC_STUB ISpeechTextSelectionInformation_get_ActiveOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_put_ActiveLength_Proxy( + ISpeechTextSelectionInformation * This, + /* [in] */ long ActiveLength); + + +void __RPC_STUB ISpeechTextSelectionInformation_put_ActiveLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_get_ActiveLength_Proxy( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *ActiveLength); + + +void __RPC_STUB ISpeechTextSelectionInformation_get_ActiveLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_put_SelectionOffset_Proxy( + ISpeechTextSelectionInformation * This, + /* [in] */ long SelectionOffset); + + +void __RPC_STUB ISpeechTextSelectionInformation_put_SelectionOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_get_SelectionOffset_Proxy( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *SelectionOffset); + + +void __RPC_STUB ISpeechTextSelectionInformation_get_SelectionOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_put_SelectionLength_Proxy( + ISpeechTextSelectionInformation * This, + /* [in] */ long SelectionLength); + + +void __RPC_STUB ISpeechTextSelectionInformation_put_SelectionLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechTextSelectionInformation_get_SelectionLength_Proxy( + ISpeechTextSelectionInformation * This, + /* [retval][out] */ long *SelectionLength); + + +void __RPC_STUB ISpeechTextSelectionInformation_get_SelectionLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechTextSelectionInformation_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecoResult_INTERFACE_DEFINED__ +#define __ISpeechRecoResult_INTERFACE_DEFINED__ + +/* interface ISpeechRecoResult */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecoResult; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ED2879CF-CED9-4ee6-A534-DE0191D5468D") + ISpeechRecoResult : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RecoContext( + /* [retval][out] */ ISpeechRecoContext **RecoContext) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Times( + /* [retval][out] */ ISpeechRecoResultTimes **Times) = 0; + + virtual /* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE putref_AudioFormat( + /* [in] */ ISpeechAudioFormat *Format) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioFormat( + /* [retval][out] */ ISpeechAudioFormat **Format) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PhraseInfo( + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Alternates( + /* [in] */ long RequestCount, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechPhraseAlternates **Alternates) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Audio( + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechMemoryStream **Stream) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SpeakAudio( + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SaveToMemory( + /* [retval][out] */ VARIANT *ResultBlock) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE DiscardResultInfo( + /* [in] */ SpeechDiscardType ValueTypes) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecoResultVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecoResult * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecoResult * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecoResult * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecoResult * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecoResult * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecoResult * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecoResult * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RecoContext )( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechRecoContext **RecoContext); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Times )( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechRecoResultTimes **Times); + + /* [id][helpstring][propputref] */ HRESULT ( STDMETHODCALLTYPE *putref_AudioFormat )( + ISpeechRecoResult * This, + /* [in] */ ISpeechAudioFormat *Format); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioFormat )( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechAudioFormat **Format); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PhraseInfo )( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Alternates )( + ISpeechRecoResult * This, + /* [in] */ long RequestCount, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechPhraseAlternates **Alternates); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Audio )( + ISpeechRecoResult * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechMemoryStream **Stream); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SpeakAudio )( + ISpeechRecoResult * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SaveToMemory )( + ISpeechRecoResult * This, + /* [retval][out] */ VARIANT *ResultBlock); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *DiscardResultInfo )( + ISpeechRecoResult * This, + /* [in] */ SpeechDiscardType ValueTypes); + + END_INTERFACE + } ISpeechRecoResultVtbl; + + interface ISpeechRecoResult + { + CONST_VTBL struct ISpeechRecoResultVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecoResult_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecoResult_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecoResult_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecoResult_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecoResult_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecoResult_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecoResult_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecoResult_get_RecoContext(This,RecoContext) \ + (This)->lpVtbl -> get_RecoContext(This,RecoContext) + +#define ISpeechRecoResult_get_Times(This,Times) \ + (This)->lpVtbl -> get_Times(This,Times) + +#define ISpeechRecoResult_putref_AudioFormat(This,Format) \ + (This)->lpVtbl -> putref_AudioFormat(This,Format) + +#define ISpeechRecoResult_get_AudioFormat(This,Format) \ + (This)->lpVtbl -> get_AudioFormat(This,Format) + +#define ISpeechRecoResult_get_PhraseInfo(This,PhraseInfo) \ + (This)->lpVtbl -> get_PhraseInfo(This,PhraseInfo) + +#define ISpeechRecoResult_Alternates(This,RequestCount,StartElement,Elements,Alternates) \ + (This)->lpVtbl -> Alternates(This,RequestCount,StartElement,Elements,Alternates) + +#define ISpeechRecoResult_Audio(This,StartElement,Elements,Stream) \ + (This)->lpVtbl -> Audio(This,StartElement,Elements,Stream) + +#define ISpeechRecoResult_SpeakAudio(This,StartElement,Elements,Flags,StreamNumber) \ + (This)->lpVtbl -> SpeakAudio(This,StartElement,Elements,Flags,StreamNumber) + +#define ISpeechRecoResult_SaveToMemory(This,ResultBlock) \ + (This)->lpVtbl -> SaveToMemory(This,ResultBlock) + +#define ISpeechRecoResult_DiscardResultInfo(This,ValueTypes) \ + (This)->lpVtbl -> DiscardResultInfo(This,ValueTypes) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_get_RecoContext_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechRecoContext **RecoContext); + + +void __RPC_STUB ISpeechRecoResult_get_RecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_get_Times_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechRecoResultTimes **Times); + + +void __RPC_STUB ISpeechRecoResult_get_Times_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propputref] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_putref_AudioFormat_Proxy( + ISpeechRecoResult * This, + /* [in] */ ISpeechAudioFormat *Format); + + +void __RPC_STUB ISpeechRecoResult_putref_AudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_get_AudioFormat_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechAudioFormat **Format); + + +void __RPC_STUB ISpeechRecoResult_get_AudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_get_PhraseInfo_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + +void __RPC_STUB ISpeechRecoResult_get_PhraseInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_Alternates_Proxy( + ISpeechRecoResult * This, + /* [in] */ long RequestCount, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechPhraseAlternates **Alternates); + + +void __RPC_STUB ISpeechRecoResult_Alternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_Audio_Proxy( + ISpeechRecoResult * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [retval][out] */ ISpeechMemoryStream **Stream); + + +void __RPC_STUB ISpeechRecoResult_Audio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_SpeakAudio_Proxy( + ISpeechRecoResult * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ SpeechVoiceSpeakFlags Flags, + /* [retval][out] */ long *StreamNumber); + + +void __RPC_STUB ISpeechRecoResult_SpeakAudio_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_SaveToMemory_Proxy( + ISpeechRecoResult * This, + /* [retval][out] */ VARIANT *ResultBlock); + + +void __RPC_STUB ISpeechRecoResult_SaveToMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResult_DiscardResultInfo_Proxy( + ISpeechRecoResult * This, + /* [in] */ SpeechDiscardType ValueTypes); + + +void __RPC_STUB ISpeechRecoResult_DiscardResultInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecoResult_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechRecoResultTimes_INTERFACE_DEFINED__ +#define __ISpeechRecoResultTimes_INTERFACE_DEFINED__ + +/* interface ISpeechRecoResultTimes */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechRecoResultTimes; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("62B3B8FB-F6E7-41be-BDCB-056B1C29EFC0") + ISpeechRecoResultTimes : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_StreamTime( + /* [retval][out] */ VARIANT *Time) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Length( + /* [retval][out] */ VARIANT *Length) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_TickCount( + /* [retval][out] */ long *TickCount) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_OffsetFromStart( + /* [retval][out] */ VARIANT *OffsetFromStart) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechRecoResultTimesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechRecoResultTimes * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechRecoResultTimes * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechRecoResultTimes * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechRecoResultTimes * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechRecoResultTimes * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechRecoResultTimes * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechRecoResultTimes * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StreamTime )( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *Time); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Length )( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *Length); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TickCount )( + ISpeechRecoResultTimes * This, + /* [retval][out] */ long *TickCount); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_OffsetFromStart )( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *OffsetFromStart); + + END_INTERFACE + } ISpeechRecoResultTimesVtbl; + + interface ISpeechRecoResultTimes + { + CONST_VTBL struct ISpeechRecoResultTimesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechRecoResultTimes_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechRecoResultTimes_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechRecoResultTimes_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechRecoResultTimes_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechRecoResultTimes_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechRecoResultTimes_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechRecoResultTimes_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechRecoResultTimes_get_StreamTime(This,Time) \ + (This)->lpVtbl -> get_StreamTime(This,Time) + +#define ISpeechRecoResultTimes_get_Length(This,Length) \ + (This)->lpVtbl -> get_Length(This,Length) + +#define ISpeechRecoResultTimes_get_TickCount(This,TickCount) \ + (This)->lpVtbl -> get_TickCount(This,TickCount) + +#define ISpeechRecoResultTimes_get_OffsetFromStart(This,OffsetFromStart) \ + (This)->lpVtbl -> get_OffsetFromStart(This,OffsetFromStart) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResultTimes_get_StreamTime_Proxy( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *Time); + + +void __RPC_STUB ISpeechRecoResultTimes_get_StreamTime_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResultTimes_get_Length_Proxy( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *Length); + + +void __RPC_STUB ISpeechRecoResultTimes_get_Length_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResultTimes_get_TickCount_Proxy( + ISpeechRecoResultTimes * This, + /* [retval][out] */ long *TickCount); + + +void __RPC_STUB ISpeechRecoResultTimes_get_TickCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechRecoResultTimes_get_OffsetFromStart_Proxy( + ISpeechRecoResultTimes * This, + /* [retval][out] */ VARIANT *OffsetFromStart); + + +void __RPC_STUB ISpeechRecoResultTimes_get_OffsetFromStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechRecoResultTimes_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseAlternate_INTERFACE_DEFINED__ +#define __ISpeechPhraseAlternate_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseAlternate */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseAlternate; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("27864A2A-2B9F-4cb8-92D3-0D2722FD1E73") + ISpeechPhraseAlternate : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RecoResult( + /* [retval][out] */ ISpeechRecoResult **RecoResult) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_StartElementInResult( + /* [retval][out] */ long *StartElement) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfElementsInResult( + /* [retval][out] */ long *NumberOfElements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_PhraseInfo( + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Commit( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseAlternateVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseAlternate * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseAlternate * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseAlternate * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseAlternate * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseAlternate * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseAlternate * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseAlternate * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RecoResult )( + ISpeechPhraseAlternate * This, + /* [retval][out] */ ISpeechRecoResult **RecoResult); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StartElementInResult )( + ISpeechPhraseAlternate * This, + /* [retval][out] */ long *StartElement); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfElementsInResult )( + ISpeechPhraseAlternate * This, + /* [retval][out] */ long *NumberOfElements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PhraseInfo )( + ISpeechPhraseAlternate * This, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpeechPhraseAlternate * This); + + END_INTERFACE + } ISpeechPhraseAlternateVtbl; + + interface ISpeechPhraseAlternate + { + CONST_VTBL struct ISpeechPhraseAlternateVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseAlternate_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseAlternate_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseAlternate_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseAlternate_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseAlternate_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseAlternate_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseAlternate_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseAlternate_get_RecoResult(This,RecoResult) \ + (This)->lpVtbl -> get_RecoResult(This,RecoResult) + +#define ISpeechPhraseAlternate_get_StartElementInResult(This,StartElement) \ + (This)->lpVtbl -> get_StartElementInResult(This,StartElement) + +#define ISpeechPhraseAlternate_get_NumberOfElementsInResult(This,NumberOfElements) \ + (This)->lpVtbl -> get_NumberOfElementsInResult(This,NumberOfElements) + +#define ISpeechPhraseAlternate_get_PhraseInfo(This,PhraseInfo) \ + (This)->lpVtbl -> get_PhraseInfo(This,PhraseInfo) + +#define ISpeechPhraseAlternate_Commit(This) \ + (This)->lpVtbl -> Commit(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_get_RecoResult_Proxy( + ISpeechPhraseAlternate * This, + /* [retval][out] */ ISpeechRecoResult **RecoResult); + + +void __RPC_STUB ISpeechPhraseAlternate_get_RecoResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_get_StartElementInResult_Proxy( + ISpeechPhraseAlternate * This, + /* [retval][out] */ long *StartElement); + + +void __RPC_STUB ISpeechPhraseAlternate_get_StartElementInResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_get_NumberOfElementsInResult_Proxy( + ISpeechPhraseAlternate * This, + /* [retval][out] */ long *NumberOfElements); + + +void __RPC_STUB ISpeechPhraseAlternate_get_NumberOfElementsInResult_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_get_PhraseInfo_Proxy( + ISpeechPhraseAlternate * This, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + +void __RPC_STUB ISpeechPhraseAlternate_get_PhraseInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternate_Commit_Proxy( + ISpeechPhraseAlternate * This); + + +void __RPC_STUB ISpeechPhraseAlternate_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseAlternate_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseAlternates_INTERFACE_DEFINED__ +#define __ISpeechPhraseAlternates_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseAlternates */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseAlternates; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B238B6D5-F276-4c3d-A6C1-2974801C3CC2") + ISpeechPhraseAlternates : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseAlternate **PhraseAlternate) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseAlternatesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseAlternates * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseAlternates * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseAlternates * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseAlternates * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseAlternates * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseAlternates * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseAlternates * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseAlternates * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseAlternates * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseAlternate **PhraseAlternate); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseAlternates * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhraseAlternatesVtbl; + + interface ISpeechPhraseAlternates + { + CONST_VTBL struct ISpeechPhraseAlternatesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseAlternates_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseAlternates_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseAlternates_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseAlternates_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseAlternates_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseAlternates_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseAlternates_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseAlternates_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseAlternates_Item(This,Index,PhraseAlternate) \ + (This)->lpVtbl -> Item(This,Index,PhraseAlternate) + +#define ISpeechPhraseAlternates_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternates_get_Count_Proxy( + ISpeechPhraseAlternates * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseAlternates_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternates_Item_Proxy( + ISpeechPhraseAlternates * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseAlternate **PhraseAlternate); + + +void __RPC_STUB ISpeechPhraseAlternates_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseAlternates_get__NewEnum_Proxy( + ISpeechPhraseAlternates * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseAlternates_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseAlternates_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseInfo_INTERFACE_DEFINED__ +#define __ISpeechPhraseInfo_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseInfo */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseInfo; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("961559CF-4E67-4662-8BF0-D93F1FCD61B3") + ISpeechPhraseInfo : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LanguageId( + /* [retval][out] */ long *LanguageId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_GrammarId( + /* [retval][out] */ VARIANT *GrammarId) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_StartTime( + /* [retval][out] */ VARIANT *StartTime) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStreamPosition( + /* [retval][out] */ VARIANT *AudioStreamPosition) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioSizeBytes( + /* [retval][out] */ long *pAudioSizeBytes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedSizeBytes( + /* [retval][out] */ long *RetainedSizeBytes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioSizeTime( + /* [retval][out] */ long *AudioSizeTime) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Rule( + /* [retval][out] */ ISpeechPhraseRule **Rule) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Properties( + /* [retval][out] */ ISpeechPhraseProperties **Properties) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Elements( + /* [retval][out] */ ISpeechPhraseElements **Elements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Replacements( + /* [retval][out] */ ISpeechPhraseReplacements **Replacements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EngineId( + /* [retval][out] */ BSTR *EngineIdGuid) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EnginePrivateData( + /* [retval][out] */ VARIANT *PrivateData) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE SaveToMemory( + /* [retval][out] */ VARIANT *PhraseBlock) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetText( + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ BSTR *Text) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetDisplayAttributes( + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseInfoVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseInfo * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseInfo * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseInfo * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseInfo * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseInfo * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseInfo * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseInfo * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LanguageId )( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *LanguageId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_GrammarId )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *GrammarId); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_StartTime )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *StartTime); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioStreamPosition )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *AudioStreamPosition); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSizeBytes )( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *pAudioSizeBytes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedSizeBytes )( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *RetainedSizeBytes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSizeTime )( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *AudioSizeTime); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Rule )( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseRule **Rule); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Properties )( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseProperties **Properties); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Elements )( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseElements **Elements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Replacements )( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseReplacements **Replacements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EngineId )( + ISpeechPhraseInfo * This, + /* [retval][out] */ BSTR *EngineIdGuid); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EnginePrivateData )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *PrivateData); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *SaveToMemory )( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *PhraseBlock); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpeechPhraseInfo * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ BSTR *Text); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetDisplayAttributes )( + ISpeechPhraseInfo * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + END_INTERFACE + } ISpeechPhraseInfoVtbl; + + interface ISpeechPhraseInfo + { + CONST_VTBL struct ISpeechPhraseInfoVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseInfo_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseInfo_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseInfo_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseInfo_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseInfo_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseInfo_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseInfo_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseInfo_get_LanguageId(This,LanguageId) \ + (This)->lpVtbl -> get_LanguageId(This,LanguageId) + +#define ISpeechPhraseInfo_get_GrammarId(This,GrammarId) \ + (This)->lpVtbl -> get_GrammarId(This,GrammarId) + +#define ISpeechPhraseInfo_get_StartTime(This,StartTime) \ + (This)->lpVtbl -> get_StartTime(This,StartTime) + +#define ISpeechPhraseInfo_get_AudioStreamPosition(This,AudioStreamPosition) \ + (This)->lpVtbl -> get_AudioStreamPosition(This,AudioStreamPosition) + +#define ISpeechPhraseInfo_get_AudioSizeBytes(This,pAudioSizeBytes) \ + (This)->lpVtbl -> get_AudioSizeBytes(This,pAudioSizeBytes) + +#define ISpeechPhraseInfo_get_RetainedSizeBytes(This,RetainedSizeBytes) \ + (This)->lpVtbl -> get_RetainedSizeBytes(This,RetainedSizeBytes) + +#define ISpeechPhraseInfo_get_AudioSizeTime(This,AudioSizeTime) \ + (This)->lpVtbl -> get_AudioSizeTime(This,AudioSizeTime) + +#define ISpeechPhraseInfo_get_Rule(This,Rule) \ + (This)->lpVtbl -> get_Rule(This,Rule) + +#define ISpeechPhraseInfo_get_Properties(This,Properties) \ + (This)->lpVtbl -> get_Properties(This,Properties) + +#define ISpeechPhraseInfo_get_Elements(This,Elements) \ + (This)->lpVtbl -> get_Elements(This,Elements) + +#define ISpeechPhraseInfo_get_Replacements(This,Replacements) \ + (This)->lpVtbl -> get_Replacements(This,Replacements) + +#define ISpeechPhraseInfo_get_EngineId(This,EngineIdGuid) \ + (This)->lpVtbl -> get_EngineId(This,EngineIdGuid) + +#define ISpeechPhraseInfo_get_EnginePrivateData(This,PrivateData) \ + (This)->lpVtbl -> get_EnginePrivateData(This,PrivateData) + +#define ISpeechPhraseInfo_SaveToMemory(This,PhraseBlock) \ + (This)->lpVtbl -> SaveToMemory(This,PhraseBlock) + +#define ISpeechPhraseInfo_GetText(This,StartElement,Elements,UseReplacements,Text) \ + (This)->lpVtbl -> GetText(This,StartElement,Elements,UseReplacements,Text) + +#define ISpeechPhraseInfo_GetDisplayAttributes(This,StartElement,Elements,UseReplacements,DisplayAttributes) \ + (This)->lpVtbl -> GetDisplayAttributes(This,StartElement,Elements,UseReplacements,DisplayAttributes) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_LanguageId_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *LanguageId); + + +void __RPC_STUB ISpeechPhraseInfo_get_LanguageId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_GrammarId_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *GrammarId); + + +void __RPC_STUB ISpeechPhraseInfo_get_GrammarId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_StartTime_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *StartTime); + + +void __RPC_STUB ISpeechPhraseInfo_get_StartTime_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_AudioStreamPosition_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *AudioStreamPosition); + + +void __RPC_STUB ISpeechPhraseInfo_get_AudioStreamPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_AudioSizeBytes_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *pAudioSizeBytes); + + +void __RPC_STUB ISpeechPhraseInfo_get_AudioSizeBytes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_RetainedSizeBytes_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *RetainedSizeBytes); + + +void __RPC_STUB ISpeechPhraseInfo_get_RetainedSizeBytes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_AudioSizeTime_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ long *AudioSizeTime); + + +void __RPC_STUB ISpeechPhraseInfo_get_AudioSizeTime_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_Rule_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseRule **Rule); + + +void __RPC_STUB ISpeechPhraseInfo_get_Rule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_Properties_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseProperties **Properties); + + +void __RPC_STUB ISpeechPhraseInfo_get_Properties_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_Elements_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseElements **Elements); + + +void __RPC_STUB ISpeechPhraseInfo_get_Elements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_Replacements_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ ISpeechPhraseReplacements **Replacements); + + +void __RPC_STUB ISpeechPhraseInfo_get_Replacements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_EngineId_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ BSTR *EngineIdGuid); + + +void __RPC_STUB ISpeechPhraseInfo_get_EngineId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_get_EnginePrivateData_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *PrivateData); + + +void __RPC_STUB ISpeechPhraseInfo_get_EnginePrivateData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_SaveToMemory_Proxy( + ISpeechPhraseInfo * This, + /* [retval][out] */ VARIANT *PhraseBlock); + + +void __RPC_STUB ISpeechPhraseInfo_SaveToMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_GetText_Proxy( + ISpeechPhraseInfo * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ BSTR *Text); + + +void __RPC_STUB ISpeechPhraseInfo_GetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfo_GetDisplayAttributes_Proxy( + ISpeechPhraseInfo * This, + /* [defaultvalue][in] */ long StartElement, + /* [defaultvalue][in] */ long Elements, + /* [defaultvalue][in] */ VARIANT_BOOL UseReplacements, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + +void __RPC_STUB ISpeechPhraseInfo_GetDisplayAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseInfo_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseElement_INTERFACE_DEFINED__ +#define __ISpeechPhraseElement_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseElement */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseElement; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E6176F96-E373-4801-B223-3B62C068C0B4") + ISpeechPhraseElement : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioTimeOffset( + /* [retval][out] */ long *AudioTimeOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioSizeTime( + /* [retval][out] */ long *AudioSizeTime) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStreamOffset( + /* [retval][out] */ long *AudioStreamOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_AudioSizeBytes( + /* [retval][out] */ long *AudioSizeBytes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedStreamOffset( + /* [retval][out] */ long *RetainedStreamOffset) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RetainedSizeBytes( + /* [retval][out] */ long *RetainedSizeBytes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayText( + /* [retval][out] */ BSTR *DisplayText) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LexicalForm( + /* [retval][out] */ BSTR *LexicalForm) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Pronunciation( + /* [retval][out] */ VARIANT *Pronunciation) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayAttributes( + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_RequiredConfidence( + /* [retval][out] */ SpeechEngineConfidence *RequiredConfidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_ActualConfidence( + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EngineConfidence( + /* [retval][out] */ float *EngineConfidence) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseElementVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseElement * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseElement * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseElement * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseElement * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseElement * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseElement * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseElement * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioTimeOffset )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioTimeOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSizeTime )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioSizeTime); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioStreamOffset )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioStreamOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_AudioSizeBytes )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioSizeBytes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedStreamOffset )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *RetainedStreamOffset); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RetainedSizeBytes )( + ISpeechPhraseElement * This, + /* [retval][out] */ long *RetainedSizeBytes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayText )( + ISpeechPhraseElement * This, + /* [retval][out] */ BSTR *DisplayText); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LexicalForm )( + ISpeechPhraseElement * This, + /* [retval][out] */ BSTR *LexicalForm); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Pronunciation )( + ISpeechPhraseElement * This, + /* [retval][out] */ VARIANT *Pronunciation); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayAttributes )( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequiredConfidence )( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechEngineConfidence *RequiredConfidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ActualConfidence )( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EngineConfidence )( + ISpeechPhraseElement * This, + /* [retval][out] */ float *EngineConfidence); + + END_INTERFACE + } ISpeechPhraseElementVtbl; + + interface ISpeechPhraseElement + { + CONST_VTBL struct ISpeechPhraseElementVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseElement_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseElement_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseElement_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseElement_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseElement_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseElement_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseElement_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseElement_get_AudioTimeOffset(This,AudioTimeOffset) \ + (This)->lpVtbl -> get_AudioTimeOffset(This,AudioTimeOffset) + +#define ISpeechPhraseElement_get_AudioSizeTime(This,AudioSizeTime) \ + (This)->lpVtbl -> get_AudioSizeTime(This,AudioSizeTime) + +#define ISpeechPhraseElement_get_AudioStreamOffset(This,AudioStreamOffset) \ + (This)->lpVtbl -> get_AudioStreamOffset(This,AudioStreamOffset) + +#define ISpeechPhraseElement_get_AudioSizeBytes(This,AudioSizeBytes) \ + (This)->lpVtbl -> get_AudioSizeBytes(This,AudioSizeBytes) + +#define ISpeechPhraseElement_get_RetainedStreamOffset(This,RetainedStreamOffset) \ + (This)->lpVtbl -> get_RetainedStreamOffset(This,RetainedStreamOffset) + +#define ISpeechPhraseElement_get_RetainedSizeBytes(This,RetainedSizeBytes) \ + (This)->lpVtbl -> get_RetainedSizeBytes(This,RetainedSizeBytes) + +#define ISpeechPhraseElement_get_DisplayText(This,DisplayText) \ + (This)->lpVtbl -> get_DisplayText(This,DisplayText) + +#define ISpeechPhraseElement_get_LexicalForm(This,LexicalForm) \ + (This)->lpVtbl -> get_LexicalForm(This,LexicalForm) + +#define ISpeechPhraseElement_get_Pronunciation(This,Pronunciation) \ + (This)->lpVtbl -> get_Pronunciation(This,Pronunciation) + +#define ISpeechPhraseElement_get_DisplayAttributes(This,DisplayAttributes) \ + (This)->lpVtbl -> get_DisplayAttributes(This,DisplayAttributes) + +#define ISpeechPhraseElement_get_RequiredConfidence(This,RequiredConfidence) \ + (This)->lpVtbl -> get_RequiredConfidence(This,RequiredConfidence) + +#define ISpeechPhraseElement_get_ActualConfidence(This,ActualConfidence) \ + (This)->lpVtbl -> get_ActualConfidence(This,ActualConfidence) + +#define ISpeechPhraseElement_get_EngineConfidence(This,EngineConfidence) \ + (This)->lpVtbl -> get_EngineConfidence(This,EngineConfidence) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_AudioTimeOffset_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioTimeOffset); + + +void __RPC_STUB ISpeechPhraseElement_get_AudioTimeOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_AudioSizeTime_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioSizeTime); + + +void __RPC_STUB ISpeechPhraseElement_get_AudioSizeTime_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_AudioStreamOffset_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioStreamOffset); + + +void __RPC_STUB ISpeechPhraseElement_get_AudioStreamOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_AudioSizeBytes_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *AudioSizeBytes); + + +void __RPC_STUB ISpeechPhraseElement_get_AudioSizeBytes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_RetainedStreamOffset_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *RetainedStreamOffset); + + +void __RPC_STUB ISpeechPhraseElement_get_RetainedStreamOffset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_RetainedSizeBytes_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ long *RetainedSizeBytes); + + +void __RPC_STUB ISpeechPhraseElement_get_RetainedSizeBytes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_DisplayText_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ BSTR *DisplayText); + + +void __RPC_STUB ISpeechPhraseElement_get_DisplayText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_LexicalForm_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ BSTR *LexicalForm); + + +void __RPC_STUB ISpeechPhraseElement_get_LexicalForm_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_Pronunciation_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ VARIANT *Pronunciation); + + +void __RPC_STUB ISpeechPhraseElement_get_Pronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_DisplayAttributes_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + +void __RPC_STUB ISpeechPhraseElement_get_DisplayAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_RequiredConfidence_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechEngineConfidence *RequiredConfidence); + + +void __RPC_STUB ISpeechPhraseElement_get_RequiredConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_ActualConfidence_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence); + + +void __RPC_STUB ISpeechPhraseElement_get_ActualConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElement_get_EngineConfidence_Proxy( + ISpeechPhraseElement * This, + /* [retval][out] */ float *EngineConfidence); + + +void __RPC_STUB ISpeechPhraseElement_get_EngineConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseElement_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseElements_INTERFACE_DEFINED__ +#define __ISpeechPhraseElements_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseElements */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseElements; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0626B328-3478-467d-A0B3-D0853B93DDA3") + ISpeechPhraseElements : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseElement **Element) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseElementsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseElements * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseElements * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseElements * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseElements * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseElements * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseElements * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseElements * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseElements * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseElements * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseElement **Element); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseElements * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhraseElementsVtbl; + + interface ISpeechPhraseElements + { + CONST_VTBL struct ISpeechPhraseElementsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseElements_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseElements_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseElements_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseElements_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseElements_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseElements_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseElements_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseElements_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseElements_Item(This,Index,Element) \ + (This)->lpVtbl -> Item(This,Index,Element) + +#define ISpeechPhraseElements_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElements_get_Count_Proxy( + ISpeechPhraseElements * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseElements_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElements_Item_Proxy( + ISpeechPhraseElements * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseElement **Element); + + +void __RPC_STUB ISpeechPhraseElements_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseElements_get__NewEnum_Proxy( + ISpeechPhraseElements * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseElements_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseElements_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseReplacement_INTERFACE_DEFINED__ +#define __ISpeechPhraseReplacement_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseReplacement */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseReplacement; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2890A410-53A7-4fb5-94EC-06D4998E3D02") + ISpeechPhraseReplacement : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayAttributes( + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Text( + /* [retval][out] */ BSTR *Text) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FirstElement( + /* [retval][out] */ long *FirstElement) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfElements( + /* [retval][out] */ long *NumberOfElements) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseReplacementVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseReplacement * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseReplacement * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseReplacement * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseReplacement * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseReplacement * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseReplacement * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseReplacement * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayAttributes )( + ISpeechPhraseReplacement * This, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Text )( + ISpeechPhraseReplacement * This, + /* [retval][out] */ BSTR *Text); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FirstElement )( + ISpeechPhraseReplacement * This, + /* [retval][out] */ long *FirstElement); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfElements )( + ISpeechPhraseReplacement * This, + /* [retval][out] */ long *NumberOfElements); + + END_INTERFACE + } ISpeechPhraseReplacementVtbl; + + interface ISpeechPhraseReplacement + { + CONST_VTBL struct ISpeechPhraseReplacementVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseReplacement_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseReplacement_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseReplacement_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseReplacement_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseReplacement_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseReplacement_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseReplacement_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseReplacement_get_DisplayAttributes(This,DisplayAttributes) \ + (This)->lpVtbl -> get_DisplayAttributes(This,DisplayAttributes) + +#define ISpeechPhraseReplacement_get_Text(This,Text) \ + (This)->lpVtbl -> get_Text(This,Text) + +#define ISpeechPhraseReplacement_get_FirstElement(This,FirstElement) \ + (This)->lpVtbl -> get_FirstElement(This,FirstElement) + +#define ISpeechPhraseReplacement_get_NumberOfElements(This,NumberOfElements) \ + (This)->lpVtbl -> get_NumberOfElements(This,NumberOfElements) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacement_get_DisplayAttributes_Proxy( + ISpeechPhraseReplacement * This, + /* [retval][out] */ SpeechDisplayAttributes *DisplayAttributes); + + +void __RPC_STUB ISpeechPhraseReplacement_get_DisplayAttributes_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacement_get_Text_Proxy( + ISpeechPhraseReplacement * This, + /* [retval][out] */ BSTR *Text); + + +void __RPC_STUB ISpeechPhraseReplacement_get_Text_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacement_get_FirstElement_Proxy( + ISpeechPhraseReplacement * This, + /* [retval][out] */ long *FirstElement); + + +void __RPC_STUB ISpeechPhraseReplacement_get_FirstElement_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacement_get_NumberOfElements_Proxy( + ISpeechPhraseReplacement * This, + /* [retval][out] */ long *NumberOfElements); + + +void __RPC_STUB ISpeechPhraseReplacement_get_NumberOfElements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseReplacement_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseReplacements_INTERFACE_DEFINED__ +#define __ISpeechPhraseReplacements_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseReplacements */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseReplacements; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("38BC662F-2257-4525-959E-2069D2596C05") + ISpeechPhraseReplacements : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseReplacement **Reps) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseReplacementsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseReplacements * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseReplacements * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseReplacements * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseReplacements * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseReplacements * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseReplacements * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseReplacements * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseReplacements * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseReplacements * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseReplacement **Reps); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseReplacements * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhraseReplacementsVtbl; + + interface ISpeechPhraseReplacements + { + CONST_VTBL struct ISpeechPhraseReplacementsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseReplacements_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseReplacements_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseReplacements_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseReplacements_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseReplacements_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseReplacements_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseReplacements_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseReplacements_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseReplacements_Item(This,Index,Reps) \ + (This)->lpVtbl -> Item(This,Index,Reps) + +#define ISpeechPhraseReplacements_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacements_get_Count_Proxy( + ISpeechPhraseReplacements * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseReplacements_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacements_Item_Proxy( + ISpeechPhraseReplacements * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseReplacement **Reps); + + +void __RPC_STUB ISpeechPhraseReplacements_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseReplacements_get__NewEnum_Proxy( + ISpeechPhraseReplacements * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseReplacements_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseReplacements_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseProperty_INTERFACE_DEFINED__ +#define __ISpeechPhraseProperty_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseProperty */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseProperty; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CE563D48-961E-4732-A2E1-378A42B430BE") + ISpeechPhraseProperty : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR *Name) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ long *Id) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Value( + /* [retval][out] */ VARIANT *Value) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FirstElement( + /* [retval][out] */ long *FirstElement) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfElements( + /* [retval][out] */ long *NumberOfElements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EngineConfidence( + /* [retval][out] */ float *Confidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Confidence( + /* [retval][out] */ SpeechEngineConfidence *Confidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Parent( + /* [retval][out] */ ISpeechPhraseProperty **ParentProperty) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Children( + /* [retval][out] */ ISpeechPhraseProperties **Children) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhrasePropertyVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseProperty * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseProperty * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseProperty * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseProperty * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseProperty * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseProperty * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseProperty * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( + ISpeechPhraseProperty * This, + /* [retval][out] */ BSTR *Name); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *Id); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Value )( + ISpeechPhraseProperty * This, + /* [retval][out] */ VARIANT *Value); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FirstElement )( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *FirstElement); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfElements )( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *NumberOfElements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EngineConfidence )( + ISpeechPhraseProperty * This, + /* [retval][out] */ float *Confidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Confidence )( + ISpeechPhraseProperty * This, + /* [retval][out] */ SpeechEngineConfidence *Confidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Parent )( + ISpeechPhraseProperty * This, + /* [retval][out] */ ISpeechPhraseProperty **ParentProperty); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Children )( + ISpeechPhraseProperty * This, + /* [retval][out] */ ISpeechPhraseProperties **Children); + + END_INTERFACE + } ISpeechPhrasePropertyVtbl; + + interface ISpeechPhraseProperty + { + CONST_VTBL struct ISpeechPhrasePropertyVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseProperty_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseProperty_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseProperty_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseProperty_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseProperty_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseProperty_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseProperty_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseProperty_get_Name(This,Name) \ + (This)->lpVtbl -> get_Name(This,Name) + +#define ISpeechPhraseProperty_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechPhraseProperty_get_Value(This,Value) \ + (This)->lpVtbl -> get_Value(This,Value) + +#define ISpeechPhraseProperty_get_FirstElement(This,FirstElement) \ + (This)->lpVtbl -> get_FirstElement(This,FirstElement) + +#define ISpeechPhraseProperty_get_NumberOfElements(This,NumberOfElements) \ + (This)->lpVtbl -> get_NumberOfElements(This,NumberOfElements) + +#define ISpeechPhraseProperty_get_EngineConfidence(This,Confidence) \ + (This)->lpVtbl -> get_EngineConfidence(This,Confidence) + +#define ISpeechPhraseProperty_get_Confidence(This,Confidence) \ + (This)->lpVtbl -> get_Confidence(This,Confidence) + +#define ISpeechPhraseProperty_get_Parent(This,ParentProperty) \ + (This)->lpVtbl -> get_Parent(This,ParentProperty) + +#define ISpeechPhraseProperty_get_Children(This,Children) \ + (This)->lpVtbl -> get_Children(This,Children) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Name_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ BSTR *Name); + + +void __RPC_STUB ISpeechPhraseProperty_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Id_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *Id); + + +void __RPC_STUB ISpeechPhraseProperty_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Value_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ VARIANT *Value); + + +void __RPC_STUB ISpeechPhraseProperty_get_Value_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_FirstElement_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *FirstElement); + + +void __RPC_STUB ISpeechPhraseProperty_get_FirstElement_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_NumberOfElements_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ long *NumberOfElements); + + +void __RPC_STUB ISpeechPhraseProperty_get_NumberOfElements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_EngineConfidence_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ float *Confidence); + + +void __RPC_STUB ISpeechPhraseProperty_get_EngineConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Confidence_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ SpeechEngineConfidence *Confidence); + + +void __RPC_STUB ISpeechPhraseProperty_get_Confidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Parent_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ ISpeechPhraseProperty **ParentProperty); + + +void __RPC_STUB ISpeechPhraseProperty_get_Parent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperty_get_Children_Proxy( + ISpeechPhraseProperty * This, + /* [retval][out] */ ISpeechPhraseProperties **Children); + + +void __RPC_STUB ISpeechPhraseProperty_get_Children_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseProperty_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseProperties_INTERFACE_DEFINED__ +#define __ISpeechPhraseProperties_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseProperties */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseProperties; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("08166B47-102E-4b23-A599-BDB98DBFD1F4") + ISpeechPhraseProperties : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseProperty **Property) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhrasePropertiesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseProperties * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseProperties * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseProperties * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseProperties * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseProperties * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseProperties * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseProperties * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseProperties * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseProperties * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseProperty **Property); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseProperties * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhrasePropertiesVtbl; + + interface ISpeechPhraseProperties + { + CONST_VTBL struct ISpeechPhrasePropertiesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseProperties_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseProperties_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseProperties_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseProperties_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseProperties_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseProperties_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseProperties_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseProperties_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseProperties_Item(This,Index,Property) \ + (This)->lpVtbl -> Item(This,Index,Property) + +#define ISpeechPhraseProperties_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperties_get_Count_Proxy( + ISpeechPhraseProperties * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseProperties_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperties_Item_Proxy( + ISpeechPhraseProperties * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseProperty **Property); + + +void __RPC_STUB ISpeechPhraseProperties_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseProperties_get__NewEnum_Proxy( + ISpeechPhraseProperties * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseProperties_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseProperties_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseRule_INTERFACE_DEFINED__ +#define __ISpeechPhraseRule_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseRule */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseRule; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A7BFE112-A4A0-48d9-B602-C313843F6964") + ISpeechPhraseRule : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Name( + /* [retval][out] */ BSTR *Name) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Id( + /* [retval][out] */ long *Id) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_FirstElement( + /* [retval][out] */ long *FirstElement) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_NumberOfElements( + /* [retval][out] */ long *NumberOfElements) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Parent( + /* [retval][out] */ ISpeechPhraseRule **Parent) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Children( + /* [retval][out] */ ISpeechPhraseRules **Children) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Confidence( + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence) = 0; + + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_EngineConfidence( + /* [retval][out] */ float *EngineConfidence) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseRuleVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseRule * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseRule * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseRule * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseRule * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseRule * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseRule * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseRule * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )( + ISpeechPhraseRule * This, + /* [retval][out] */ BSTR *Name); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )( + ISpeechPhraseRule * This, + /* [retval][out] */ long *Id); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_FirstElement )( + ISpeechPhraseRule * This, + /* [retval][out] */ long *FirstElement); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_NumberOfElements )( + ISpeechPhraseRule * This, + /* [retval][out] */ long *NumberOfElements); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Parent )( + ISpeechPhraseRule * This, + /* [retval][out] */ ISpeechPhraseRule **Parent); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Children )( + ISpeechPhraseRule * This, + /* [retval][out] */ ISpeechPhraseRules **Children); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Confidence )( + ISpeechPhraseRule * This, + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EngineConfidence )( + ISpeechPhraseRule * This, + /* [retval][out] */ float *EngineConfidence); + + END_INTERFACE + } ISpeechPhraseRuleVtbl; + + interface ISpeechPhraseRule + { + CONST_VTBL struct ISpeechPhraseRuleVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseRule_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseRule_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseRule_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseRule_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseRule_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseRule_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseRule_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseRule_get_Name(This,Name) \ + (This)->lpVtbl -> get_Name(This,Name) + +#define ISpeechPhraseRule_get_Id(This,Id) \ + (This)->lpVtbl -> get_Id(This,Id) + +#define ISpeechPhraseRule_get_FirstElement(This,FirstElement) \ + (This)->lpVtbl -> get_FirstElement(This,FirstElement) + +#define ISpeechPhraseRule_get_NumberOfElements(This,NumberOfElements) \ + (This)->lpVtbl -> get_NumberOfElements(This,NumberOfElements) + +#define ISpeechPhraseRule_get_Parent(This,Parent) \ + (This)->lpVtbl -> get_Parent(This,Parent) + +#define ISpeechPhraseRule_get_Children(This,Children) \ + (This)->lpVtbl -> get_Children(This,Children) + +#define ISpeechPhraseRule_get_Confidence(This,ActualConfidence) \ + (This)->lpVtbl -> get_Confidence(This,ActualConfidence) + +#define ISpeechPhraseRule_get_EngineConfidence(This,EngineConfidence) \ + (This)->lpVtbl -> get_EngineConfidence(This,EngineConfidence) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Name_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ BSTR *Name); + + +void __RPC_STUB ISpeechPhraseRule_get_Name_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Id_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ long *Id); + + +void __RPC_STUB ISpeechPhraseRule_get_Id_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_FirstElement_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ long *FirstElement); + + +void __RPC_STUB ISpeechPhraseRule_get_FirstElement_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_NumberOfElements_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ long *NumberOfElements); + + +void __RPC_STUB ISpeechPhraseRule_get_NumberOfElements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Parent_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ ISpeechPhraseRule **Parent); + + +void __RPC_STUB ISpeechPhraseRule_get_Parent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Children_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ ISpeechPhraseRules **Children); + + +void __RPC_STUB ISpeechPhraseRule_get_Children_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_Confidence_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ SpeechEngineConfidence *ActualConfidence); + + +void __RPC_STUB ISpeechPhraseRule_get_Confidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRule_get_EngineConfidence_Proxy( + ISpeechPhraseRule * This, + /* [retval][out] */ float *EngineConfidence); + + +void __RPC_STUB ISpeechPhraseRule_get_EngineConfidence_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseRule_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhraseRules_INTERFACE_DEFINED__ +#define __ISpeechPhraseRules_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseRules */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseRules; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9047D593-01DD-4b72-81A3-E4A0CA69F407") + ISpeechPhraseRules : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseRule **Rule) = 0; + + virtual /* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseRulesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseRules * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseRules * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseRules * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseRules * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseRules * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseRules * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseRules * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechPhraseRules * This, + /* [retval][out] */ long *Count); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechPhraseRules * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseRule **Rule); + + /* [id][restricted][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechPhraseRules * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechPhraseRulesVtbl; + + interface ISpeechPhraseRules + { + CONST_VTBL struct ISpeechPhraseRulesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseRules_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseRules_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseRules_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseRules_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseRules_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseRules_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseRules_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseRules_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechPhraseRules_Item(This,Index,Rule) \ + (This)->lpVtbl -> Item(This,Index,Rule) + +#define ISpeechPhraseRules_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRules_get_Count_Proxy( + ISpeechPhraseRules * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechPhraseRules_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRules_Item_Proxy( + ISpeechPhraseRules * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechPhraseRule **Rule); + + +void __RPC_STUB ISpeechPhraseRules_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][restricted][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseRules_get__NewEnum_Proxy( + ISpeechPhraseRules * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechPhraseRules_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseRules_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexicon_INTERFACE_DEFINED__ +#define __ISpeechLexicon_INTERFACE_DEFINED__ + +/* interface ISpeechLexicon */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexicon; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3DA7627A-C7AE-4b23-8708-638C50362C25") + ISpeechLexicon : public IDispatch + { + public: + virtual /* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_GenerationId( + /* [retval][out] */ long *GenerationId) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetWords( + /* [defaultvalue][in] */ SpeechLexiconType Flags, + /* [defaultvalue][out] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **Words) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE AddPronunciation( + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech = SPSUnknown, + /* [defaultvalue][in] */ BSTR bstrPronunciation = L"") = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE AddPronunciationByPhoneIds( + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech = SPSUnknown, + /* [defaultvalue][in] */ VARIANT *PhoneIds = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE RemovePronunciation( + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech = SPSUnknown, + /* [defaultvalue][in] */ BSTR bstrPronunciation = L"") = 0; + + virtual /* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE RemovePronunciationByPhoneIds( + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech = SPSUnknown, + /* [defaultvalue][in] */ VARIANT *PhoneIds = 0) = 0; + + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE GetPronunciations( + /* [in] */ BSTR bstrWord, + /* [defaultvalue][in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechLexiconType TypeFlags, + /* [retval][out] */ ISpeechLexiconPronunciations **ppPronunciations) = 0; + + virtual /* [hidden][id][helpstring] */ HRESULT STDMETHODCALLTYPE GetGenerationChange( + /* [out][in] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **ppWords) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexicon * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexicon * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexicon * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexicon * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexicon * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexicon * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexicon * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [hidden][id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_GenerationId )( + ISpeechLexicon * This, + /* [retval][out] */ long *GenerationId); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetWords )( + ISpeechLexicon * This, + /* [defaultvalue][in] */ SpeechLexiconType Flags, + /* [defaultvalue][out] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **Words); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddPronunciation )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ BSTR bstrPronunciation); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *AddPronunciationByPhoneIds )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ VARIANT *PhoneIds); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemovePronunciation )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ BSTR bstrPronunciation); + + /* [id][hidden][helpstring] */ HRESULT ( STDMETHODCALLTYPE *RemovePronunciationByPhoneIds )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ VARIANT *PhoneIds); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetPronunciations )( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [defaultvalue][in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechLexiconType TypeFlags, + /* [retval][out] */ ISpeechLexiconPronunciations **ppPronunciations); + + /* [hidden][id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetGenerationChange )( + ISpeechLexicon * This, + /* [out][in] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **ppWords); + + END_INTERFACE + } ISpeechLexiconVtbl; + + interface ISpeechLexicon + { + CONST_VTBL struct ISpeechLexiconVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexicon_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexicon_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexicon_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexicon_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexicon_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexicon_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexicon_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexicon_get_GenerationId(This,GenerationId) \ + (This)->lpVtbl -> get_GenerationId(This,GenerationId) + +#define ISpeechLexicon_GetWords(This,Flags,GenerationID,Words) \ + (This)->lpVtbl -> GetWords(This,Flags,GenerationID,Words) + +#define ISpeechLexicon_AddPronunciation(This,bstrWord,LangId,PartOfSpeech,bstrPronunciation) \ + (This)->lpVtbl -> AddPronunciation(This,bstrWord,LangId,PartOfSpeech,bstrPronunciation) + +#define ISpeechLexicon_AddPronunciationByPhoneIds(This,bstrWord,LangId,PartOfSpeech,PhoneIds) \ + (This)->lpVtbl -> AddPronunciationByPhoneIds(This,bstrWord,LangId,PartOfSpeech,PhoneIds) + +#define ISpeechLexicon_RemovePronunciation(This,bstrWord,LangId,PartOfSpeech,bstrPronunciation) \ + (This)->lpVtbl -> RemovePronunciation(This,bstrWord,LangId,PartOfSpeech,bstrPronunciation) + +#define ISpeechLexicon_RemovePronunciationByPhoneIds(This,bstrWord,LangId,PartOfSpeech,PhoneIds) \ + (This)->lpVtbl -> RemovePronunciationByPhoneIds(This,bstrWord,LangId,PartOfSpeech,PhoneIds) + +#define ISpeechLexicon_GetPronunciations(This,bstrWord,LangId,TypeFlags,ppPronunciations) \ + (This)->lpVtbl -> GetPronunciations(This,bstrWord,LangId,TypeFlags,ppPronunciations) + +#define ISpeechLexicon_GetGenerationChange(This,GenerationID,ppWords) \ + (This)->lpVtbl -> GetGenerationChange(This,GenerationID,ppWords) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [hidden][id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_get_GenerationId_Proxy( + ISpeechLexicon * This, + /* [retval][out] */ long *GenerationId); + + +void __RPC_STUB ISpeechLexicon_get_GenerationId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_GetWords_Proxy( + ISpeechLexicon * This, + /* [defaultvalue][in] */ SpeechLexiconType Flags, + /* [defaultvalue][out] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **Words); + + +void __RPC_STUB ISpeechLexicon_GetWords_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_AddPronunciation_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ BSTR bstrPronunciation); + + +void __RPC_STUB ISpeechLexicon_AddPronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_AddPronunciationByPhoneIds_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ VARIANT *PhoneIds); + + +void __RPC_STUB ISpeechLexicon_AddPronunciationByPhoneIds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_RemovePronunciation_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ BSTR bstrPronunciation); + + +void __RPC_STUB ISpeechLexicon_RemovePronunciation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][hidden][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_RemovePronunciationByPhoneIds_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechPartOfSpeech PartOfSpeech, + /* [defaultvalue][in] */ VARIANT *PhoneIds); + + +void __RPC_STUB ISpeechLexicon_RemovePronunciationByPhoneIds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_GetPronunciations_Proxy( + ISpeechLexicon * This, + /* [in] */ BSTR bstrWord, + /* [defaultvalue][in] */ SpeechLanguageId LangId, + /* [defaultvalue][in] */ SpeechLexiconType TypeFlags, + /* [retval][out] */ ISpeechLexiconPronunciations **ppPronunciations); + + +void __RPC_STUB ISpeechLexicon_GetPronunciations_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [hidden][id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechLexicon_GetGenerationChange_Proxy( + ISpeechLexicon * This, + /* [out][in] */ long *GenerationID, + /* [retval][out] */ ISpeechLexiconWords **ppWords); + + +void __RPC_STUB ISpeechLexicon_GetGenerationChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexicon_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexiconWords_INTERFACE_DEFINED__ +#define __ISpeechLexiconWords_INTERFACE_DEFINED__ + +/* interface ISpeechLexiconWords */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexiconWords; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8D199862-415E-47d5-AC4F-FAA608B424E6") + ISpeechLexiconWords : public IDispatch + { + public: + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconWord **Word) = 0; + + virtual /* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconWordsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexiconWords * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexiconWords * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexiconWords * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexiconWords * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexiconWords * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexiconWords * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexiconWords * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechLexiconWords * This, + /* [retval][out] */ long *Count); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechLexiconWords * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconWord **Word); + + /* [restricted][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechLexiconWords * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechLexiconWordsVtbl; + + interface ISpeechLexiconWords + { + CONST_VTBL struct ISpeechLexiconWordsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexiconWords_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexiconWords_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexiconWords_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexiconWords_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexiconWords_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexiconWords_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexiconWords_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexiconWords_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechLexiconWords_Item(This,Index,Word) \ + (This)->lpVtbl -> Item(This,Index,Word) + +#define ISpeechLexiconWords_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWords_get_Count_Proxy( + ISpeechLexiconWords * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechLexiconWords_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWords_Item_Proxy( + ISpeechLexiconWords * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconWord **Word); + + +void __RPC_STUB ISpeechLexiconWords_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWords_get__NewEnum_Proxy( + ISpeechLexiconWords * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechLexiconWords_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexiconWords_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexiconWord_INTERFACE_DEFINED__ +#define __ISpeechLexiconWord_INTERFACE_DEFINED__ + +/* interface ISpeechLexiconWord */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexiconWord; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4E5B933C-C9BE-48ed-8842-1EE51BB1D4FF") + ISpeechLexiconWord : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_LangId( + /* [retval][out] */ SpeechLanguageId *LangId) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ SpeechWordType *WordType) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Word( + /* [retval][out] */ BSTR *Word) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE get_Pronunciations( + /* [retval][out] */ ISpeechLexiconPronunciations **Pronunciations) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconWordVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexiconWord * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexiconWord * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexiconWord * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexiconWord * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexiconWord * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexiconWord * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexiconWord * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_LangId )( + ISpeechLexiconWord * This, + /* [retval][out] */ SpeechLanguageId *LangId); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Type )( + ISpeechLexiconWord * This, + /* [retval][out] */ SpeechWordType *WordType); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Word )( + ISpeechLexiconWord * This, + /* [retval][out] */ BSTR *Word); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Pronunciations )( + ISpeechLexiconWord * This, + /* [retval][out] */ ISpeechLexiconPronunciations **Pronunciations); + + END_INTERFACE + } ISpeechLexiconWordVtbl; + + interface ISpeechLexiconWord + { + CONST_VTBL struct ISpeechLexiconWordVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexiconWord_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexiconWord_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexiconWord_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexiconWord_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexiconWord_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexiconWord_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexiconWord_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexiconWord_get_LangId(This,LangId) \ + (This)->lpVtbl -> get_LangId(This,LangId) + +#define ISpeechLexiconWord_get_Type(This,WordType) \ + (This)->lpVtbl -> get_Type(This,WordType) + +#define ISpeechLexiconWord_get_Word(This,Word) \ + (This)->lpVtbl -> get_Word(This,Word) + +#define ISpeechLexiconWord_get_Pronunciations(This,Pronunciations) \ + (This)->lpVtbl -> get_Pronunciations(This,Pronunciations) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWord_get_LangId_Proxy( + ISpeechLexiconWord * This, + /* [retval][out] */ SpeechLanguageId *LangId); + + +void __RPC_STUB ISpeechLexiconWord_get_LangId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWord_get_Type_Proxy( + ISpeechLexiconWord * This, + /* [retval][out] */ SpeechWordType *WordType); + + +void __RPC_STUB ISpeechLexiconWord_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWord_get_Word_Proxy( + ISpeechLexiconWord * This, + /* [retval][out] */ BSTR *Word); + + +void __RPC_STUB ISpeechLexiconWord_get_Word_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconWord_get_Pronunciations_Proxy( + ISpeechLexiconWord * This, + /* [retval][out] */ ISpeechLexiconPronunciations **Pronunciations); + + +void __RPC_STUB ISpeechLexiconWord_get_Pronunciations_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexiconWord_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexiconPronunciations_INTERFACE_DEFINED__ +#define __ISpeechLexiconPronunciations_INTERFACE_DEFINED__ + +/* interface ISpeechLexiconPronunciations */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexiconPronunciations; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("72829128-5682-4704-A0D4-3E2BB6F2EAD3") + ISpeechLexiconPronunciations : public IDispatch + { + public: + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Count( + /* [retval][out] */ long *Count) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconPronunciation **Pronunciation) = 0; + + virtual /* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get__NewEnum( + /* [retval][out] */ IUnknown **EnumVARIANT) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconPronunciationsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexiconPronunciations * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexiconPronunciations * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexiconPronunciations * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexiconPronunciations * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexiconPronunciations * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexiconPronunciations * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexiconPronunciations * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Count )( + ISpeechLexiconPronunciations * This, + /* [retval][out] */ long *Count); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Item )( + ISpeechLexiconPronunciations * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconPronunciation **Pronunciation); + + /* [restricted][helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )( + ISpeechLexiconPronunciations * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + END_INTERFACE + } ISpeechLexiconPronunciationsVtbl; + + interface ISpeechLexiconPronunciations + { + CONST_VTBL struct ISpeechLexiconPronunciationsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexiconPronunciations_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexiconPronunciations_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexiconPronunciations_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexiconPronunciations_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexiconPronunciations_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexiconPronunciations_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexiconPronunciations_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexiconPronunciations_get_Count(This,Count) \ + (This)->lpVtbl -> get_Count(This,Count) + +#define ISpeechLexiconPronunciations_Item(This,Index,Pronunciation) \ + (This)->lpVtbl -> Item(This,Index,Pronunciation) + +#define ISpeechLexiconPronunciations_get__NewEnum(This,EnumVARIANT) \ + (This)->lpVtbl -> get__NewEnum(This,EnumVARIANT) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciations_get_Count_Proxy( + ISpeechLexiconPronunciations * This, + /* [retval][out] */ long *Count); + + +void __RPC_STUB ISpeechLexiconPronunciations_get_Count_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciations_Item_Proxy( + ISpeechLexiconPronunciations * This, + /* [in] */ long Index, + /* [retval][out] */ ISpeechLexiconPronunciation **Pronunciation); + + +void __RPC_STUB ISpeechLexiconPronunciations_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [restricted][helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciations_get__NewEnum_Proxy( + ISpeechLexiconPronunciations * This, + /* [retval][out] */ IUnknown **EnumVARIANT); + + +void __RPC_STUB ISpeechLexiconPronunciations_get__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexiconPronunciations_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechLexiconPronunciation_INTERFACE_DEFINED__ +#define __ISpeechLexiconPronunciation_INTERFACE_DEFINED__ + +/* interface ISpeechLexiconPronunciation */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechLexiconPronunciation; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("95252C5D-9E43-4f4a-9899-48EE73352F9F") + ISpeechLexiconPronunciation : public IDispatch + { + public: + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Type( + /* [retval][out] */ SpeechLexiconType *LexiconType) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_LangId( + /* [retval][out] */ SpeechLanguageId *LangId) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_PartOfSpeech( + /* [retval][out] */ SpeechPartOfSpeech *PartOfSpeech) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_PhoneIds( + /* [retval][out] */ VARIANT *PhoneIds) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_Symbolic( + /* [retval][out] */ BSTR *Symbolic) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechLexiconPronunciationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechLexiconPronunciation * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechLexiconPronunciation * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechLexiconPronunciation * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechLexiconPronunciation * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechLexiconPronunciation * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechLexiconPronunciation * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechLexiconPronunciation * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Type )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechLexiconType *LexiconType); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_LangId )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechLanguageId *LangId); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_PartOfSpeech )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechPartOfSpeech *PartOfSpeech); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_PhoneIds )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ VARIANT *PhoneIds); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Symbolic )( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ BSTR *Symbolic); + + END_INTERFACE + } ISpeechLexiconPronunciationVtbl; + + interface ISpeechLexiconPronunciation + { + CONST_VTBL struct ISpeechLexiconPronunciationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechLexiconPronunciation_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechLexiconPronunciation_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechLexiconPronunciation_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechLexiconPronunciation_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechLexiconPronunciation_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechLexiconPronunciation_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechLexiconPronunciation_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechLexiconPronunciation_get_Type(This,LexiconType) \ + (This)->lpVtbl -> get_Type(This,LexiconType) + +#define ISpeechLexiconPronunciation_get_LangId(This,LangId) \ + (This)->lpVtbl -> get_LangId(This,LangId) + +#define ISpeechLexiconPronunciation_get_PartOfSpeech(This,PartOfSpeech) \ + (This)->lpVtbl -> get_PartOfSpeech(This,PartOfSpeech) + +#define ISpeechLexiconPronunciation_get_PhoneIds(This,PhoneIds) \ + (This)->lpVtbl -> get_PhoneIds(This,PhoneIds) + +#define ISpeechLexiconPronunciation_get_Symbolic(This,Symbolic) \ + (This)->lpVtbl -> get_Symbolic(This,Symbolic) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_Type_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechLexiconType *LexiconType); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_Type_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_LangId_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechLanguageId *LangId); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_LangId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_PartOfSpeech_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ SpeechPartOfSpeech *PartOfSpeech); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_PartOfSpeech_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_PhoneIds_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ VARIANT *PhoneIds); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_PhoneIds_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ISpeechLexiconPronunciation_get_Symbolic_Proxy( + ISpeechLexiconPronunciation * This, + /* [retval][out] */ BSTR *Symbolic); + + +void __RPC_STUB ISpeechLexiconPronunciation_get_Symbolic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechLexiconPronunciation_INTERFACE_DEFINED__ */ + + + +#ifndef __SpeechStringConstants_MODULE_DEFINED__ +#define __SpeechStringConstants_MODULE_DEFINED__ + + +/* module SpeechStringConstants */ +/* [uuid] */ + +const BSTR SpeechRegistryUserRoot = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech"; + +const BSTR SpeechRegistryLocalMachineRoot = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech"; + +const BSTR SpeechCategoryAudioOut = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioOutput"; + +const BSTR SpeechCategoryAudioIn = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AudioInput"; + +const BSTR SpeechCategoryVoices = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices"; + +const BSTR SpeechCategoryRecognizers = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Recognizers"; + +const BSTR SpeechCategoryAppLexicons = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\AppLexicons"; + +const BSTR SpeechCategoryPhoneConverters = L"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\PhoneConverters"; + +const BSTR SpeechCategoryRecoProfiles = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\RecoProfiles"; + +const BSTR SpeechTokenIdUserLexicon = L"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\CurrentUserLexicon"; + +const BSTR SpeechTokenValueCLSID = L"CLSID"; + +const BSTR SpeechTokenKeyFiles = L"Files"; + +const BSTR SpeechTokenKeyUI = L"UI"; + +const BSTR SpeechTokenKeyAttributes = L"Attributes"; + +const BSTR SpeechVoiceCategoryTTSRate = L"DefaultTTSRate"; + +const BSTR SpeechPropertyResourceUsage = L"ResourceUsage"; + +const BSTR SpeechPropertyHighConfidenceThreshold = L"HighConfidenceThreshold"; + +const BSTR SpeechPropertyNormalConfidenceThreshold = L"NormalConfidenceThreshold"; + +const BSTR SpeechPropertyLowConfidenceThreshold = L"LowConfidenceThreshold"; + +const BSTR SpeechPropertyResponseSpeed = L"ResponseSpeed"; + +const BSTR SpeechPropertyComplexResponseSpeed = L"ComplexResponseSpeed"; + +const BSTR SpeechPropertyAdaptationOn = L"AdaptationOn"; + +const BSTR SpeechDictationTopicSpelling = L"Spelling"; + +const BSTR SpeechGrammarTagWildcard = L"..."; + +const BSTR SpeechGrammarTagDictation = L"*"; + +const BSTR SpeechGrammarTagUnlimitedDictation = L"*+"; + +const BSTR SpeechEngineProperties = L"EngineProperties"; + +const BSTR SpeechAddRemoveWord = L"AddRemoveWord"; + +const BSTR SpeechUserTraining = L"UserTraining"; + +const BSTR SpeechMicTraining = L"MicTraining"; + +const BSTR SpeechRecoProfileProperties = L"RecoProfileProperties"; + +const BSTR SpeechAudioProperties = L"AudioProperties"; + +const BSTR SpeechAudioVolume = L"AudioVolume"; + +const BSTR SpeechVoiceSkipTypeSentence = L"Sentence"; + +const BSTR SpeechAudioFormatGUIDWave = L"{C31ADBAE-527F-4ff5-A230-F62BB61FF70C}"; + +const BSTR SpeechAudioFormatGUIDText = L"{7CEEF9F9-3D13-11d2-9EE7-00C04F797396}"; + +#endif /* __SpeechStringConstants_MODULE_DEFINED__ */ + + +#ifndef __SpeechConstants_MODULE_DEFINED__ +#define __SpeechConstants_MODULE_DEFINED__ + + +/* module SpeechConstants */ +/* [uuid] */ + +const float Speech_Default_Weight = DEFAULT_WEIGHT; + +const LONG Speech_Max_Word_Length = SP_MAX_WORD_LENGTH; + +const LONG Speech_Max_Pron_Length = SP_MAX_PRON_LENGTH; + +const LONG Speech_StreamPos_Asap = SP_STREAMPOS_ASAP; + +const LONG Speech_StreamPos_RealTime = SP_STREAMPOS_REALTIME; + +const LONG SpeechAllElements = SPPR_ALL_ELEMENTS; + +#endif /* __SpeechConstants_MODULE_DEFINED__ */ + +#ifndef __ISpeechPhraseInfoBuilder_INTERFACE_DEFINED__ +#define __ISpeechPhraseInfoBuilder_INTERFACE_DEFINED__ + +/* interface ISpeechPhraseInfoBuilder */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhraseInfoBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3B151836-DF3A-4E0A-846C-D2ADC9334333") + ISpeechPhraseInfoBuilder : public IDispatch + { + public: + virtual /* [id][helpstring] */ HRESULT STDMETHODCALLTYPE RestorePhraseFromMemory( + /* [in] */ VARIANT *PhraseInMemory, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhraseInfoBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhraseInfoBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhraseInfoBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhraseInfoBuilder * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring] */ HRESULT ( STDMETHODCALLTYPE *RestorePhraseFromMemory )( + ISpeechPhraseInfoBuilder * This, + /* [in] */ VARIANT *PhraseInMemory, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + END_INTERFACE + } ISpeechPhraseInfoBuilderVtbl; + + interface ISpeechPhraseInfoBuilder + { + CONST_VTBL struct ISpeechPhraseInfoBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhraseInfoBuilder_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhraseInfoBuilder_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhraseInfoBuilder_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhraseInfoBuilder_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhraseInfoBuilder_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhraseInfoBuilder_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhraseInfoBuilder_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhraseInfoBuilder_RestorePhraseFromMemory(This,PhraseInMemory,PhraseInfo) \ + (This)->lpVtbl -> RestorePhraseFromMemory(This,PhraseInMemory,PhraseInfo) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring] */ HRESULT STDMETHODCALLTYPE ISpeechPhraseInfoBuilder_RestorePhraseFromMemory_Proxy( + ISpeechPhraseInfoBuilder * This, + /* [in] */ VARIANT *PhraseInMemory, + /* [retval][out] */ ISpeechPhraseInfo **PhraseInfo); + + +void __RPC_STUB ISpeechPhraseInfoBuilder_RestorePhraseFromMemory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhraseInfoBuilder_INTERFACE_DEFINED__ */ + + +#ifndef __ISpeechPhoneConverter_INTERFACE_DEFINED__ +#define __ISpeechPhoneConverter_INTERFACE_DEFINED__ + +/* interface ISpeechPhoneConverter */ +/* [unique][helpstring][dual][uuid][object] */ + + +EXTERN_C const IID IID_ISpeechPhoneConverter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C3E4F353-433F-43d6-89A1-6A62A7054C3D") + ISpeechPhoneConverter : public IDispatch + { + public: + virtual /* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE get_LanguageId( + /* [retval][out] */ SpeechLanguageId *LanguageId) = 0; + + virtual /* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_LanguageId( + /* [in] */ SpeechLanguageId LanguageId) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE PhoneToId( + /* [in] */ const BSTR Phonemes, + /* [retval][out] */ VARIANT *IdArray) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IdToPhone( + /* [in] */ const VARIANT IdArray, + /* [retval][out] */ BSTR *Phonemes) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpeechPhoneConverterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpeechPhoneConverter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpeechPhoneConverter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpeechPhoneConverter * This); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( + ISpeechPhoneConverter * This, + /* [out] */ UINT *pctinfo); + + HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( + ISpeechPhoneConverter * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo **ppTInfo); + + HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( + ISpeechPhoneConverter * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( + ISpeechPhoneConverter * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS *pDispParams, + /* [out] */ VARIANT *pVarResult, + /* [out] */ EXCEPINFO *pExcepInfo, + /* [out] */ UINT *puArgErr); + + /* [id][helpstring][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LanguageId )( + ISpeechPhoneConverter * This, + /* [retval][out] */ SpeechLanguageId *LanguageId); + + /* [id][helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_LanguageId )( + ISpeechPhoneConverter * This, + /* [in] */ SpeechLanguageId LanguageId); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *PhoneToId )( + ISpeechPhoneConverter * This, + /* [in] */ const BSTR Phonemes, + /* [retval][out] */ VARIANT *IdArray); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *IdToPhone )( + ISpeechPhoneConverter * This, + /* [in] */ const VARIANT IdArray, + /* [retval][out] */ BSTR *Phonemes); + + END_INTERFACE + } ISpeechPhoneConverterVtbl; + + interface ISpeechPhoneConverter + { + CONST_VTBL struct ISpeechPhoneConverterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpeechPhoneConverter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpeechPhoneConverter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpeechPhoneConverter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpeechPhoneConverter_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ISpeechPhoneConverter_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ISpeechPhoneConverter_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ISpeechPhoneConverter_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ISpeechPhoneConverter_get_LanguageId(This,LanguageId) \ + (This)->lpVtbl -> get_LanguageId(This,LanguageId) + +#define ISpeechPhoneConverter_put_LanguageId(This,LanguageId) \ + (This)->lpVtbl -> put_LanguageId(This,LanguageId) + +#define ISpeechPhoneConverter_PhoneToId(This,Phonemes,IdArray) \ + (This)->lpVtbl -> PhoneToId(This,Phonemes,IdArray) + +#define ISpeechPhoneConverter_IdToPhone(This,IdArray,Phonemes) \ + (This)->lpVtbl -> IdToPhone(This,IdArray,Phonemes) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [id][helpstring][propget] */ HRESULT STDMETHODCALLTYPE ISpeechPhoneConverter_get_LanguageId_Proxy( + ISpeechPhoneConverter * This, + /* [retval][out] */ SpeechLanguageId *LanguageId); + + +void __RPC_STUB ISpeechPhoneConverter_get_LanguageId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id][helpstring][propput] */ HRESULT STDMETHODCALLTYPE ISpeechPhoneConverter_put_LanguageId_Proxy( + ISpeechPhoneConverter * This, + /* [in] */ SpeechLanguageId LanguageId); + + +void __RPC_STUB ISpeechPhoneConverter_put_LanguageId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechPhoneConverter_PhoneToId_Proxy( + ISpeechPhoneConverter * This, + /* [in] */ const BSTR Phonemes, + /* [retval][out] */ VARIANT *IdArray); + + +void __RPC_STUB ISpeechPhoneConverter_PhoneToId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ISpeechPhoneConverter_IdToPhone_Proxy( + ISpeechPhoneConverter * This, + /* [in] */ const VARIANT IdArray, + /* [retval][out] */ BSTR *Phonemes); + + +void __RPC_STUB ISpeechPhoneConverter_IdToPhone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpeechPhoneConverter_INTERFACE_DEFINED__ */ + + +EXTERN_C const CLSID CLSID_SpNotifyTranslator; + +#ifdef __cplusplus + +class DECLSPEC_UUID("E2AE5372-5D40-11D2-960E-00C04F8EE628") +SpNotifyTranslator; +#endif + +EXTERN_C const CLSID CLSID_SpObjectTokenCategory; + +#ifdef __cplusplus + +class DECLSPEC_UUID("A910187F-0C7A-45AC-92CC-59EDAFB77B53") +SpObjectTokenCategory; +#endif + +EXTERN_C const CLSID CLSID_SpObjectToken; + +#ifdef __cplusplus + +class DECLSPEC_UUID("EF411752-3736-4CB4-9C8C-8EF4CCB58EFE") +SpObjectToken; +#endif + +EXTERN_C const CLSID CLSID_SpResourceManager; + +#ifdef __cplusplus + +class DECLSPEC_UUID("96749373-3391-11D2-9EE3-00C04F797396") +SpResourceManager; +#endif + +EXTERN_C const CLSID CLSID_SpStreamFormatConverter; + +#ifdef __cplusplus + +class DECLSPEC_UUID("7013943A-E2EC-11D2-A086-00C04F8EF9B5") +SpStreamFormatConverter; +#endif + +EXTERN_C const CLSID CLSID_SpMMAudioEnum; + +#ifdef __cplusplus + +class DECLSPEC_UUID("AB1890A0-E91F-11D2-BB91-00C04F8EE6C0") +SpMMAudioEnum; +#endif + +EXTERN_C const CLSID CLSID_SpMMAudioIn; + +#ifdef __cplusplus + +class DECLSPEC_UUID("CF3D2E50-53F2-11D2-960C-00C04F8EE628") +SpMMAudioIn; +#endif + +EXTERN_C const CLSID CLSID_SpMMAudioOut; + +#ifdef __cplusplus + +class DECLSPEC_UUID("A8C680EB-3D32-11D2-9EE7-00C04F797396") +SpMMAudioOut; +#endif + +EXTERN_C const CLSID CLSID_SpRecPlayAudio; + +#ifdef __cplusplus + +class DECLSPEC_UUID("FEE225FC-7AFD-45E9-95D0-5A318079D911") +SpRecPlayAudio; +#endif + +EXTERN_C const CLSID CLSID_SpStream; + +#ifdef __cplusplus + +class DECLSPEC_UUID("715D9C59-4442-11D2-9605-00C04F8EE628") +SpStream; +#endif + +EXTERN_C const CLSID CLSID_SpVoice; + +#ifdef __cplusplus + +class DECLSPEC_UUID("96749377-3391-11D2-9EE3-00C04F797396") +SpVoice; +#endif + +EXTERN_C const CLSID CLSID_SpSharedRecoContext; + +#ifdef __cplusplus + +class DECLSPEC_UUID("47206204-5ECA-11D2-960F-00C04F8EE628") +SpSharedRecoContext; +#endif + +EXTERN_C const CLSID CLSID_SpInprocRecognizer; + +#ifdef __cplusplus + +class DECLSPEC_UUID("41B89B6B-9399-11D2-9623-00C04F8EE628") +SpInprocRecognizer; +#endif + +EXTERN_C const CLSID CLSID_SpSharedRecognizer; + +#ifdef __cplusplus + +class DECLSPEC_UUID("3BEE4890-4FE9-4A37-8C1E-5E7E12791C1F") +SpSharedRecognizer; +#endif + +EXTERN_C const CLSID CLSID_SpLexicon; + +#ifdef __cplusplus + +class DECLSPEC_UUID("0655E396-25D0-11D3-9C26-00C04F8EF87C") +SpLexicon; +#endif + +EXTERN_C const CLSID CLSID_SpUnCompressedLexicon; + +#ifdef __cplusplus + +class DECLSPEC_UUID("C9E37C15-DF92-4727-85D6-72E5EEB6995A") +SpUnCompressedLexicon; +#endif + +EXTERN_C const CLSID CLSID_SpCompressedLexicon; + +#ifdef __cplusplus + +class DECLSPEC_UUID("90903716-2F42-11D3-9C26-00C04F8EF87C") +SpCompressedLexicon; +#endif + +EXTERN_C const CLSID CLSID_SpPhoneConverter; + +#ifdef __cplusplus + +class DECLSPEC_UUID("9185F743-1143-4C28-86B5-BFF14F20E5C8") +SpPhoneConverter; +#endif + +EXTERN_C const CLSID CLSID_SpNullPhoneConverter; + +#ifdef __cplusplus + +class DECLSPEC_UUID("455F24E9-7396-4A16-9715-7C0FDBE3EFE3") +SpNullPhoneConverter; +#endif + +EXTERN_C const CLSID CLSID_SpTextSelectionInformation; + +#ifdef __cplusplus + +class DECLSPEC_UUID("0F92030A-CBFD-4AB8-A164-FF5985547FF6") +SpTextSelectionInformation; +#endif + +EXTERN_C const CLSID CLSID_SpPhraseInfoBuilder; + +#ifdef __cplusplus + +class DECLSPEC_UUID("C23FC28D-C55F-4720-8B32-91F73C2BD5D1") +SpPhraseInfoBuilder; +#endif + +EXTERN_C const CLSID CLSID_SpAudioFormat; + +#ifdef __cplusplus + +class DECLSPEC_UUID("9EF96870-E160-4792-820D-48CF0649E4EC") +SpAudioFormat; +#endif + +EXTERN_C const CLSID CLSID_SpWaveFormatEx; + +#ifdef __cplusplus + +class DECLSPEC_UUID("C79A574C-63BE-44b9-801F-283F87F898BE") +SpWaveFormatEx; +#endif + +EXTERN_C const CLSID CLSID_SpInProcRecoContext; + +#ifdef __cplusplus + +class DECLSPEC_UUID("73AD6842-ACE0-45E8-A4DD-8795881A2C2A") +SpInProcRecoContext; +#endif + +EXTERN_C const CLSID CLSID_SpCustomStream; + +#ifdef __cplusplus + +class DECLSPEC_UUID("8DBEF13F-1948-4aa8-8CF0-048EEBED95D8") +SpCustomStream; +#endif + +EXTERN_C const CLSID CLSID_SpFileStream; + +#ifdef __cplusplus + +class DECLSPEC_UUID("947812B3-2AE1-4644-BA86-9E90DED7EC91") +SpFileStream; +#endif + +EXTERN_C const CLSID CLSID_SpMemoryStream; + +#ifdef __cplusplus + +class DECLSPEC_UUID("5FB7EF7D-DFF4-468a-B6B7-2FCBD188F994") +SpMemoryStream; +#endif +#endif /* __SpeechLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/sp/src/utils/sapi51/Include/sapiddk.h b/sp/src/utils/sapi51/Include/sapiddk.h new file mode 100644 index 00000000..c311aad3 --- /dev/null +++ b/sp/src/utils/sapi51/Include/sapiddk.h @@ -0,0 +1,4557 @@ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 6.00.0347 */ +/* Compiler settings for sapiddk.idl: + Oicf, W1, Zp8, env=Win32 (32b run) + protocol : dce , ms_ext, c_ext + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +//@@MIDL_FILE_HEADING( ) + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 440 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __sapiddk_h__ +#define __sapiddk_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __ISpTokenUI_FWD_DEFINED__ +#define __ISpTokenUI_FWD_DEFINED__ +typedef interface ISpTokenUI ISpTokenUI; +#endif /* __ISpTokenUI_FWD_DEFINED__ */ + + +#ifndef __ISpObjectTokenEnumBuilder_FWD_DEFINED__ +#define __ISpObjectTokenEnumBuilder_FWD_DEFINED__ +typedef interface ISpObjectTokenEnumBuilder ISpObjectTokenEnumBuilder; +#endif /* __ISpObjectTokenEnumBuilder_FWD_DEFINED__ */ + + +#ifndef __ISpErrorLog_FWD_DEFINED__ +#define __ISpErrorLog_FWD_DEFINED__ +typedef interface ISpErrorLog ISpErrorLog; +#endif /* __ISpErrorLog_FWD_DEFINED__ */ + + +#ifndef __ISpGrammarCompiler_FWD_DEFINED__ +#define __ISpGrammarCompiler_FWD_DEFINED__ +typedef interface ISpGrammarCompiler ISpGrammarCompiler; +#endif /* __ISpGrammarCompiler_FWD_DEFINED__ */ + + +#ifndef __ISpGramCompBackend_FWD_DEFINED__ +#define __ISpGramCompBackend_FWD_DEFINED__ +typedef interface ISpGramCompBackend ISpGramCompBackend; +#endif /* __ISpGramCompBackend_FWD_DEFINED__ */ + + +#ifndef __ISpITNProcessor_FWD_DEFINED__ +#define __ISpITNProcessor_FWD_DEFINED__ +typedef interface ISpITNProcessor ISpITNProcessor; +#endif /* __ISpITNProcessor_FWD_DEFINED__ */ + + +#ifndef __ISpPhraseBuilder_FWD_DEFINED__ +#define __ISpPhraseBuilder_FWD_DEFINED__ +typedef interface ISpPhraseBuilder ISpPhraseBuilder; +#endif /* __ISpPhraseBuilder_FWD_DEFINED__ */ + + +#ifndef __ISpThreadControl_FWD_DEFINED__ +#define __ISpThreadControl_FWD_DEFINED__ +typedef interface ISpThreadControl ISpThreadControl; +#endif /* __ISpThreadControl_FWD_DEFINED__ */ + + +#ifndef __ISpTaskManager_FWD_DEFINED__ +#define __ISpTaskManager_FWD_DEFINED__ +typedef interface ISpTaskManager ISpTaskManager; +#endif /* __ISpTaskManager_FWD_DEFINED__ */ + + +#ifndef __ISpTTSEngineSite_FWD_DEFINED__ +#define __ISpTTSEngineSite_FWD_DEFINED__ +typedef interface ISpTTSEngineSite ISpTTSEngineSite; +#endif /* __ISpTTSEngineSite_FWD_DEFINED__ */ + + +#ifndef __ISpTTSEngine_FWD_DEFINED__ +#define __ISpTTSEngine_FWD_DEFINED__ +typedef interface ISpTTSEngine ISpTTSEngine; +#endif /* __ISpTTSEngine_FWD_DEFINED__ */ + + +#ifndef __ISpCFGInterpreterSite_FWD_DEFINED__ +#define __ISpCFGInterpreterSite_FWD_DEFINED__ +typedef interface ISpCFGInterpreterSite ISpCFGInterpreterSite; +#endif /* __ISpCFGInterpreterSite_FWD_DEFINED__ */ + + +#ifndef __ISpCFGInterpreter_FWD_DEFINED__ +#define __ISpCFGInterpreter_FWD_DEFINED__ +typedef interface ISpCFGInterpreter ISpCFGInterpreter; +#endif /* __ISpCFGInterpreter_FWD_DEFINED__ */ + + +#ifndef __ISpSREngineSite_FWD_DEFINED__ +#define __ISpSREngineSite_FWD_DEFINED__ +typedef interface ISpSREngineSite ISpSREngineSite; +#endif /* __ISpSREngineSite_FWD_DEFINED__ */ + + +#ifndef __ISpSREngine_FWD_DEFINED__ +#define __ISpSREngine_FWD_DEFINED__ +typedef interface ISpSREngine ISpSREngine; +#endif /* __ISpSREngine_FWD_DEFINED__ */ + + +#ifndef __ISpSRAlternates_FWD_DEFINED__ +#define __ISpSRAlternates_FWD_DEFINED__ +typedef interface ISpSRAlternates ISpSRAlternates; +#endif /* __ISpSRAlternates_FWD_DEFINED__ */ + + +#ifndef ___ISpPrivateEngineCall_FWD_DEFINED__ +#define ___ISpPrivateEngineCall_FWD_DEFINED__ +typedef interface _ISpPrivateEngineCall _ISpPrivateEngineCall; +#endif /* ___ISpPrivateEngineCall_FWD_DEFINED__ */ + + +#ifndef __SpDataKey_FWD_DEFINED__ +#define __SpDataKey_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpDataKey SpDataKey; +#else +typedef struct SpDataKey SpDataKey; +#endif /* __cplusplus */ + +#endif /* __SpDataKey_FWD_DEFINED__ */ + + +#ifndef __SpObjectTokenEnum_FWD_DEFINED__ +#define __SpObjectTokenEnum_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpObjectTokenEnum SpObjectTokenEnum; +#else +typedef struct SpObjectTokenEnum SpObjectTokenEnum; +#endif /* __cplusplus */ + +#endif /* __SpObjectTokenEnum_FWD_DEFINED__ */ + + +#ifndef __SpPhraseBuilder_FWD_DEFINED__ +#define __SpPhraseBuilder_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpPhraseBuilder SpPhraseBuilder; +#else +typedef struct SpPhraseBuilder SpPhraseBuilder; +#endif /* __cplusplus */ + +#endif /* __SpPhraseBuilder_FWD_DEFINED__ */ + + +#ifndef __SpITNProcessor_FWD_DEFINED__ +#define __SpITNProcessor_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpITNProcessor SpITNProcessor; +#else +typedef struct SpITNProcessor SpITNProcessor; +#endif /* __cplusplus */ + +#endif /* __SpITNProcessor_FWD_DEFINED__ */ + + +#ifndef __SpGrammarCompiler_FWD_DEFINED__ +#define __SpGrammarCompiler_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpGrammarCompiler SpGrammarCompiler; +#else +typedef struct SpGrammarCompiler SpGrammarCompiler; +#endif /* __cplusplus */ + +#endif /* __SpGrammarCompiler_FWD_DEFINED__ */ + + +#ifndef __SpGramCompBackend_FWD_DEFINED__ +#define __SpGramCompBackend_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class SpGramCompBackend SpGramCompBackend; +#else +typedef struct SpGramCompBackend SpGramCompBackend; +#endif /* __cplusplus */ + +#endif /* __SpGramCompBackend_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "sapi.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +void * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void * ); + +/* interface __MIDL_itf_sapiddk_0000 */ +/* [local] */ + + + + + + +#define SPRECOEXTENSION L"RecoExtension" +#define SPALTERNATESCLSID L"AlternatesCLSID" + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0000_v0_0_s_ifspec; + +#ifndef __ISpTokenUI_INTERFACE_DEFINED__ +#define __ISpTokenUI_INTERFACE_DEFINED__ + +/* interface ISpTokenUI */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpTokenUI; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F8E690F0-39CB-4843-B8D7-C84696E1119D") + ISpTokenUI : public IUnknown + { + public: + virtual /* [local] */ HRESULT STDMETHODCALLTYPE IsUISupported( + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported) = 0; + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE DisplayUI( + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ ISpObjectToken *pToken, + /* [in] */ IUnknown *punkObject) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTokenUIVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTokenUI * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTokenUI * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTokenUI * This); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *IsUISupported )( + ISpTokenUI * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE *DisplayUI )( + ISpTokenUI * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ ISpObjectToken *pToken, + /* [in] */ IUnknown *punkObject); + + END_INTERFACE + } ISpTokenUIVtbl; + + interface ISpTokenUI + { + CONST_VTBL struct ISpTokenUIVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTokenUI_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTokenUI_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTokenUI_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTokenUI_IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) \ + (This)->lpVtbl -> IsUISupported(This,pszTypeOfUI,pvExtraData,cbExtraData,punkObject,pfSupported) + +#define ISpTokenUI_DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,pToken,punkObject) \ + (This)->lpVtbl -> DisplayUI(This,hwndParent,pszTitle,pszTypeOfUI,pvExtraData,cbExtraData,pToken,punkObject) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpTokenUI_IsUISupported_Proxy( + ISpTokenUI * This, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ IUnknown *punkObject, + /* [out] */ BOOL *pfSupported); + + +void __RPC_STUB ISpTokenUI_IsUISupported_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [local] */ HRESULT STDMETHODCALLTYPE ISpTokenUI_DisplayUI_Proxy( + ISpTokenUI * This, + /* [in] */ HWND hwndParent, + /* [in] */ const WCHAR *pszTitle, + /* [in] */ const WCHAR *pszTypeOfUI, + /* [in] */ void *pvExtraData, + /* [in] */ ULONG cbExtraData, + /* [in] */ ISpObjectToken *pToken, + /* [in] */ IUnknown *punkObject); + + +void __RPC_STUB ISpTokenUI_DisplayUI_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTokenUI_INTERFACE_DEFINED__ */ + + +#ifndef __ISpObjectTokenEnumBuilder_INTERFACE_DEFINED__ +#define __ISpObjectTokenEnumBuilder_INTERFACE_DEFINED__ + +/* interface ISpObjectTokenEnumBuilder */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpObjectTokenEnumBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("06B64F9F-7FDA-11d2-B4F2-00C04F797396") + ISpObjectTokenEnumBuilder : public IEnumSpObjectTokens + { + public: + virtual HRESULT STDMETHODCALLTYPE SetAttribs( + const WCHAR *pszReqAttribs, + const WCHAR *pszOptAttribs) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddTokens( + ULONG cTokens, + ISpObjectToken **pToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddTokensFromDataKey( + ISpDataKey *pDataKey, + const WCHAR *pszSubKey, + const WCHAR *pszCategoryId) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddTokensFromTokenEnum( + IEnumSpObjectTokens *pTokenEnum) = 0; + + virtual HRESULT STDMETHODCALLTYPE Sort( + const WCHAR *pszTokenIdToListFirst) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpObjectTokenEnumBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpObjectTokenEnumBuilder * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpObjectTokenEnumBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpObjectTokenEnumBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + ISpObjectTokenEnumBuilder * This, + /* [in] */ ULONG celt, + /* [length_is][size_is][out] */ ISpObjectToken **pelt, + /* [out] */ ULONG *pceltFetched); + + HRESULT ( STDMETHODCALLTYPE *Skip )( + ISpObjectTokenEnumBuilder * This, + /* [in] */ ULONG celt); + + HRESULT ( STDMETHODCALLTYPE *Reset )( + ISpObjectTokenEnumBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *Clone )( + ISpObjectTokenEnumBuilder * This, + /* [out] */ IEnumSpObjectTokens **ppEnum); + + HRESULT ( STDMETHODCALLTYPE *Item )( + ISpObjectTokenEnumBuilder * This, + /* [in] */ ULONG Index, + /* [out] */ ISpObjectToken **ppToken); + + HRESULT ( STDMETHODCALLTYPE *GetCount )( + ISpObjectTokenEnumBuilder * This, + /* [out] */ ULONG *pCount); + + HRESULT ( STDMETHODCALLTYPE *SetAttribs )( + ISpObjectTokenEnumBuilder * This, + const WCHAR *pszReqAttribs, + const WCHAR *pszOptAttribs); + + HRESULT ( STDMETHODCALLTYPE *AddTokens )( + ISpObjectTokenEnumBuilder * This, + ULONG cTokens, + ISpObjectToken **pToken); + + HRESULT ( STDMETHODCALLTYPE *AddTokensFromDataKey )( + ISpObjectTokenEnumBuilder * This, + ISpDataKey *pDataKey, + const WCHAR *pszSubKey, + const WCHAR *pszCategoryId); + + HRESULT ( STDMETHODCALLTYPE *AddTokensFromTokenEnum )( + ISpObjectTokenEnumBuilder * This, + IEnumSpObjectTokens *pTokenEnum); + + HRESULT ( STDMETHODCALLTYPE *Sort )( + ISpObjectTokenEnumBuilder * This, + const WCHAR *pszTokenIdToListFirst); + + END_INTERFACE + } ISpObjectTokenEnumBuilderVtbl; + + interface ISpObjectTokenEnumBuilder + { + CONST_VTBL struct ISpObjectTokenEnumBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpObjectTokenEnumBuilder_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpObjectTokenEnumBuilder_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpObjectTokenEnumBuilder_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpObjectTokenEnumBuilder_Next(This,celt,pelt,pceltFetched) \ + (This)->lpVtbl -> Next(This,celt,pelt,pceltFetched) + +#define ISpObjectTokenEnumBuilder_Skip(This,celt) \ + (This)->lpVtbl -> Skip(This,celt) + +#define ISpObjectTokenEnumBuilder_Reset(This) \ + (This)->lpVtbl -> Reset(This) + +#define ISpObjectTokenEnumBuilder_Clone(This,ppEnum) \ + (This)->lpVtbl -> Clone(This,ppEnum) + +#define ISpObjectTokenEnumBuilder_Item(This,Index,ppToken) \ + (This)->lpVtbl -> Item(This,Index,ppToken) + +#define ISpObjectTokenEnumBuilder_GetCount(This,pCount) \ + (This)->lpVtbl -> GetCount(This,pCount) + + +#define ISpObjectTokenEnumBuilder_SetAttribs(This,pszReqAttribs,pszOptAttribs) \ + (This)->lpVtbl -> SetAttribs(This,pszReqAttribs,pszOptAttribs) + +#define ISpObjectTokenEnumBuilder_AddTokens(This,cTokens,pToken) \ + (This)->lpVtbl -> AddTokens(This,cTokens,pToken) + +#define ISpObjectTokenEnumBuilder_AddTokensFromDataKey(This,pDataKey,pszSubKey,pszCategoryId) \ + (This)->lpVtbl -> AddTokensFromDataKey(This,pDataKey,pszSubKey,pszCategoryId) + +#define ISpObjectTokenEnumBuilder_AddTokensFromTokenEnum(This,pTokenEnum) \ + (This)->lpVtbl -> AddTokensFromTokenEnum(This,pTokenEnum) + +#define ISpObjectTokenEnumBuilder_Sort(This,pszTokenIdToListFirst) \ + (This)->lpVtbl -> Sort(This,pszTokenIdToListFirst) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_SetAttribs_Proxy( + ISpObjectTokenEnumBuilder * This, + const WCHAR *pszReqAttribs, + const WCHAR *pszOptAttribs); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_SetAttribs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_AddTokens_Proxy( + ISpObjectTokenEnumBuilder * This, + ULONG cTokens, + ISpObjectToken **pToken); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_AddTokens_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_AddTokensFromDataKey_Proxy( + ISpObjectTokenEnumBuilder * This, + ISpDataKey *pDataKey, + const WCHAR *pszSubKey, + const WCHAR *pszCategoryId); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_AddTokensFromDataKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_AddTokensFromTokenEnum_Proxy( + ISpObjectTokenEnumBuilder * This, + IEnumSpObjectTokens *pTokenEnum); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_AddTokensFromTokenEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpObjectTokenEnumBuilder_Sort_Proxy( + ISpObjectTokenEnumBuilder * This, + const WCHAR *pszTokenIdToListFirst); + + +void __RPC_STUB ISpObjectTokenEnumBuilder_Sort_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpObjectTokenEnumBuilder_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0339 */ +/* [local] */ + +#if 0 +typedef void *SPWORDHANDLE; + +typedef void *SPRULEHANDLE; + +typedef void *SPGRAMMARHANDLE; + +typedef void *SPRECOCONTEXTHANDLE; + +typedef void *SPPHRASERULEHANDLE; + +typedef void *SPPHRASEPROPERTYHANDLE; + +typedef void *SPTRANSITIONID; + +#else +DECLARE_HANDLE(SPWORDHANDLE); +DECLARE_HANDLE(SPRULEHANDLE); +DECLARE_HANDLE(SPGRAMMARHANDLE); +DECLARE_HANDLE(SPRECOCONTEXTHANDLE); +DECLARE_HANDLE(SPPHRASERULEHANDLE); +DECLARE_HANDLE(SPPHRASEPROPERTYHANDLE); +DECLARE_HANDLE(SPTRANSITIONID); +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0339_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0339_v0_0_s_ifspec; + +#ifndef __ISpErrorLog_INTERFACE_DEFINED__ +#define __ISpErrorLog_INTERFACE_DEFINED__ + +/* interface ISpErrorLog */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpErrorLog; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F4711347-E608-11d2-A086-00C04F8EF9B5") + ISpErrorLog : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AddError( + const long lLineNumber, + HRESULT hr, + const WCHAR *pszDescription, + const WCHAR *pszHelpFile, + DWORD dwHelpContext) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpErrorLogVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpErrorLog * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpErrorLog * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpErrorLog * This); + + HRESULT ( STDMETHODCALLTYPE *AddError )( + ISpErrorLog * This, + const long lLineNumber, + HRESULT hr, + const WCHAR *pszDescription, + const WCHAR *pszHelpFile, + DWORD dwHelpContext); + + END_INTERFACE + } ISpErrorLogVtbl; + + interface ISpErrorLog + { + CONST_VTBL struct ISpErrorLogVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpErrorLog_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpErrorLog_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpErrorLog_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpErrorLog_AddError(This,lLineNumber,hr,pszDescription,pszHelpFile,dwHelpContext) \ + (This)->lpVtbl -> AddError(This,lLineNumber,hr,pszDescription,pszHelpFile,dwHelpContext) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpErrorLog_AddError_Proxy( + ISpErrorLog * This, + const long lLineNumber, + HRESULT hr, + const WCHAR *pszDescription, + const WCHAR *pszHelpFile, + DWORD dwHelpContext); + + +void __RPC_STUB ISpErrorLog_AddError_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpErrorLog_INTERFACE_DEFINED__ */ + + +#ifndef __ISpGrammarCompiler_INTERFACE_DEFINED__ +#define __ISpGrammarCompiler_INTERFACE_DEFINED__ + +/* interface ISpGrammarCompiler */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpGrammarCompiler; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B1E29D58-A675-11D2-8302-00C04F8EE6C0") + ISpGrammarCompiler : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CompileStream( + IStream *pSource, + IStream *pDest, + IStream *pHeader, + IUnknown *pReserved, + ISpErrorLog *pErrorLog, + /* [in] */ DWORD dwFlags) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpGrammarCompilerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpGrammarCompiler * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpGrammarCompiler * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpGrammarCompiler * This); + + HRESULT ( STDMETHODCALLTYPE *CompileStream )( + ISpGrammarCompiler * This, + IStream *pSource, + IStream *pDest, + IStream *pHeader, + IUnknown *pReserved, + ISpErrorLog *pErrorLog, + /* [in] */ DWORD dwFlags); + + END_INTERFACE + } ISpGrammarCompilerVtbl; + + interface ISpGrammarCompiler + { + CONST_VTBL struct ISpGrammarCompilerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpGrammarCompiler_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpGrammarCompiler_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpGrammarCompiler_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpGrammarCompiler_CompileStream(This,pSource,pDest,pHeader,pReserved,pErrorLog,dwFlags) \ + (This)->lpVtbl -> CompileStream(This,pSource,pDest,pHeader,pReserved,pErrorLog,dwFlags) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpGrammarCompiler_CompileStream_Proxy( + ISpGrammarCompiler * This, + IStream *pSource, + IStream *pDest, + IStream *pHeader, + IUnknown *pReserved, + ISpErrorLog *pErrorLog, + /* [in] */ DWORD dwFlags); + + +void __RPC_STUB ISpGrammarCompiler_CompileStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpGrammarCompiler_INTERFACE_DEFINED__ */ + + +#ifndef __ISpGramCompBackend_INTERFACE_DEFINED__ +#define __ISpGramCompBackend_INTERFACE_DEFINED__ + +/* interface ISpGramCompBackend */ +/* [restricted][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpGramCompBackend; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3DDCA27C-665C-4786-9F97-8C90C3488B61") + ISpGramCompBackend : public ISpGrammarBuilder + { + public: + virtual HRESULT STDMETHODCALLTYPE SetSaveObjects( + IStream *pStream, + ISpErrorLog *pErrorLog) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitFromBinaryGrammar( + const SPBINARYGRAMMAR *pBinaryData) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpGramCompBackendVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpGramCompBackend * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpGramCompBackend * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpGramCompBackend * This); + + HRESULT ( STDMETHODCALLTYPE *ResetGrammar )( + ISpGramCompBackend * This, + /* [in] */ WORD NewLanguage); + + HRESULT ( STDMETHODCALLTYPE *GetRule )( + ISpGramCompBackend * This, + /* [in] */ const WCHAR *pszRuleName, + /* [in] */ DWORD dwRuleId, + /* [in] */ DWORD dwAttributes, + /* [in] */ BOOL fCreateIfNotExist, + /* [out] */ SPSTATEHANDLE *phInitialState); + + HRESULT ( STDMETHODCALLTYPE *ClearRule )( + ISpGramCompBackend * This, + SPSTATEHANDLE hState); + + HRESULT ( STDMETHODCALLTYPE *CreateNewState )( + ISpGramCompBackend * This, + SPSTATEHANDLE hState, + SPSTATEHANDLE *phState); + + HRESULT ( STDMETHODCALLTYPE *AddWordTransition )( + ISpGramCompBackend * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + const WCHAR *psz, + const WCHAR *pszSeparators, + SPGRAMMARWORDTYPE eWordType, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddRuleTransition )( + ISpGramCompBackend * This, + SPSTATEHANDLE hFromState, + SPSTATEHANDLE hToState, + SPSTATEHANDLE hRule, + float Weight, + const SPPROPERTYINFO *pPropInfo); + + HRESULT ( STDMETHODCALLTYPE *AddResource )( + ISpGramCompBackend * This, + /* [in] */ SPSTATEHANDLE hRuleState, + /* [in] */ const WCHAR *pszResourceName, + /* [in] */ const WCHAR *pszResourceValue); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpGramCompBackend * This, + DWORD dwReserved); + + HRESULT ( STDMETHODCALLTYPE *SetSaveObjects )( + ISpGramCompBackend * This, + IStream *pStream, + ISpErrorLog *pErrorLog); + + HRESULT ( STDMETHODCALLTYPE *InitFromBinaryGrammar )( + ISpGramCompBackend * This, + const SPBINARYGRAMMAR *pBinaryData); + + END_INTERFACE + } ISpGramCompBackendVtbl; + + interface ISpGramCompBackend + { + CONST_VTBL struct ISpGramCompBackendVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpGramCompBackend_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpGramCompBackend_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpGramCompBackend_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpGramCompBackend_ResetGrammar(This,NewLanguage) \ + (This)->lpVtbl -> ResetGrammar(This,NewLanguage) + +#define ISpGramCompBackend_GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) \ + (This)->lpVtbl -> GetRule(This,pszRuleName,dwRuleId,dwAttributes,fCreateIfNotExist,phInitialState) + +#define ISpGramCompBackend_ClearRule(This,hState) \ + (This)->lpVtbl -> ClearRule(This,hState) + +#define ISpGramCompBackend_CreateNewState(This,hState,phState) \ + (This)->lpVtbl -> CreateNewState(This,hState,phState) + +#define ISpGramCompBackend_AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) \ + (This)->lpVtbl -> AddWordTransition(This,hFromState,hToState,psz,pszSeparators,eWordType,Weight,pPropInfo) + +#define ISpGramCompBackend_AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) \ + (This)->lpVtbl -> AddRuleTransition(This,hFromState,hToState,hRule,Weight,pPropInfo) + +#define ISpGramCompBackend_AddResource(This,hRuleState,pszResourceName,pszResourceValue) \ + (This)->lpVtbl -> AddResource(This,hRuleState,pszResourceName,pszResourceValue) + +#define ISpGramCompBackend_Commit(This,dwReserved) \ + (This)->lpVtbl -> Commit(This,dwReserved) + + +#define ISpGramCompBackend_SetSaveObjects(This,pStream,pErrorLog) \ + (This)->lpVtbl -> SetSaveObjects(This,pStream,pErrorLog) + +#define ISpGramCompBackend_InitFromBinaryGrammar(This,pBinaryData) \ + (This)->lpVtbl -> InitFromBinaryGrammar(This,pBinaryData) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpGramCompBackend_SetSaveObjects_Proxy( + ISpGramCompBackend * This, + IStream *pStream, + ISpErrorLog *pErrorLog); + + +void __RPC_STUB ISpGramCompBackend_SetSaveObjects_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpGramCompBackend_InitFromBinaryGrammar_Proxy( + ISpGramCompBackend * This, + const SPBINARYGRAMMAR *pBinaryData); + + +void __RPC_STUB ISpGramCompBackend_InitFromBinaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpGramCompBackend_INTERFACE_DEFINED__ */ + + +#ifndef __ISpITNProcessor_INTERFACE_DEFINED__ +#define __ISpITNProcessor_INTERFACE_DEFINED__ + +/* interface ISpITNProcessor */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpITNProcessor; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("12D7360F-A1C9-11d3-BC90-00C04F72DF9F") + ISpITNProcessor : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE LoadITNGrammar( + WCHAR *pszCLSID) = 0; + + virtual HRESULT STDMETHODCALLTYPE ITNPhrase( + ISpPhraseBuilder *pPhrase) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpITNProcessorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpITNProcessor * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpITNProcessor * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpITNProcessor * This); + + HRESULT ( STDMETHODCALLTYPE *LoadITNGrammar )( + ISpITNProcessor * This, + WCHAR *pszCLSID); + + HRESULT ( STDMETHODCALLTYPE *ITNPhrase )( + ISpITNProcessor * This, + ISpPhraseBuilder *pPhrase); + + END_INTERFACE + } ISpITNProcessorVtbl; + + interface ISpITNProcessor + { + CONST_VTBL struct ISpITNProcessorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpITNProcessor_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpITNProcessor_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpITNProcessor_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpITNProcessor_LoadITNGrammar(This,pszCLSID) \ + (This)->lpVtbl -> LoadITNGrammar(This,pszCLSID) + +#define ISpITNProcessor_ITNPhrase(This,pPhrase) \ + (This)->lpVtbl -> ITNPhrase(This,pPhrase) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpITNProcessor_LoadITNGrammar_Proxy( + ISpITNProcessor * This, + WCHAR *pszCLSID); + + +void __RPC_STUB ISpITNProcessor_LoadITNGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpITNProcessor_ITNPhrase_Proxy( + ISpITNProcessor * This, + ISpPhraseBuilder *pPhrase); + + +void __RPC_STUB ISpITNProcessor_ITNPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpITNProcessor_INTERFACE_DEFINED__ */ + + +#ifndef __ISpPhraseBuilder_INTERFACE_DEFINED__ +#define __ISpPhraseBuilder_INTERFACE_DEFINED__ + +/* interface ISpPhraseBuilder */ +/* [restricted][unique][helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_ISpPhraseBuilder; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("88A3342A-0BED-4834-922B-88D43173162F") + ISpPhraseBuilder : public ISpPhrase + { + public: + virtual HRESULT STDMETHODCALLTYPE InitFromPhrase( + const SPPHRASE *pPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE InitFromSerializedPhrase( + const SPSERIALIZEDPHRASE *pPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddElements( + ULONG cElements, + const SPPHRASEELEMENT *pElement) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddRules( + const SPPHRASERULEHANDLE hParent, + const SPPHRASERULE *pRule, + SPPHRASERULEHANDLE *phNewRule) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddProperties( + const SPPHRASEPROPERTYHANDLE hParent, + const SPPHRASEPROPERTY *pProperty, + SPPHRASEPROPERTYHANDLE *phNewProperty) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddReplacements( + ULONG cReplacements, + const SPPHRASEREPLACEMENT *pReplacements) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpPhraseBuilderVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpPhraseBuilder * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpPhraseBuilder * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpPhraseBuilder * This); + + HRESULT ( STDMETHODCALLTYPE *GetPhrase )( + ISpPhraseBuilder * This, + /* [out] */ SPPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetSerializedPhrase )( + ISpPhraseBuilder * This, + /* [out] */ SPSERIALIZEDPHRASE **ppCoMemPhrase); + + HRESULT ( STDMETHODCALLTYPE *GetText )( + ISpPhraseBuilder * This, + /* [in] */ ULONG ulStart, + /* [in] */ ULONG ulCount, + /* [in] */ BOOL fUseTextReplacements, + /* [out] */ WCHAR **ppszCoMemText, + /* [out] */ BYTE *pbDisplayAttributes); + + HRESULT ( STDMETHODCALLTYPE *Discard )( + ISpPhraseBuilder * This, + /* [in] */ DWORD dwValueTypes); + + HRESULT ( STDMETHODCALLTYPE *InitFromPhrase )( + ISpPhraseBuilder * This, + const SPPHRASE *pPhrase); + + HRESULT ( STDMETHODCALLTYPE *InitFromSerializedPhrase )( + ISpPhraseBuilder * This, + const SPSERIALIZEDPHRASE *pPhrase); + + HRESULT ( STDMETHODCALLTYPE *AddElements )( + ISpPhraseBuilder * This, + ULONG cElements, + const SPPHRASEELEMENT *pElement); + + HRESULT ( STDMETHODCALLTYPE *AddRules )( + ISpPhraseBuilder * This, + const SPPHRASERULEHANDLE hParent, + const SPPHRASERULE *pRule, + SPPHRASERULEHANDLE *phNewRule); + + HRESULT ( STDMETHODCALLTYPE *AddProperties )( + ISpPhraseBuilder * This, + const SPPHRASEPROPERTYHANDLE hParent, + const SPPHRASEPROPERTY *pProperty, + SPPHRASEPROPERTYHANDLE *phNewProperty); + + HRESULT ( STDMETHODCALLTYPE *AddReplacements )( + ISpPhraseBuilder * This, + ULONG cReplacements, + const SPPHRASEREPLACEMENT *pReplacements); + + END_INTERFACE + } ISpPhraseBuilderVtbl; + + interface ISpPhraseBuilder + { + CONST_VTBL struct ISpPhraseBuilderVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpPhraseBuilder_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpPhraseBuilder_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpPhraseBuilder_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpPhraseBuilder_GetPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetPhrase(This,ppCoMemPhrase) + +#define ISpPhraseBuilder_GetSerializedPhrase(This,ppCoMemPhrase) \ + (This)->lpVtbl -> GetSerializedPhrase(This,ppCoMemPhrase) + +#define ISpPhraseBuilder_GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) \ + (This)->lpVtbl -> GetText(This,ulStart,ulCount,fUseTextReplacements,ppszCoMemText,pbDisplayAttributes) + +#define ISpPhraseBuilder_Discard(This,dwValueTypes) \ + (This)->lpVtbl -> Discard(This,dwValueTypes) + + +#define ISpPhraseBuilder_InitFromPhrase(This,pPhrase) \ + (This)->lpVtbl -> InitFromPhrase(This,pPhrase) + +#define ISpPhraseBuilder_InitFromSerializedPhrase(This,pPhrase) \ + (This)->lpVtbl -> InitFromSerializedPhrase(This,pPhrase) + +#define ISpPhraseBuilder_AddElements(This,cElements,pElement) \ + (This)->lpVtbl -> AddElements(This,cElements,pElement) + +#define ISpPhraseBuilder_AddRules(This,hParent,pRule,phNewRule) \ + (This)->lpVtbl -> AddRules(This,hParent,pRule,phNewRule) + +#define ISpPhraseBuilder_AddProperties(This,hParent,pProperty,phNewProperty) \ + (This)->lpVtbl -> AddProperties(This,hParent,pProperty,phNewProperty) + +#define ISpPhraseBuilder_AddReplacements(This,cReplacements,pReplacements) \ + (This)->lpVtbl -> AddReplacements(This,cReplacements,pReplacements) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_InitFromPhrase_Proxy( + ISpPhraseBuilder * This, + const SPPHRASE *pPhrase); + + +void __RPC_STUB ISpPhraseBuilder_InitFromPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_InitFromSerializedPhrase_Proxy( + ISpPhraseBuilder * This, + const SPSERIALIZEDPHRASE *pPhrase); + + +void __RPC_STUB ISpPhraseBuilder_InitFromSerializedPhrase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_AddElements_Proxy( + ISpPhraseBuilder * This, + ULONG cElements, + const SPPHRASEELEMENT *pElement); + + +void __RPC_STUB ISpPhraseBuilder_AddElements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_AddRules_Proxy( + ISpPhraseBuilder * This, + const SPPHRASERULEHANDLE hParent, + const SPPHRASERULE *pRule, + SPPHRASERULEHANDLE *phNewRule); + + +void __RPC_STUB ISpPhraseBuilder_AddRules_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_AddProperties_Proxy( + ISpPhraseBuilder * This, + const SPPHRASEPROPERTYHANDLE hParent, + const SPPHRASEPROPERTY *pProperty, + SPPHRASEPROPERTYHANDLE *phNewProperty); + + +void __RPC_STUB ISpPhraseBuilder_AddProperties_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpPhraseBuilder_AddReplacements_Proxy( + ISpPhraseBuilder * This, + ULONG cReplacements, + const SPPHRASEREPLACEMENT *pReplacements); + + +void __RPC_STUB ISpPhraseBuilder_AddReplacements_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpPhraseBuilder_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0344 */ +/* [local] */ + +#if defined(__cplusplus) +interface ISpTask +{ +virtual HRESULT STDMETHODCALLTYPE Execute( + void *pvTaskData, + volatile const BOOL* pfContinueProcessing) = 0; +}; +#else +typedef void *ISpTask; + +#endif +#if defined(__cplusplus) +interface ISpThreadTask +{ +virtual HRESULT STDMETHODCALLTYPE InitThread( + void * pvTaskData, + HWND hwnd) = 0; +virtual HRESULT STDMETHODCALLTYPE ThreadProc( + void *pvTaskData, + HANDLE hExitThreadEvent, + HANDLE hNotifyEvent, + HWND hwndWorker, + volatile const BOOL * pfContinueProcessing) = 0; +virtual LRESULT STDMETHODCALLTYPE WindowMessage( + void *pvTaskData, + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam) = 0; +}; +#else +typedef void *ISpThreadTask; + +#endif + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0344_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0344_v0_0_s_ifspec; + +#ifndef __ISpThreadControl_INTERFACE_DEFINED__ +#define __ISpThreadControl_INTERFACE_DEFINED__ + +/* interface ISpThreadControl */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpThreadControl; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A6BE4D73-4403-4358-B22D-0346E23B1764") + ISpThreadControl : public ISpNotifySink + { + public: + virtual HRESULT STDMETHODCALLTYPE StartThread( + DWORD dwFlags, + HWND *phwnd) = 0; + + virtual HRESULT STDMETHODCALLTYPE WaitForThreadDone( + BOOL fForceStop, + HRESULT *phrThreadResult, + ULONG msTimeOut) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateThread( void) = 0; + + virtual HANDLE STDMETHODCALLTYPE ThreadHandle( void) = 0; + + virtual DWORD STDMETHODCALLTYPE ThreadId( void) = 0; + + virtual HANDLE STDMETHODCALLTYPE NotifyEvent( void) = 0; + + virtual HWND STDMETHODCALLTYPE WindowHandle( void) = 0; + + virtual HANDLE STDMETHODCALLTYPE ThreadCompleteEvent( void) = 0; + + virtual HANDLE STDMETHODCALLTYPE ExitThreadEvent( void) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpThreadControlVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpThreadControl * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpThreadControl * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpThreadControl * This); + + HRESULT ( STDMETHODCALLTYPE *Notify )( + ISpThreadControl * This); + + HRESULT ( STDMETHODCALLTYPE *StartThread )( + ISpThreadControl * This, + DWORD dwFlags, + HWND *phwnd); + + HRESULT ( STDMETHODCALLTYPE *WaitForThreadDone )( + ISpThreadControl * This, + BOOL fForceStop, + HRESULT *phrThreadResult, + ULONG msTimeOut); + + HRESULT ( STDMETHODCALLTYPE *TerminateThread )( + ISpThreadControl * This); + + HANDLE ( STDMETHODCALLTYPE *ThreadHandle )( + ISpThreadControl * This); + + DWORD ( STDMETHODCALLTYPE *ThreadId )( + ISpThreadControl * This); + + HANDLE ( STDMETHODCALLTYPE *NotifyEvent )( + ISpThreadControl * This); + + HWND ( STDMETHODCALLTYPE *WindowHandle )( + ISpThreadControl * This); + + HANDLE ( STDMETHODCALLTYPE *ThreadCompleteEvent )( + ISpThreadControl * This); + + HANDLE ( STDMETHODCALLTYPE *ExitThreadEvent )( + ISpThreadControl * This); + + END_INTERFACE + } ISpThreadControlVtbl; + + interface ISpThreadControl + { + CONST_VTBL struct ISpThreadControlVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpThreadControl_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpThreadControl_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpThreadControl_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpThreadControl_Notify(This) \ + (This)->lpVtbl -> Notify(This) + + +#define ISpThreadControl_StartThread(This,dwFlags,phwnd) \ + (This)->lpVtbl -> StartThread(This,dwFlags,phwnd) + +#define ISpThreadControl_WaitForThreadDone(This,fForceStop,phrThreadResult,msTimeOut) \ + (This)->lpVtbl -> WaitForThreadDone(This,fForceStop,phrThreadResult,msTimeOut) + +#define ISpThreadControl_TerminateThread(This) \ + (This)->lpVtbl -> TerminateThread(This) + +#define ISpThreadControl_ThreadHandle(This) \ + (This)->lpVtbl -> ThreadHandle(This) + +#define ISpThreadControl_ThreadId(This) \ + (This)->lpVtbl -> ThreadId(This) + +#define ISpThreadControl_NotifyEvent(This) \ + (This)->lpVtbl -> NotifyEvent(This) + +#define ISpThreadControl_WindowHandle(This) \ + (This)->lpVtbl -> WindowHandle(This) + +#define ISpThreadControl_ThreadCompleteEvent(This) \ + (This)->lpVtbl -> ThreadCompleteEvent(This) + +#define ISpThreadControl_ExitThreadEvent(This) \ + (This)->lpVtbl -> ExitThreadEvent(This) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpThreadControl_StartThread_Proxy( + ISpThreadControl * This, + DWORD dwFlags, + HWND *phwnd); + + +void __RPC_STUB ISpThreadControl_StartThread_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpThreadControl_WaitForThreadDone_Proxy( + ISpThreadControl * This, + BOOL fForceStop, + HRESULT *phrThreadResult, + ULONG msTimeOut); + + +void __RPC_STUB ISpThreadControl_WaitForThreadDone_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpThreadControl_TerminateThread_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_TerminateThread_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpThreadControl_ThreadHandle_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_ThreadHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +DWORD STDMETHODCALLTYPE ISpThreadControl_ThreadId_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_ThreadId_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpThreadControl_NotifyEvent_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_NotifyEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HWND STDMETHODCALLTYPE ISpThreadControl_WindowHandle_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_WindowHandle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpThreadControl_ThreadCompleteEvent_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_ThreadCompleteEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HANDLE STDMETHODCALLTYPE ISpThreadControl_ExitThreadEvent_Proxy( + ISpThreadControl * This); + + +void __RPC_STUB ISpThreadControl_ExitThreadEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpThreadControl_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0345 */ +/* [local] */ + +typedef /* [restricted] */ struct SPTMTHREADINFO + { + long lPoolSize; + long lPriority; + ULONG ulConcurrencyLimit; + ULONG ulMaxQuickAllocThreads; + } SPTMTHREADINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0345_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0345_v0_0_s_ifspec; + +#ifndef __ISpTaskManager_INTERFACE_DEFINED__ +#define __ISpTaskManager_INTERFACE_DEFINED__ + +/* interface ISpTaskManager */ +/* [object][restricted][unique][helpstring][uuid][local] */ + + +EXTERN_C const IID IID_ISpTaskManager; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2BAEEF81-2CA3-4331-98F3-26EC5ABEFB03") + ISpTaskManager : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetThreadPoolInfo( + /* [in] */ const SPTMTHREADINFO *pPoolInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetThreadPoolInfo( + /* [out] */ SPTMTHREADINFO *pPoolInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE QueueTask( + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out][in] */ DWORD *pdwGroupId, + /* [out] */ DWORD *pTaskID) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateReoccurringTask( + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out] */ ISpNotifySink **ppTaskCtrl) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateThreadControl( + /* [in] */ ISpThreadTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ long nPriority, + /* [out] */ ISpThreadControl **ppTaskCtrl) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateTask( + /* [in] */ DWORD dwTaskId, + /* [in] */ ULONG ulWaitPeriod) = 0; + + virtual HRESULT STDMETHODCALLTYPE TerminateTaskGroup( + /* [in] */ DWORD dwGroupId, + /* [in] */ ULONG ulWaitPeriod) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTaskManagerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTaskManager * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTaskManager * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTaskManager * This); + + HRESULT ( STDMETHODCALLTYPE *SetThreadPoolInfo )( + ISpTaskManager * This, + /* [in] */ const SPTMTHREADINFO *pPoolInfo); + + HRESULT ( STDMETHODCALLTYPE *GetThreadPoolInfo )( + ISpTaskManager * This, + /* [out] */ SPTMTHREADINFO *pPoolInfo); + + HRESULT ( STDMETHODCALLTYPE *QueueTask )( + ISpTaskManager * This, + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out][in] */ DWORD *pdwGroupId, + /* [out] */ DWORD *pTaskID); + + HRESULT ( STDMETHODCALLTYPE *CreateReoccurringTask )( + ISpTaskManager * This, + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out] */ ISpNotifySink **ppTaskCtrl); + + HRESULT ( STDMETHODCALLTYPE *CreateThreadControl )( + ISpTaskManager * This, + /* [in] */ ISpThreadTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ long nPriority, + /* [out] */ ISpThreadControl **ppTaskCtrl); + + HRESULT ( STDMETHODCALLTYPE *TerminateTask )( + ISpTaskManager * This, + /* [in] */ DWORD dwTaskId, + /* [in] */ ULONG ulWaitPeriod); + + HRESULT ( STDMETHODCALLTYPE *TerminateTaskGroup )( + ISpTaskManager * This, + /* [in] */ DWORD dwGroupId, + /* [in] */ ULONG ulWaitPeriod); + + END_INTERFACE + } ISpTaskManagerVtbl; + + interface ISpTaskManager + { + CONST_VTBL struct ISpTaskManagerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTaskManager_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTaskManager_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTaskManager_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTaskManager_SetThreadPoolInfo(This,pPoolInfo) \ + (This)->lpVtbl -> SetThreadPoolInfo(This,pPoolInfo) + +#define ISpTaskManager_GetThreadPoolInfo(This,pPoolInfo) \ + (This)->lpVtbl -> GetThreadPoolInfo(This,pPoolInfo) + +#define ISpTaskManager_QueueTask(This,pTask,pvTaskData,hCompEvent,pdwGroupId,pTaskID) \ + (This)->lpVtbl -> QueueTask(This,pTask,pvTaskData,hCompEvent,pdwGroupId,pTaskID) + +#define ISpTaskManager_CreateReoccurringTask(This,pTask,pvTaskData,hCompEvent,ppTaskCtrl) \ + (This)->lpVtbl -> CreateReoccurringTask(This,pTask,pvTaskData,hCompEvent,ppTaskCtrl) + +#define ISpTaskManager_CreateThreadControl(This,pTask,pvTaskData,nPriority,ppTaskCtrl) \ + (This)->lpVtbl -> CreateThreadControl(This,pTask,pvTaskData,nPriority,ppTaskCtrl) + +#define ISpTaskManager_TerminateTask(This,dwTaskId,ulWaitPeriod) \ + (This)->lpVtbl -> TerminateTask(This,dwTaskId,ulWaitPeriod) + +#define ISpTaskManager_TerminateTaskGroup(This,dwGroupId,ulWaitPeriod) \ + (This)->lpVtbl -> TerminateTaskGroup(This,dwGroupId,ulWaitPeriod) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_SetThreadPoolInfo_Proxy( + ISpTaskManager * This, + /* [in] */ const SPTMTHREADINFO *pPoolInfo); + + +void __RPC_STUB ISpTaskManager_SetThreadPoolInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_GetThreadPoolInfo_Proxy( + ISpTaskManager * This, + /* [out] */ SPTMTHREADINFO *pPoolInfo); + + +void __RPC_STUB ISpTaskManager_GetThreadPoolInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_QueueTask_Proxy( + ISpTaskManager * This, + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out][in] */ DWORD *pdwGroupId, + /* [out] */ DWORD *pTaskID); + + +void __RPC_STUB ISpTaskManager_QueueTask_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_CreateReoccurringTask_Proxy( + ISpTaskManager * This, + /* [in] */ ISpTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ HANDLE hCompEvent, + /* [out] */ ISpNotifySink **ppTaskCtrl); + + +void __RPC_STUB ISpTaskManager_CreateReoccurringTask_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_CreateThreadControl_Proxy( + ISpTaskManager * This, + /* [in] */ ISpThreadTask *pTask, + /* [in] */ void *pvTaskData, + /* [in] */ long nPriority, + /* [out] */ ISpThreadControl **ppTaskCtrl); + + +void __RPC_STUB ISpTaskManager_CreateThreadControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_TerminateTask_Proxy( + ISpTaskManager * This, + /* [in] */ DWORD dwTaskId, + /* [in] */ ULONG ulWaitPeriod); + + +void __RPC_STUB ISpTaskManager_TerminateTask_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTaskManager_TerminateTaskGroup_Proxy( + ISpTaskManager * This, + /* [in] */ DWORD dwGroupId, + /* [in] */ ULONG ulWaitPeriod); + + +void __RPC_STUB ISpTaskManager_TerminateTaskGroup_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTaskManager_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0346 */ +/* [local] */ + +typedef +enum SPVSKIPTYPE + { SPVST_SENTENCE = 1L << 0 + } SPVSKIPTYPE; + +typedef +enum SPVESACTIONS + { SPVES_CONTINUE = 0, + SPVES_ABORT = 1L << 0, + SPVES_SKIP = 1L << 1, + SPVES_RATE = 1L << 2, + SPVES_VOLUME = 1L << 3 + } SPVESACTIONS; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0346_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0346_v0_0_s_ifspec; + +#ifndef __ISpTTSEngineSite_INTERFACE_DEFINED__ +#define __ISpTTSEngineSite_INTERFACE_DEFINED__ + +/* interface ISpTTSEngineSite */ +/* [unique][helpstring][uuid][local][object] */ + + +EXTERN_C const IID IID_ISpTTSEngineSite; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9880499B-CCE9-11d2-B503-00C04F797396") + ISpTTSEngineSite : public ISpEventSink + { + public: + virtual DWORD STDMETHODCALLTYPE GetActions( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Write( + /* [in] */ const void *pBuff, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRate( + /* [out] */ long *pRateAdjust) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVolume( + /* [out] */ USHORT *pusVolume) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetSkipInfo( + /* [out] */ SPVSKIPTYPE *peType, + /* [out] */ long *plNumItems) = 0; + + virtual HRESULT STDMETHODCALLTYPE CompleteSkip( + /* [in] */ long ulNumSkipped) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTTSEngineSiteVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTTSEngineSite * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTTSEngineSite * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTTSEngineSite * This); + + HRESULT ( STDMETHODCALLTYPE *AddEvents )( + ISpTTSEngineSite * This, + /* [in] */ const SPEVENT *pEventArray, + /* [in] */ ULONG ulCount); + + HRESULT ( STDMETHODCALLTYPE *GetEventInterest )( + ISpTTSEngineSite * This, + /* [out] */ ULONGLONG *pullEventInterest); + + DWORD ( STDMETHODCALLTYPE *GetActions )( + ISpTTSEngineSite * This); + + HRESULT ( STDMETHODCALLTYPE *Write )( + ISpTTSEngineSite * This, + /* [in] */ const void *pBuff, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + HRESULT ( STDMETHODCALLTYPE *GetRate )( + ISpTTSEngineSite * This, + /* [out] */ long *pRateAdjust); + + HRESULT ( STDMETHODCALLTYPE *GetVolume )( + ISpTTSEngineSite * This, + /* [out] */ USHORT *pusVolume); + + HRESULT ( STDMETHODCALLTYPE *GetSkipInfo )( + ISpTTSEngineSite * This, + /* [out] */ SPVSKIPTYPE *peType, + /* [out] */ long *plNumItems); + + HRESULT ( STDMETHODCALLTYPE *CompleteSkip )( + ISpTTSEngineSite * This, + /* [in] */ long ulNumSkipped); + + END_INTERFACE + } ISpTTSEngineSiteVtbl; + + interface ISpTTSEngineSite + { + CONST_VTBL struct ISpTTSEngineSiteVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTTSEngineSite_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTTSEngineSite_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTTSEngineSite_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTTSEngineSite_AddEvents(This,pEventArray,ulCount) \ + (This)->lpVtbl -> AddEvents(This,pEventArray,ulCount) + +#define ISpTTSEngineSite_GetEventInterest(This,pullEventInterest) \ + (This)->lpVtbl -> GetEventInterest(This,pullEventInterest) + + +#define ISpTTSEngineSite_GetActions(This) \ + (This)->lpVtbl -> GetActions(This) + +#define ISpTTSEngineSite_Write(This,pBuff,cb,pcbWritten) \ + (This)->lpVtbl -> Write(This,pBuff,cb,pcbWritten) + +#define ISpTTSEngineSite_GetRate(This,pRateAdjust) \ + (This)->lpVtbl -> GetRate(This,pRateAdjust) + +#define ISpTTSEngineSite_GetVolume(This,pusVolume) \ + (This)->lpVtbl -> GetVolume(This,pusVolume) + +#define ISpTTSEngineSite_GetSkipInfo(This,peType,plNumItems) \ + (This)->lpVtbl -> GetSkipInfo(This,peType,plNumItems) + +#define ISpTTSEngineSite_CompleteSkip(This,ulNumSkipped) \ + (This)->lpVtbl -> CompleteSkip(This,ulNumSkipped) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +DWORD STDMETHODCALLTYPE ISpTTSEngineSite_GetActions_Proxy( + ISpTTSEngineSite * This); + + +void __RPC_STUB ISpTTSEngineSite_GetActions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_Write_Proxy( + ISpTTSEngineSite * This, + /* [in] */ const void *pBuff, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbWritten); + + +void __RPC_STUB ISpTTSEngineSite_Write_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_GetRate_Proxy( + ISpTTSEngineSite * This, + /* [out] */ long *pRateAdjust); + + +void __RPC_STUB ISpTTSEngineSite_GetRate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_GetVolume_Proxy( + ISpTTSEngineSite * This, + /* [out] */ USHORT *pusVolume); + + +void __RPC_STUB ISpTTSEngineSite_GetVolume_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_GetSkipInfo_Proxy( + ISpTTSEngineSite * This, + /* [out] */ SPVSKIPTYPE *peType, + /* [out] */ long *plNumItems); + + +void __RPC_STUB ISpTTSEngineSite_GetSkipInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngineSite_CompleteSkip_Proxy( + ISpTTSEngineSite * This, + /* [in] */ long ulNumSkipped); + + +void __RPC_STUB ISpTTSEngineSite_CompleteSkip_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTTSEngineSite_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0347 */ +/* [local] */ + +typedef struct SPVTEXTFRAG + { + struct SPVTEXTFRAG *pNext; + SPVSTATE State; + LPCWSTR pTextStart; + ULONG ulTextLen; + ULONG ulTextSrcOffset; + } SPVTEXTFRAG; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0347_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0347_v0_0_s_ifspec; + +#ifndef __ISpTTSEngine_INTERFACE_DEFINED__ +#define __ISpTTSEngine_INTERFACE_DEFINED__ + +/* interface ISpTTSEngine */ +/* [unique][helpstring][uuid][local][object] */ + + +EXTERN_C const IID IID_ISpTTSEngine; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A74D7C8E-4CC5-4f2f-A6EB-804DEE18500E") + ISpTTSEngine : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Speak( + /* [in] */ DWORD dwSpeakFlags, + /* [in] */ REFGUID rguidFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ const SPVTEXTFRAG *pTextFragList, + /* [in] */ ISpTTSEngineSite *pOutputSite) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetOutputFormat( + /* [in] */ const GUID *pTargetFmtId, + /* [in] */ const WAVEFORMATEX *pTargetWaveFormatEx, + /* [out] */ GUID *pOutputFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemOutputWaveFormatEx) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpTTSEngineVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpTTSEngine * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpTTSEngine * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpTTSEngine * This); + + HRESULT ( STDMETHODCALLTYPE *Speak )( + ISpTTSEngine * This, + /* [in] */ DWORD dwSpeakFlags, + /* [in] */ REFGUID rguidFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ const SPVTEXTFRAG *pTextFragList, + /* [in] */ ISpTTSEngineSite *pOutputSite); + + HRESULT ( STDMETHODCALLTYPE *GetOutputFormat )( + ISpTTSEngine * This, + /* [in] */ const GUID *pTargetFmtId, + /* [in] */ const WAVEFORMATEX *pTargetWaveFormatEx, + /* [out] */ GUID *pOutputFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemOutputWaveFormatEx); + + END_INTERFACE + } ISpTTSEngineVtbl; + + interface ISpTTSEngine + { + CONST_VTBL struct ISpTTSEngineVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpTTSEngine_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpTTSEngine_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpTTSEngine_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpTTSEngine_Speak(This,dwSpeakFlags,rguidFormatId,pWaveFormatEx,pTextFragList,pOutputSite) \ + (This)->lpVtbl -> Speak(This,dwSpeakFlags,rguidFormatId,pWaveFormatEx,pTextFragList,pOutputSite) + +#define ISpTTSEngine_GetOutputFormat(This,pTargetFmtId,pTargetWaveFormatEx,pOutputFormatId,ppCoMemOutputWaveFormatEx) \ + (This)->lpVtbl -> GetOutputFormat(This,pTargetFmtId,pTargetWaveFormatEx,pOutputFormatId,ppCoMemOutputWaveFormatEx) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpTTSEngine_Speak_Proxy( + ISpTTSEngine * This, + /* [in] */ DWORD dwSpeakFlags, + /* [in] */ REFGUID rguidFormatId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ const SPVTEXTFRAG *pTextFragList, + /* [in] */ ISpTTSEngineSite *pOutputSite); + + +void __RPC_STUB ISpTTSEngine_Speak_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpTTSEngine_GetOutputFormat_Proxy( + ISpTTSEngine * This, + /* [in] */ const GUID *pTargetFmtId, + /* [in] */ const WAVEFORMATEX *pTargetWaveFormatEx, + /* [out] */ GUID *pOutputFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemOutputWaveFormatEx); + + +void __RPC_STUB ISpTTSEngine_GetOutputFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpTTSEngine_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0348 */ +/* [local] */ + +typedef /* [restricted] */ struct SPWORDENTRY + { + SPWORDHANDLE hWord; + WORD LangID; + WCHAR *pszDisplayText; + WCHAR *pszLexicalForm; + SPPHONEID *aPhoneId; + void *pvClientContext; + } SPWORDENTRY; + +typedef /* [restricted] */ struct SPRULEENTRY + { + SPRULEHANDLE hRule; + SPSTATEHANDLE hInitialState; + DWORD Attributes; + void *pvClientRuleContext; + void *pvClientGrammarContext; + } SPRULEENTRY; + +typedef +enum SPTRANSITIONTYPE + { SPTRANSEPSILON = 0, + SPTRANSWORD = SPTRANSEPSILON + 1, + SPTRANSRULE = SPTRANSWORD + 1, + SPTRANSTEXTBUF = SPTRANSRULE + 1, + SPTRANSWILDCARD = SPTRANSTEXTBUF + 1, + SPTRANSDICTATION = SPTRANSWILDCARD + 1 + } SPTRANSITIONTYPE; + +typedef /* [restricted] */ struct SPTRANSITIONENTRY + { + SPTRANSITIONID ID; + SPSTATEHANDLE hNextState; + BYTE Type; + char RequiredConfidence; + struct + { + DWORD fHasProperty; + } ; + float Weight; + union + { + struct + { + SPSTATEHANDLE hRuleInitialState; + SPRULEHANDLE hRule; + void *pvClientRuleContext; + } ; + struct + { + SPWORDHANDLE hWord; + void *pvClientWordContext; + } ; + struct + { + void *pvGrammarCookie; + } ; + } ; + } SPTRANSITIONENTRY; + +typedef /* [restricted] */ struct SPTRANSITIONPROPERTY + { + const WCHAR *pszName; + ULONG ulId; + const WCHAR *pszValue; + VARIANT vValue; + } SPTRANSITIONPROPERTY; + +typedef /* [restricted] */ struct SPSTATEINFO + { + ULONG cAllocatedEntries; + SPTRANSITIONENTRY *pTransitions; + ULONG cEpsilons; + ULONG cRules; + ULONG cWords; + ULONG cSpecialTransitions; + } SPSTATEINFO; + +typedef /* [restricted] */ struct SPPATHENTRY + { + SPTRANSITIONID hTransition; + SPPHRASEELEMENT elem; + } SPPATHENTRY; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0348_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0348_v0_0_s_ifspec; + +#ifndef __ISpCFGInterpreterSite_INTERFACE_DEFINED__ +#define __ISpCFGInterpreterSite_INTERFACE_DEFINED__ + +/* interface ISpCFGInterpreterSite */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpCFGInterpreterSite; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6A6FFAD8-78B6-473d-B844-98152E4FB16B") + ISpCFGInterpreterSite : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AddTextReplacement( + /* [in] */ SPPHRASEREPLACEMENT *pReplace) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddProperty( + /* [in] */ const SPPHRASEPROPERTY *pProperty) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetResourceValue( + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpCFGInterpreterSiteVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpCFGInterpreterSite * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpCFGInterpreterSite * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpCFGInterpreterSite * This); + + HRESULT ( STDMETHODCALLTYPE *AddTextReplacement )( + ISpCFGInterpreterSite * This, + /* [in] */ SPPHRASEREPLACEMENT *pReplace); + + HRESULT ( STDMETHODCALLTYPE *AddProperty )( + ISpCFGInterpreterSite * This, + /* [in] */ const SPPHRASEPROPERTY *pProperty); + + HRESULT ( STDMETHODCALLTYPE *GetResourceValue )( + ISpCFGInterpreterSite * This, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource); + + END_INTERFACE + } ISpCFGInterpreterSiteVtbl; + + interface ISpCFGInterpreterSite + { + CONST_VTBL struct ISpCFGInterpreterSiteVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpCFGInterpreterSite_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpCFGInterpreterSite_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpCFGInterpreterSite_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpCFGInterpreterSite_AddTextReplacement(This,pReplace) \ + (This)->lpVtbl -> AddTextReplacement(This,pReplace) + +#define ISpCFGInterpreterSite_AddProperty(This,pProperty) \ + (This)->lpVtbl -> AddProperty(This,pProperty) + +#define ISpCFGInterpreterSite_GetResourceValue(This,pszResourceName,ppCoMemResource) \ + (This)->lpVtbl -> GetResourceValue(This,pszResourceName,ppCoMemResource) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreterSite_AddTextReplacement_Proxy( + ISpCFGInterpreterSite * This, + /* [in] */ SPPHRASEREPLACEMENT *pReplace); + + +void __RPC_STUB ISpCFGInterpreterSite_AddTextReplacement_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreterSite_AddProperty_Proxy( + ISpCFGInterpreterSite * This, + /* [in] */ const SPPHRASEPROPERTY *pProperty); + + +void __RPC_STUB ISpCFGInterpreterSite_AddProperty_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreterSite_GetResourceValue_Proxy( + ISpCFGInterpreterSite * This, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource); + + +void __RPC_STUB ISpCFGInterpreterSite_GetResourceValue_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpCFGInterpreterSite_INTERFACE_DEFINED__ */ + + +#ifndef __ISpCFGInterpreter_INTERFACE_DEFINED__ +#define __ISpCFGInterpreter_INTERFACE_DEFINED__ + +/* interface ISpCFGInterpreter */ +/* [restricted][local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpCFGInterpreter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F3D3F926-11FC-11d3-BB97-00C04F8EE6C0") + ISpCFGInterpreter : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InitGrammar( + /* [in] */ const WCHAR *pszGrammarName, + /* [in] */ const void **pvGrammarData) = 0; + + virtual HRESULT STDMETHODCALLTYPE Interpret( + /* [in] */ ISpPhraseBuilder *pPhrase, + /* [in] */ const ULONG ulFirstElement, + /* [in] */ const ULONG ulCountOfElements, + /* [in] */ ISpCFGInterpreterSite *pSite) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpCFGInterpreterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpCFGInterpreter * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpCFGInterpreter * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpCFGInterpreter * This); + + HRESULT ( STDMETHODCALLTYPE *InitGrammar )( + ISpCFGInterpreter * This, + /* [in] */ const WCHAR *pszGrammarName, + /* [in] */ const void **pvGrammarData); + + HRESULT ( STDMETHODCALLTYPE *Interpret )( + ISpCFGInterpreter * This, + /* [in] */ ISpPhraseBuilder *pPhrase, + /* [in] */ const ULONG ulFirstElement, + /* [in] */ const ULONG ulCountOfElements, + /* [in] */ ISpCFGInterpreterSite *pSite); + + END_INTERFACE + } ISpCFGInterpreterVtbl; + + interface ISpCFGInterpreter + { + CONST_VTBL struct ISpCFGInterpreterVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpCFGInterpreter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpCFGInterpreter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpCFGInterpreter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpCFGInterpreter_InitGrammar(This,pszGrammarName,pvGrammarData) \ + (This)->lpVtbl -> InitGrammar(This,pszGrammarName,pvGrammarData) + +#define ISpCFGInterpreter_Interpret(This,pPhrase,ulFirstElement,ulCountOfElements,pSite) \ + (This)->lpVtbl -> Interpret(This,pPhrase,ulFirstElement,ulCountOfElements,pSite) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreter_InitGrammar_Proxy( + ISpCFGInterpreter * This, + /* [in] */ const WCHAR *pszGrammarName, + /* [in] */ const void **pvGrammarData); + + +void __RPC_STUB ISpCFGInterpreter_InitGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpCFGInterpreter_Interpret_Proxy( + ISpCFGInterpreter * This, + /* [in] */ ISpPhraseBuilder *pPhrase, + /* [in] */ const ULONG ulFirstElement, + /* [in] */ const ULONG ulCountOfElements, + /* [in] */ ISpCFGInterpreterSite *pSite); + + +void __RPC_STUB ISpCFGInterpreter_Interpret_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpCFGInterpreter_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0350 */ +/* [local] */ + +typedef +enum SPCFGNOTIFY + { SPCFGN_ADD = 0, + SPCFGN_REMOVE = SPCFGN_ADD + 1, + SPCFGN_INVALIDATE = SPCFGN_REMOVE + 1, + SPCFGN_ACTIVATE = SPCFGN_INVALIDATE + 1, + SPCFGN_DEACTIVATE = SPCFGN_ACTIVATE + 1 + } SPCFGNOTIFY; + +typedef +enum SPRESULTTYPE + { SPRT_CFG = 0, + SPRT_SLM = 1, + SPRT_PROPRIETARY = 2, + SPRT_FALSE_RECOGNITION = 1L << 2 + } SPRESULTTYPE; + +typedef struct tagSPPHRASEALT + { + ISpPhraseBuilder *pPhrase; + ULONG ulStartElementInParent; + ULONG cElementsInParent; + ULONG cElementsInAlternate; + void *pvAltExtra; + ULONG cbAltExtra; + } SPPHRASEALT; + +typedef struct SPRECORESULTINFO + { + ULONG cbSize; + SPRESULTTYPE eResultType; + BOOL fHypothesis; + BOOL fProprietaryAutoPause; + ULONGLONG ullStreamPosStart; + ULONGLONG ullStreamPosEnd; + SPGRAMMARHANDLE hGrammar; + ULONG ulSizeEngineData; + void *pvEngineData; + ISpPhraseBuilder *pPhrase; + SPPHRASEALT *aPhraseAlts; + ULONG ulNumAlts; + } SPRECORESULTINFO; + +typedef +enum SPWORDINFOOPT + { SPWIO_NONE = 0, + SPWIO_WANT_TEXT = 1 + } SPWORDINFOOPT; + +typedef +enum SPRULEINFOOPT + { SPRIO_NONE = 0 + } SPRULEINFOOPT; + +typedef struct SPPARSEINFO + { + ULONG cbSize; + SPRULEHANDLE hRule; + ULONGLONG ullAudioStreamPosition; + ULONG ulAudioSize; + ULONG cTransitions; + SPPATHENTRY *pPath; + GUID SREngineID; + ULONG ulSREnginePrivateDataSize; + const BYTE *pSREnginePrivateData; + BOOL fHypothesis; + } SPPARSEINFO; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0350_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0350_v0_0_s_ifspec; + +#ifndef __ISpSREngineSite_INTERFACE_DEFINED__ +#define __ISpSREngineSite_INTERFACE_DEFINED__ + +/* interface ISpSREngineSite */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpSREngineSite; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3B414AEC-720C-4883-B9EF-178CD394FB3A") + ISpSREngineSite : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Read( + /* [in] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead) = 0; + + virtual HRESULT STDMETHODCALLTYPE DataAvailable( + ULONG *pcb) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBufferNotifySize( + /* [in] */ ULONG cbSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE ParseFromTransitions( + /* [in] */ const SPPARSEINFO *pParseInfo, + /* [out] */ ISpPhraseBuilder **ppNewPhrase) = 0; + + virtual HRESULT STDMETHODCALLTYPE Recognition( + /* [in] */ const SPRECORESULTINFO *pResultInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE AddEvent( + /* [in] */ const SPEVENT *pEvent, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE Synchronize( + /* [in] */ ULONGLONG ullProcessedThruPos) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetWordInfo( + /* [out][in] */ SPWORDENTRY *pWordEntry, + /* [in] */ SPWORDINFOOPT Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetWordClientContext( + SPWORDHANDLE hWord, + void *pvClientContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetRuleInfo( + /* [out][in] */ SPRULEENTRY *pRuleEntry, + /* [in] */ SPRULEINFOOPT Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRuleClientContext( + SPRULEHANDLE hRule, + void *pvClientContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetStateInfo( + SPSTATEHANDLE hState, + SPSTATEINFO *pStateInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetResource( + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTransitionProperty( + /* [in] */ SPTRANSITIONID ID, + /* [out] */ SPTRANSITIONPROPERTY **ppCoMemProperty) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsAlternate( + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ SPRULEHANDLE hAltRule) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetMaxAlternates( + /* [in] */ SPRULEHANDLE hRule, + /* [out] */ ULONG *pulNumAlts) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetContextMaxAlternates( + /* [in] */ SPRECOCONTEXTHANDLE hContext, + /* [out] */ ULONG *pulNumAlts) = 0; + + virtual HRESULT STDMETHODCALLTYPE UpdateRecoPos( + /* [in] */ ULONGLONG ullCurrentRecoPos) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpSREngineSiteVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpSREngineSite * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpSREngineSite * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpSREngineSite * This); + + HRESULT ( STDMETHODCALLTYPE *Read )( + ISpSREngineSite * This, + /* [in] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + HRESULT ( STDMETHODCALLTYPE *DataAvailable )( + ISpSREngineSite * This, + ULONG *pcb); + + HRESULT ( STDMETHODCALLTYPE *SetBufferNotifySize )( + ISpSREngineSite * This, + /* [in] */ ULONG cbSize); + + HRESULT ( STDMETHODCALLTYPE *ParseFromTransitions )( + ISpSREngineSite * This, + /* [in] */ const SPPARSEINFO *pParseInfo, + /* [out] */ ISpPhraseBuilder **ppNewPhrase); + + HRESULT ( STDMETHODCALLTYPE *Recognition )( + ISpSREngineSite * This, + /* [in] */ const SPRECORESULTINFO *pResultInfo); + + HRESULT ( STDMETHODCALLTYPE *AddEvent )( + ISpSREngineSite * This, + /* [in] */ const SPEVENT *pEvent, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext); + + HRESULT ( STDMETHODCALLTYPE *Synchronize )( + ISpSREngineSite * This, + /* [in] */ ULONGLONG ullProcessedThruPos); + + HRESULT ( STDMETHODCALLTYPE *GetWordInfo )( + ISpSREngineSite * This, + /* [out][in] */ SPWORDENTRY *pWordEntry, + /* [in] */ SPWORDINFOOPT Options); + + HRESULT ( STDMETHODCALLTYPE *SetWordClientContext )( + ISpSREngineSite * This, + SPWORDHANDLE hWord, + void *pvClientContext); + + HRESULT ( STDMETHODCALLTYPE *GetRuleInfo )( + ISpSREngineSite * This, + /* [out][in] */ SPRULEENTRY *pRuleEntry, + /* [in] */ SPRULEINFOOPT Options); + + HRESULT ( STDMETHODCALLTYPE *SetRuleClientContext )( + ISpSREngineSite * This, + SPRULEHANDLE hRule, + void *pvClientContext); + + HRESULT ( STDMETHODCALLTYPE *GetStateInfo )( + ISpSREngineSite * This, + SPSTATEHANDLE hState, + SPSTATEINFO *pStateInfo); + + HRESULT ( STDMETHODCALLTYPE *GetResource )( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource); + + HRESULT ( STDMETHODCALLTYPE *GetTransitionProperty )( + ISpSREngineSite * This, + /* [in] */ SPTRANSITIONID ID, + /* [out] */ SPTRANSITIONPROPERTY **ppCoMemProperty); + + HRESULT ( STDMETHODCALLTYPE *IsAlternate )( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ SPRULEHANDLE hAltRule); + + HRESULT ( STDMETHODCALLTYPE *GetMaxAlternates )( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [out] */ ULONG *pulNumAlts); + + HRESULT ( STDMETHODCALLTYPE *GetContextMaxAlternates )( + ISpSREngineSite * This, + /* [in] */ SPRECOCONTEXTHANDLE hContext, + /* [out] */ ULONG *pulNumAlts); + + HRESULT ( STDMETHODCALLTYPE *UpdateRecoPos )( + ISpSREngineSite * This, + /* [in] */ ULONGLONG ullCurrentRecoPos); + + END_INTERFACE + } ISpSREngineSiteVtbl; + + interface ISpSREngineSite + { + CONST_VTBL struct ISpSREngineSiteVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpSREngineSite_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpSREngineSite_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpSREngineSite_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpSREngineSite_Read(This,pv,cb,pcbRead) \ + (This)->lpVtbl -> Read(This,pv,cb,pcbRead) + +#define ISpSREngineSite_DataAvailable(This,pcb) \ + (This)->lpVtbl -> DataAvailable(This,pcb) + +#define ISpSREngineSite_SetBufferNotifySize(This,cbSize) \ + (This)->lpVtbl -> SetBufferNotifySize(This,cbSize) + +#define ISpSREngineSite_ParseFromTransitions(This,pParseInfo,ppNewPhrase) \ + (This)->lpVtbl -> ParseFromTransitions(This,pParseInfo,ppNewPhrase) + +#define ISpSREngineSite_Recognition(This,pResultInfo) \ + (This)->lpVtbl -> Recognition(This,pResultInfo) + +#define ISpSREngineSite_AddEvent(This,pEvent,hSAPIRecoContext) \ + (This)->lpVtbl -> AddEvent(This,pEvent,hSAPIRecoContext) + +#define ISpSREngineSite_Synchronize(This,ullProcessedThruPos) \ + (This)->lpVtbl -> Synchronize(This,ullProcessedThruPos) + +#define ISpSREngineSite_GetWordInfo(This,pWordEntry,Options) \ + (This)->lpVtbl -> GetWordInfo(This,pWordEntry,Options) + +#define ISpSREngineSite_SetWordClientContext(This,hWord,pvClientContext) \ + (This)->lpVtbl -> SetWordClientContext(This,hWord,pvClientContext) + +#define ISpSREngineSite_GetRuleInfo(This,pRuleEntry,Options) \ + (This)->lpVtbl -> GetRuleInfo(This,pRuleEntry,Options) + +#define ISpSREngineSite_SetRuleClientContext(This,hRule,pvClientContext) \ + (This)->lpVtbl -> SetRuleClientContext(This,hRule,pvClientContext) + +#define ISpSREngineSite_GetStateInfo(This,hState,pStateInfo) \ + (This)->lpVtbl -> GetStateInfo(This,hState,pStateInfo) + +#define ISpSREngineSite_GetResource(This,hRule,pszResourceName,ppCoMemResource) \ + (This)->lpVtbl -> GetResource(This,hRule,pszResourceName,ppCoMemResource) + +#define ISpSREngineSite_GetTransitionProperty(This,ID,ppCoMemProperty) \ + (This)->lpVtbl -> GetTransitionProperty(This,ID,ppCoMemProperty) + +#define ISpSREngineSite_IsAlternate(This,hRule,hAltRule) \ + (This)->lpVtbl -> IsAlternate(This,hRule,hAltRule) + +#define ISpSREngineSite_GetMaxAlternates(This,hRule,pulNumAlts) \ + (This)->lpVtbl -> GetMaxAlternates(This,hRule,pulNumAlts) + +#define ISpSREngineSite_GetContextMaxAlternates(This,hContext,pulNumAlts) \ + (This)->lpVtbl -> GetContextMaxAlternates(This,hContext,pulNumAlts) + +#define ISpSREngineSite_UpdateRecoPos(This,ullCurrentRecoPos) \ + (This)->lpVtbl -> UpdateRecoPos(This,ullCurrentRecoPos) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_Read_Proxy( + ISpSREngineSite * This, + /* [in] */ void *pv, + /* [in] */ ULONG cb, + /* [out] */ ULONG *pcbRead); + + +void __RPC_STUB ISpSREngineSite_Read_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_DataAvailable_Proxy( + ISpSREngineSite * This, + ULONG *pcb); + + +void __RPC_STUB ISpSREngineSite_DataAvailable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_SetBufferNotifySize_Proxy( + ISpSREngineSite * This, + /* [in] */ ULONG cbSize); + + +void __RPC_STUB ISpSREngineSite_SetBufferNotifySize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_ParseFromTransitions_Proxy( + ISpSREngineSite * This, + /* [in] */ const SPPARSEINFO *pParseInfo, + /* [out] */ ISpPhraseBuilder **ppNewPhrase); + + +void __RPC_STUB ISpSREngineSite_ParseFromTransitions_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_Recognition_Proxy( + ISpSREngineSite * This, + /* [in] */ const SPRECORESULTINFO *pResultInfo); + + +void __RPC_STUB ISpSREngineSite_Recognition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_AddEvent_Proxy( + ISpSREngineSite * This, + /* [in] */ const SPEVENT *pEvent, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext); + + +void __RPC_STUB ISpSREngineSite_AddEvent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_Synchronize_Proxy( + ISpSREngineSite * This, + /* [in] */ ULONGLONG ullProcessedThruPos); + + +void __RPC_STUB ISpSREngineSite_Synchronize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetWordInfo_Proxy( + ISpSREngineSite * This, + /* [out][in] */ SPWORDENTRY *pWordEntry, + /* [in] */ SPWORDINFOOPT Options); + + +void __RPC_STUB ISpSREngineSite_GetWordInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_SetWordClientContext_Proxy( + ISpSREngineSite * This, + SPWORDHANDLE hWord, + void *pvClientContext); + + +void __RPC_STUB ISpSREngineSite_SetWordClientContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetRuleInfo_Proxy( + ISpSREngineSite * This, + /* [out][in] */ SPRULEENTRY *pRuleEntry, + /* [in] */ SPRULEINFOOPT Options); + + +void __RPC_STUB ISpSREngineSite_GetRuleInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_SetRuleClientContext_Proxy( + ISpSREngineSite * This, + SPRULEHANDLE hRule, + void *pvClientContext); + + +void __RPC_STUB ISpSREngineSite_SetRuleClientContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetStateInfo_Proxy( + ISpSREngineSite * This, + SPSTATEHANDLE hState, + SPSTATEINFO *pStateInfo); + + +void __RPC_STUB ISpSREngineSite_GetStateInfo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetResource_Proxy( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ const WCHAR *pszResourceName, + /* [out] */ WCHAR **ppCoMemResource); + + +void __RPC_STUB ISpSREngineSite_GetResource_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetTransitionProperty_Proxy( + ISpSREngineSite * This, + /* [in] */ SPTRANSITIONID ID, + /* [out] */ SPTRANSITIONPROPERTY **ppCoMemProperty); + + +void __RPC_STUB ISpSREngineSite_GetTransitionProperty_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_IsAlternate_Proxy( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [in] */ SPRULEHANDLE hAltRule); + + +void __RPC_STUB ISpSREngineSite_IsAlternate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetMaxAlternates_Proxy( + ISpSREngineSite * This, + /* [in] */ SPRULEHANDLE hRule, + /* [out] */ ULONG *pulNumAlts); + + +void __RPC_STUB ISpSREngineSite_GetMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_GetContextMaxAlternates_Proxy( + ISpSREngineSite * This, + /* [in] */ SPRECOCONTEXTHANDLE hContext, + /* [out] */ ULONG *pulNumAlts); + + +void __RPC_STUB ISpSREngineSite_GetContextMaxAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngineSite_UpdateRecoPos_Proxy( + ISpSREngineSite * This, + /* [in] */ ULONGLONG ullCurrentRecoPos); + + +void __RPC_STUB ISpSREngineSite_UpdateRecoPos_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpSREngineSite_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0351 */ +/* [local] */ + +typedef +enum SPPROPSRC + { SPPROPSRC_RECO_INST = 0, + SPPROPSRC_RECO_CTX = SPPROPSRC_RECO_INST + 1, + SPPROPSRC_RECO_GRAMMAR = SPPROPSRC_RECO_CTX + 1 + } SPPROPSRC; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0351_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0351_v0_0_s_ifspec; + +#ifndef __ISpSREngine_INTERFACE_DEFINED__ +#define __ISpSREngine_INTERFACE_DEFINED__ + +/* interface ISpSREngine */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpSREngine; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2F472991-854B-4465-B613-FBAFB3AD8ED8") + ISpSREngine : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetSite( + /* [in] */ ISpSREngineSite *pSite) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInputAudioFormat( + /* [in] */ const GUID *pguidSourceFormatId, + /* [in] */ const WAVEFORMATEX *pSourceWaveFormatEx, + /* [out] */ GUID *pguidDesiredFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemDesiredWaveFormatEx) = 0; + + virtual HRESULT STDMETHODCALLTYPE RecognizeStream( + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ HANDLE hRequestSync, + /* [in] */ HANDLE hDataAvailable, + /* [in] */ HANDLE hExit, + /* [in] */ BOOL fNewAudioStream, + /* [in] */ BOOL fRealTimeAudio, + /* [in] */ ISpObjectToken *pAudioObjectToken) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetRecoProfile( + ISpObjectToken *pProfile) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnCreateGrammar( + /* [in] */ void *pvEngineRecoContext, + /* [in] */ SPGRAMMARHANDLE hSAPIGrammar, + /* [out] */ void **ppvEngineGrammarContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnDeleteGrammar( + /* [in] */ void *pvEngineGrammar) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadProprietaryGrammar( + /* [in] */ void *pvEngineGrammar, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataParam, + /* [in] */ ULONG ulDataSize, + /* [in] */ SPLOADOPTIONS Options) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnloadProprietaryGrammar( + /* [in] */ void *pvEngineGrammar) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetProprietaryRuleState( + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszName, + /* [in] */ void *pReserved, + /* [in] */ SPRULESTATE NewState, + /* [out] */ ULONG *pcRulesChanged) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetProprietaryRuleIdState( + /* [in] */ void *pvEngineGrammar, + /* [in] */ DWORD dwRuleId, + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE LoadSLM( + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszTopicName) = 0; + + virtual HRESULT STDMETHODCALLTYPE UnloadSLM( + /* [in] */ void *pvEngineGrammar) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetSLMState( + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPRULESTATE NewState) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetWordSequenceData( + /* [in] */ void *pvEngineGrammar, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTextSelection( + /* [in] */ void *pvEngineGrammar, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsPronounceable( + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnCreateRecoContext( + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext, + /* [out] */ void **ppvEngineContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE OnDeleteRecoContext( + /* [in] */ void *pvEngineContext) = 0; + + virtual HRESULT STDMETHODCALLTYPE PrivateCall( + /* [in] */ void *pvEngineContext, + /* [out][in] */ PVOID pCallFrame, + /* [in] */ ULONG ulCallFrameSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAdaptationData( + /* [in] */ void *pvEngineContext, + const WCHAR *pAdaptationData, + const ULONG cch) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPropertyNum( + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyNum( + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *lValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPropertyString( + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPropertyString( + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetGrammarState( + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPGRAMMARSTATE eGrammarState) = 0; + + virtual HRESULT STDMETHODCALLTYPE WordNotify( + SPCFGNOTIFY Action, + ULONG cWords, + const SPWORDENTRY *pWords) = 0; + + virtual HRESULT STDMETHODCALLTYPE RuleNotify( + SPCFGNOTIFY Action, + ULONG cRules, + const SPRULEENTRY *pRules) = 0; + + virtual HRESULT STDMETHODCALLTYPE PrivateCallEx( + /* [in] */ void *pvEngineContext, + /* [in] */ const void *pInCallFrame, + /* [in] */ ULONG ulInCallFrameSize, + /* [out] */ void **ppvCoMemResponse, + /* [out] */ ULONG *pulResponseSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetContextState( + /* [in] */ void *pvEngineContext, + /* [in] */ SPCONTEXTSTATE eContextState) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpSREngineVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpSREngine * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpSREngine * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpSREngine * This); + + HRESULT ( STDMETHODCALLTYPE *SetSite )( + ISpSREngine * This, + /* [in] */ ISpSREngineSite *pSite); + + HRESULT ( STDMETHODCALLTYPE *GetInputAudioFormat )( + ISpSREngine * This, + /* [in] */ const GUID *pguidSourceFormatId, + /* [in] */ const WAVEFORMATEX *pSourceWaveFormatEx, + /* [out] */ GUID *pguidDesiredFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemDesiredWaveFormatEx); + + HRESULT ( STDMETHODCALLTYPE *RecognizeStream )( + ISpSREngine * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ HANDLE hRequestSync, + /* [in] */ HANDLE hDataAvailable, + /* [in] */ HANDLE hExit, + /* [in] */ BOOL fNewAudioStream, + /* [in] */ BOOL fRealTimeAudio, + /* [in] */ ISpObjectToken *pAudioObjectToken); + + HRESULT ( STDMETHODCALLTYPE *SetRecoProfile )( + ISpSREngine * This, + ISpObjectToken *pProfile); + + HRESULT ( STDMETHODCALLTYPE *OnCreateGrammar )( + ISpSREngine * This, + /* [in] */ void *pvEngineRecoContext, + /* [in] */ SPGRAMMARHANDLE hSAPIGrammar, + /* [out] */ void **ppvEngineGrammarContext); + + HRESULT ( STDMETHODCALLTYPE *OnDeleteGrammar )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + HRESULT ( STDMETHODCALLTYPE *LoadProprietaryGrammar )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataParam, + /* [in] */ ULONG ulDataSize, + /* [in] */ SPLOADOPTIONS Options); + + HRESULT ( STDMETHODCALLTYPE *UnloadProprietaryGrammar )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + HRESULT ( STDMETHODCALLTYPE *SetProprietaryRuleState )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszName, + /* [in] */ void *pReserved, + /* [in] */ SPRULESTATE NewState, + /* [out] */ ULONG *pcRulesChanged); + + HRESULT ( STDMETHODCALLTYPE *SetProprietaryRuleIdState )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ DWORD dwRuleId, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *LoadSLM )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszTopicName); + + HRESULT ( STDMETHODCALLTYPE *UnloadSLM )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + HRESULT ( STDMETHODCALLTYPE *SetSLMState )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPRULESTATE NewState); + + HRESULT ( STDMETHODCALLTYPE *SetWordSequenceData )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *SetTextSelection )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + HRESULT ( STDMETHODCALLTYPE *IsPronounceable )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable); + + HRESULT ( STDMETHODCALLTYPE *OnCreateRecoContext )( + ISpSREngine * This, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext, + /* [out] */ void **ppvEngineContext); + + HRESULT ( STDMETHODCALLTYPE *OnDeleteRecoContext )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext); + + HRESULT ( STDMETHODCALLTYPE *PrivateCall )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [out][in] */ PVOID pCallFrame, + /* [in] */ ULONG ulCallFrameSize); + + HRESULT ( STDMETHODCALLTYPE *SetAdaptationData )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + const WCHAR *pAdaptationData, + const ULONG cch); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyNum )( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyNum )( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *lValue); + + HRESULT ( STDMETHODCALLTYPE *SetPropertyString )( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + HRESULT ( STDMETHODCALLTYPE *GetPropertyString )( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + HRESULT ( STDMETHODCALLTYPE *SetGrammarState )( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPGRAMMARSTATE eGrammarState); + + HRESULT ( STDMETHODCALLTYPE *WordNotify )( + ISpSREngine * This, + SPCFGNOTIFY Action, + ULONG cWords, + const SPWORDENTRY *pWords); + + HRESULT ( STDMETHODCALLTYPE *RuleNotify )( + ISpSREngine * This, + SPCFGNOTIFY Action, + ULONG cRules, + const SPRULEENTRY *pRules); + + HRESULT ( STDMETHODCALLTYPE *PrivateCallEx )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [in] */ const void *pInCallFrame, + /* [in] */ ULONG ulInCallFrameSize, + /* [out] */ void **ppvCoMemResponse, + /* [out] */ ULONG *pulResponseSize); + + HRESULT ( STDMETHODCALLTYPE *SetContextState )( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [in] */ SPCONTEXTSTATE eContextState); + + END_INTERFACE + } ISpSREngineVtbl; + + interface ISpSREngine + { + CONST_VTBL struct ISpSREngineVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpSREngine_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpSREngine_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpSREngine_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpSREngine_SetSite(This,pSite) \ + (This)->lpVtbl -> SetSite(This,pSite) + +#define ISpSREngine_GetInputAudioFormat(This,pguidSourceFormatId,pSourceWaveFormatEx,pguidDesiredFormatId,ppCoMemDesiredWaveFormatEx) \ + (This)->lpVtbl -> GetInputAudioFormat(This,pguidSourceFormatId,pSourceWaveFormatEx,pguidDesiredFormatId,ppCoMemDesiredWaveFormatEx) + +#define ISpSREngine_RecognizeStream(This,rguidFmtId,pWaveFormatEx,hRequestSync,hDataAvailable,hExit,fNewAudioStream,fRealTimeAudio,pAudioObjectToken) \ + (This)->lpVtbl -> RecognizeStream(This,rguidFmtId,pWaveFormatEx,hRequestSync,hDataAvailable,hExit,fNewAudioStream,fRealTimeAudio,pAudioObjectToken) + +#define ISpSREngine_SetRecoProfile(This,pProfile) \ + (This)->lpVtbl -> SetRecoProfile(This,pProfile) + +#define ISpSREngine_OnCreateGrammar(This,pvEngineRecoContext,hSAPIGrammar,ppvEngineGrammarContext) \ + (This)->lpVtbl -> OnCreateGrammar(This,pvEngineRecoContext,hSAPIGrammar,ppvEngineGrammarContext) + +#define ISpSREngine_OnDeleteGrammar(This,pvEngineGrammar) \ + (This)->lpVtbl -> OnDeleteGrammar(This,pvEngineGrammar) + +#define ISpSREngine_LoadProprietaryGrammar(This,pvEngineGrammar,rguidParam,pszStringParam,pvDataParam,ulDataSize,Options) \ + (This)->lpVtbl -> LoadProprietaryGrammar(This,pvEngineGrammar,rguidParam,pszStringParam,pvDataParam,ulDataSize,Options) + +#define ISpSREngine_UnloadProprietaryGrammar(This,pvEngineGrammar) \ + (This)->lpVtbl -> UnloadProprietaryGrammar(This,pvEngineGrammar) + +#define ISpSREngine_SetProprietaryRuleState(This,pvEngineGrammar,pszName,pReserved,NewState,pcRulesChanged) \ + (This)->lpVtbl -> SetProprietaryRuleState(This,pvEngineGrammar,pszName,pReserved,NewState,pcRulesChanged) + +#define ISpSREngine_SetProprietaryRuleIdState(This,pvEngineGrammar,dwRuleId,NewState) \ + (This)->lpVtbl -> SetProprietaryRuleIdState(This,pvEngineGrammar,dwRuleId,NewState) + +#define ISpSREngine_LoadSLM(This,pvEngineGrammar,pszTopicName) \ + (This)->lpVtbl -> LoadSLM(This,pvEngineGrammar,pszTopicName) + +#define ISpSREngine_UnloadSLM(This,pvEngineGrammar) \ + (This)->lpVtbl -> UnloadSLM(This,pvEngineGrammar) + +#define ISpSREngine_SetSLMState(This,pvEngineGrammar,NewState) \ + (This)->lpVtbl -> SetSLMState(This,pvEngineGrammar,NewState) + +#define ISpSREngine_SetWordSequenceData(This,pvEngineGrammar,pText,cchText,pInfo) \ + (This)->lpVtbl -> SetWordSequenceData(This,pvEngineGrammar,pText,cchText,pInfo) + +#define ISpSREngine_SetTextSelection(This,pvEngineGrammar,pInfo) \ + (This)->lpVtbl -> SetTextSelection(This,pvEngineGrammar,pInfo) + +#define ISpSREngine_IsPronounceable(This,pvEngineGrammar,pszWord,pWordPronounceable) \ + (This)->lpVtbl -> IsPronounceable(This,pvEngineGrammar,pszWord,pWordPronounceable) + +#define ISpSREngine_OnCreateRecoContext(This,hSAPIRecoContext,ppvEngineContext) \ + (This)->lpVtbl -> OnCreateRecoContext(This,hSAPIRecoContext,ppvEngineContext) + +#define ISpSREngine_OnDeleteRecoContext(This,pvEngineContext) \ + (This)->lpVtbl -> OnDeleteRecoContext(This,pvEngineContext) + +#define ISpSREngine_PrivateCall(This,pvEngineContext,pCallFrame,ulCallFrameSize) \ + (This)->lpVtbl -> PrivateCall(This,pvEngineContext,pCallFrame,ulCallFrameSize) + +#define ISpSREngine_SetAdaptationData(This,pvEngineContext,pAdaptationData,cch) \ + (This)->lpVtbl -> SetAdaptationData(This,pvEngineContext,pAdaptationData,cch) + +#define ISpSREngine_SetPropertyNum(This,eSrc,pvSrcObj,pName,lValue) \ + (This)->lpVtbl -> SetPropertyNum(This,eSrc,pvSrcObj,pName,lValue) + +#define ISpSREngine_GetPropertyNum(This,eSrc,pvSrcObj,pName,lValue) \ + (This)->lpVtbl -> GetPropertyNum(This,eSrc,pvSrcObj,pName,lValue) + +#define ISpSREngine_SetPropertyString(This,eSrc,pvSrcObj,pName,pValue) \ + (This)->lpVtbl -> SetPropertyString(This,eSrc,pvSrcObj,pName,pValue) + +#define ISpSREngine_GetPropertyString(This,eSrc,pvSrcObj,pName,ppCoMemValue) \ + (This)->lpVtbl -> GetPropertyString(This,eSrc,pvSrcObj,pName,ppCoMemValue) + +#define ISpSREngine_SetGrammarState(This,pvEngineGrammar,eGrammarState) \ + (This)->lpVtbl -> SetGrammarState(This,pvEngineGrammar,eGrammarState) + +#define ISpSREngine_WordNotify(This,Action,cWords,pWords) \ + (This)->lpVtbl -> WordNotify(This,Action,cWords,pWords) + +#define ISpSREngine_RuleNotify(This,Action,cRules,pRules) \ + (This)->lpVtbl -> RuleNotify(This,Action,cRules,pRules) + +#define ISpSREngine_PrivateCallEx(This,pvEngineContext,pInCallFrame,ulInCallFrameSize,ppvCoMemResponse,pulResponseSize) \ + (This)->lpVtbl -> PrivateCallEx(This,pvEngineContext,pInCallFrame,ulInCallFrameSize,ppvCoMemResponse,pulResponseSize) + +#define ISpSREngine_SetContextState(This,pvEngineContext,eContextState) \ + (This)->lpVtbl -> SetContextState(This,pvEngineContext,eContextState) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetSite_Proxy( + ISpSREngine * This, + /* [in] */ ISpSREngineSite *pSite); + + +void __RPC_STUB ISpSREngine_SetSite_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_GetInputAudioFormat_Proxy( + ISpSREngine * This, + /* [in] */ const GUID *pguidSourceFormatId, + /* [in] */ const WAVEFORMATEX *pSourceWaveFormatEx, + /* [out] */ GUID *pguidDesiredFormatId, + /* [out] */ WAVEFORMATEX **ppCoMemDesiredWaveFormatEx); + + +void __RPC_STUB ISpSREngine_GetInputAudioFormat_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_RecognizeStream_Proxy( + ISpSREngine * This, + /* [in] */ REFGUID rguidFmtId, + /* [in] */ const WAVEFORMATEX *pWaveFormatEx, + /* [in] */ HANDLE hRequestSync, + /* [in] */ HANDLE hDataAvailable, + /* [in] */ HANDLE hExit, + /* [in] */ BOOL fNewAudioStream, + /* [in] */ BOOL fRealTimeAudio, + /* [in] */ ISpObjectToken *pAudioObjectToken); + + +void __RPC_STUB ISpSREngine_RecognizeStream_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetRecoProfile_Proxy( + ISpSREngine * This, + ISpObjectToken *pProfile); + + +void __RPC_STUB ISpSREngine_SetRecoProfile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_OnCreateGrammar_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineRecoContext, + /* [in] */ SPGRAMMARHANDLE hSAPIGrammar, + /* [out] */ void **ppvEngineGrammarContext); + + +void __RPC_STUB ISpSREngine_OnCreateGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_OnDeleteGrammar_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + +void __RPC_STUB ISpSREngine_OnDeleteGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_LoadProprietaryGrammar_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ REFGUID rguidParam, + /* [string][in] */ const WCHAR *pszStringParam, + /* [in] */ const void *pvDataParam, + /* [in] */ ULONG ulDataSize, + /* [in] */ SPLOADOPTIONS Options); + + +void __RPC_STUB ISpSREngine_LoadProprietaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_UnloadProprietaryGrammar_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + +void __RPC_STUB ISpSREngine_UnloadProprietaryGrammar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetProprietaryRuleState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszName, + /* [in] */ void *pReserved, + /* [in] */ SPRULESTATE NewState, + /* [out] */ ULONG *pcRulesChanged); + + +void __RPC_STUB ISpSREngine_SetProprietaryRuleState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetProprietaryRuleIdState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ DWORD dwRuleId, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpSREngine_SetProprietaryRuleIdState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_LoadSLM_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszTopicName); + + +void __RPC_STUB ISpSREngine_LoadSLM_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_UnloadSLM_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar); + + +void __RPC_STUB ISpSREngine_UnloadSLM_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetSLMState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPRULESTATE NewState); + + +void __RPC_STUB ISpSREngine_SetSLMState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetWordSequenceData_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ const WCHAR *pText, + /* [in] */ ULONG cchText, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + +void __RPC_STUB ISpSREngine_SetWordSequenceData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetTextSelection_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ const SPTEXTSELECTIONINFO *pInfo); + + +void __RPC_STUB ISpSREngine_SetTextSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_IsPronounceable_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [string][in] */ const WCHAR *pszWord, + /* [out] */ SPWORDPRONOUNCEABLE *pWordPronounceable); + + +void __RPC_STUB ISpSREngine_IsPronounceable_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_OnCreateRecoContext_Proxy( + ISpSREngine * This, + /* [in] */ SPRECOCONTEXTHANDLE hSAPIRecoContext, + /* [out] */ void **ppvEngineContext); + + +void __RPC_STUB ISpSREngine_OnCreateRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_OnDeleteRecoContext_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext); + + +void __RPC_STUB ISpSREngine_OnDeleteRecoContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_PrivateCall_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [out][in] */ PVOID pCallFrame, + /* [in] */ ULONG ulCallFrameSize); + + +void __RPC_STUB ISpSREngine_PrivateCall_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetAdaptationData_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + const WCHAR *pAdaptationData, + const ULONG cch); + + +void __RPC_STUB ISpSREngine_SetAdaptationData_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetPropertyNum_Proxy( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ LONG lValue); + + +void __RPC_STUB ISpSREngine_SetPropertyNum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_GetPropertyNum_Proxy( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ LONG *lValue); + + +void __RPC_STUB ISpSREngine_GetPropertyNum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetPropertyString_Proxy( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [in] */ const WCHAR *pValue); + + +void __RPC_STUB ISpSREngine_SetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_GetPropertyString_Proxy( + ISpSREngine * This, + /* [in] */ SPPROPSRC eSrc, + /* [in] */ void *pvSrcObj, + /* [in] */ const WCHAR *pName, + /* [out] */ WCHAR **ppCoMemValue); + + +void __RPC_STUB ISpSREngine_GetPropertyString_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetGrammarState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineGrammar, + /* [in] */ SPGRAMMARSTATE eGrammarState); + + +void __RPC_STUB ISpSREngine_SetGrammarState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_WordNotify_Proxy( + ISpSREngine * This, + SPCFGNOTIFY Action, + ULONG cWords, + const SPWORDENTRY *pWords); + + +void __RPC_STUB ISpSREngine_WordNotify_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_RuleNotify_Proxy( + ISpSREngine * This, + SPCFGNOTIFY Action, + ULONG cRules, + const SPRULEENTRY *pRules); + + +void __RPC_STUB ISpSREngine_RuleNotify_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_PrivateCallEx_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [in] */ const void *pInCallFrame, + /* [in] */ ULONG ulInCallFrameSize, + /* [out] */ void **ppvCoMemResponse, + /* [out] */ ULONG *pulResponseSize); + + +void __RPC_STUB ISpSREngine_PrivateCallEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSREngine_SetContextState_Proxy( + ISpSREngine * This, + /* [in] */ void *pvEngineContext, + /* [in] */ SPCONTEXTSTATE eContextState); + + +void __RPC_STUB ISpSREngine_SetContextState_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpSREngine_INTERFACE_DEFINED__ */ + + +/* interface __MIDL_itf_sapiddk_0352 */ +/* [local] */ + +typedef struct tagSPPHRASEALTREQUEST + { + ULONG ulStartElement; + ULONG cElements; + ULONG ulRequestAltCount; + void *pvResultExtra; + ULONG cbResultExtra; + ISpPhrase *pPhrase; + ISpRecoContext *pRecoContext; + } SPPHRASEALTREQUEST; + + + +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0352_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_sapiddk_0352_v0_0_s_ifspec; + +#ifndef __ISpSRAlternates_INTERFACE_DEFINED__ +#define __ISpSRAlternates_INTERFACE_DEFINED__ + +/* interface ISpSRAlternates */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID_ISpSRAlternates; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("FECE8294-2BE1-408f-8E68-2DE377092F0E") + ISpSRAlternates : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetAlternates( + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [out] */ SPPHRASEALT **ppAlts, + /* [out] */ ULONG *pcAlts) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [in] */ SPPHRASEALT *pAlt, + /* [out] */ void **ppvResultExtra, + /* [out] */ ULONG *pcbResultExtra) = 0; + + }; + +#else /* C style interface */ + + typedef struct ISpSRAlternatesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISpSRAlternates * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISpSRAlternates * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISpSRAlternates * This); + + HRESULT ( STDMETHODCALLTYPE *GetAlternates )( + ISpSRAlternates * This, + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [out] */ SPPHRASEALT **ppAlts, + /* [out] */ ULONG *pcAlts); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + ISpSRAlternates * This, + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [in] */ SPPHRASEALT *pAlt, + /* [out] */ void **ppvResultExtra, + /* [out] */ ULONG *pcbResultExtra); + + END_INTERFACE + } ISpSRAlternatesVtbl; + + interface ISpSRAlternates + { + CONST_VTBL struct ISpSRAlternatesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISpSRAlternates_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ISpSRAlternates_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ISpSRAlternates_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ISpSRAlternates_GetAlternates(This,pAltRequest,ppAlts,pcAlts) \ + (This)->lpVtbl -> GetAlternates(This,pAltRequest,ppAlts,pcAlts) + +#define ISpSRAlternates_Commit(This,pAltRequest,pAlt,ppvResultExtra,pcbResultExtra) \ + (This)->lpVtbl -> Commit(This,pAltRequest,pAlt,ppvResultExtra,pcbResultExtra) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE ISpSRAlternates_GetAlternates_Proxy( + ISpSRAlternates * This, + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [out] */ SPPHRASEALT **ppAlts, + /* [out] */ ULONG *pcAlts); + + +void __RPC_STUB ISpSRAlternates_GetAlternates_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE ISpSRAlternates_Commit_Proxy( + ISpSRAlternates * This, + /* [in] */ SPPHRASEALTREQUEST *pAltRequest, + /* [in] */ SPPHRASEALT *pAlt, + /* [out] */ void **ppvResultExtra, + /* [out] */ ULONG *pcbResultExtra); + + +void __RPC_STUB ISpSRAlternates_Commit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ISpSRAlternates_INTERFACE_DEFINED__ */ + + +#ifndef ___ISpPrivateEngineCall_INTERFACE_DEFINED__ +#define ___ISpPrivateEngineCall_INTERFACE_DEFINED__ + +/* interface _ISpPrivateEngineCall */ +/* [local][unique][helpstring][uuid][object] */ + + +EXTERN_C const IID IID__ISpPrivateEngineCall; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8E7C791E-4467-11d3-9723-00C04F72DB08") + _ISpPrivateEngineCall : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE CallEngine( + /* [out][in] */ void *pCallFrame, + /* [in] */ ULONG ulCallFrameSize) = 0; + + virtual HRESULT STDMETHODCALLTYPE CallEngineEx( + /* [in] */ const void *pInFrame, + /* [in] */ ULONG ulInFrameSize, + /* [out] */ void **ppCoMemOutFrame, + /* [out] */ ULONG *pulOutFrameSize) = 0; + + }; + +#else /* C style interface */ + + typedef struct _ISpPrivateEngineCallVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + _ISpPrivateEngineCall * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + _ISpPrivateEngineCall * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + _ISpPrivateEngineCall * This); + + HRESULT ( STDMETHODCALLTYPE *CallEngine )( + _ISpPrivateEngineCall * This, + /* [out][in] */ void *pCallFrame, + /* [in] */ ULONG ulCallFrameSize); + + HRESULT ( STDMETHODCALLTYPE *CallEngineEx )( + _ISpPrivateEngineCall * This, + /* [in] */ const void *pInFrame, + /* [in] */ ULONG ulInFrameSize, + /* [out] */ void **ppCoMemOutFrame, + /* [out] */ ULONG *pulOutFrameSize); + + END_INTERFACE + } _ISpPrivateEngineCallVtbl; + + interface _ISpPrivateEngineCall + { + CONST_VTBL struct _ISpPrivateEngineCallVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define _ISpPrivateEngineCall_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define _ISpPrivateEngineCall_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define _ISpPrivateEngineCall_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define _ISpPrivateEngineCall_CallEngine(This,pCallFrame,ulCallFrameSize) \ + (This)->lpVtbl -> CallEngine(This,pCallFrame,ulCallFrameSize) + +#define _ISpPrivateEngineCall_CallEngineEx(This,pInFrame,ulInFrameSize,ppCoMemOutFrame,pulOutFrameSize) \ + (This)->lpVtbl -> CallEngineEx(This,pInFrame,ulInFrameSize,ppCoMemOutFrame,pulOutFrameSize) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +HRESULT STDMETHODCALLTYPE _ISpPrivateEngineCall_CallEngine_Proxy( + _ISpPrivateEngineCall * This, + /* [out][in] */ void *pCallFrame, + /* [in] */ ULONG ulCallFrameSize); + + +void __RPC_STUB _ISpPrivateEngineCall_CallEngine_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +HRESULT STDMETHODCALLTYPE _ISpPrivateEngineCall_CallEngineEx_Proxy( + _ISpPrivateEngineCall * This, + /* [in] */ const void *pInFrame, + /* [in] */ ULONG ulInFrameSize, + /* [out] */ void **ppCoMemOutFrame, + /* [out] */ ULONG *pulOutFrameSize); + + +void __RPC_STUB _ISpPrivateEngineCall_CallEngineEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* ___ISpPrivateEngineCall_INTERFACE_DEFINED__ */ + + + +#ifndef __SpeechDDKLib_LIBRARY_DEFINED__ +#define __SpeechDDKLib_LIBRARY_DEFINED__ + +/* library SpeechDDKLib */ +/* [version][uuid][helpstring] */ + + +EXTERN_C const IID LIBID_SpeechDDKLib; + +EXTERN_C const CLSID CLSID_SpDataKey; + +#ifdef __cplusplus + +class DECLSPEC_UUID("D9F6EE60-58C9-458b-88E1-2F908FD7F87C") +SpDataKey; +#endif + +EXTERN_C const CLSID CLSID_SpObjectTokenEnum; + +#ifdef __cplusplus + +class DECLSPEC_UUID("3918D75F-0ACB-41f2-B733-92AA15BCECF6") +SpObjectTokenEnum; +#endif + +EXTERN_C const CLSID CLSID_SpPhraseBuilder; + +#ifdef __cplusplus + +class DECLSPEC_UUID("777B6BBD-2FF2-11d3-88FE-00C04F8EF9B5") +SpPhraseBuilder; +#endif + +EXTERN_C const CLSID CLSID_SpITNProcessor; + +#ifdef __cplusplus + +class DECLSPEC_UUID("12D73610-A1C9-11d3-BC90-00C04F72DF9F") +SpITNProcessor; +#endif + +EXTERN_C const CLSID CLSID_SpGrammarCompiler; + +#ifdef __cplusplus + +class DECLSPEC_UUID("B1E29D59-A675-11D2-8302-00C04F8EE6C0") +SpGrammarCompiler; +#endif + +EXTERN_C const CLSID CLSID_SpGramCompBackend; + +#ifdef __cplusplus + +class DECLSPEC_UUID("DA93E903-C843-11D2-A084-00C04F8EF9B5") +SpGramCompBackend; +#endif +#endif /* __SpeechDDKLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/sp/src/utils/sapi51/Include/spcollec.h b/sp/src/utils/sapi51/Include/spcollec.h new file mode 100644 index 00000000..faee6437 --- /dev/null +++ b/sp/src/utils/sapi51/Include/spcollec.h @@ -0,0 +1,1432 @@ +/***************************************************************************** +* SPCollec.h * +*------------* +* This header file contains the SAPI5 collection class templates. These +* are a modified version of the MFC template classes without the dependencies. +*----------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#ifndef SPCollec_h +#define SPCollec_h + +#ifndef _INC_LIMITS +#include +#endif + +#ifndef _INC_STRING +#include +#endif + +#ifndef _INC_STDLIB +#include +#endif + +#ifndef _WIN32_WCE +#ifndef _INC_SEARCH +#include +#endif +#endif + +///////////////////////////////////////////////////////////////////////////// +#define SPASSERT_VALID( a ) // This doesn't do anything right now + +typedef void* SPLISTPOS; +typedef DWORD SPLISTHANDLE; + +#define SP_BEFORE_START_POSITION ((void*)-1L) + +inline BOOL SPIsValidAddress(const void* lp, UINT nBytes, BOOL bReadWrite) +{ + // simple version using Win-32 APIs for pointer validation. + return (lp != NULL && !IsBadReadPtr(lp, nBytes) && + (!bReadWrite || !IsBadWritePtr((LPVOID)lp, nBytes))); +} + +///////////////////////////////////////////////////////////////////////////// +// global helpers (can be overridden) +template +inline HRESULT SPConstructElements(TYPE* pElements, int nCount) +{ + HRESULT hr = S_OK; + SPDBG_ASSERT( nCount == 0 || + SPIsValidAddress( pElements, nCount * sizeof(TYPE), TRUE ) ); + + // default is bit-wise zero initialization + memset((void*)pElements, 0, nCount * sizeof(TYPE)); + return hr; +} + +template +inline void SPDestructElements(TYPE* pElements, int nCount) +{ + SPDBG_ASSERT( ( nCount == 0 || + SPIsValidAddress( pElements, nCount * sizeof(TYPE), TRUE ) ) ); + pElements; // not used + nCount; // not used + + // default does nothing +} + +template +inline HRESULT SPCopyElements(TYPE* pDest, const TYPE* pSrc, int nCount) +{ + HRESULT hr = S_OK; + SPDBG_ASSERT( ( nCount == 0 || + SPIsValidAddress( pDest, nCount * sizeof(TYPE), TRUE )) ); + SPDBG_ASSERT( ( nCount == 0 || + SPIsValidAddress( pSrc, nCount * sizeof(TYPE), FALSE )) ); + + // default is bit-wise copy + memcpy(pDest, pSrc, nCount * sizeof(TYPE)); + return hr; +} + +template +BOOL SPCompareElements(const TYPE* pElement1, const ARG_TYPE* pElement2) +{ + SPDBG_ASSERT( SPIsValidAddress( pElement1, sizeof(TYPE), FALSE ) ); + SPDBG_ASSERT( SPIsValidAddress( pElement2, sizeof(ARG_TYPE), FALSE ) ); + return *pElement1 == *pElement2; +} + +template +inline UINT SPHashKey(ARG_KEY key) +{ + // default identity hash - works for most primitive values + return ((UINT)(void*)(DWORD)key) >> 4; +} + +///////////////////////////////////////////////////////////////////////////// +// CSPPlex + +struct CSPPlex // warning variable length structure +{ + CSPPlex* pNext; + UINT nMax; + UINT nCur; + /* BYTE data[maxNum*elementSize]; */ + void* data() { return this+1; } + + static CSPPlex* PASCAL Create( CSPPlex*& pHead, UINT nMax, UINT cbElement ) + { + CSPPlex* p = (CSPPlex*) new BYTE[sizeof(CSPPlex) + nMax * cbElement]; + SPDBG_ASSERT(p); + p->nMax = nMax; + p->nCur = 0; + p->pNext = pHead; + pHead = p; // change head (adds in reverse order for simplicity) + return p; + } + + void FreeDataChain() + { + CSPPlex* p = this; + while (p != NULL) + { + BYTE* bytes = (BYTE*) p; + CSPPlex* pNext = p->pNext; + delete[] bytes; + p = pNext; + } + } +}; + + +///////////////////////////////////////////////////////////////////////////// +// CSPArray + +template +class CSPArray +{ +public: +// Construction + CSPArray(); + +// Attributes + int GetSize() const; + int GetUpperBound() const; + HRESULT SetSize(int nNewSize, int nGrowBy = -1); + +// Operations + // Clean up + void FreeExtra(); + void RemoveAll(); + + // Accessing elements + TYPE GetAt(int nIndex) const; + void SetAt(int nIndex, ARG_TYPE newElement); + TYPE& ElementAt(int nIndex); + + // Direct Access to the element data (may return NULL) + const TYPE* GetData() const; + TYPE* GetData(); + + // Potentially growing the array + HRESULT SetAtGrow(int nIndex, ARG_TYPE newElement); + int Add(ARG_TYPE newElement); + int Append(const CSPArray& src); + HRESULT Copy(const CSPArray& src); + + // overloaded operator helpers + TYPE operator[](int nIndex) const; + TYPE& operator[](int nIndex); + + // Operations that move elements around + HRESULT InsertAt(int nIndex, ARG_TYPE newElement, int nCount = 1); + void RemoveAt(int nIndex, int nCount = 1); + HRESULT InsertAt(int nStartIndex, CSPArray* pNewArray); + void Sort(int (__cdecl *compare )(const void *elem1, const void *elem2 )); + +// Implementation +protected: + TYPE* m_pData; // the actual array of data + int m_nSize; // # of elements (upperBound - 1) + int m_nMaxSize; // max allocated + int m_nGrowBy; // grow amount + +public: + ~CSPArray(); +#ifdef _DEBUG +// void Dump(CDumpContext&) const; + void AssertValid() const; +#endif +}; + +///////////////////////////////////////////////////////////////////////////// +// CSPArray inline functions + +template +inline int CSPArray::GetSize() const + { return m_nSize; } +template +inline int CSPArray::GetUpperBound() const + { return m_nSize-1; } +template +inline void CSPArray::RemoveAll() + { SetSize(0, -1); } +template +inline TYPE CSPArray::GetAt(int nIndex) const + { SPDBG_ASSERT( (nIndex >= 0 && nIndex < m_nSize) ); + return m_pData[nIndex]; } +template +inline void CSPArray::SetAt(int nIndex, ARG_TYPE newElement) + { SPDBG_ASSERT( (nIndex >= 0 && nIndex < m_nSize) ); + m_pData[nIndex] = newElement; } +template +inline TYPE& CSPArray::ElementAt(int nIndex) + { SPDBG_ASSERT( (nIndex >= 0 && nIndex < m_nSize) ); + return m_pData[nIndex]; } +template +inline const TYPE* CSPArray::GetData() const + { return (const TYPE*)m_pData; } +template +inline TYPE* CSPArray::GetData() + { return (TYPE*)m_pData; } +template +inline int CSPArray::Add(ARG_TYPE newElement) + { int nIndex = m_nSize; + SetAtGrow(nIndex, newElement); + return nIndex; } +template +inline TYPE CSPArray::operator[](int nIndex) const + { return GetAt(nIndex); } +template +inline TYPE& CSPArray::operator[](int nIndex) + { return ElementAt(nIndex); } + +///////////////////////////////////////////////////////////////////////////// +// CSPArray out-of-line functions + +template +CSPArray::CSPArray() +{ + m_pData = NULL; + m_nSize = m_nMaxSize = m_nGrowBy = 0; +} + +template +CSPArray::~CSPArray() +{ + SPASSERT_VALID( this ); + + if (m_pData != NULL) + { + SPDestructElements(m_pData, m_nSize); + delete[] (BYTE*)m_pData; + } +} + +template +HRESULT CSPArray::SetSize(int nNewSize, int nGrowBy) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nNewSize >= 0 ); + HRESULT hr = S_OK; + + if (nGrowBy != -1) + m_nGrowBy = nGrowBy; // set new size + + if (nNewSize == 0) + { + // shrink to nothing + if (m_pData != NULL) + { + SPDestructElements(m_pData, m_nSize); + delete[] (BYTE*)m_pData; + m_pData = NULL; + } + m_nSize = m_nMaxSize = 0; + } + else if (m_pData == NULL) + { + // create one with exact size +#ifdef SIZE_T_MAX + SPDBG_ASSERT( nNewSize <= SIZE_T_MAX/sizeof(TYPE) ); // no overflow +#endif + m_pData = (TYPE*) new BYTE[nNewSize * sizeof(TYPE)]; + if( m_pData ) + { + hr = SPConstructElements(m_pData, nNewSize); + if( SUCCEEDED( hr ) ) + { + m_nSize = m_nMaxSize = nNewSize; + } + else + { + delete[] (BYTE*)m_pData; + m_pData = NULL; + } + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if (nNewSize <= m_nMaxSize) + { + // it fits + if (nNewSize > m_nSize) + { + // initialize the new elements + hr = SPConstructElements(&m_pData[m_nSize], nNewSize-m_nSize); + } + else if (m_nSize > nNewSize) + { + // destroy the old elements + SPDestructElements(&m_pData[nNewSize], m_nSize-nNewSize); + } + + if( SUCCEEDED( hr ) ) + { + m_nSize = nNewSize; + } + } + else + { + // otherwise, grow array + int nGrowBy = m_nGrowBy; + if (nGrowBy == 0) + { + // heuristically determe growth when nGrowBy == 0 + // (this avoids heap fragmentation in many situations) + nGrowBy = min(1024, max(4, m_nSize / 8)); + } + int nNewMax; + if (nNewSize < m_nMaxSize + nGrowBy) + nNewMax = m_nMaxSize + nGrowBy; // granularity + else + nNewMax = nNewSize; // no slush + + SPDBG_ASSERT( nNewMax >= m_nMaxSize ); // no wrap around +#ifdef SIZE_T_MAX + SPDBG_ASSERT( nNewMax <= SIZE_T_MAX/sizeof(TYPE) ); // no overflow +#endif + TYPE* pNewData = (TYPE*) new BYTE[nNewMax * sizeof(TYPE)]; + + if( pNewData ) + { + // copy new data from old + memcpy(pNewData, m_pData, m_nSize * sizeof(TYPE)); + + // construct remaining elements + SPDBG_ASSERT( nNewSize > m_nSize ); + hr = SPConstructElements(&pNewData[m_nSize], nNewSize-m_nSize); + + // get rid of old stuff (note: no destructors called) + delete[] (BYTE*)m_pData; + m_pData = pNewData; + m_nSize = nNewSize; + m_nMaxSize = nNewMax; + } + else + { + hr = E_OUTOFMEMORY; + } + } + return hr; +} + +template +int CSPArray::Append(const CSPArray& src) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( this != &src ); // cannot append to itself + + int nOldSize = m_nSize; + HRESULT hr = SetSize(m_nSize + src.m_nSize); + if( SUCCEEDED( hr ) ) + { + hr = SPCopyElements(m_pData + nOldSize, src.m_pData, src.m_nSize); + } + return ( SUCCEEDED( hr ) )?(nOldSize):(-1); +} + +template +HRESULT CSPArray::Copy(const CSPArray& src) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( this != &src ); // cannot copy to itself + + HRESULT hr = SetSize(src.m_nSize); + if( SUCCEEDED( hr ) ) + { + hr = SPCopyElements(m_pData, src.m_pData, src.m_nSize); + } + return hr; +} + +template +void CSPArray::FreeExtra() +{ + SPASSERT_VALID( this ); + + if (m_nSize != m_nMaxSize) + { + // shrink to desired size +#ifdef SIZE_T_MAX + SPDBG_ASSERT( m_nSize <= SIZE_T_MAX/sizeof(TYPE)); // no overflow +#endif + TYPE* pNewData = NULL; + if (m_nSize != 0) + { + pNewData = (TYPE*) new BYTE[m_nSize * sizeof(TYPE)]; + SPDBG_ASSERT(pNewData); + // copy new data from old + memcpy(pNewData, m_pData, m_nSize * sizeof(TYPE)); + } + + // get rid of old stuff (note: no destructors called) + delete[] (BYTE*)m_pData; + m_pData = pNewData; + m_nMaxSize = m_nSize; + } +} + +template +HRESULT CSPArray::SetAtGrow(int nIndex, ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nIndex >= 0 ); + HRESULT hr = S_OK; + + if (nIndex >= m_nSize) + { + hr = SetSize(nIndex+1, -1); + } + + if( SUCCEEDED( hr ) ) + { + m_pData[nIndex] = newElement; + } + return hr; +} + +template +HRESULT CSPArray::InsertAt(int nIndex, ARG_TYPE newElement, int nCount /*=1*/) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nIndex >= 0 ); // will expand to meet need + SPDBG_ASSERT( nCount > 0 ); // zero or negative size not allowed + HRESULT hr = S_OK; + + if (nIndex >= m_nSize) + { + // adding after the end of the array + hr = SetSize(nIndex + nCount, -1); // grow so nIndex is valid + } + else + { + // inserting in the middle of the array + int nOldSize = m_nSize; + hr = SetSize(m_nSize + nCount, -1); // grow it to new size + if( SUCCEEDED( hr ) ) + { + // shift old data up to fill gap + memmove(&m_pData[nIndex+nCount], &m_pData[nIndex], + (nOldSize-nIndex) * sizeof(TYPE)); + + // re-init slots we copied from + hr = SPConstructElements(&m_pData[nIndex], nCount); + } + } + + // insert new value in the gap + if( SUCCEEDED( hr ) ) + { + SPDBG_ASSERT( nIndex + nCount <= m_nSize ); + while (nCount--) + m_pData[nIndex++] = newElement; + } + return hr; +} + +template +void CSPArray::RemoveAt(int nIndex, int nCount) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nIndex >= 0 ); + SPDBG_ASSERT( nCount >= 0 ); + SPDBG_ASSERT( nIndex + nCount <= m_nSize ); + + // just remove a range + int nMoveCount = m_nSize - (nIndex + nCount); + SPDestructElements(&m_pData[nIndex], nCount); + if (nMoveCount) + memcpy(&m_pData[nIndex], &m_pData[nIndex + nCount], + nMoveCount * sizeof(TYPE)); + m_nSize -= nCount; +} + +template +HRESULT CSPArray::InsertAt(int nStartIndex, CSPArray* pNewArray) +{ + SPASSERT_VALID( this ); + SPASSERT_VALID( pNewArray ); + SPDBG_ASSERT( nStartIndex >= 0 ); + HRESULT hr = S_OK; + + if (pNewArray->GetSize() > 0) + { + hr = InsertAt(nStartIndex, pNewArray->GetAt(0), pNewArray->GetSize()); + for (int i = 0; SUCCEEDED( hr )&& (i < pNewArray->GetSize()); i++) + { + SetAt(nStartIndex + i, pNewArray->GetAt(i)); + } + } + return hr; +} + +template +void CSPArray::Sort(int (__cdecl *compare )(const void *elem1, const void *elem2 )) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_pData != NULL ); + + qsort( m_pData, m_nSize, sizeof(TYPE), compare ); +} + +#ifdef _DEBUG +template +void CSPArray::AssertValid() const +{ + if (m_pData == NULL) + { + SPDBG_ASSERT( m_nSize == 0 ); + SPDBG_ASSERT( m_nMaxSize == 0 ); + } + else + { + SPDBG_ASSERT( m_nSize >= 0 ); + SPDBG_ASSERT( m_nMaxSize >= 0 ); + SPDBG_ASSERT( m_nSize <= m_nMaxSize ); + SPDBG_ASSERT( SPIsValidAddress(m_pData, m_nMaxSize * sizeof(TYPE), TRUE ) ); + } +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CSPList + +template +class CSPList +{ +protected: + struct CNode + { + CNode* pNext; + CNode* pPrev; + TYPE data; + }; +public: + +// Construction + CSPList(int nBlockSize = 10); + +// Attributes (head and tail) + // count of elements + int GetCount() const; + BOOL IsEmpty() const; + + // peek at head or tail + TYPE& GetHead(); + TYPE GetHead() const; + TYPE& GetTail(); + TYPE GetTail() const; + +// Operations + // get head or tail (and remove it) - don't call on empty list ! + TYPE RemoveHead(); + TYPE RemoveTail(); + + // add before head or after tail + SPLISTPOS AddHead(ARG_TYPE newElement); + SPLISTPOS AddTail(ARG_TYPE newElement); + + // add another list of elements before head or after tail + void AddHead(CSPList* pNewList); + void AddTail(CSPList* pNewList); + + // remove all elements + void RemoveAll(); + + // iteration + SPLISTPOS GetHeadPosition() const; + SPLISTPOS GetTailPosition() const; + TYPE& GetNext(SPLISTPOS& rPosition); // return *Position++ + TYPE GetNext(SPLISTPOS& rPosition) const; // return *Position++ + TYPE& GetPrev(SPLISTPOS& rPosition); // return *Position-- + TYPE GetPrev(SPLISTPOS& rPosition) const; // return *Position-- + + // getting/modifying an element at a given position + TYPE& GetAt(SPLISTPOS position); + TYPE GetAt(SPLISTPOS position) const; + void SetAt(SPLISTPOS pos, ARG_TYPE newElement); + void RemoveAt(SPLISTPOS position); + + // inserting before or after a given position + SPLISTPOS InsertBefore(SPLISTPOS position, ARG_TYPE newElement); + SPLISTPOS InsertAfter(SPLISTPOS position, ARG_TYPE newElement); + + // helper functions (note: O(n) speed) + SPLISTPOS Find(ARG_TYPE searchValue, SPLISTPOS startAfter = NULL) const; + // defaults to starting at the HEAD, return NULL if not found + SPLISTPOS FindIndex(int nIndex) const; + // get the 'nIndex'th element (may return NULL) + +// Implementation +protected: + CNode* m_pNodeHead; + CNode* m_pNodeTail; + int m_nCount; + CNode* m_pNodeFree; + struct CSPPlex* m_pBlocks; + int m_nBlockSize; + + CNode* NewNode(CNode*, CNode*); + void FreeNode(CNode*); + +public: + ~CSPList(); +#ifdef _DEBUG + void AssertValid() const; +#endif +}; + +///////////////////////////////////////////////////////////////////////////// +// CSPList inline functions + +template +inline int CSPList::GetCount() const + { return m_nCount; } +template +inline BOOL CSPList::IsEmpty() const + { return m_nCount == 0; } +template +inline TYPE& CSPList::GetHead() + { SPDBG_ASSERT( m_pNodeHead != NULL ); + return m_pNodeHead->data; } +template +inline TYPE CSPList::GetHead() const + { SPDBG_ASSERT( m_pNodeHead != NULL ); + return m_pNodeHead->data; } +template +inline TYPE& CSPList::GetTail() + { SPDBG_ASSERT( m_pNodeTail != NULL ); + return m_pNodeTail->data; } +template +inline TYPE CSPList::GetTail() const + { SPDBG_ASSERT( m_pNodeTail != NULL ); + return m_pNodeTail->data; } +template +inline SPLISTPOS CSPList::GetHeadPosition() const + { return (SPLISTPOS) m_pNodeHead; } +template +inline SPLISTPOS CSPList::GetTailPosition() const + { return (SPLISTPOS) m_pNodeTail; } +template +inline TYPE& CSPList::GetNext(SPLISTPOS& rPosition) // return *Position++ + { CNode* pNode = (CNode*) rPosition; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + rPosition = (SPLISTPOS) pNode->pNext; + return pNode->data; } +template +inline TYPE CSPList::GetNext(SPLISTPOS& rPosition) const // return *Position++ + { CNode* pNode = (CNode*) rPosition; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + rPosition = (SPLISTPOS) pNode->pNext; + return pNode->data; } +template +inline TYPE& CSPList::GetPrev(SPLISTPOS& rPosition) // return *Position-- + { CNode* pNode = (CNode*) rPosition; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + rPosition = (SPLISTPOS) pNode->pPrev; + return pNode->data; } +template +inline TYPE CSPList::GetPrev(SPLISTPOS& rPosition) const // return *Position-- + { CNode* pNode = (CNode*) rPosition; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + rPosition = (SPLISTPOS) pNode->pPrev; + return pNode->data; } +template +inline TYPE& CSPList::GetAt(SPLISTPOS position) + { CNode* pNode = (CNode*) position; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + return pNode->data; } +template +inline TYPE CSPList::GetAt(SPLISTPOS position) const + { CNode* pNode = (CNode*) position; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + return pNode->data; } +template +inline void CSPList::SetAt(SPLISTPOS pos, ARG_TYPE newElement) + { CNode* pNode = (CNode*) pos; + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + pNode->data = newElement; } + +///////////////////////////////////////////////////////////////////////////// +// CSPList out-of-line functions + +template +CSPList::CSPList( int nBlockSize ) +{ + SPDBG_ASSERT( nBlockSize > 0 ); + + m_nCount = 0; + m_pNodeHead = m_pNodeTail = m_pNodeFree = NULL; + m_pBlocks = NULL; + m_nBlockSize = nBlockSize; +} + +template +void CSPList::RemoveAll() +{ + SPASSERT_VALID( this ); + + // destroy elements + CNode* pNode; + for (pNode = m_pNodeHead; pNode != NULL; pNode = pNode->pNext) + SPDestructElements(&pNode->data, 1); + + m_nCount = 0; + m_pNodeHead = m_pNodeTail = m_pNodeFree = NULL; + m_pBlocks->FreeDataChain(); + m_pBlocks = NULL; +} + +template +CSPList::~CSPList() +{ + RemoveAll(); + SPDBG_ASSERT( m_nCount == 0 ); +} + +///////////////////////////////////////////////////////////////////////////// +// Node helpers +// +// Implementation note: CNode's are stored in CSPPlex blocks and +// chained together. Free blocks are maintained in a singly linked list +// using the 'pNext' member of CNode with 'm_pNodeFree' as the head. +// Used blocks are maintained in a doubly linked list using both 'pNext' +// and 'pPrev' as links and 'm_pNodeHead' and 'm_pNodeTail' +// as the head/tail. +// +// We never free a CSPPlex block unless the List is destroyed or RemoveAll() +// is used - so the total number of CSPPlex blocks may grow large depending +// on the maximum past size of the list. +// + +template +CSPList::CNode* +CSPList::NewNode(CSPList::CNode* pPrev, CSPList::CNode* pNext) +{ + if (m_pNodeFree == NULL) + { + // add another block + CSPPlex* pNewBlock = CSPPlex::Create(m_pBlocks, m_nBlockSize,sizeof(CNode)); + + // chain them into free list + CNode* pNode = (CNode*) pNewBlock->data(); + // free in reverse order to make it easier to debug + pNode += m_nBlockSize - 1; + for (int i = m_nBlockSize-1; i >= 0; i--, pNode--) + { + pNode->pNext = m_pNodeFree; + m_pNodeFree = pNode; + } + } + + CSPList::CNode* pNode = m_pNodeFree; + if( pNode ) + { + if( SUCCEEDED( SPConstructElements(&pNode->data, 1) ) ) + { + m_pNodeFree = m_pNodeFree->pNext; + pNode->pPrev = pPrev; + pNode->pNext = pNext; + m_nCount++; + SPDBG_ASSERT( m_nCount > 0 ); // make sure we don't overflow + } + } + return pNode; +} + +template +void CSPList::FreeNode(CSPList::CNode* pNode) +{ + SPDestructElements(&pNode->data, 1); + pNode->pNext = m_pNodeFree; + m_pNodeFree = pNode; + m_nCount--; + SPDBG_ASSERT( m_nCount >= 0 ); // make sure we don't underflow +} + +template +SPLISTPOS CSPList::AddHead(ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + + CNode* pNewNode = NewNode(NULL, m_pNodeHead); + if( pNewNode ) + { + pNewNode->data = newElement; + if (m_pNodeHead != NULL) + m_pNodeHead->pPrev = pNewNode; + else + m_pNodeTail = pNewNode; + m_pNodeHead = pNewNode; + } + return (SPLISTPOS) pNewNode; +} + +template +SPLISTPOS CSPList::AddTail(ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + + CNode* pNewNode = NewNode(m_pNodeTail, NULL); + if( pNewNode ) + { + pNewNode->data = newElement; + if (m_pNodeTail != NULL) + m_pNodeTail->pNext = pNewNode; + else + m_pNodeHead = pNewNode; + m_pNodeTail = pNewNode; + } + return (SPLISTPOS) pNewNode; +} + +template +void CSPList::AddHead(CSPList* pNewList) +{ + SPASSERT_VALID( this ); + SPASSERT_VALID( pNewList ); + + // add a list of same elements to head (maintain order) + SPLISTPOS pos = pNewList->GetTailPosition(); + while (pos != NULL) + AddHead(pNewList->GetPrev(pos)); +} + +template +void CSPList::AddTail(CSPList* pNewList) +{ + SPASSERT_VALID( this ); + SPASSERT_VALID( pNewList ); + + // add a list of same elements + SPLISTPOS pos = pNewList->GetHeadPosition(); + while (pos != NULL) + AddTail(pNewList->GetNext(pos)); +} + +template +TYPE CSPList::RemoveHead() +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_pNodeHead != NULL ); // don't call on empty list !!! + SPDBG_ASSERT( SPIsValidAddress(m_pNodeHead, sizeof(CNode), TRUE ) ); + + CNode* pOldNode = m_pNodeHead; + TYPE returnValue = pOldNode->data; + + m_pNodeHead = pOldNode->pNext; + if (m_pNodeHead != NULL) + m_pNodeHead->pPrev = NULL; + else + m_pNodeTail = NULL; + FreeNode(pOldNode); + return returnValue; +} + +template +TYPE CSPList::RemoveTail() +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_pNodeTail != NULL ); // don't call on empty list !!! + SPDBG_ASSERT( SPIsValidAddress(m_pNodeTail, sizeof(CNode), TRUE ) ); + + CNode* pOldNode = m_pNodeTail; + TYPE returnValue = pOldNode->data; + + m_pNodeTail = pOldNode->pPrev; + if (m_pNodeTail != NULL) + m_pNodeTail->pNext = NULL; + else + m_pNodeHead = NULL; + FreeNode(pOldNode); + return returnValue; +} + +template +SPLISTPOS CSPList::InsertBefore(SPLISTPOS position, ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + + if (position == NULL) + return AddHead(newElement); // insert before nothing -> head of the list + + // Insert it before position + CNode* pOldNode = (CNode*) position; + CNode* pNewNode = NewNode(pOldNode->pPrev, pOldNode); + if( pNewNode ) + { + pNewNode->data = newElement; + + if (pOldNode->pPrev != NULL) + { + SPDBG_ASSERT( SPIsValidAddress(pOldNode->pPrev, sizeof(CNode), TRUE ) ); + pOldNode->pPrev->pNext = pNewNode; + } + else + { + SPDBG_ASSERT( pOldNode == m_pNodeHead ); + m_pNodeHead = pNewNode; + } + pOldNode->pPrev = pNewNode; + } + return (SPLISTPOS) pNewNode; +} + +template +SPLISTPOS CSPList::InsertAfter(SPLISTPOS position, ARG_TYPE newElement) +{ + SPASSERT_VALID( this ); + + if (position == NULL) + return AddTail(newElement); // insert after nothing -> tail of the list + + // Insert it before position + CNode* pOldNode = (CNode*) position; + SPDBG_ASSERT( SPIsValidAddress(pOldNode, sizeof(CNode), TRUE )); + CNode* pNewNode = NewNode(pOldNode, pOldNode->pNext); + if( pNewNode ) + { + pNewNode->data = newElement; + + if (pOldNode->pNext != NULL) + { + SPDBG_ASSERT( SPIsValidAddress(pOldNode->pNext, sizeof(CNode), TRUE )); + pOldNode->pNext->pPrev = pNewNode; + } + else + { + SPDBG_ASSERT( pOldNode == m_pNodeTail ); + m_pNodeTail = pNewNode; + } + pOldNode->pNext = pNewNode; + } + return (SPLISTPOS) pNewNode; +} + +template +void CSPList::RemoveAt(SPLISTPOS position) +{ + SPASSERT_VALID( this ); + + CNode* pOldNode = (CNode*) position; + SPDBG_ASSERT( SPIsValidAddress(pOldNode, sizeof(CNode), TRUE ) ); + + // remove pOldNode from list + if (pOldNode == m_pNodeHead) + { + m_pNodeHead = pOldNode->pNext; + } + else + { + SPDBG_ASSERT( SPIsValidAddress(pOldNode->pPrev, sizeof(CNode), TRUE ) ); + pOldNode->pPrev->pNext = pOldNode->pNext; + } + if (pOldNode == m_pNodeTail) + { + m_pNodeTail = pOldNode->pPrev; + } + else + { + SPDBG_ASSERT( SPIsValidAddress(pOldNode->pNext, sizeof(CNode), TRUE ) ); + pOldNode->pNext->pPrev = pOldNode->pPrev; + } + FreeNode(pOldNode); +} + +template +SPLISTPOS CSPList::FindIndex(int nIndex) const +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( nIndex >= 0 ); + + if (nIndex >= m_nCount) + return NULL; // went too far + + CNode* pNode = m_pNodeHead; + while (nIndex--) + { + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE )); + pNode = pNode->pNext; + } + return (SPLISTPOS) pNode; +} + +template +SPLISTPOS CSPList::Find(ARG_TYPE searchValue, SPLISTPOS startAfter) const +{ + SPASSERT_VALID( this ); + + CNode* pNode = (CNode*) startAfter; + if (pNode == NULL) + { + pNode = m_pNodeHead; // start at head + } + else + { + SPDBG_ASSERT( SPIsValidAddress(pNode, sizeof(CNode), TRUE ) ); + pNode = pNode->pNext; // start after the one specified + } + + for (; pNode != NULL; pNode = pNode->pNext) + if (SPCompareElements(&pNode->data, &searchValue)) + return (SPLISTPOS)pNode; + return NULL; +} + +#ifdef _DEBUG +template +void CSPList::AssertValid() const +{ + if (m_nCount == 0) + { + // empty list + SPDBG_ASSERT( m_pNodeHead == NULL ); + SPDBG_ASSERT( m_pNodeTail == NULL ); + } + else + { + // non-empty list + SPDBG_ASSERT( SPIsValidAddress(m_pNodeHead, sizeof(CNode), TRUE )); + SPDBG_ASSERT( SPIsValidAddress(m_pNodeTail, sizeof(CNode), TRUE )); + } +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CSPMap + +template +class CSPMap +{ +protected: + // Association + struct CAssoc + { + CAssoc* pNext; + UINT nHashValue; // needed for efficient iteration + KEY key; + VALUE value; + }; +public: +// Construction + CSPMap( int nBlockSize = 10 ); + +// Attributes + // number of elements + int GetCount() const; + BOOL IsEmpty() const; + + // Lookup + BOOL Lookup(ARG_KEY key, VALUE& rValue) const; + +// Operations + // Lookup and add if not there + VALUE& operator[](ARG_KEY key); + + // add a new (key, value) pair + void SetAt(ARG_KEY key, ARG_VALUE newValue); + + // removing existing (key, ?) pair + BOOL RemoveKey(ARG_KEY key); + void RemoveAll(); + + // iterating all (key, value) pairs + SPLISTPOS GetStartPosition() const; + void GetNextAssoc(SPLISTPOS& rNextPosition, KEY& rKey, VALUE& rValue) const; + + // advanced features for derived classes + UINT GetHashTableSize() const; + HRESULT InitHashTable(UINT hashSize, BOOL bAllocNow = TRUE); + +// Implementation +protected: + CAssoc** m_pHashTable; + UINT m_nHashTableSize; + int m_nCount; + CAssoc* m_pFreeList; + struct CSPPlex* m_pBlocks; + int m_nBlockSize; + + CAssoc* NewAssoc(); + void FreeAssoc(CAssoc*); + CAssoc* GetAssocAt(ARG_KEY, UINT&) const; + +public: + ~CSPMap(); +#ifdef _DEBUG +// void Dump(CDumpContext&) const; + void AssertValid() const; +#endif +}; + +///////////////////////////////////////////////////////////////////////////// +// CSPMap inline functions + +template +inline int CSPMap::GetCount() const + { return m_nCount; } +template +inline BOOL CSPMap::IsEmpty() const + { return m_nCount == 0; } +template +inline void CSPMap::SetAt(ARG_KEY key, ARG_VALUE newValue) + { (*this)[key] = newValue; } +template +inline SPLISTPOS CSPMap::GetStartPosition() const + { return (m_nCount == 0) ? NULL : SP_BEFORE_START_POSITION; } +template +inline UINT CSPMap::GetHashTableSize() const + { return m_nHashTableSize; } + +///////////////////////////////////////////////////////////////////////////// +// CSPMap out-of-line functions + +template +CSPMap::CSPMap( int nBlockSize ) +{ + SPDBG_ASSERT( nBlockSize > 0 ); + + m_pHashTable = NULL; + m_nHashTableSize = 17; // default size + m_nCount = 0; + m_pFreeList = NULL; + m_pBlocks = NULL; + m_nBlockSize = nBlockSize; +} + +template +HRESULT CSPMap::InitHashTable( + UINT nHashSize, BOOL bAllocNow) +// +// Used to force allocation of a hash table or to override the default +// hash table size of (which is fairly small) +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_nCount == 0 ); + SPDBG_ASSERT( nHashSize > 0 ); + HRESULT hr = S_OK; + + if (m_pHashTable != NULL) + { + // free hash table + delete[] m_pHashTable; + m_pHashTable = NULL; + } + + if (bAllocNow) + { + m_pHashTable = new CAssoc* [nHashSize]; + if( m_pHashTable ) + { + memset(m_pHashTable, 0, sizeof(CAssoc*) * nHashSize); + } + else + { + hr = E_OUTOFMEMORY; + } + } + + m_nHashTableSize = ( SUCCEEDED( hr ) )?(nHashSize):(0); + return hr; +} + +template +void CSPMap::RemoveAll() +{ + SPASSERT_VALID( this ); + + if (m_pHashTable != NULL) + { + // destroy elements (values and keys) + for (UINT nHash = 0; nHash < m_nHashTableSize; nHash++) + { + CAssoc* pAssoc; + for( pAssoc = m_pHashTable[nHash]; pAssoc != NULL; + pAssoc = pAssoc->pNext) + { + SPDestructElements(&pAssoc->value, 1); + SPDestructElements(&pAssoc->key, 1); + } + } + } + + // free hash table + delete[] m_pHashTable; + m_pHashTable = NULL; + + m_nCount = 0; + m_pFreeList = NULL; + m_pBlocks->FreeDataChain(); + m_pBlocks = NULL; +} + +template +CSPMap::~CSPMap() +{ + RemoveAll(); + SPDBG_ASSERT( m_nCount == 0 ); +} + +template +CSPMap::CAssoc* +CSPMap::NewAssoc() +{ + if (m_pFreeList == NULL) + { + // add another block + CSPPlex* newBlock = CSPPlex::Create(m_pBlocks, m_nBlockSize, sizeof(CSPMap::CAssoc)); + + if( newBlock ) + { + // chain them into free list + CSPMap::CAssoc* pAssoc = (CSPMap::CAssoc*) newBlock->data(); + // free in reverse order to make it easier to debug + pAssoc += m_nBlockSize - 1; + for (int i = m_nBlockSize-1; i >= 0; i--, pAssoc--) + { + pAssoc->pNext = m_pFreeList; + m_pFreeList = pAssoc; + } + } + } + + CSPMap::CAssoc* pAssoc = m_pFreeList; + if( pAssoc ) + { + if( SUCCEEDED( SPConstructElements(&pAssoc->key, 1 ) ) ) + { + if( SUCCEEDED( SPConstructElements(&pAssoc->value, 1 ) ) ) + { + m_pFreeList = m_pFreeList->pNext; + m_nCount++; + SPDBG_ASSERT( m_nCount > 0 ); // make sure we don't overflow + } + else + { + SPDestructElements( &pAssoc->key, 1 ); + } + } + else + { + pAssoc = NULL; + } + } + return pAssoc; +} + +template +void CSPMap::FreeAssoc(CSPMap::CAssoc* pAssoc) +{ + SPDestructElements(&pAssoc->value, 1); + SPDestructElements(&pAssoc->key, 1); + pAssoc->pNext = m_pFreeList; + m_pFreeList = pAssoc; + m_nCount--; + SPDBG_ASSERT( m_nCount >= 0 ); // make sure we don't underflow +} + +template +CSPMap::CAssoc* +CSPMap::GetAssocAt(ARG_KEY key, UINT& nHash) const +// find association (or return NULL) +{ + nHash = SPHashKey(key) % m_nHashTableSize; + + if (m_pHashTable == NULL) + return NULL; + + // see if it exists + CAssoc* pAssoc; + for (pAssoc = m_pHashTable[nHash]; pAssoc != NULL; pAssoc = pAssoc->pNext) + { + if (SPCompareElements(&pAssoc->key, &key)) + return pAssoc; + } + return NULL; +} + +template +BOOL CSPMap::Lookup(ARG_KEY key, VALUE& rValue) const +{ + SPASSERT_VALID( this ); + + UINT nHash; + CAssoc* pAssoc = GetAssocAt(key, nHash); + if (pAssoc == NULL) + return FALSE; // not in map + + rValue = pAssoc->value; + return TRUE; +} + +template +VALUE& CSPMap::operator[](ARG_KEY key) +{ + SPASSERT_VALID( this ); + HRESULT hr = S_OK; + static const CAssoc ErrAssoc = 0; + + UINT nHash; + CAssoc* pAssoc; + if ((pAssoc = GetAssocAt(key, nHash)) == NULL) + { + if( m_pHashTable == NULL ) + { + hr = InitHashTable(m_nHashTableSize); + } + + if( SUCCEEDED( hr ) ) + { + // it doesn't exist, add a new Association + pAssoc = NewAssoc(); + if( pAssoc ) + { + pAssoc->nHashValue = nHash; + pAssoc->key = key; + // 'pAssoc->value' is a constructed object, nothing more + + // put into hash table + pAssoc->pNext = m_pHashTable[nHash]; + m_pHashTable[nHash] = pAssoc; + } + else + { + pAssoc = &ErrAssoc; + } + } + } + return pAssoc->value; // return new reference +} + +template +BOOL CSPMap::RemoveKey(ARG_KEY key) +// remove key - return TRUE if removed +{ + SPASSERT_VALID( this ); + + if (m_pHashTable == NULL) + return FALSE; // nothing in the table + + CAssoc** ppAssocPrev; + ppAssocPrev = &m_pHashTable[SPHashKey(key) % m_nHashTableSize]; + + CAssoc* pAssoc; + for (pAssoc = *ppAssocPrev; pAssoc != NULL; pAssoc = pAssoc->pNext) + { + if (SPCompareElements(&pAssoc->key, &key)) + { + // remove it + *ppAssocPrev = pAssoc->pNext; // remove from list + FreeAssoc(pAssoc); + return TRUE; + } + ppAssocPrev = &pAssoc->pNext; + } + return FALSE; // not found +} + +template +void CSPMap::GetNextAssoc(SPLISTPOS& rNextPosition, + KEY& rKey, VALUE& rValue) const +{ + SPASSERT_VALID( this ); + SPDBG_ASSERT( m_pHashTable != NULL ); // never call on empty map + + CAssoc* pAssocRet = (CAssoc*)rNextPosition; + SPDBG_ASSERT( pAssocRet != NULL ); + + if (pAssocRet == (CAssoc*) SP_BEFORE_START_POSITION) + { + // find the first association + for (UINT nBucket = 0; nBucket < m_nHashTableSize; nBucket++) + if ((pAssocRet = m_pHashTable[nBucket]) != NULL) + break; + SPDBG_ASSERT( pAssocRet != NULL ); // must find something + } + + // find next association + SPDBG_ASSERT( SPIsValidAddress(pAssocRet, sizeof(CAssoc), TRUE )); + CAssoc* pAssocNext; + if ((pAssocNext = pAssocRet->pNext) == NULL) + { + // go to next bucket + for (UINT nBucket = pAssocRet->nHashValue + 1; + nBucket < m_nHashTableSize; nBucket++) + if ((pAssocNext = m_pHashTable[nBucket]) != NULL) + break; + } + + rNextPosition = (SPLISTPOS) pAssocNext; + + // fill in return data + rKey = pAssocRet->key; + rValue = pAssocRet->value; +} + +#ifdef _DEBUG +template +void CSPMap::AssertValid() const +{ + SPDBG_ASSERT( m_nHashTableSize > 0 ); + SPDBG_ASSERT( (m_nCount == 0 || m_pHashTable != NULL) ); + // non-empty map should have hash table +} +#endif //_DEBUG + +#endif //--- This must be the last line in the file diff --git a/sp/src/utils/sapi51/Include/spdebug.h b/sp/src/utils/sapi51/Include/spdebug.h new file mode 100644 index 00000000..da9a7ee9 --- /dev/null +++ b/sp/src/utils/sapi51/Include/spdebug.h @@ -0,0 +1,636 @@ +/******************************************************************************* +* SPDebug.h * +*-----------* +* Description: +* This header file contains debug output services for SAPI5 +*------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*******************************************************************************/ + +#pragma once + +#include +#include + +#ifdef ASSERT_WITH_STACK +#include "AssertWithStack.h" +#endif + +const TCHAR g_szSpDebugKey[] = _T("SPDebug"); +const TCHAR g_szSpDebugFuncTraceReportMode[] = _T("FuncTraceMode"); +const TCHAR g_szSpDebugFuncTraceReportFile[] = _T("FuncTraceFile"); +const TCHAR g_szSpDebugParamInfoReportMode[] = _T("ParamInfoMode"); +const TCHAR g_szSpDebugParamInfoReportFile[] = _T("ParamInfoFile"); +const TCHAR g_szSpDebugDumpInfoReportMode[] = _T("DumpInfoMode"); +const TCHAR g_szSpDebugDumpInfoReportFile[] = _T("DumpInfoFile"); +const TCHAR g_szSpDebugAssertReportMode[] = _T("AssertMode"); +const TCHAR g_szSpDebugAssertReportFile[] = _T("AssertFile"); +const TCHAR g_szSpDebugHRFailReportMode[] = _T("HRFailMode"); +const TCHAR g_szSpDebugHRFailReportFile[] = _T("HRFailFile"); + +const TCHAR g_szSpDebugAssertSettingsReReadEachTime[] = _T("AssertSettingsReReadEachTime"); +const TCHAR g_szSpDebugServerOnStart[] = _T("DebugServerOnStart"); +const TCHAR g_szSpDebugClientOnStart[] = _T("DebugClientOnStart"); + +const TCHAR g_szSpDebugLog[] = _T("c:\\spdebug.log"); + +#ifdef _DEBUG + +class CSpDebug +{ +public: + + CSpDebug() + { + m_mutex = NULL; + m_reportModePrev = -1; + m_hfilePrev = NULL; + Read(); + } + + ~CSpDebug() + { + if (m_mutex != NULL) + { + CloseHandle(m_mutex); + } + } + + BOOL FuncTrace(BOOL fEnter = TRUE) + { + return fEnter + ? Enter(_CRT_WARN, m_FuncTraceMode, m_szFuncTraceFile) + : Leave(); + } + + BOOL ParamInfo(BOOL fEnter = TRUE) + { + return fEnter + ? Enter(_CRT_WARN, m_ParamInfoMode, m_szParamInfoFile) + : Leave(); + } + + BOOL DumpInfo(BOOL fEnter = TRUE) + { + return fEnter + ? Enter(_CRT_WARN, m_DumpInfoMode, m_szDumpInfoFile) + : Leave(); + } + + BOOL Assert(BOOL fEnter = TRUE) + { + if (m_fAssertSettingsReReadEachTime) + Read(); + + return fEnter + ? Enter(_CRT_ASSERT, m_AssertMode, m_szAssertFile) + : Leave(); + } + + BOOL HRFail(BOOL fEnter = TRUE) + { + return fEnter + ? Enter(_CRT_WARN, m_HRFailMode, m_szHRFailFile) + : Leave(); + } + + BOOL DebugServerOnStart() + { + return m_fDebugServerOnStart; + } + + BOOL DebugClientOnStart() + { + return m_fDebugClientOnStart; + } + +private: + + void Read() + { + HKEY hkeyDebug; + RegCreateKeyEx( + HKEY_CLASSES_ROOT, + g_szSpDebugKey, + 0, + NULL, + 0, + KEY_READ | KEY_WRITE, + NULL, + &hkeyDebug, + NULL); + if (hkeyDebug == NULL) + { + RegCreateKeyEx( + HKEY_CLASSES_ROOT, + g_szSpDebugKey, + 0, + NULL, + 0, + KEY_READ, + NULL, + &hkeyDebug, + NULL); + } + + DWORD dw = sizeof(m_fAssertSettingsReReadEachTime); + if (RegQueryValueEx( + hkeyDebug, + g_szSpDebugAssertSettingsReReadEachTime, + NULL, + NULL, + LPBYTE(&m_fAssertSettingsReReadEachTime), + &dw) != ERROR_SUCCESS) + { + m_fAssertSettingsReReadEachTime = FALSE; + RegSetValueEx( + hkeyDebug, + g_szSpDebugAssertSettingsReReadEachTime, + NULL, + REG_DWORD, + LPBYTE(&m_fAssertSettingsReReadEachTime), + sizeof(m_fAssertSettingsReReadEachTime)); + } + + ReadFor( + hkeyDebug, + g_szSpDebugFuncTraceReportMode, + g_szSpDebugFuncTraceReportFile, + &m_FuncTraceMode, + m_szFuncTraceFile, + 0, + g_szSpDebugLog); + ReadFor( + hkeyDebug, + g_szSpDebugParamInfoReportMode, + g_szSpDebugParamInfoReportFile, + &m_ParamInfoMode, + m_szParamInfoFile, + 0, + g_szSpDebugLog); + ReadFor( + hkeyDebug, + g_szSpDebugDumpInfoReportMode, + g_szSpDebugDumpInfoReportFile, + &m_DumpInfoMode, + m_szDumpInfoFile, + _CRTDBG_MODE_DEBUG, + g_szSpDebugLog); + ReadFor( + hkeyDebug, + g_szSpDebugAssertReportMode, + g_szSpDebugAssertReportFile, + &m_AssertMode, + m_szAssertFile, + _CRTDBG_MODE_WNDW, + g_szSpDebugLog); + ReadFor( + hkeyDebug, + g_szSpDebugHRFailReportMode, + g_szSpDebugHRFailReportFile, + &m_HRFailMode, + m_szHRFailFile, + _CRTDBG_MODE_DEBUG, + g_szSpDebugLog); + + dw = sizeof(m_fDebugServerOnStart); + if (RegQueryValueEx( + hkeyDebug, + g_szSpDebugServerOnStart, + NULL, + NULL, + LPBYTE(&m_fDebugServerOnStart), + &dw) != ERROR_SUCCESS) + { + m_fDebugServerOnStart = FALSE; + RegSetValueEx( + hkeyDebug, + g_szSpDebugServerOnStart, + NULL, + REG_DWORD, + LPBYTE(&m_fDebugServerOnStart), + sizeof(m_fDebugServerOnStart)); + } + + dw = sizeof(m_fDebugClientOnStart); + if (RegQueryValueEx( + hkeyDebug, + g_szSpDebugClientOnStart, + NULL, + NULL, + LPBYTE(&m_fDebugClientOnStart), + &dw) != ERROR_SUCCESS) + { + m_fDebugClientOnStart = FALSE; + RegSetValueEx( + hkeyDebug, + g_szSpDebugClientOnStart, + NULL, + REG_DWORD, + LPBYTE(&m_fDebugClientOnStart), + sizeof(m_fDebugClientOnStart)); + } + + RegCloseKey(hkeyDebug); + } + + void ReadFor( + HKEY hkey, + const TCHAR * pszModeValueName, + const TCHAR * pszFileValueName, + DWORD * pdwModeValue, + TCHAR * pszFileValue, + DWORD dwDefaultModeValue, + const TCHAR * pszDefaultFileValue) + { + DWORD dw = sizeof(*pdwModeValue); + if (RegQueryValueEx( + hkey, + pszModeValueName, + NULL, + NULL, + LPBYTE(pdwModeValue), + &dw) != ERROR_SUCCESS) + { + *pdwModeValue = dwDefaultModeValue; + RegSetValueEx( + hkey, + pszModeValueName, + NULL, + REG_DWORD, + LPBYTE(pdwModeValue), + sizeof(*pdwModeValue)); + } + + dw = MAX_PATH; + if (RegQueryValueEx( + hkey, + pszFileValueName, + NULL, + NULL, + LPBYTE(pszFileValue), + &dw) != ERROR_SUCCESS) + { + _tcscpy(pszFileValue, pszDefaultFileValue); + RegSetValueEx( + hkey, + pszFileValueName, + NULL, + REG_SZ, + LPBYTE(pszFileValue), + MAX_PATH); + } + } + + BOOL Enter(int reportType, DWORD &reportMode, TCHAR * pszFile) + { + if (reportMode != 0) + { + // We'll hold the mutex, until the caller also calls Leave + if (m_mutex == NULL) + { + m_mutex = CreateMutex(NULL, FALSE, _T("SpDebug")); + } + WaitForSingleObject(m_mutex, INFINITE); + + m_reportType = reportType; + m_reportModePrev = _CrtSetReportMode(reportType, reportMode); + if (reportMode & _CRTDBG_MODE_FILE) + { + HANDLE hfile = CreateFile( + pszFile, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, + NULL, + OPEN_ALWAYS, + 0, + NULL); + SetFilePointer(hfile, 0, NULL, FILE_END); + m_hfilePrev = (_HFILE)_CrtSetReportFile(reportType, (_HFILE)hfile); + } + + return TRUE; + } + + return FALSE; + } + + BOOL Leave() + { + int reportMode = _CrtSetReportMode(m_reportType, m_reportModePrev); + if (reportMode & _CRTDBG_MODE_FILE) + { + CloseHandle((_HFILE)_CrtSetReportFile(m_reportType, (_HFILE)m_hfilePrev)); + } + + ReleaseMutex(m_mutex); + + return TRUE; + } + +private: + + HANDLE m_mutex; + + int m_reportType; + int m_reportModePrev; + _HFILE m_hfilePrev; + + BOOL m_fAssertSettingsReReadEachTime; + + DWORD m_FuncTraceMode; + TCHAR m_szFuncTraceFile[MAX_PATH + 1]; + DWORD m_ParamInfoMode; + TCHAR m_szParamInfoFile[MAX_PATH + 1]; + DWORD m_DumpInfoMode; + TCHAR m_szDumpInfoFile[MAX_PATH + 1]; + DWORD m_AssertMode; + TCHAR m_szAssertFile[MAX_PATH + 1]; + DWORD m_HRFailMode; + TCHAR m_szHRFailFile[MAX_PATH + 1]; + + BOOL m_fDebugServerOnStart; + BOOL m_fDebugClientOnStart; +}; + +inline CSpDebug *PSpDebug() +{ + static CSpDebug debug; + return &debug; +} + +class CSpFuncTrace +{ +public: + + CSpFuncTrace(PCHAR pFuncName) + { + m_pFuncName = pFuncName; + if (PSpDebug()->FuncTrace()) + { + _RPT1( _CRT_WARN, "\nEntering Function: %s\n", m_pFuncName ); + PSpDebug()->FuncTrace(FALSE); + } + } + + ~CSpFuncTrace() + { + if (PSpDebug()->FuncTrace()) + { + _RPT1( _CRT_WARN, "Leaving Function: %s\n", m_pFuncName ); + PSpDebug()->FuncTrace(FALSE); + } + } + +private: + + PCHAR m_pFuncName; +}; + +#endif // _DEBUG + +//=== User macros ============================================================== + +#ifdef _DEBUG + +#define SPDBG_FUNC(name) \ + CSpFuncTrace functrace(name) + +#if defined(ASSERT_WITH_STACK) && !defined(_WIN64) +#define SPDBG_REPORT_ON_FAIL(hr) \ + do \ + { \ + HRESULT _hr = (hr); \ + if (FAILED(_hr) && PSpDebug()->HRFail()) \ + { \ + SYSTEMTIME sysTime; \ + GetLocalTime(&sysTime); \ + CHAR pszHrWithTime[100]; \ + sprintf(pszHrWithTime, "%lX\n\n%d.%d.%d %02d:%02d:%02d", \ + _hr, \ + sysTime.wMonth,sysTime.wDay,sysTime.wYear, \ + sysTime.wHour,sysTime.wMinute,sysTime.wSecond); \ + PCHAR pszStack = \ + (PCHAR)_alloca( \ + cchMaxAssertStackLevelStringLen * \ + cfrMaxAssertStackLevels + 1); \ + GetStringFromStackLevels(0, 10, pszStack); \ + _RPT4(_CRT_WARN, \ + "%s(%d): Failed HR = %s\n\n%s\n", \ + __FILE__, \ + __LINE__, \ + pszHrWithTime, \ + pszStack); \ + PSpDebug()->HRFail(FALSE); \ + } \ + } while (0) +#else // ASSERT_WITH_STACK & !_WIN64 +#define SPDBG_REPORT_ON_FAIL(hr) \ + do \ + { \ + HRESULT _hr = (hr); \ + if (FAILED(_hr) && PSpDebug()->HRFail()) \ + { \ + _RPT3(_CRT_WARN, "%s(%d): Failed HR = %lX\n", __FILE__, __LINE__, (_hr) );\ + PSpDebug()->HRFail(FALSE); \ + } \ + } while (0) +#endif // ASSERT_WITH_STACK + +#define SPDBG_ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + if (PSpDebug()->Assert()) \ + { \ + _ASSERTE( expr ); \ + PSpDebug()->Assert(FALSE); \ + } \ + } \ + } \ + while (0) + +#define SPDBG_VERIFY(expr) \ + SPDBG_ASSERT(expr) + +#define SPDBG_PMSG0(format) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT0(_CRT_WARN, format); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_PMSG1(format, arg1) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT1(_CRT_WARN, format, arg1); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_PMSG2(format, arg1, arg2) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT2(_CRT_WARN, format, arg1, arg2); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_PMSG3(format, arg1, arg2, arg3) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT3(_CRT_WARN, format, arg1, arg2, arg3); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_PMSG4(format, arg1, arg2, arg3, arg4) \ + do \ + { \ + if (PSpDebug()->ParamInfo()) \ + { \ + _RPT4(_CRT_WARN, format, arg1, arg2, arg3, arg4); \ + PSpDebug()->ParamInfo(FALSE); \ + } \ + } while (0) + +#define SPDBG_DMSG0(format) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT0(_CRT_WARN, format); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_DMSG1(format, arg1) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT1(_CRT_WARN, format, arg1); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_DMSG2(format, arg1, arg2) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT2(_CRT_WARN, format, arg1, arg2); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_DMSG3(format, arg1, arg2, arg3) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT3(_CRT_WARN, format, arg1, arg2, arg3); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) +#define SPDBG_DMSG4(format, arg1, arg2, arg3, arg4) \ + do \ + { \ + if (PSpDebug()->DumpInfo()) \ + { \ + _RPT4(_CRT_WARN, format, arg1, arg2, arg3, arg4); \ + PSpDebug()->DumpInfo(FALSE); \ + } \ + } while (0) + +#define SPDBG_RETURN(hr) \ + { \ + HRESULT __hr = (hr); \ + if (FAILED(__hr)) \ + { \ + SPDBG_REPORT_ON_FAIL(__hr); \ + } \ + return __hr; \ + } + +#define SPDBG_DEBUG_SERVER_ON_START() \ + { \ + if (PSpDebug()->DebugServerOnStart()) \ + { \ + if (MessageBox( \ + GetDesktopWindow(), \ + _T("Attach Debugger to the SAPI Server process?"), \ + _T("SAPI"), \ + MB_YESNO) == IDYES) \ + { \ + USES_CONVERSION; \ + TCHAR szCommand[MAX_PATH + 1]; \ + wsprintf( \ + szCommand, \ + _T("msdev -p %d"), \ + GetCurrentProcessId()); \ + system(T2A(szCommand)); \ + } \ + } \ + } + +#define SPDBG_DEBUG_CLIENT_ON_START() \ + { \ + if (PSpDebug()->DebugClientOnStart()) \ + { \ + TCHAR szModule[MAX_PATH + 1]; \ + szModule[0] = '\0'; \ + TCHAR * pszSapiServer = \ + _T("sapisvr.exe"); \ + GetModuleFileName( \ + NULL, \ + szModule, \ + MAX_PATH); \ + if ((_tcslen(szModule) <= \ + _tcslen(pszSapiServer) || \ + _tcsicmp( \ + szModule + \ + _tcslen(szModule) - \ + _tcslen(pszSapiServer), \ + pszSapiServer) != 0) && \ + MessageBox( \ + GetDesktopWindow(), \ + _T("Attach Debugger to the SAPI Client process?"), \ + _T("SAPI"), \ + MB_YESNO) == IDYES) \ + { \ + USES_CONVERSION; \ + TCHAR szCommand[MAX_PATH + 1]; \ + wsprintf( \ + szCommand, \ + _T("msdev -p %d"), \ + GetCurrentProcessId()); \ + system(T2A(szCommand)); \ + } \ + } \ + } + +#else // _DEBUG + +#define SPDBG_FUNC(name) +#define SPDBG_REPORT_ON_FAIL(hr) +#define SPDBG_ASSERT(expr) +#define SPDBG_VERIFY(expr) (expr) +#define SPDBG_PMSG0(format) +#define SPDBG_PMSG1(format, arg1) +#define SPDBG_PMSG2(format, arg1, arg2) +#define SPDBG_PMSG3(format, arg1, arg2, arg3) +#define SPDBG_PMSG4(format, arg1, arg2, arg3, arg4) +#define SPDBG_DMSG0(format) +#define SPDBG_DMSG1(format, arg1) +#define SPDBG_DMSG2(format, arg1, arg2) +#define SPDBG_DMSG3(format, arg1, arg2, arg3) +#define SPDBG_DMSG4(format, arg1, arg2, arg3, arg4) +#define SPDBG_RETURN(hr) return (hr) +#define SPDBG_DEBUG_SERVER_ON_START() +#define SPDBG_DEBUG_CLIENT_ON_START() + +#endif // _DEBUG diff --git a/sp/src/utils/sapi51/Include/sperror.h b/sp/src/utils/sapi51/Include/sperror.h new file mode 100644 index 00000000..95a43952 --- /dev/null +++ b/sp/src/utils/sapi51/Include/sperror.h @@ -0,0 +1,559 @@ +/******************************************************************************* +* SPError.h * +*-----------* +* Description: +* This header file contains the custom error codes specific to SAPI5 +*------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*******************************************************************************/ +#ifndef SPError_h +#define SPError_h + +#ifndef _WINERROR_ +#include +#endif + +#define FACILITY_SAPI FACILITY_ITF +#define SAPI_ERROR_BASE 0x5000 + +#define MAKE_SAPI_HRESULT(sev, err) MAKE_HRESULT(sev, FACILITY_SAPI, err) +#define MAKE_SAPI_ERROR(err) MAKE_SAPI_HRESULT(SEVERITY_ERROR, err + SAPI_ERROR_BASE) +#define MAKE_SAPI_SCODE(scode) MAKE_SAPI_HRESULT(SEVERITY_SUCCESS, scode + SAPI_ERROR_BASE) + +/*** SPERR_UNINITIALIZED 0x80045001 -2147201023 +* The object has not been properly initialized. +*/ +#define SPERR_UNINITIALIZED MAKE_SAPI_ERROR(0x001) + +/*** SPERR_ALREADY_INITIALIZED 0x80045002 -2147201022 +* The object has already been initialized. +*/ +#define SPERR_ALREADY_INITIALIZED MAKE_SAPI_ERROR(0x002) + +/*** SPERR_UNSUPPORTED_FORMAT 0x80045003 -2147201021 +* The caller has specified an unsupported format. +*/ +#define SPERR_UNSUPPORTED_FORMAT MAKE_SAPI_ERROR(0x003) + +/*** SPERR_INVALID_FLAGS 0x80045004 -2147201020 +* The caller has specified invalid flags for this operation. +*/ +#define SPERR_INVALID_FLAGS MAKE_SAPI_ERROR(0x004) + +/*** SP_END_OF_STREAM 0x00045005 282629 +* The operation has reached the end of stream. +*/ +#define SP_END_OF_STREAM MAKE_SAPI_SCODE(0x005) + +/*** SPERR_DEVICE_BUSY 0x80045006 -2147201018 +* The wave device is busy. +*/ +#define SPERR_DEVICE_BUSY MAKE_SAPI_ERROR(0x006) + +/*** SPERR_DEVICE_NOT_SUPPORTED 0x80045007 -2147201017 +* The wave device is not supported. +*/ +#define SPERR_DEVICE_NOT_SUPPORTED MAKE_SAPI_ERROR(0x007) + +/*** SPERR_DEVICE_NOT_ENABLED 0x80045008 -2147201016 +* The wave device is not enabled. +*/ +#define SPERR_DEVICE_NOT_ENABLED MAKE_SAPI_ERROR(0x008) + +/*** SPERR_NO_DRIVER 0x80045009 -2147201015 +* There is no wave driver installed. +*/ +#define SPERR_NO_DRIVER MAKE_SAPI_ERROR(0x009) + +/*** SPERR_FILEMUSTBEUNICODE 0x8004500a -2147201014 +* The file must be Unicode. +*/ +#define SPERR_FILE_MUST_BE_UNICODE MAKE_SAPI_ERROR(0x00a) + +/*** SP_INSUFFICIENTDATA 0x0004500b 282635 +* +*/ +#define SP_INSUFFICIENT_DATA MAKE_SAPI_SCODE(0x00b) + +/*** SPERR_INVALID_PHRASE_ID 0x8004500c -2147201012 +* The phrase ID specified does not exist or is out of range. +*/ +#define SPERR_INVALID_PHRASE_ID MAKE_SAPI_ERROR(0x00c) + +/*** SPERR_BUFFER_TOO_SMALL 0x8004500d -2147201011 +* The caller provided a buffer too small to return a result. +*/ +#define SPERR_BUFFER_TOO_SMALL MAKE_SAPI_ERROR(0x00d) + +/*** SPERR_FORMAT_NOT_SPECIFIED 0x8004500e -2147201010 +* Caller did not specify a format prior to opening a stream. +*/ +#define SPERR_FORMAT_NOT_SPECIFIED MAKE_SAPI_ERROR(0x00e) + +/*** SPERR_AUDIO_STOPPED 0x8004500f -2147201009 +* This method is deprecated. Use SP_AUDIO_STOPPED instead. +*/ +#define SPERR_AUDIO_STOPPED MAKE_SAPI_ERROR(0x00f) + +/*** SP_AUDIO_PAUSED 0x00045010 282640 +* This will be returned only on input (read) streams when the stream is paused. Reads on +* paused streams will not block, and this return code indicates that all of the data has been +* removed from the stream. +*/ +#define SP_AUDIO_PAUSED MAKE_SAPI_SCODE(0x010) + +/*** SPERR_RULE_NOT_FOUND 0x80045011 -2147201007 +* Invalid rule name passed to ActivateGrammar. +*/ +#define SPERR_RULE_NOT_FOUND MAKE_SAPI_ERROR(0x011) + +/*** SPERR_TTS_ENGINE_EXCEPTION 0x80045012 -2147201006 +* An exception was raised during a call to the current TTS driver. +*/ +#define SPERR_TTS_ENGINE_EXCEPTION MAKE_SAPI_ERROR(0x012) + +/*** SPERR_TTS_NLP_EXCEPTION 0x80045013 -2147201005 +* An exception was raised during a call to an application sentence filter. +*/ +#define SPERR_TTS_NLP_EXCEPTION MAKE_SAPI_ERROR(0x013) + +/*** SPERR_ENGINE_BUSY 0x80045014 -2147201004 +* In speech recognition, the current method can not be performed while +* a grammar rule is active. +*/ +#define SPERR_ENGINE_BUSY MAKE_SAPI_ERROR(0x014) + +/*** SP_AUDIO_CONVERSION_ENABLED 0x00045015 282645 +* The operation was successful, but only with automatic stream format conversion. +*/ +#define SP_AUDIO_CONVERSION_ENABLED MAKE_SAPI_SCODE(0x015) + +/*** SP_NO_HYPOTHESIS_AVAILABLE 0x00045016 282646 +* There is currently no hypothesis recognition available. +*/ +#define SP_NO_HYPOTHESIS_AVAILABLE MAKE_SAPI_SCODE(0x016) + +/*** SPERR_CANT_CREATE 0x80045017 -2147201001 +* Can not create a new object instance for the specified object category. +*/ +#define SPERR_CANT_CREATE MAKE_SAPI_ERROR(0x017) + +/*** SP_ALREADY_IN_LEX 0x00045018 282648 +* The word, pronunciation, or POS pair being added is already in lexicon. +*/ +#define SP_ALREADY_IN_LEX MAKE_SAPI_SCODE(0x018) + +/*** SPERR_NOT_IN_LEX 0x80045019 -2147200999 +* The word does not exist in the lexicon. +*/ +#define SPERR_NOT_IN_LEX MAKE_SAPI_ERROR(0x019) + +/*** SP_LEX_NOTHING_TO_SYNC 0x0004501a 282650 +* The client is currently synced with the lexicon. +*/ +#define SP_LEX_NOTHING_TO_SYNC MAKE_SAPI_SCODE(0x01a) + +/*** SPERR_LEX_VERY_OUT_OF_SYNC 0x8004501b -2147200997 +* The client is excessively out of sync with the lexicon. Mismatches may not be incrementally sync'd. +*/ +#define SPERR_LEX_VERY_OUT_OF_SYNC MAKE_SAPI_ERROR(0x01b) + +/*** SPERR_UNDEFINED_FORWARD_RULE_REF 0x8004501c -2147200996 +* A rule reference in a grammar was made to a named rule that was never defined. +*/ +#define SPERR_UNDEFINED_FORWARD_RULE_REF MAKE_SAPI_ERROR(0x01c) + +/*** SPERR_EMPTY_RULE 0x8004501d -2147200995 +* A non-dynamic grammar rule that has no body. +*/ +#define SPERR_EMPTY_RULE MAKE_SAPI_ERROR(0x01d) + +/*** SPERR_GRAMMAR_COMPILER_INTERNAL_ERROR 0x8004501e -2147200994 +* The grammar compiler failed due to an internal state error. +*/ +#define SPERR_GRAMMAR_COMPILER_INTERNAL_ERROR MAKE_SAPI_ERROR(0x01e) + + +/*** SPERR_RULE_NOT_DYNAMIC 0x8004501f -2147200993 +* An attempt was made to modify a non-dynamic rule. +*/ +#define SPERR_RULE_NOT_DYNAMIC MAKE_SAPI_ERROR(0x01f) + +/*** SPERR_DUPLICATE_RULE_NAME 0x80045020 -2147200992 +* A rule name was duplicated. +*/ +#define SPERR_DUPLICATE_RULE_NAME MAKE_SAPI_ERROR(0x020) + +/*** SPERR_DUPLICATE_RESOURCE_NAME 0x80045021 -2147200991 +* A resource name was duplicated for a given rule. +*/ +#define SPERR_DUPLICATE_RESOURCE_NAME MAKE_SAPI_ERROR(0x021) + + +/*** SPERR_TOO_MANY_GRAMMARS 0x80045022 -2147200990 +* Too many grammars have been loaded. +*/ +#define SPERR_TOO_MANY_GRAMMARS MAKE_SAPI_ERROR(0x022) + +/*** SPERR_CIRCULAR_REFERENCE 0x80045023 -2147200989 +* Circular reference in import rules of grammars. +*/ +#define SPERR_CIRCULAR_REFERENCE MAKE_SAPI_ERROR(0x023) + +/*** SPERR_INVALID_IMPORT 0x80045024 -2147200988 +* A rule reference to an imported grammar that could not be resolved. +*/ +#define SPERR_INVALID_IMPORT MAKE_SAPI_ERROR(0x024) + +/*** SPERR_INVALID_WAV_FILE 0x80045025 -2147200987 +* The format of the WAV file is not supported. +*/ +#define SPERR_INVALID_WAV_FILE MAKE_SAPI_ERROR(0x025) + +/*** SP_REQUEST_PENDING 0x00045026 282662 +* This success code indicates that an SR method called with the SPRIF_ASYNC flag is +* being processed. When it has finished processing, an SPFEI_ASYNC_COMPLETED event will be generated. +*/ +#define SP_REQUEST_PENDING MAKE_SAPI_SCODE(0x026) + +/*** SPERR_ALL_WORDS_OPTIONAL 0x80045027 -2147200985 +* A grammar rule was defined with a null path through the rule. That is, it is possible +* to satisfy the rule conditions with no words. +*/ +#define SPERR_ALL_WORDS_OPTIONAL MAKE_SAPI_ERROR(0x027) + +/*** SPERR_INSTANCE_CHANGE_INVALID 0x80045028 -2147200984 +* It is not possible to change the current engine or input. This occurs in the +* following cases: +* +* 1) SelectEngine called while a recognition context exists, or +* 2) SetInput called in the shared instance case. +*/ +#define SPERR_INSTANCE_CHANGE_INVALID MAKE_SAPI_ERROR(0x028) + +/*** SPERR_RULE_NAME_ID_CONFLICT 0x80045029 -2147200983 +* A rule exists with matching IDs (names) but different names (IDs). +*/ +#define SPERR_RULE_NAME_ID_CONFLICT MAKE_SAPI_ERROR(0x029) + +/*** SPERR_NO_RULES 0x8004502a -2147200982 +* A grammar contains no top-level, dynamic, or exported rules. There is no possible +* way to activate or otherwise use any rule in this grammar. +*/ +#define SPERR_NO_RULES MAKE_SAPI_ERROR(0x02a) + +/*** SPERR_CIRCULAR_RULE_REF 0x8004502b -2147200981 +* Rule 'A' refers to a second rule 'B' which, in turn, refers to rule 'A'. +*/ +#define SPERR_CIRCULAR_RULE_REF MAKE_SAPI_ERROR(0x02b) + +/*** SP_NO_PARSE_FOUND 0x0004502c 282668 +* Parse path cannot be parsed given the currently active rules. +*/ +#define SP_NO_PARSE_FOUND MAKE_SAPI_SCODE(0x02c) + +/*** SPERR_NO_PARSE_FOUND 0x8004502d -2147200979 +* Parse path cannot be parsed given the currently active rules. +*/ +#define SPERR_INVALID_HANDLE MAKE_SAPI_ERROR(0x02d) + +/*** SPERR_REMOTE_CALL_TIMED_OUT 0x8004502e -2147200978 +* A marshaled remote call failed to respond. +*/ +#define SPERR_REMOTE_CALL_TIMED_OUT MAKE_SAPI_ERROR(0x02e) + +/*** SPERR_AUDIO_BUFFER_OVERFLOW 0x8004502f -2147200977 +* This will only be returned on input (read) streams when the stream is paused because +* the SR driver has not retrieved data recently. +*/ +#define SPERR_AUDIO_BUFFER_OVERFLOW MAKE_SAPI_ERROR(0x02f) + + +/*** SPERR_NO_AUDIO_DATA 0x80045030 -2147200976 +* The result does not contain any audio, nor does the portion of the element chain of the result +* contain any audio. +*/ +#define SPERR_NO_AUDIO_DATA MAKE_SAPI_ERROR(0x030) + +/*** SPERR_DEAD_ALTERNATE 0x80045031 -2147200975 +* This alternate is no longer a valid alternate to the result it was obtained from. +* Returned from ISpPhraseAlt methods. +*/ +#define SPERR_DEAD_ALTERNATE MAKE_SAPI_ERROR(0x031) + +/*** SPERR_HIGH_LOW_CONFIDENCE 0x80045032 -2147200974 +* The result does not contain any audio, nor does the portion of the element chain of the result +* contain any audio. Returned from ISpResult::GetAudio and ISpResult::SpeakAudio. +*/ +#define SPERR_HIGH_LOW_CONFIDENCE MAKE_SAPI_ERROR(0x032) + +/*** SPERR_INVALID_FORMAT_STRING 0x80045033 -2147200973 +* The XML format string for this RULEREF is invalid, e.g. not a GUID or REFCLSID. +*/ +#define SPERR_INVALID_FORMAT_STRING MAKE_SAPI_ERROR(0x033) + +/*** SP_UNSUPPORTED_ON_STREAM_INPUT 0x00045034 282676 +* The operation is not supported for stream input. +*/ +#define SP_UNSUPPORTED_ON_STREAM_INPUT MAKE_SAPI_SCODE(0x034) + +/*** SPERR_APPLEX_READ_ONLY 0x80045035 -2147200971 +* The operation is invalid for all but newly created application lexicons. +*/ +#define SPERR_APPLEX_READ_ONLY MAKE_SAPI_ERROR(0x035) + +/*** SPERR_NO_TERMINATING_RULE_PATH 0x80045036 -2147200970 +* +*/ + +#define SPERR_NO_TERMINATING_RULE_PATH MAKE_SAPI_ERROR(0x036) + +/*** SP_WORD_EXISTS_WITHOUT_PRONUNCIATION 0x00045037 282679 +* The word exists but without pronunciation. +*/ +#define SP_WORD_EXISTS_WITHOUT_PRONUNCIATION MAKE_SAPI_SCODE(0x037) + +/*** SPERR_STREAM_CLOSED 0x80045038 -2147200968 +* An operation was attempted on a stream object that has been closed. +*/ +#define SPERR_STREAM_CLOSED MAKE_SAPI_ERROR(0x038) + +// --- The following error codes are taken directly from WIN32 --- + +/*** SPERR_NO_MORE_ITEMS 0x80045039 -2147200967 +* When enumerating items, the requested index is greater than the count of items. +*/ +#define SPERR_NO_MORE_ITEMS MAKE_SAPI_ERROR(0x039) + +/*** SPERR_NOT_FOUND 0x8004503a -2147200966 +* The requested data item (data key, value, etc.) was not found. +*/ +#define SPERR_NOT_FOUND MAKE_SAPI_ERROR(0x03a) + +/*** SPERR_INVALID_AUDIO_STATE 0x8004503b -2147200965 +* Audio state passed to SetState() is invalid. +*/ +#define SPERR_INVALID_AUDIO_STATE MAKE_SAPI_ERROR(0x03b) + +/*** SPERR_GENERIC_MMSYS_ERROR 0x8004503c -2147200964 +* A generic MMSYS error not caught by _MMRESULT_TO_HRESULT. +*/ +#define SPERR_GENERIC_MMSYS_ERROR MAKE_SAPI_ERROR(0x03c) + +/*** SPERR_MARSHALER_EXCEPTION 0x8004503d -2147200963 +* An exception was raised during a call to the marshaling code. +*/ +#define SPERR_MARSHALER_EXCEPTION MAKE_SAPI_ERROR(0x03d) + +/*** SPERR_NOT_DYNAMIC_GRAMMAR 0x8004503e -2147200962 +* Attempt was made to manipulate a non-dynamic grammar. +*/ +#define SPERR_NOT_DYNAMIC_GRAMMAR MAKE_SAPI_ERROR(0x03e) + +/*** SPERR_AMBIGUOUS_PROPERTY 0x8004503f -2147200961 +* Cannot add ambiguous property. +*/ +#define SPERR_AMBIGUOUS_PROPERTY MAKE_SAPI_ERROR(0x03f) + +/*** SPERR_INVALID_REGISTRY_KEY 0x80045040 -2147200960 +* The key specified is invalid. +*/ +#define SPERR_INVALID_REGISTRY_KEY MAKE_SAPI_ERROR(0x040) + +/*** SPERR_INVALID_TOKEN_ID 0x80045041 -2147200959 +* The token specified is invalid. +*/ +#define SPERR_INVALID_TOKEN_ID MAKE_SAPI_ERROR(0x041) + +/*** SPERR_XML_BAD_SYNTAX 0x80045042 -2147200958 +* The xml parser failed due to bad syntax. +*/ +#define SPERR_XML_BAD_SYNTAX MAKE_SAPI_ERROR(0x042) + +/*** SPERR_XML_RESOURCE_NOT_FOUND 0x80045043 -2147200957 +* The xml parser failed to load a required resource (e.g., voice, phoneconverter, etc.). +*/ +#define SPERR_XML_RESOURCE_NOT_FOUND MAKE_SAPI_ERROR(0x043) + +/*** SPERR_TOKEN_IN_USE 0x80045044 -2147200956 +* Attempted to remove registry data from a token that is already in use elsewhere. +*/ +#define SPERR_TOKEN_IN_USE MAKE_SAPI_ERROR(0x044) + +/*** SPERR_TOKEN_DELETED 0x80045045 -2147200955 +* Attempted to perform an action on an object token that has had associated registry key deleted. +*/ +#define SPERR_TOKEN_DELETED MAKE_SAPI_ERROR(0x045) + +/*** SPERR_MULTI_LINGUAL_NOT_SUPPORTED 0x80045046 -2147200954 +* The selected voice was registered as multi-lingual. SAPI does not support multi-lingual registration. +*/ +#define SPERR_MULTI_LINGUAL_NOT_SUPPORTED MAKE_SAPI_ERROR(0x046) + +/*** SPERR_EXPORT_DYNAMIC_RULE 0x80045047 -2147200953 +* Exported rules cannot refer directly or indirectly to a dynamic rule. +*/ +#define SPERR_EXPORT_DYNAMIC_RULE MAKE_SAPI_ERROR(0x047) + +/*** SPERR_STGF_ERROR 0x80045048 -2147200952 +* Error parsing the SAPI Text Grammar Format (XML grammar). +*/ +#define SPERR_STGF_ERROR MAKE_SAPI_ERROR(0x048) + +/*** SPERR_WORDFORMAT_ERROR 0x80045049 -2147200951 +* Incorrect word format, probably due to incorrect pronunciation string. +*/ +#define SPERR_WORDFORMAT_ERROR MAKE_SAPI_ERROR(0x049) + +/*** SPERR_STREAM_NOT_ACTIVE 0x8004504a -2147200950 +* Methods associated with active audio stream cannot be called unless stream is active. +*/ +#define SPERR_STREAM_NOT_ACTIVE MAKE_SAPI_ERROR(0x04a) + +/*** SPERR_ENGINE_RESPONSE_INVALID 0x8004504b -2147200949 +* Arguments or data supplied by the engine are in an invalid format or are inconsistent. +*/ +#define SPERR_ENGINE_RESPONSE_INVALID MAKE_SAPI_ERROR(0x04b) + +/*** SPERR_SR_ENGINE_EXCEPTION 0x8004504c -2147200948 +* An exception was raised during a call to the current SR engine. +*/ +#define SPERR_SR_ENGINE_EXCEPTION MAKE_SAPI_ERROR(0x04c) + +/*** SPERR_STREAM_POS_INVALID 0x8004504d -2147200947 +* Stream position information supplied from engine is inconsistent. +*/ +#define SPERR_STREAM_POS_INVALID MAKE_SAPI_ERROR(0x04d) + +/*** SP_RECOGNIZER_INACTIVE 0x0004504e 282702 +* Operation could not be completed because the recognizer is inactive. It is inactive either +* because the recognition state is currently inactive or because no rules are active . +*/ +#define SP_RECOGNIZER_INACTIVE MAKE_SAPI_SCODE(0x04e) + +/*** SPERR_REMOTE_CALL_ON_WRONG_THREAD 0x8004504f -2147200945 +* When making a remote call to the server, the call was made on the wrong thread. +*/ +#define SPERR_REMOTE_CALL_ON_WRONG_THREAD MAKE_SAPI_ERROR(0x04f) + +/*** SPERR_REMOTE_PROCESS_TERMINATED 0x80045050 -2147200944 +* The remote process terminated unexpectedly. +*/ +#define SPERR_REMOTE_PROCESS_TERMINATED MAKE_SAPI_ERROR(0x050) + +/*** SPERR_REMOTE_PROCESS_ALREADY_RUNNING 0x80045051 -2147200943 +* The remote process is already running; it cannot be started a second time. +*/ +#define SPERR_REMOTE_PROCESS_ALREADY_RUNNING MAKE_SAPI_ERROR(0x051) + +/*** SPERR_LANGID_MISMATCH 0x80045052 -2147200942 +* An attempt to load a CFG grammar with a LANGID different than other loaded grammars. +*/ +#define SPERR_LANGID_MISMATCH MAKE_SAPI_ERROR(0x052) + +/*** SP_PARTIAL_PARSE_FOUND 0x00045053 282707 +* A grammar-ending parse has been found that does not use all available words. +*/ +#define SP_PARTIAL_PARSE_FOUND MAKE_SAPI_SCODE(0x053) + +/*** SPERR_NOT_TOPLEVEL_RULE 0x80045054 -2147200940 +* An attempt to deactivate or activate a non-toplevel rule. +*/ +#define SPERR_NOT_TOPLEVEL_RULE MAKE_SAPI_ERROR(0x054) + +/*** SP_NO_RULE_ACTIVE 0x00045055 282709 +* An attempt to parse when no rule was active. +*/ +#define SP_NO_RULE_ACTIVE MAKE_SAPI_SCODE(0x055) + +/*** SPERR_LEX_REQUIRES_COOKIE 0x80045056 -2147200938 +* An attempt to ask a container lexicon for all words at once. +*/ +#define SPERR_LEX_REQUIRES_COOKIE MAKE_SAPI_ERROR(0x056) + +/*** SP_STREAM_UNINITIALIZED 0x00045057 282711 +* An attempt to activate a rule/dictation/etc without calling SetInput +* first in the inproc case. +*/ +#define SP_STREAM_UNINITIALIZED MAKE_SAPI_SCODE(0x057) + + +// Error x058 is not used in SAPI 5.0 + + +/*** SPERR_UNSUPPORTED_LANG 0x80045059 -2147200935 +* The requested language is not supported. +*/ +#define SPERR_UNSUPPORTED_LANG MAKE_SAPI_ERROR(0x059) + +/*** SPERR_VOICE_PAUSED 0x8004505a -2147200934 +* The operation cannot be performed because the voice is currently paused. +*/ +#define SPERR_VOICE_PAUSED MAKE_SAPI_ERROR(0x05a) + +/*** SPERR_AUDIO_BUFFER_UNDERFLOW 0x8004505b -2147200933 +* This will only be returned on input (read) streams when the real time audio device +* stops returning data for a long period of time. +*/ +#define SPERR_AUDIO_BUFFER_UNDERFLOW MAKE_SAPI_ERROR(0x05b) + +/*** SPERR_AUDIO_STOPPED_UNEXPECTEDLY 0x8004505c -2147200932 +* An audio device stopped returning data from the Read() method even though it was in +* the run state. This error is only returned in the END_SR_STREAM event. +*/ +#define SPERR_AUDIO_STOPPED_UNEXPECTEDLY MAKE_SAPI_ERROR(0x05c) + +/*** SPERR_NO_WORD_PRONUNCIATION 0x8004505d -2147200931 +* The SR engine is unable to add this word to a grammar. The application may need to supply +* an explicit pronunciation for this word. +*/ +#define SPERR_NO_WORD_PRONUNCIATION MAKE_SAPI_ERROR(0x05d) + +/*** SPERR_ALTERNATES_WOULD_BE_INCONSISTENT 0x8004505e -2147200930 +* An attempt to call ScaleAudio on a recognition result having previously +* called GetAlternates. Allowing the call to succeed would result in +* the previously created alternates located in incorrect audio stream positions. +*/ +#define SPERR_ALTERNATES_WOULD_BE_INCONSISTENT MAKE_SAPI_ERROR(0x05e) + +/*** SPERR_NOT_SUPPORTED_FOR_SHARED_RECOGNIZER 0x8004505f -2147200929 +* The method called is not supported for the shared recognizer. +* For example, ISpRecognizer::GetInputStream(). +*/ +#define SPERR_NOT_SUPPORTED_FOR_SHARED_RECOGNIZER MAKE_SAPI_ERROR(0x05f) + +/*** SPERR_TIMEOUT 0x80045060 -2147200928 +* A task could not complete because the SR engine had timed out. +*/ +#define SPERR_TIMEOUT MAKE_SAPI_ERROR(0x060) + + +/*** SPERR_REENTER_SYNCHRONIZE 0x80045061 -2147200927 +* A SR engine called synchronize while inside of a synchronize call. +*/ +#define SPERR_REENTER_SYNCHRONIZE MAKE_SAPI_ERROR(0x061) + +/*** SPERR_STATE_WITH_NO_ARCS 0x80045062 -2147200926 +* The grammar contains a node no arcs. +*/ +#define SPERR_STATE_WITH_NO_ARCS MAKE_SAPI_ERROR(0x062) + +/*** SPERR_NOT_ACTIVE_SESSION 0x80045063 -2147200925 +* Neither audio output and input is supported for non-active console sessions. +*/ +#define SPERR_NOT_ACTIVE_SESSION MAKE_SAPI_ERROR(0x063) + +/*** SPERR_ALREADY_DELETED 0x80045064 -2147200924 +* The object is a stale reference and is invalid to use. +* For example having a ISpeechGrammarRule object reference and then calling +* ISpeechRecoGrammar::Reset() will cause the rule object to be invalidated. +* Calling any methods after this will result in this error. +*/ +#define SPERR_ALREADY_DELETED MAKE_SAPI_ERROR(0x064) + +/*** SP_AUDIO_STOPPED 0x00045065 282725 +* This can be returned from Read or Write calls audio streams when the stream is stopped. +*/ +#define SP_AUDIO_STOPPED MAKE_SAPI_SCODE(0x065) + +#endif //--- This must be the last line in the file diff --git a/sp/src/utils/sapi51/Include/speventq.h b/sp/src/utils/sapi51/Include/speventq.h new file mode 100644 index 00000000..b0447dcc --- /dev/null +++ b/sp/src/utils/sapi51/Include/speventq.h @@ -0,0 +1,605 @@ +/******************************************************************************* +* SPEventQ.h * +*------------* +* Description: +* This is the header file for the SAPI5 event queue implementation. +*------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*******************************************************************************/ +#ifndef SPEventQ_h +#define SPEventQ_h + +#ifndef SPHelper_h +#include +#endif + +#ifndef SPCollec_h +#include +#endif + +//=== Inline helpers for copying and deleting events ============================ + + +//=== Class definition ========================================================== + +class CSpEventNode : public CSpEvent +{ +public: + CSpEventNode * m_pNext; + static LONG Compare(const CSpEventNode * p1, const CSpEventNode *p2) + { + // Assumes offsets DO or DO NOT reset when stream number changes + if (p1->ulStreamNum < p2->ulStreamNum) + { + return -1; + } + else if (p1->ulStreamNum > p2->ulStreamNum) + { + return 1; + } + else if (p1->ullAudioStreamOffset < p2->ullAudioStreamOffset) + { + return -1; + } + else if (p1->ullAudioStreamOffset > p2->ullAudioStreamOffset) + { + return 1; + } + return 0; + } +}; + + +typedef CSpBasicQueue CSpEventList; + +#define DECLARE_SPNOTIFYSOURCE_METHODS(T) \ +STDMETHODIMP SetNotifySink(ISpNotifySink * pNotifySink) \ +{ return T._SetNotifySink(pNotifySink); } \ +STDMETHODIMP SetNotifyWindowMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) \ +{ return T._SetNotifyWindowMessage(hWnd, Msg, wParam, lParam); } \ +STDMETHODIMP SetNotifyCallbackFunction(SPNOTIFYCALLBACK * pfnCallback, WPARAM wParam, LPARAM lParam) \ +{ return T._SetNotifyCallbackFunction(pfnCallback, wParam, lParam); } \ +STDMETHODIMP SetNotifyCallbackInterface(ISpNotifyCallback * pSpCallback, WPARAM wParam, LPARAM lParam) \ +{ return T._SetNotifyCallbackInterface(pSpCallback, wParam, lParam); } \ +STDMETHODIMP SetNotifyWin32Event() \ +{ return T._SetNotifyWin32Event(); } \ +STDMETHODIMP WaitForNotifyEvent(DWORD dwMilliseconds) \ +{ return T._WaitForNotifyEvent(dwMilliseconds); } \ +STDMETHODIMP_(HANDLE) GetNotifyEventHandle() \ +{ return T._GetNotifyEventHandle(); } + +#define DECLARE_SPEVENTSOURCE_METHODS(T) \ +DECLARE_SPNOTIFYSOURCE_METHODS(T) \ +STDMETHODIMP SetInterest(ULONGLONG ullEventInterest, ULONGLONG ullQueuedInterest) \ +{ return T._SetInterest(ullEventInterest, ullQueuedInterest); } \ +STDMETHODIMP GetEvents(ULONG ulCount, SPEVENT* pEventArray, ULONG * pulFetched) \ +{ return T._GetEvents(ulCount, pEventArray, pulFetched); } \ +STDMETHODIMP GetInfo(SPEVENTSOURCEINFO *pInfo) \ +{ return T._GetInfo(pInfo); } + + + +class CSpEventSource +{ + public: + CSpEventSource(CComObjectRootEx * pParent) : + m_pParent(pParent) + { + m_ullEventInterest = 0; m_ullQueuedInterest = 0; + m_ulStreamNum = 0; + } + HRESULT _SetNotifySink(ISpNotifySink * pNotifySink); + HRESULT _SetNotifyWindowMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); + HRESULT _SetNotifyCallbackFunction(SPNOTIFYCALLBACK * pfnCallback, WPARAM wParam, LPARAM lParam); + HRESULT _SetNotifyCallbackInterface(ISpNotifyCallback * pSpCallback, WPARAM wParam, LPARAM lParam); + HRESULT _SetNotifyWin32Event(); + HRESULT _WaitForNotifyEvent(DWORD dwMilliseconds); + HANDLE _GetNotifyEventHandle(); + + HRESULT _SetInterest(ULONGLONG ullEventInterest , ULONGLONG ullQueuedInterest); + HRESULT _GetEvents( ULONG ulCount, SPEVENT* pEventArray, ULONG * pulFetched ); + HRESULT _GetInfo(SPEVENTSOURCEINFO *pInfo ); + + /*--- Non interface methods ---*/ + HRESULT _CompleteEvents( ULONGLONG ullPos = 0xFFFFFFFFFFFFFFFF ); + inline void _MoveAllToFreeList(CSpEventList * pList); + inline void _RemoveAllEvents(); + inline HRESULT _AddEvent(const SPEVENT & Event); + inline HRESULT _AddEvents(const SPEVENT* pEventArray, ULONG ulCount); + inline HRESULT _DeserializeAndAddEvent(const BYTE * pBuffer, ULONG * pcbUsed); + inline HRESULT _GetStreamNumber(const ULONGLONG ullAudioOffset, ULONG *pulStreamNum); + //=== Data members ============================== + public: + ULONGLONG m_ullEventInterest; + ULONGLONG m_ullQueuedInterest; + ULONG m_ulStreamNum; + CSpEventList m_PendingList; + CSpEventList m_CompletedList; + CSpEventList m_FreeList; + CComPtr m_cpNotifySink; + CComPtr m_cpEventTranslator; // If non-NULL then Win32 events being used + CComObjectRootEx * m_pParent; + CComAutoCriticalSection m_NotifyObjChangeCrit; // Critical section used to make sure that + // the notify object (m_cpNotifySink) not changed + // while waiting on it. + +}; + + +// +//=== Inlines ========================================================= +// + +// +// WARNING: If this logic changes, you will need to change the logic in SetNotifyWin32Event also. +// +inline HRESULT CSpEventSource::_SetNotifySink(ISpNotifySink * pNotifySink) +{ + if (SP_IS_BAD_OPTIONAL_INTERFACE_PTR(pNotifySink)) + { + return E_INVALIDARG; + } + else + { + m_pParent->Lock(); + m_NotifyObjChangeCrit.Lock(); + m_cpEventTranslator.Release(); + m_cpNotifySink = pNotifySink; + if (m_cpNotifySink && m_CompletedList.GetHead()) + { + m_cpNotifySink->Notify(); + } + m_NotifyObjChangeCrit.Unlock(); + m_pParent->Unlock(); + return S_OK; + } +} + +/**************************************************************************** +* CSpEventSource::_SetNotifyWindowMessage * +*-----------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_SetNotifyWindowMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + SPDBG_FUNC("CSpEventSource::_SetNotifyWindowMessage"); + HRESULT hr = S_OK; + CComPtr cpTranslator; + hr = cpTranslator.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTranslator->InitWindowMessage(hWnd, Msg, wParam, lParam); + } + if (SUCCEEDED(hr)) + { + hr = _SetNotifySink(cpTranslator); + } + return hr; +} +/**************************************************************************** +* CSpEventSource::_SetNotifyCallbackFunction * +*--------------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_SetNotifyCallbackFunction(SPNOTIFYCALLBACK * pfnCallback, WPARAM wParam, LPARAM lParam) +{ + SPDBG_FUNC("CSpEventSource::_SetNotifyCallbackFunction"); + HRESULT hr = S_OK; + CComPtr cpTranslator; + hr = cpTranslator.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTranslator->InitCallback(pfnCallback, wParam, lParam); + } + if (SUCCEEDED(hr)) + { + hr = _SetNotifySink(cpTranslator); + } + return hr; +} +/**************************************************************************** +* CSpEventSource::_SetNotifyCallbackInterface * +*---------------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_SetNotifyCallbackInterface(ISpNotifyCallback * pSpCallback, WPARAM wParam, LPARAM lParam) +{ + SPDBG_FUNC("CSpEventSource::_SetNotifyCallbackInterface"); + HRESULT hr = S_OK; + CComPtr cpTranslator; + hr = cpTranslator.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTranslator->InitSpNotifyCallback(pSpCallback, wParam, lParam); + } + if (SUCCEEDED(hr)) + { + hr = _SetNotifySink(cpTranslator); + } + return hr; +} +/**************************************************************************** +* CSpEventSource::_SetNotifyWin32Event * +*--------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_SetNotifyWin32Event(void) +{ + SPDBG_FUNC("CSpEventSource::_SetNotifyWin32Event"); + HRESULT hr = S_OK; + CComPtr cpTranslator; + hr = cpTranslator.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTranslator->InitWin32Event(NULL, TRUE); + } + if (SUCCEEDED(hr)) + { + // + // In this case we do NOT call _SetNotify sink since we want to set the cpEventTranslator + // + m_pParent->Lock(); + m_NotifyObjChangeCrit.Lock(); + m_cpEventTranslator = cpTranslator; + m_cpNotifySink = cpTranslator; + if (m_cpNotifySink && m_CompletedList.GetHead()) + { + m_cpNotifySink->Notify(); + } + m_NotifyObjChangeCrit.Unlock(); + m_pParent->Unlock(); + } + return hr; +} +/**************************************************************************** +* CSpEventSource::_WaitForNotifyEvent * +*-------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HRESULT CSpEventSource::_WaitForNotifyEvent(DWORD dwMilliseconds) +{ + SPDBG_FUNC("CSpEventSource::_WaitForNotifyEvent"); + HRESULT hr = S_OK; + m_NotifyObjChangeCrit.Lock(); + if (m_cpEventTranslator) + { + hr = m_cpEventTranslator->Wait(dwMilliseconds); + } + else + { + if (m_cpNotifySink) + { + hr = SPERR_ALREADY_INITIALIZED; + } + else + { + hr = _SetNotifyWin32Event(); + if (SUCCEEDED(hr)) + { + hr = m_cpEventTranslator->Wait(dwMilliseconds); + } + } + } + m_NotifyObjChangeCrit.Unlock(); + return hr; +} +/**************************************************************************** +* CSpEventSource::_GetNotifyEventHandle * +*---------------------------------------* +* Description: +* +* Returns: +* +********************************************************************* RAL ***/ + +inline HANDLE CSpEventSource::_GetNotifyEventHandle() +{ + HANDLE h = NULL; + SPDBG_FUNC("CSpEventSource::_GetNotifyEventHandle"); + m_NotifyObjChangeCrit.Lock(); + if (!m_cpNotifySink) + { + _SetNotifyWin32Event(); + } + if (m_cpEventTranslator) + { + h = m_cpEventTranslator->GetEventHandle(); + } + m_NotifyObjChangeCrit.Unlock(); + return h; +} + + +inline HRESULT CSpEventSource::_SetInterest( ULONGLONG ullEventInterest, ULONGLONG ullQueuedInterest ) +{ + HRESULT hr = S_OK; + m_pParent->Lock(); + + if(ullEventInterest && SPFEI_FLAGCHECK != (ullEventInterest & SPFEI_FLAGCHECK)) + { + hr = E_INVALIDARG; + } + else if(ullQueuedInterest && SPFEI_FLAGCHECK != (ullQueuedInterest & SPFEI_FLAGCHECK)) + { + hr = E_INVALIDARG; + } + else if ((ullQueuedInterest | ullEventInterest) != ullEventInterest) + { + hr = E_INVALIDARG; + } + else + { + m_ullEventInterest = ullEventInterest; + m_ullQueuedInterest = ullQueuedInterest; + } + m_pParent->Unlock(); + return hr; +} + + +// +// Same as AddEvents except: No param validation, and caller must take the critical section +// prior to calling. +// +inline HRESULT CSpEventSource::_AddEvents( const SPEVENT* pEventArray, ULONG ulCount ) +{ + HRESULT hr = S_OK; + for( ULONG i = 0; i < ulCount && SUCCEEDED(hr = _AddEvent(pEventArray[i])); ++i ) {} + return hr; +} + +inline HRESULT CSpEventSource::_AddEvent(const SPEVENT & Event) +{ + SPDBG_ASSERT(Event.eEventId < 64); + SPDBG_ASSERT(Event.elParamType == SPET_LPARAM_IS_UNDEFINED || + Event.elParamType == SPET_LPARAM_IS_TOKEN || + Event.elParamType == SPET_LPARAM_IS_OBJECT || + Event.elParamType == SPET_LPARAM_IS_POINTER || + Event.elParamType == SPET_LPARAM_IS_STRING); +#ifdef _DEBUG + if (Event.eEventId == SPEI_VOICE_CHANGE) + { + SPDBG_ASSERT(Event.elParamType == SPET_LPARAM_IS_TOKEN); + } + else if (Event.eEventId == SPEI_RECOGNITION || Event.eEventId == SPEI_FALSE_RECOGNITION || Event.eEventId == SPEI_HYPOTHESIS) + { + SPDBG_ASSERT(Event.elParamType == SPET_LPARAM_IS_OBJECT); + } + else if (Event.eEventId ==SPEI_REQUEST_UI || Event.eEventId == SPEI_TTS_BOOKMARK) + { + SPDBG_ASSERT(Event.elParamType == SPET_LPARAM_IS_STRING); + } +#endif + + if ( (1i64 << Event.eEventId) & m_ullEventInterest ) + { + CSpEventNode *pNode = m_FreeList.RemoveHead(); + if (pNode == NULL) + { + pNode = new CSpEventNode(); + if (pNode == NULL) + { + return E_OUTOFMEMORY; + } + } + pNode->CopyFrom(&Event); + m_PendingList.InsertSorted(pNode); + } + return S_OK; +} + +inline HRESULT CSpEventSource:: + _DeserializeAndAddEvent(const BYTE *pBuffer, ULONG * pcbUsed) +{ + HRESULT hr = S_OK; + const SPEVENT * pSrcEvent = (const SPEVENT *)pBuffer; + SPDBG_ASSERT(pSrcEvent->eEventId < 64); + if ( (1i64 << pSrcEvent->eEventId) & m_ullEventInterest ) + { + CSpEventNode *pNode = m_FreeList.RemoveHead(); + if (pNode == NULL) + { + pNode = new CSpEventNode(); + if (pNode == NULL) + { + hr = E_OUTOFMEMORY; + } + } + if (SUCCEEDED(hr)) + { + hr = pNode->Deserialize(((const SPSERIALIZEDEVENT64 *)(pBuffer)), pcbUsed); + if (SUCCEEDED(hr)) + { + m_PendingList.InsertSorted(pNode); + } + else + { + m_FreeList.InsertHead(pNode); + } + } + } + else + { +// WCE compiler does not work propertly with template +#ifndef _WIN32_WCE + *pcbUsed = SpEventSerializeSize(pSrcEvent); +#else + *pcbUsed = SpEventSerializeSize(pSrcEvent, sizeof(SPSERIALIZEDEVENT64)); +#endif + } + return hr; +} + +inline HRESULT CSpEventSource::_GetEvents( ULONG ulCount, SPEVENT* pEventArray, ULONG *pulFetched ) +{ + HRESULT hr = S_OK; + m_pParent->Lock(); + if( SPIsBadWritePtr( pEventArray, sizeof( SPEVENT ) * ulCount ) || + SP_IS_BAD_OPTIONAL_WRITE_PTR(pulFetched) ) + { + hr = E_INVALIDARG; + } + else + { + ULONG ulCopied = 0; + ULONG ulRemaining = ulCount; + CSpEventNode * pCur = m_CompletedList.m_pHead; + CSpEventNode * pLastCopied = NULL; + while (ulRemaining && pCur) + { + pCur->Detach(pEventArray + ulCopied); + pLastCopied = pCur; + ulCopied++; + pCur = pCur->m_pNext; + ulRemaining--; + } + if (ulCopied) + { + if (m_FreeList.m_pHead == NULL) + { + m_FreeList.m_pTail = pLastCopied; + } + pLastCopied->m_pNext = m_FreeList.m_pHead; + m_FreeList.m_pHead = m_CompletedList.m_pHead; + m_CompletedList.m_pHead = pCur; + m_CompletedList.m_cElements -= ulCopied; + m_FreeList.m_cElements += ulCopied; + } + if (ulCopied < ulCount) + { + hr = S_FALSE; + } + if (pulFetched) + { + *pulFetched = ulCopied; + } + } + m_pParent->Unlock(); + return hr; +} + + +inline HRESULT CSpEventSource::_GetInfo( SPEVENTSOURCEINFO * pInfo ) +{ + HRESULT hr = S_OK; + m_pParent->Lock(); + if( SP_IS_BAD_WRITE_PTR( pInfo ) ) + { + hr = E_POINTER; + } + else + { + pInfo->ulCount = m_CompletedList.GetCount(); + pInfo->ullEventInterest = m_ullEventInterest; + pInfo->ullQueuedInterest= m_ullQueuedInterest; + } + m_pParent->Unlock(); + return hr; +} + + + +// +// The caller must call this function with the critical section owned +// +inline HRESULT CSpEventSource::_CompleteEvents( ULONGLONG ullPos ) +{ + HRESULT hr = S_OK; + + if (m_PendingList.m_pHead && m_PendingList.m_pHead->ullAudioStreamOffset <= ullPos) + { + BOOL bNotify = FALSE; + while (m_PendingList.m_pHead && + m_PendingList.m_pHead->ullAudioStreamOffset <= ullPos) + { + CSpEventNode *pNode = m_PendingList.RemoveHead(); + if(pNode->ulStreamNum != m_ulStreamNum) + { + m_ulStreamNum = pNode->ulStreamNum; + } + if ( (1i64 << pNode->eEventId) & m_ullEventInterest ) + { + bNotify = TRUE; + // + // NOTE: If we're forwarding events to an event sink then we'll only + // pay attention to the Interest flags. If we're going to notify, then + // we'll only queue completed events that the user has explicitly asked + // us to store as completed events. + // + if ( (1i64 << pNode->eEventId) & m_ullQueuedInterest ) + { + m_CompletedList.InsertSorted(pNode); + } + else + { + pNode->Clear(); + m_FreeList.InsertHead(pNode); + } + } + else + { + pNode->Clear(); + m_FreeList.InsertHead(pNode); + } + } + if (bNotify && m_cpNotifySink) + { + hr = m_cpNotifySink->Notify(); + } + } + return hr; +}; + + +inline void CSpEventSource::_MoveAllToFreeList(CSpEventList * pList) +{ + CSpEventNode * pNode; + while ((pNode = pList->RemoveHead()) != NULL) + { + pNode->Clear(); + m_FreeList.InsertHead(pNode); + } +} +inline void CSpEventSource::_RemoveAllEvents( ) +{ + m_pParent->Lock(); + + _MoveAllToFreeList(&m_CompletedList); + _MoveAllToFreeList(&m_PendingList); + m_pParent->Unlock(); +} + +inline HRESULT CSpEventSource::_GetStreamNumber(const ULONGLONG ullAudioOffset, ULONG *pulStreamNum) +{ + CSpEventNode *pNode = m_PendingList.m_pHead; + *pulStreamNum = m_ulStreamNum; + for(;pNode && pNode->ullAudioStreamOffset <= ullAudioOffset; pNode = pNode->m_pNext) + { + *pulStreamNum = pNode->ulStreamNum; + } + return S_OK; +} + + + +#endif //--- This must be the last line in this file diff --git a/sp/src/utils/sapi51/Include/sphelper.h b/sp/src/utils/sapi51/Include/sphelper.h new file mode 100644 index 00000000..bd739b29 --- /dev/null +++ b/sp/src/utils/sapi51/Include/sphelper.h @@ -0,0 +1,2754 @@ +/******************************************************************************* +* SPHelper.h * +*------------* +* Description: +* This is the header file for core helper functions implementation. +*------------------------------------------------------------------------------- +* Copyright (c) Microsoft Corporation. All rights reserved. +*******************************************************************************/ +#ifndef SPHelper_h +#define SPHelper_h + +#ifndef _INC_MALLOC +#include +#endif + +#ifndef _INC_CRTDBG +#include +#endif + +#ifndef __sapi_h__ +#include +#endif + +#ifndef __sapiddk_h__ +#include +#endif + +#ifndef SPError_h +#include +#endif + +#ifndef SPDebug_h +#include +#endif + +#ifndef _INC_LIMITS +#include +#endif + +#ifndef _INC_MMSYSTEM +#include +#endif + +#ifndef __comcat_h__ +#include +#endif + +#ifndef _INC_MMREG +#include +#endif + +#ifndef __ATLBASE_H__ +#include +#endif + +//=== Constants ============================================================== +#define sp_countof(x) ((sizeof(x) / sizeof(*(x)))) + +/*** CSpDynamicString helper class +* +*/ +class CSpDynamicString +{ +public: + + WCHAR * m_psz; + CSpDynamicString() + { + m_psz = NULL; + } + CSpDynamicString(ULONG cchReserve) + { + m_psz = (WCHAR *)::CoTaskMemAlloc(cchReserve * sizeof(WCHAR)); + } + WCHAR * operator=(const CSpDynamicString& src) + { + if (m_psz != src.m_psz) + { + ::CoTaskMemFree(m_psz); + m_psz = src.Copy(); + } + return m_psz; + } + WCHAR * operator=(const WCHAR * pSrc) + { + Clear(); + if (pSrc) + { + ULONG cbNeeded = (wcslen(pSrc) + 1) * sizeof(WCHAR); + m_psz = (WCHAR *)::CoTaskMemAlloc(cbNeeded); + SPDBG_ASSERT(m_psz); + if (m_psz) + { + memcpy(m_psz, pSrc, cbNeeded); + } + } + return m_psz; + } + + WCHAR * operator=(const char * pSrc) + { + Clear(); + if (pSrc) + { + ULONG cbNeeded = (lstrlenA(pSrc) + 1) * sizeof(WCHAR); + m_psz = (WCHAR *)::CoTaskMemAlloc(cbNeeded); + SPDBG_ASSERT(m_psz); + if (m_psz) + { + ::MultiByteToWideChar(CP_ACP, 0, pSrc, -1, m_psz, cbNeeded/sizeof(WCHAR)); + } + } + return m_psz; + } + + WCHAR * operator=(REFGUID rguid) + { + Clear(); + ::StringFromCLSID(rguid, &m_psz); + return m_psz; + } + + + /*explicit*/ CSpDynamicString(const WCHAR * pSrc) + { + m_psz = NULL; + operator=(pSrc); + } + /*explicit*/ CSpDynamicString(const char * pSrc) + { + m_psz = NULL; + operator=(pSrc); + } + /*explicit*/ CSpDynamicString(const CSpDynamicString& src) + { + m_psz = src.Copy(); + } + /*explicit*/ CSpDynamicString(REFGUID rguid) + { + ::StringFromCLSID(rguid, &m_psz); + } + + + ~CSpDynamicString() + { + ::CoTaskMemFree(m_psz); + } + unsigned int Length() const + { + return (m_psz == NULL)? 0 : wcslen(m_psz); + } + + operator WCHAR * () const + { + return m_psz; + } + //The assert on operator& usually indicates a bug. If this is really + //what is needed, however, take the address of the m_psz member explicitly. + WCHAR ** operator&() + { + SPDBG_ASSERT(m_psz == NULL); + return &m_psz; + } + + WCHAR * Append(const WCHAR * pszSrc) + { + if (pszSrc) + { + ULONG lenSrc = wcslen(pszSrc); + if (lenSrc) + { + ULONG lenMe = Length(); + WCHAR *pszNew = (WCHAR *)::CoTaskMemAlloc((lenMe + lenSrc + 1) * sizeof(WCHAR)); + if (pszNew) + { + if (m_psz) // Could append to an empty string so check... + { + if (lenMe) + { + memcpy(pszNew, m_psz, lenMe * sizeof(WCHAR)); + } + ::CoTaskMemFree(m_psz); + } + memcpy(pszNew + lenMe, pszSrc, (lenSrc + 1) * sizeof(WCHAR)); + m_psz = pszNew; + } + else + { + SPDBG_ASSERT(FALSE); + } + } + } + return m_psz; + } + + WCHAR * Append(const WCHAR * pszSrc, const ULONG lenSrc) + { + if (pszSrc && lenSrc) + { + ULONG lenMe = Length(); + WCHAR *pszNew = (WCHAR *)::CoTaskMemAlloc((lenMe + lenSrc + 1) * sizeof(WCHAR)); + if (pszNew) + { + if (m_psz) // Could append to an empty string so check... + { + if (lenMe) + { + memcpy(pszNew, m_psz, lenMe * sizeof(WCHAR)); + } + ::CoTaskMemFree(m_psz); + } + memcpy(pszNew + lenMe, pszSrc, lenSrc * sizeof(WCHAR)); + *(pszNew + lenMe + lenSrc) = L'\0'; + m_psz = pszNew; + } + else + { + SPDBG_ASSERT(FALSE); + } + } + return m_psz; + } + + WCHAR * Append2(const WCHAR * pszSrc1, const WCHAR * pszSrc2) + { + ULONG lenSrc1 = pszSrc1 ? wcslen(pszSrc1) : 0; + ULONG lenSrc2 = pszSrc2 ? wcslen(pszSrc2) : 0; + + if (lenSrc1 || lenSrc2) + { + ULONG lenMe = Length(); + WCHAR *pszNew = (WCHAR *)::CoTaskMemAlloc((lenMe + lenSrc1 + lenSrc2 + 1) * sizeof(WCHAR)); + if (pszNew) + { + if (m_psz) // Could append to an empty string so check... + { + if (lenMe) + { + memcpy(pszNew, m_psz, lenMe * sizeof(WCHAR)); + } + ::CoTaskMemFree(m_psz); + } + // In both of these cases, we copy the trailing NULL so that we're sure it gets + // there (if lenSrc2 is 0 then we better copy it from pszSrc1). + if (lenSrc1) + { + memcpy(pszNew + lenMe, pszSrc1, (lenSrc1 + 1) * sizeof(WCHAR)); + } + if (lenSrc2) + { + memcpy(pszNew + lenMe + lenSrc1, pszSrc2, (lenSrc2 + 1) * sizeof(WCHAR)); + } + m_psz = pszNew; + } + else + { + SPDBG_ASSERT(FALSE); + } + } + return m_psz; + } + WCHAR * Copy() const + { + if (m_psz) + { + CSpDynamicString szNew(m_psz); + return szNew.Detach(); + } + return NULL; + } + CHAR * CopyToChar() const + { + if (m_psz) + { + CHAR* psz; + ULONG cbNeeded = ::WideCharToMultiByte(CP_ACP, 0, m_psz, -1, NULL, NULL, NULL, NULL); + psz = (CHAR *)::CoTaskMemAlloc(cbNeeded); + SPDBG_ASSERT(psz); + if (psz) + { + ::WideCharToMultiByte(CP_ACP, 0, m_psz, -1, psz, cbNeeded/sizeof(CHAR), NULL, NULL); + } + return psz; + } + return NULL; + } + void Attach(WCHAR * pszSrc) + { + SPDBG_ASSERT(m_psz == NULL); + m_psz = pszSrc; + } + WCHAR * Detach() + { + WCHAR * s = m_psz; + m_psz = NULL; + return s; + } + void Clear() + { + ::CoTaskMemFree(m_psz); + m_psz = NULL; + } + bool operator!() const + { + return (m_psz == NULL); + } + HRESULT CopyToBSTR(BSTR * pbstr) + { + if (m_psz) + { + *pbstr = ::SysAllocString(m_psz); + if (*pbstr == NULL) + { + return E_OUTOFMEMORY; + } + } + else + { + *pbstr = NULL; + } + return S_OK; + } + void TrimToSize(ULONG ulNumChars) + { + if (m_psz && ulNumChars < Length()) + { + m_psz[ulNumChars] = 0; + } + } + WCHAR * Compact() + { + if (m_psz) + { + ULONG cch = wcslen(m_psz); + m_psz = (WCHAR *)::CoTaskMemRealloc(m_psz, (cch + 1) * sizeof(WCHAR)); + } + return m_psz; + } + WCHAR * ClearAndGrowTo(ULONG cch) + { + if (m_psz) + { + Clear(); + } + m_psz = (WCHAR *)::CoTaskMemAlloc(cch * sizeof(WCHAR)); + return m_psz; + } + WCHAR * LTrim() + { + if (m_psz) + { + WCHAR * pszRead = m_psz; + while (iswspace(*pszRead)) + { + pszRead++; + } + if (pszRead != m_psz) + { + WCHAR * pszWrite = m_psz; + while (*pszRead) + { + *pszWrite++ = *pszRead++; + } + *pszWrite = '\0'; + } + } + return m_psz; + } + WCHAR * RTrim() + { + if (m_psz) + { + WCHAR * pszTail = m_psz + wcslen(m_psz); + WCHAR * pszZeroTerm = pszTail; + while (pszZeroTerm > m_psz && iswspace(pszZeroTerm[-1])) + { + pszZeroTerm--; + } + if (pszZeroTerm != pszTail) + { + *pszZeroTerm = '\0'; + } + } + return m_psz; + } + WCHAR * TrimBoth() + { + RTrim(); + return LTrim(); + } +}; + + + +// +// Simple inline function converts a ulong to a hex string. +// +inline void SpHexFromUlong(WCHAR * psz, ULONG ul) +{ + const static WCHAR szHexChars[] = L"0123456789ABCDEF"; + if (ul == 0) + { + psz[0] = L'0'; + psz[1] = 0; + } + else + { + ULONG ulChars = 1; + psz[0] = 0; + while (ul) + { + memmove(psz + 1, psz, ulChars * sizeof(WCHAR)); + psz[0] = szHexChars[ul % 16]; + ul /= 16; + ulChars++; + } + } +} + + +//=== Token helpers + +inline HRESULT SpGetTokenFromId( + const WCHAR * pszTokenId, + ISpObjectToken ** ppToken, + BOOL fCreateIfNotExist = FALSE) +{ + SPDBG_FUNC("SpGetTokenFromId"); + HRESULT hr; + + CComPtr cpToken; + hr = cpToken.CoCreateInstance(CLSID_SpObjectToken); + + if (SUCCEEDED(hr)) + { + hr = cpToken->SetId(NULL, pszTokenId, fCreateIfNotExist); + } + + if (SUCCEEDED(hr)) + { + *ppToken = cpToken.Detach(); + } + + if (hr != SPERR_NOT_FOUND) + { + SPDBG_REPORT_ON_FAIL(hr); + } + + return hr; +} + +inline HRESULT SpGetCategoryFromId( + const WCHAR * pszCategoryId, + ISpObjectTokenCategory ** ppCategory, + BOOL fCreateIfNotExist = FALSE) +{ + SPDBG_FUNC("SpGetCategoryFromId"); + HRESULT hr; + + CComPtr cpTokenCategory; + hr = cpTokenCategory.CoCreateInstance(CLSID_SpObjectTokenCategory); + + if (SUCCEEDED(hr)) + { + hr = cpTokenCategory->SetId(pszCategoryId, fCreateIfNotExist); + } + + if (SUCCEEDED(hr)) + { + *ppCategory = cpTokenCategory.Detach(); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpGetDefaultTokenIdFromCategoryId( + const WCHAR * pszCategoryId, + WCHAR ** ppszTokenId) +{ + SPDBG_FUNC("SpGetDefaultTokenFromCategoryId"); + HRESULT hr; + + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory); + + if (SUCCEEDED(hr)) + { + hr = cpCategory->GetDefaultTokenId(ppszTokenId); + } + + return hr; +} + +inline HRESULT SpSetDefaultTokenIdForCategoryId( + const WCHAR * pszCategoryId, + const WCHAR * pszTokenId) +{ + SPDBG_FUNC("SpSetDefaultTokenIdForCategoryId"); + HRESULT hr; + + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory); + + if (SUCCEEDED(hr)) + { + hr = cpCategory->SetDefaultTokenId(pszTokenId); + } + + return hr; +} + +inline HRESULT SpGetDefaultTokenFromCategoryId( + const WCHAR * pszCategoryId, + ISpObjectToken ** ppToken, + BOOL fCreateCategoryIfNotExist = TRUE) +{ + SPDBG_FUNC("SpGetDefaultTokenFromCategoryId"); + HRESULT hr; + + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory, fCreateCategoryIfNotExist); + + if (SUCCEEDED(hr)) + { + WCHAR * pszTokenId; + hr = cpCategory->GetDefaultTokenId(&pszTokenId); + if (SUCCEEDED(hr)) + { + hr = SpGetTokenFromId(pszTokenId, ppToken); + ::CoTaskMemFree(pszTokenId); + } + } + + return hr; +} + +inline HRESULT SpSetDefaultTokenForCategoryId( + const WCHAR * pszCategoryId, + ISpObjectToken * pToken) +{ + SPDBG_FUNC("SpSetDefaultTokenForCategoryId"); + HRESULT hr; + + WCHAR * pszTokenId; + hr = pToken->GetId(&pszTokenId); + + if (SUCCEEDED(hr)) + { + hr = SpSetDefaultTokenIdForCategoryId(pszCategoryId, pszTokenId); + ::CoTaskMemFree(pszTokenId); + } + + return hr; +} + +inline HRESULT SpSetCommonTokenData( + ISpObjectToken * pToken, + const CLSID * pclsid, + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + ISpDataKey ** ppDataKeyAttribs) +{ + SPDBG_FUNC("SpSetCommonTokenData"); + HRESULT hr = S_OK; + + // Set the new token's CLSID (if specified) + if (SUCCEEDED(hr) && pclsid) + { + CSpDynamicString dstrClsid; + hr = StringFromCLSID(*pclsid, &dstrClsid); + + if (SUCCEEDED(hr)) + { + hr = pToken->SetStringValue(SPTOKENVALUE_CLSID, dstrClsid); + } + } + + // Set the token's lang independent name + if (SUCCEEDED(hr) && pszLangIndependentName) + { + hr = pToken->SetStringValue(NULL, pszLangIndependentName); + } + + // Set the token's lang dependent name + if (SUCCEEDED(hr) && pszLangDependentName) + { + USES_CONVERSION; + + TCHAR szLangId[10]; + wsprintf(szLangId, _T("%x"), langid); + + hr = pToken->SetStringValue(T2W(szLangId), pszLangDependentName); + } + + // Open the attributes key if requested + if (SUCCEEDED(hr) && ppDataKeyAttribs) + { + hr = pToken->CreateKey(L"Attributes", ppDataKeyAttribs); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpCreateNewToken( + const WCHAR * pszTokenId, + ISpObjectToken ** ppToken) +{ + SPDBG_FUNC("SpCreateNewToken"); + HRESULT hr; + + // Forcefully create the token + hr = SpGetTokenFromId(pszTokenId, ppToken, TRUE); + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpCreateNewToken( + const WCHAR * pszCategoryId, + const WCHAR * pszTokenKeyName, + ISpObjectToken ** ppToken) +{ + SPDBG_FUNC("SpCreateNewToken"); + HRESULT hr; + + // Forcefully create the category + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory, TRUE); + + // Come up with a token key name if one wasn't specified + CSpDynamicString dstrTokenKeyName; + if (SUCCEEDED(hr)) + { + if (pszTokenKeyName == NULL) + { + GUID guidTokenKeyName; + hr = CoCreateGuid(&guidTokenKeyName); + + if (SUCCEEDED(hr)) + { + hr = StringFromCLSID(guidTokenKeyName, &dstrTokenKeyName); + } + + if (SUCCEEDED(hr)) + { + pszTokenKeyName = dstrTokenKeyName; + } + } + } + + // Build the token id + CSpDynamicString dstrTokenId; + if (SUCCEEDED(hr)) + { + dstrTokenId = pszCategoryId; + dstrTokenId.Append2(L"\\Tokens\\", pszTokenKeyName); + } + + // Forcefully create the token + if (SUCCEEDED(hr)) + { + hr = SpGetTokenFromId(dstrTokenId, ppToken, TRUE); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpCreateNewTokenEx( + const WCHAR * pszCategoryId, + const WCHAR * pszTokenKeyName, + const CLSID * pclsid, + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + ISpObjectToken ** ppToken, + ISpDataKey ** ppDataKeyAttribs) +{ + SPDBG_FUNC("SpCreateNewTokenEx"); + HRESULT hr; + + // Create the new token + hr = SpCreateNewToken(pszCategoryId, pszTokenKeyName, ppToken); + + // Now set the extra data + if (SUCCEEDED(hr)) + { + hr = SpSetCommonTokenData( + *ppToken, + pclsid, + pszLangIndependentName, + langid, + pszLangDependentName, + ppDataKeyAttribs); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpCreateNewTokenEx( + const WCHAR * pszTokenId, + const CLSID * pclsid, + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + ISpObjectToken ** ppToken, + ISpDataKey ** ppDataKeyAttribs) +{ + SPDBG_FUNC("SpCreateNewTokenEx"); + HRESULT hr; + + // Create the new token + hr = SpCreateNewToken(pszTokenId, ppToken); + + // Now set the extra data + if (SUCCEEDED(hr)) + { + hr = SpSetCommonTokenData( + *ppToken, + pclsid, + pszLangIndependentName, + langid, + pszLangDependentName, + ppDataKeyAttribs); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpEnumTokens( + const WCHAR * pszCategoryId, + const WCHAR * pszReqAttribs, + const WCHAR * pszOptAttribs, + IEnumSpObjectTokens ** ppEnum) +{ + SPDBG_FUNC("SpEnumTokens"); + HRESULT hr = S_OK; + + CComPtr cpCategory; + hr = SpGetCategoryFromId(pszCategoryId, &cpCategory); + + if (SUCCEEDED(hr)) + { + hr = cpCategory->EnumTokens( + pszReqAttribs, + pszOptAttribs, + ppEnum); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +inline HRESULT SpFindBestToken( + const WCHAR * pszCategoryId, + const WCHAR * pszReqAttribs, + const WCHAR * pszOptAttribs, + ISpObjectToken **ppObjectToken) +{ + SPDBG_FUNC("SpFindBestToken"); + HRESULT hr = S_OK; + + const WCHAR *pszVendorPreferred = L"VendorPreferred"; + const size_t ulLenVendorPreferred = wcslen(pszVendorPreferred); // no size_t + + // append VendorPreferred to the end of pszOptAttribs to force this preference + ULONG ulLen = pszOptAttribs ? wcslen(pszOptAttribs) + ulLenVendorPreferred + 1 : ulLenVendorPreferred; + WCHAR *pszOptAttribsVendorPref = (WCHAR*)_alloca((ulLen+1)*sizeof(WCHAR)); + if (pszOptAttribsVendorPref) + { + if (pszOptAttribs) + { + wcscpy(pszOptAttribsVendorPref, pszOptAttribs); + wcscat(pszOptAttribsVendorPref, L";"); + wcscat(pszOptAttribsVendorPref, pszVendorPreferred); + } + else + { + wcscpy(pszOptAttribsVendorPref, pszVendorPreferred); + } + } + else + { + hr = E_OUTOFMEMORY; + } + + CComPtr cpEnum; + if (SUCCEEDED(hr)) + { + hr = SpEnumTokens(pszCategoryId, pszReqAttribs, pszOptAttribsVendorPref, &cpEnum); + } + + if (SUCCEEDED(hr)) + { + hr = cpEnum->Next(1, ppObjectToken, NULL); + if (hr == S_FALSE) + { + *ppObjectToken = NULL; + hr = SPERR_NOT_FOUND; + } + } + + if (hr != SPERR_NOT_FOUND) + { + SPDBG_REPORT_ON_FAIL(hr); + } + + return hr; +} + +template +HRESULT SpCreateObjectFromToken(ISpObjectToken * pToken, T ** ppObject, + IUnknown * pUnkOuter = NULL, DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateObjectFromToken"); + HRESULT hr; + + hr = pToken->CreateInstance(pUnkOuter, dwClsCtxt, __uuidof(T), (void **)ppObject); + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +template +HRESULT SpCreateObjectFromTokenId(const WCHAR * pszTokenId, T ** ppObject, + IUnknown * pUnkOuter = NULL, DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateObjectFromTokenId"); + + ISpObjectToken * pToken; + HRESULT hr = SpGetTokenFromId(pszTokenId, &pToken); + if (SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(pToken, ppObject, pUnkOuter, dwClsCtxt); + pToken->Release(); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +template +HRESULT SpCreateDefaultObjectFromCategoryId(const WCHAR * pszCategoryId, T ** ppObject, + IUnknown * pUnkOuter = NULL, DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateObjectFromTokenId"); + + ISpObjectToken * pToken; + HRESULT hr = SpGetDefaultTokenFromCategoryId(pszCategoryId, &pToken); + if (SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(pToken, ppObject, pUnkOuter, dwClsCtxt); + pToken->Release(); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +template +HRESULT SpCreateBestObject( + const WCHAR * pszCategoryId, + const WCHAR * pszReqAttribs, + const WCHAR * pszOptAttribs, + T ** ppObject, + IUnknown * pUnkOuter = NULL, + DWORD dwClsCtxt = CLSCTX_ALL) +{ + SPDBG_FUNC("SpCreateBestObject"); + HRESULT hr; + + CComPtr cpToken; + hr = SpFindBestToken(pszCategoryId, pszReqAttribs, pszOptAttribs, &cpToken); + + if (SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(cpToken, ppObject, pUnkOuter, dwClsCtxt); + } + + if (hr != SPERR_NOT_FOUND) + { + SPDBG_REPORT_ON_FAIL(hr); + } + + return hr; +} + +inline HRESULT SpCreatePhoneConverter( + LANGID LangID, + const WCHAR * pszReqAttribs, + const WCHAR * pszOptAttribs, + ISpPhoneConverter ** ppPhoneConverter) +{ + SPDBG_FUNC("SpCreatePhoneConverter"); + HRESULT hr; + + if (LangID == 0) + { + hr = E_INVALIDARG; + } + else + { + CSpDynamicString dstrReqAttribs; + if (pszReqAttribs) + { + dstrReqAttribs = pszReqAttribs; + dstrReqAttribs.Append(L";"); + } + + WCHAR szLang[MAX_PATH]; + + SpHexFromUlong(szLang, LangID); + + WCHAR szLangCondition[MAX_PATH]; + wcscpy(szLangCondition, L"Language="); + wcscat(szLangCondition, szLang); + + dstrReqAttribs.Append(szLangCondition); + + hr = SpCreateBestObject(SPCAT_PHONECONVERTERS, dstrReqAttribs, pszOptAttribs, ppPhoneConverter); + } + + if (hr != SPERR_NOT_FOUND) + { + SPDBG_REPORT_ON_FAIL(hr); + } + + return hr; +} + +/**************************************************************************** +* SpHrFromWin32 * +*---------------* +* Description: +* This inline function works around a basic problem with the macro +* HRESULT_FROM_WIN32. The macro forces the expresion in ( ) to be evaluated +* two times. By using this inline function, the expression will only be +* evaluated once. +* +* Returns: +* HRESULT of converted Win32 error code +* +*****************************************************************************/ + +inline HRESULT SpHrFromWin32(DWORD dwErr) +{ + return HRESULT_FROM_WIN32(dwErr); +} + + +/**************************************************************************** +* SpHrFromLastWin32Error * +*------------------------* +* Description: +* This simple inline function is used to return a converted HRESULT +* from the Win32 function ::GetLastError. Note that using HRESULT_FROM_WIN32 +* will evaluate the error code twice so we don't want to use: +* +* HRESULT_FROM_WIN32(::GetLastError()) +* +* since that will call GetLastError twice. +* On Win98 and WinMe ::GetLastError() returns 0 for some functions (see MSDN). +* We therefore check for that and return E_FAIL. This function should only be +* called in an error case since it will always return an error code! +* +* Returns: +* HRESULT for ::GetLastError() +* +*****************************************************************************/ + +inline HRESULT SpHrFromLastWin32Error() +{ + DWORD dw = ::GetLastError(); + return (dw == 0) ? E_FAIL : SpHrFromWin32(dw); +} + + +/**************************************************************************** +* SpGetUserDefaultUILanguage * +*----------------------------* +* Description: +* Returns the default user interface language, using a method +* appropriate to the platform (Windows 9x, Windows NT, or Windows 2000) +* +* Returns: +* Default UI language +* +*****************************************************************************/ + +inline LANGID SpGetUserDefaultUILanguage(void) +{ + HRESULT hr = S_OK; + LANGID wUILang = 0; + + OSVERSIONINFO Osv ; + Osv.dwOSVersionInfoSize = sizeof(Osv) ; + if(!GetVersionEx(&Osv)) + { + hr = SpHrFromLastWin32Error(); + } + // Get the UI language by one of three methods, depending on the system + else if(Osv.dwPlatformId != VER_PLATFORM_WIN32_NT) + { + // Case 1: Running on Windows 9x. Get the system UI language from registry: + CHAR szData[32]; + DWORD dwSize = sizeof(szData) ; + HKEY hKey; + + long lRet = RegOpenKeyEx( + HKEY_USERS, + _T(".Default\\Control Panel\\desktop\\ResourceLocale"), + 0, + KEY_READ, + &hKey); + +#ifdef _WIN32_WCE_BUG_10655 + if (lRet == ERROR_INVALID_PARAMETER) + { + lRet = ERROR_FILE_NOT_FOUND; + } +#endif // _WIN32_WCE_BUG_10655 + + hr = SpHrFromWin32(lRet); + + if (SUCCEEDED(hr)) + { + lRet = RegQueryValueEx( + hKey, + _T(""), + NULL, + NULL, + (BYTE *)szData, + &dwSize); + +#ifdef _WIN32_WCE_BUG_10655 + if(lRet == ERROR_INVALID_PARAMETER) + { + lRet = ERROR_FILE_NOT_FOUND; + } +#endif //_WIN32_WCE_BUG_10655 + + hr = SpHrFromWin32(lRet); + ::RegCloseKey(hKey) ; + } + if (SUCCEEDED(hr)) + { + // Convert string to number + wUILang = (LANGID) strtol(szData, NULL, 16) ; + } + } + else if (Osv.dwMajorVersion >= 5.0) + { + // Case 2: Running on Windows 2000 or later. Use GetUserDefaultUILanguage to find + // the user's prefered UI language + + + HMODULE hMKernel32 = ::LoadLibraryW(L"kernel32.dll") ; + if (hMKernel32 == NULL) + { + hr = SpHrFromLastWin32Error(); + } + else + { + + LANGID (WINAPI *pfnGetUserDefaultUILanguage) () = + (LANGID (WINAPI *)(void)) +#ifdef _WIN32_WCE + GetProcAddress(hMKernel32, L"GetUserDefaultUILanguage") ; +#else + GetProcAddress(hMKernel32, "GetUserDefaultUILanguage") ; +#endif + + if(NULL != pfnGetUserDefaultUILanguage) + { + wUILang = pfnGetUserDefaultUILanguage() ; + } + else + { // GetProcAddress failed + hr = SpHrFromLastWin32Error(); + } + ::FreeLibrary(hMKernel32); + } + } + else { + // Case 3: Running on Windows NT 4.0 or earlier. Get UI language + // from locale of .default user in registry: + // HKEY_USERS\.DEFAULT\Control Panel\International\Locale + + WCHAR szData[32] ; + DWORD dwSize = sizeof(szData) ; + HKEY hKey ; + + LONG lRet = RegOpenKeyEx(HKEY_USERS, + _T(".DEFAULT\\Control Panel\\International"), + 0, + KEY_READ, + &hKey); +#ifdef _WIN32_WCE_BUG_10655 + if(lRet == ERROR_INVALID_PARAMETER) + { + lRet = ERROR_FILE_NOT_FOUND; + } +#endif //_WIN32_WCE_BUG_10655 + + hr = SpHrFromWin32(lRet); + + if (SUCCEEDED(hr)) + { + lRet = RegQueryValueEx( + hKey, + _T("Locale"), + NULL, + NULL, + (BYTE *)szData, + &dwSize); + +#ifdef _WIN32_WCE_BUG_10655 + if(lRet == ERROR_INVALID_PARAMETER) + { + lRet = ERROR_FILE_NOT_FOUND; + } +#endif //_WIN32_WCE_BUG_10655 + + hr = SpHrFromWin32(lRet); + ::RegCloseKey(hKey); + } + + if (SUCCEEDED(hr)) + { + // Convert string to number + wUILang = (LANGID) wcstol(szData, NULL, 16) ; + + if(0x0401 == wUILang || // Arabic + 0x040d == wUILang || // Hebrew + 0x041e == wUILang // Thai + ) + { + // Special case these to the English UI. + // These versions of Windows NT 4.0 were enabled only, i.e., the + // UI was English. However, the registry setting + // HKEY_USERS\.DEFAULT\Control Panel\International\Locale was set + // to the respective locale for application compatibility. + wUILang = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US) ; + } + } + } + + return (wUILang ? wUILang : ::GetUserDefaultLangID()); // In failure case, try our best! +} + + +inline HRESULT SpGetDescription(ISpObjectToken * pObjToken, WCHAR ** ppszDescription, LANGID Language = SpGetUserDefaultUILanguage()) +{ + WCHAR szLangId[10]; + SpHexFromUlong(szLangId, Language); + HRESULT hr = pObjToken->GetStringValue(szLangId, ppszDescription); + if (hr == SPERR_NOT_FOUND) + { + hr = pObjToken->GetStringValue(NULL, ppszDescription); + } + return hr; +} + + +inline HRESULT SpSetDescription(ISpObjectToken * pObjToken, const WCHAR * pszDescription, LANGID Language = SpGetUserDefaultUILanguage(), BOOL fSetLangIndependentId = TRUE) +{ + WCHAR szLangId[10]; + SpHexFromUlong(szLangId, Language); + HRESULT hr = pObjToken->SetStringValue(szLangId, pszDescription); + if (SUCCEEDED(hr) && fSetLangIndependentId) + { + hr = pObjToken->SetStringValue(NULL, pszDescription); + } + return hr; +} + +/**************************************************************************** +* SpConvertStreamFormatEnum * +*---------------------------* +* Description: +* This method converts the specified stream format into a wave format +* structure. +* +*****************************************************************************/ +inline HRESULT SpConvertStreamFormatEnum(SPSTREAMFORMAT eFormat, GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + HRESULT hr = S_OK; + + if(pFormatId==NULL || ::IsBadWritePtr(pFormatId, sizeof(*pFormatId)) + || ppCoMemWaveFormatEx==NULL || ::IsBadWritePtr(ppCoMemWaveFormatEx, sizeof(*ppCoMemWaveFormatEx))) + { + return E_INVALIDARG; + } + + const GUID * pFmtGuid = &GUID_NULL; // Assume failure case + if( eFormat >= SPSF_8kHz8BitMono && eFormat <= SPSF_48kHz16BitStereo ) + { + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc(sizeof(WAVEFORMATEX)); + *ppCoMemWaveFormatEx = pwfex; + if (pwfex) + { + DWORD dwIndex = eFormat - SPSF_8kHz8BitMono; + BOOL bIsStereo = dwIndex & 0x1; + BOOL bIs16 = dwIndex & 0x2; + DWORD dwKHZ = (dwIndex & 0x3c) >> 2; + static const DWORD adwKHZ[] = { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }; + pwfex->wFormatTag = WAVE_FORMAT_PCM; + pwfex->nChannels = pwfex->nBlockAlign = (WORD)(bIsStereo ? 2 : 1); + pwfex->nSamplesPerSec = adwKHZ[dwKHZ]; + pwfex->wBitsPerSample = 8; + if (bIs16) + { + pwfex->wBitsPerSample *= 2; + pwfex->nBlockAlign *= 2; + } + pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nBlockAlign; + pwfex->cbSize = 0; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if( eFormat == SPSF_TrueSpeech_8kHz1BitMono ) + { + int NumBytes = sizeof( WAVEFORMATEX ) + 32; + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc( NumBytes ); + *ppCoMemWaveFormatEx = pwfex; + if( pwfex ) + { + memset( pwfex, 0, NumBytes ); + pwfex->wFormatTag = WAVE_FORMAT_DSPGROUP_TRUESPEECH; + pwfex->nChannels = 1; + pwfex->nSamplesPerSec = 8000; + pwfex->nAvgBytesPerSec = 1067; + pwfex->nBlockAlign = 32; + pwfex->wBitsPerSample = 1; + pwfex->cbSize = 32; + BYTE* pExtra = ((BYTE*)pwfex) + sizeof( WAVEFORMATEX ); + pExtra[0] = 1; + pExtra[2] = 0xF0; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if( (eFormat >= SPSF_CCITT_ALaw_8kHzMono ) && + (eFormat <= SPSF_CCITT_ALaw_44kHzStereo ) ) + { + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc( sizeof(WAVEFORMATEX) ); + *ppCoMemWaveFormatEx = pwfex; + if( pwfex ) + { + memset( pwfex, 0, sizeof(WAVEFORMATEX) ); + DWORD dwIndex = eFormat - SPSF_CCITT_ALaw_8kHzMono; + DWORD dwKHZ = dwIndex / 2; + static const DWORD adwKHZ[] = { 8000, 11025, 22050, 44100 }; + BOOL bIsStereo = dwIndex & 0x1; + pwfex->wFormatTag = WAVE_FORMAT_ALAW; + pwfex->nChannels = pwfex->nBlockAlign = (WORD)(bIsStereo ? 2 : 1); + pwfex->nSamplesPerSec = adwKHZ[dwKHZ]; + pwfex->wBitsPerSample = 8; + pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nBlockAlign; + pwfex->cbSize = 0; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if( (eFormat >= SPSF_CCITT_uLaw_8kHzMono ) && + (eFormat <= SPSF_CCITT_uLaw_44kHzStereo ) ) + { + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc( sizeof(WAVEFORMATEX) ); + *ppCoMemWaveFormatEx = pwfex; + if( pwfex ) + { + memset( pwfex, 0, sizeof(WAVEFORMATEX) ); + DWORD dwIndex = eFormat - SPSF_CCITT_uLaw_8kHzMono; + DWORD dwKHZ = dwIndex / 2; + static const DWORD adwKHZ[] = { 8000, 11025, 22050, 44100 }; + BOOL bIsStereo = dwIndex & 0x1; + pwfex->wFormatTag = WAVE_FORMAT_MULAW; + pwfex->nChannels = pwfex->nBlockAlign = (WORD)(bIsStereo ? 2 : 1); + pwfex->nSamplesPerSec = adwKHZ[dwKHZ]; + pwfex->wBitsPerSample = 8; + pwfex->nAvgBytesPerSec = pwfex->nSamplesPerSec * pwfex->nBlockAlign; + pwfex->cbSize = 0; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if( (eFormat >= SPSF_ADPCM_8kHzMono ) && + (eFormat <= SPSF_ADPCM_44kHzStereo ) ) + { + int NumBytes = sizeof( WAVEFORMATEX ) + 32; + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc( NumBytes ); + *ppCoMemWaveFormatEx = pwfex; + if( pwfex ) + { + //--- Some of these values seem odd. We used what the codec told us. + static const DWORD adwKHZ[] = { 8000, 11025, 22050, 44100 }; + static const DWORD BytesPerSec[] = { 4096, 8192, 5644, 11289, 11155, 22311, 22179, 44359 }; + static const DWORD BlockAlign[] = { 256, 256, 512, 1024 }; + static const BYTE Extra811[32] = + { + 0xF4, 0x01, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, + 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF + }; + + static const BYTE Extra22[32] = + { + 0xF4, 0x03, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, + 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF + }; + + static const BYTE Extra44[32] = + { + 0xF4, 0x07, 0x07, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x02, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, + 0xC0, 0x00, 0x40, 0x00, 0xF0, 0x00, 0x00, 0x00, + 0xCC, 0x01, 0x30, 0xFF, 0x88, 0x01, 0x18, 0xFF + }; + + static const BYTE* Extra[4] = { Extra811, Extra811, Extra22, Extra44 }; + memset( pwfex, 0, NumBytes ); + DWORD dwIndex = eFormat - SPSF_ADPCM_8kHzMono; + DWORD dwKHZ = dwIndex / 2; + BOOL bIsStereo = dwIndex & 0x1; + pwfex->wFormatTag = WAVE_FORMAT_ADPCM; + pwfex->nChannels = (WORD)(bIsStereo ? 2 : 1); + pwfex->nSamplesPerSec = adwKHZ[dwKHZ]; + pwfex->nAvgBytesPerSec = BytesPerSec[dwIndex]; + pwfex->nBlockAlign = (WORD)(BlockAlign[dwKHZ] * pwfex->nChannels); + pwfex->wBitsPerSample = 4; + pwfex->cbSize = 32; + BYTE* pExtra = ((BYTE*)pwfex) + sizeof( WAVEFORMATEX ); + memcpy( pExtra, Extra[dwKHZ], 32 ); + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else if( (eFormat >= SPSF_GSM610_8kHzMono ) && + (eFormat <= SPSF_GSM610_44kHzMono ) ) + { + int NumBytes = sizeof( WAVEFORMATEX ) + 2; + WAVEFORMATEX * pwfex = (WAVEFORMATEX *)::CoTaskMemAlloc( NumBytes ); + *ppCoMemWaveFormatEx = pwfex; + if( pwfex ) + { + //--- Some of these values seem odd. We used what the codec told us. + static const DWORD adwKHZ[] = { 8000, 11025, 22050, 44100 }; + static const DWORD BytesPerSec[] = { 1625, 2239, 4478, 8957 }; + memset( pwfex, 0, NumBytes ); + DWORD dwIndex = eFormat - SPSF_GSM610_8kHzMono; + pwfex->wFormatTag = WAVE_FORMAT_GSM610; + pwfex->nChannels = 1; + pwfex->nSamplesPerSec = adwKHZ[dwIndex]; + pwfex->nAvgBytesPerSec = BytesPerSec[dwIndex]; + pwfex->nBlockAlign = 65; + pwfex->wBitsPerSample = 0; + pwfex->cbSize = 2; + BYTE* pExtra = ((BYTE*)pwfex) + sizeof( WAVEFORMATEX ); + pExtra[0] = 0x40; + pExtra[1] = 0x01; + pFmtGuid = &SPDFID_WaveFormatEx; + } + else + { + hr = E_OUTOFMEMORY; + } + } + else + { + *ppCoMemWaveFormatEx = NULL; + switch (eFormat) + { + case SPSF_NoAssignedFormat: + break; + case SPSF_Text: + pFmtGuid = &SPDFID_Text; + break; + default: + hr = E_INVALIDARG; + break; + } + } + *pFormatId = *pFmtGuid; + return hr; +} + +class CSpStreamFormat +{ +public: + GUID m_guidFormatId; + WAVEFORMATEX * m_pCoMemWaveFormatEx; + + + static long CoMemCopyWFEX(const WAVEFORMATEX * pSrc, WAVEFORMATEX ** ppCoMemWFEX) // missing long + { + ULONG cb = sizeof(WAVEFORMATEX) + pSrc->cbSize; + *ppCoMemWFEX = (WAVEFORMATEX *)::CoTaskMemAlloc(cb); + if (*ppCoMemWFEX) + { + memcpy(*ppCoMemWFEX, pSrc, cb); + return S_OK; + } + else + { + return E_OUTOFMEMORY; + } + } + + + CSpStreamFormat() + { + m_guidFormatId = GUID_NULL; + m_pCoMemWaveFormatEx = NULL; + } + + CSpStreamFormat(SPSTREAMFORMAT eFormat, HRESULT * phr) + { + *phr = SpConvertStreamFormatEnum(eFormat, &m_guidFormatId, &m_pCoMemWaveFormatEx); + } + + CSpStreamFormat(const WAVEFORMATEX * pWaveFormatEx, HRESULT * phr) + { + SPDBG_ASSERT(pWaveFormatEx); + *phr = CoMemCopyWFEX(pWaveFormatEx, &m_pCoMemWaveFormatEx); + m_guidFormatId = SUCCEEDED(*phr) ? SPDFID_WaveFormatEx : GUID_NULL; + } + + ~CSpStreamFormat() + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + } + + void Clear() + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + m_pCoMemWaveFormatEx = NULL; + memset(&m_guidFormatId, 0, sizeof(m_guidFormatId)); + } + + const GUID & FormatId() const + { + return m_guidFormatId; + } + + const WAVEFORMATEX * WaveFormatExPtr() const + { + return m_pCoMemWaveFormatEx; + } + + + HRESULT AssignFormat(SPSTREAMFORMAT eFormat) + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + return SpConvertStreamFormatEnum(eFormat, &m_guidFormatId, &m_pCoMemWaveFormatEx); + } + + HRESULT AssignFormat(ISpStreamFormat * pStream) + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + m_pCoMemWaveFormatEx = NULL; + return pStream->GetFormat(&m_guidFormatId, &m_pCoMemWaveFormatEx); + } + + HRESULT AssignFormat(const WAVEFORMATEX * pWaveFormatEx) + { + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + HRESULT hr = CoMemCopyWFEX(pWaveFormatEx, &m_pCoMemWaveFormatEx); + m_guidFormatId = SUCCEEDED(hr) ? SPDFID_WaveFormatEx : GUID_NULL; + return hr; + } + + HRESULT AssignFormat(REFGUID rguidFormatId, const WAVEFORMATEX * pWaveFormatEx) + { + HRESULT hr = S_OK; + + m_guidFormatId = rguidFormatId; + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + m_pCoMemWaveFormatEx = NULL; + + if (rguidFormatId == SPDFID_WaveFormatEx) + { + if (::IsBadReadPtr(pWaveFormatEx, sizeof(*pWaveFormatEx))) + { + hr = E_INVALIDARG; + } + else + { + hr = CoMemCopyWFEX(pWaveFormatEx, &m_pCoMemWaveFormatEx); + } + + if (FAILED(hr)) + { + m_guidFormatId = GUID_NULL; + } + } + + return hr; + } + + + BOOL IsEqual(REFGUID rguidFormatId, const WAVEFORMATEX * pwfex) const + { + if (rguidFormatId == m_guidFormatId) + { + if (m_pCoMemWaveFormatEx) + { + if (pwfex && + pwfex->cbSize == m_pCoMemWaveFormatEx->cbSize && + memcmp(m_pCoMemWaveFormatEx, pwfex, sizeof(WAVEFORMATEX) + pwfex->cbSize) == 0) + { + return TRUE; + } + } + else + { + return (pwfex == NULL); + } + } + return FALSE; + } + + + + HRESULT ParamValidateAssignFormat(REFGUID rguidFormatId, const WAVEFORMATEX * pWaveFormatEx, BOOL fRequireWaveFormat = FALSE) + { + if ((pWaveFormatEx && (::IsBadReadPtr(pWaveFormatEx, sizeof(*pWaveFormatEx)) || rguidFormatId != SPDFID_WaveFormatEx)) || + (fRequireWaveFormat && pWaveFormatEx == NULL)) + { + return E_INVALIDARG; + } + return AssignFormat(rguidFormatId, pWaveFormatEx); + } + + SPSTREAMFORMAT ComputeFormatEnum() + { + if (m_guidFormatId == GUID_NULL) + { + return SPSF_NoAssignedFormat; + } + if (m_guidFormatId == SPDFID_Text) + { + return SPSF_Text; + } + if (m_guidFormatId != SPDFID_WaveFormatEx) + { + return SPSF_NonStandardFormat; + } + // + // It is a WAVEFORMATEX. Now determine which type it is and convert. + // + DWORD dwIndex = 0; + switch (m_pCoMemWaveFormatEx->wFormatTag) + { + case WAVE_FORMAT_PCM: + { + switch (m_pCoMemWaveFormatEx->nChannels) + { + case 1: + break; + case 2: + dwIndex |= 1; + break; + default: + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->wBitsPerSample) + { + case 8: + break; + case 16: + dwIndex |= 2; + break; + default: + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->nSamplesPerSec) + { + case 48000: + dwIndex += 4; // Fall through + case 44100: + dwIndex += 4; // Fall through + case 32000: + dwIndex += 4; // Fall through + case 24000: + dwIndex += 4; // Fall through + case 22050: + dwIndex += 4; // Fall through + case 16000: + dwIndex += 4; // Fall through + case 12000: + dwIndex += 4; // Fall through + case 11025: + dwIndex += 4; // Fall through + case 8000: + break; + default: + return SPSF_ExtendedAudioFormat; + } + + return static_cast(SPSF_8kHz8BitMono + dwIndex); + } + + case WAVE_FORMAT_DSPGROUP_TRUESPEECH: + { + return SPSF_TrueSpeech_8kHz1BitMono; + } + + case WAVE_FORMAT_ALAW: // fall through + case WAVE_FORMAT_MULAW: + case WAVE_FORMAT_ADPCM: + { + switch (m_pCoMemWaveFormatEx->nChannels) + { + case 1: + break; + case 2: + dwIndex |= 1; + break; + default: + return SPSF_ExtendedAudioFormat; + } + + if(m_pCoMemWaveFormatEx->wFormatTag == WAVE_FORMAT_ADPCM) + { + if(m_pCoMemWaveFormatEx->wBitsPerSample != 4) + { + return SPSF_ExtendedAudioFormat; + } + } + else if(m_pCoMemWaveFormatEx->wBitsPerSample != 8) + { + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->nSamplesPerSec) + { + case 44100: + dwIndex += 2; // Fall through + case 22050: + dwIndex += 2; // Fall through + case 11025: + dwIndex += 2; // Fall through + case 8000: + break; + default: + return SPSF_ExtendedAudioFormat; + } + + switch( m_pCoMemWaveFormatEx->wFormatTag ) + { + case WAVE_FORMAT_ALAW: + return static_cast(SPSF_CCITT_ALaw_8kHzMono + dwIndex); + case WAVE_FORMAT_MULAW: + return static_cast(SPSF_CCITT_uLaw_8kHzMono + dwIndex); + case WAVE_FORMAT_ADPCM: + return static_cast(SPSF_ADPCM_8kHzMono + dwIndex); + } + } + + case WAVE_FORMAT_GSM610: + { + if( m_pCoMemWaveFormatEx->nChannels != 1 ) + { + return SPSF_ExtendedAudioFormat; + } + + switch (m_pCoMemWaveFormatEx->nSamplesPerSec) + { + case 44100: + dwIndex = 3; + break; + case 22050: + dwIndex = 2; + break; + case 11025: + dwIndex = 1; + break; + case 8000: + dwIndex = 0; + break; + default: + return SPSF_ExtendedAudioFormat; + } + + return static_cast(SPSF_GSM610_8kHzMono + dwIndex); + } + + default: + return SPSF_ExtendedAudioFormat; + break; + } + } + + void DetachTo(CSpStreamFormat & Other) + { + ::CoTaskMemFree(Other.m_pCoMemWaveFormatEx); + Other.m_guidFormatId = m_guidFormatId; + Other.m_pCoMemWaveFormatEx = m_pCoMemWaveFormatEx; + m_pCoMemWaveFormatEx = NULL; + memset(&m_guidFormatId, 0, sizeof(m_guidFormatId)); + } + + void DetachTo(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx) + { + *pFormatId = m_guidFormatId; + *ppCoMemWaveFormatEx = m_pCoMemWaveFormatEx; + m_pCoMemWaveFormatEx = NULL; + memset(&m_guidFormatId, 0, sizeof(m_guidFormatId)); + } + + HRESULT CopyTo(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWFEX) const + { + HRESULT hr = S_OK; + *pFormatId = m_guidFormatId; + if (m_pCoMemWaveFormatEx) + { + hr = CoMemCopyWFEX(m_pCoMemWaveFormatEx, ppCoMemWFEX); + if (FAILED(hr)) + { + memset(pFormatId, 0, sizeof(*pFormatId)); + } + } + else + { + *ppCoMemWFEX = NULL; + } + return hr; + } + + HRESULT CopyTo(CSpStreamFormat & Other) const + { + ::CoTaskMemFree(Other.m_pCoMemWaveFormatEx); + return CopyTo(&Other.m_guidFormatId, &Other.m_pCoMemWaveFormatEx); + } + + HRESULT AssignFormat(const CSpStreamFormat & Src) + { + return Src.CopyTo(*this); + } + + + HRESULT ParamValidateCopyTo(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWFEX) const + { + if (::IsBadWritePtr(pFormatId, sizeof(*pFormatId)) || + ::IsBadWritePtr(ppCoMemWFEX, sizeof(*ppCoMemWFEX))) + { + return E_POINTER; + } + return CopyTo(pFormatId, ppCoMemWFEX); + } + + BOOL operator==(const CSpStreamFormat & Other) const + { + return IsEqual(Other.m_guidFormatId, Other.m_pCoMemWaveFormatEx); + } + BOOL operator!=(const CSpStreamFormat & Other) const + { + return !IsEqual(Other.m_guidFormatId, Other.m_pCoMemWaveFormatEx); + } + + ULONG SerializeSize() const + { + ULONG cb = sizeof(ULONG) + sizeof(m_guidFormatId); + if (m_pCoMemWaveFormatEx) + { + cb += sizeof(WAVEFORMATEX) + m_pCoMemWaveFormatEx->cbSize + 3; // Add 3 to round up + cb -= cb % 4; // Round to DWORD + } + return cb; + } + + ULONG Serialize(BYTE * pBuffer) const + { + ULONG cb = SerializeSize(); + *((UNALIGNED ULONG *)pBuffer) = cb; + pBuffer += sizeof(ULONG); + *((UNALIGNED GUID *)pBuffer) = m_guidFormatId; + if (m_pCoMemWaveFormatEx) + { + pBuffer += sizeof(m_guidFormatId); + memcpy(pBuffer, m_pCoMemWaveFormatEx, sizeof(WAVEFORMATEX) + m_pCoMemWaveFormatEx->cbSize); + } + return cb; + } + + HRESULT Deserialize(const BYTE * pBuffer, ULONG * pcbUsed) + { + HRESULT hr = S_OK; + ::CoTaskMemFree(m_pCoMemWaveFormatEx); + m_pCoMemWaveFormatEx = NULL; + *pcbUsed = *((UNALIGNED ULONG *)pBuffer); + pBuffer += sizeof(ULONG); + // Misaligment exception is generated for SHx platform. + // Marking pointer as UNALIGNED does not help. +#ifndef _WIN32_WCE + m_guidFormatId = *((UNALIGNED GUID *)pBuffer); +#else + memcpy(&m_guidFormatId, pBuffer, sizeof(GUID)); +#endif + if (*pcbUsed > sizeof(GUID) + sizeof(ULONG)) + { + pBuffer += sizeof(m_guidFormatId); + hr = CoMemCopyWFEX((const WAVEFORMATEX *)pBuffer, &m_pCoMemWaveFormatEx); + if (FAILED(hr)) + { + m_guidFormatId = GUID_NULL; + } + } + return hr; + } + +}; + + + +// Return the default codepage given a LCID. +// Note some of the newer locales do not have associated Windows codepages. For these, we return UTF-8. + +inline UINT SpCodePageFromLcid(LCID lcid) +{ + char achCodePage[6]; + + return (0 != GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE, achCodePage, sizeof(achCodePage))) ? atoi(achCodePage) : 65001; +} + + +inline HRESULT SPBindToFile( LPCWSTR pFileName, SPFILEMODE eMode, ISpStream ** ppStream, + const GUID * pFormatId = NULL, const WAVEFORMATEX * pWaveFormatEx = NULL, + ULONGLONG ullEventInterest = SPFEI_ALL_EVENTS) +{ + HRESULT hr = ::CoCreateInstance(CLSID_SpStream, NULL, CLSCTX_ALL, __uuidof(*ppStream), (void **)ppStream); + if (SUCCEEDED(hr)) + { + hr = (*ppStream)->BindToFile(pFileName, eMode, pFormatId, pWaveFormatEx, ullEventInterest); + if (FAILED(hr)) + { + (*ppStream)->Release(); + *ppStream = NULL; + } + } + return hr; +} /* SPBindToFile */ + +#ifndef _UNICODE +inline HRESULT SPBindToFile( const TCHAR * pFileName, SPFILEMODE eMode, ISpStream** ppStream, + const GUID * pFormatId = NULL, const WAVEFORMATEX * pWaveFormatEx = NULL, + ULONGLONG ullEventInterest = SPFEI_ALL_EVENTS) +{ + WCHAR szWcharFileName[MAX_PATH]; + ::MultiByteToWideChar(CP_ACP, 0, pFileName, -1, szWcharFileName, sp_countof(szWcharFileName)); + return SPBindToFile(szWcharFileName, eMode, ppStream, pFormatId, pWaveFormatEx, ullEventInterest); +} +#endif + +/**************************************************************************** +* SpClearEvent * +*--------------* +* Description: +* Helper function that can be used by clients that do not use the CSpEvent +* class. +* +* Returns: +* +*****************************************************************************/ + +inline void SpClearEvent(SPEVENT * pe) +{ + if( pe->elParamType != SPEI_UNDEFINED) + { + if( pe->elParamType == SPET_LPARAM_IS_POINTER || + pe->elParamType == SPET_LPARAM_IS_STRING) + { + ::CoTaskMemFree((void *)pe->lParam); + } + else if (pe->elParamType == SPET_LPARAM_IS_TOKEN || + pe->elParamType == SPET_LPARAM_IS_OBJECT) + { + ((IUnknown*)pe->lParam)->Release(); + } + } + memset(pe, 0, sizeof(*pe)); +} + +/**************************************************************************** +* SpInitEvent * +*-------------* +* Description: +* +* Returns: +* +*****************************************************************************/ + +inline void SpInitEvent(SPEVENT * pe) +{ + memset(pe, 0, sizeof(*pe)); +} + +/**************************************************************************** +* SpEventSerializeSize * +*----------------------* +* Description: +* Computes the required size of a buffer to serialize an event. The caller +* must specify which type of serialized event is desired -- either SPSERIALIZEDEVENT +* or SPSERIALIZEDEVENT64. +* +* Returns: +* Size in bytes required to seriailze the event. +* +****************************************************************************/ + +// WCE compiler does not work propertly with template +#ifndef _WIN32_WCE +template +inline ULONG SpEventSerializeSize(const SPEVENT * pEvent) + +{ + ULONG ulSize = sizeof(T); + +#else + +inline ULONG SpEventSerializeSize(const SPEVENT * pEvent, ULONG ulSize) +{ +#endif //_WIN32_WCE + + if( ( pEvent->elParamType == SPET_LPARAM_IS_POINTER ) && pEvent->lParam ) + { + ulSize += ULONG(pEvent->wParam); + } + else if ((pEvent->elParamType == SPET_LPARAM_IS_STRING) && pEvent->lParam != NULL) + { + ulSize += (wcslen((WCHAR*)pEvent->lParam) + 1) * sizeof( WCHAR ); + } + else if( pEvent->elParamType == SPET_LPARAM_IS_TOKEN ) + { + CSpDynamicString dstrObjectId; + if( ((ISpObjectToken*)(pEvent->lParam))->GetId( &dstrObjectId ) == S_OK ) + { + ulSize += (dstrObjectId.Length() + 1) * sizeof( WCHAR ); + } + } + // Round up to nearest DWORD + ulSize += 3; + ulSize -= ulSize % 4; + return ulSize; +} + +/**************************************************************************** +* SpSerializedEventSize * +*-----------------------* +* Description: +* Returns the size, in bytes, used by a serialized event. The caller can +* pass a pointer to either a SPSERIAILZEDEVENT or SPSERIALIZEDEVENT64 structure. +* +* Returns: +* Number of bytes used by serizlied event +* +********************************************************************* RAL ***/ + +// WCE compiler does not work propertly with template +#ifndef _WIN32_WCE +template +inline ULONG SpSerializedEventSize(const T * pSerEvent) +{ + ULONG ulSize = sizeof(T); + + if( ( pSerEvent->elParamType == SPET_LPARAM_IS_POINTER ) && pSerEvent->SerializedlParam ) + { + ulSize += ULONG(pSerEvent->SerializedwParam); + } + else if ((pSerEvent->elParamType == SPET_LPARAM_IS_STRING || pSerEvent->elParamType == SPET_LPARAM_IS_TOKEN) && + pSerEvent->SerializedlParam != NULL) + { + ulSize += (wcslen((WCHAR*)(pSerEvent + 1)) + 1) * sizeof( WCHAR ); + } + // Round up to nearest DWORD + ulSize += 3; + ulSize -= ulSize % 4; + return ulSize; +} + +#else //_WIN32_WCE + +inline ULONG SpSerializedEventSize(const SPSERIALIZEDEVENT * pSerEvent, ULONG ulSize) +{ + if( ( pSerEvent->elParamType == SPET_LPARAM_IS_POINTER ) && pSerEvent->SerializedlParam ) + { + ulSize += ULONG(pSerEvent->SerializedwParam); + } + else if ((pSerEvent->elParamType == SPET_LPARAM_IS_STRING || pSerEvent->elParamType == SPET_LPARAM_IS_TOKEN) && + pSerEvent->SerializedlParam != NULL) + { + ulSize += (wcslen((WCHAR*)(pSerEvent + 1)) + 1) * sizeof( WCHAR ); + } + // Round up to nearest DWORD + ulSize += 3; + ulSize -= ulSize % 4; + return ulSize; +} + +inline ULONG SpSerializedEventSize(const SPSERIALIZEDEVENT64 * pSerEvent, ULONG ulSize) +{ + if( ( pSerEvent->elParamType == SPET_LPARAM_IS_POINTER ) && pSerEvent->SerializedlParam ) + { + ulSize += ULONG(pSerEvent->SerializedwParam); + } + else if ((pSerEvent->elParamType == SPET_LPARAM_IS_STRING || pSerEvent->elParamType == SPET_LPARAM_IS_TOKEN) && + pSerEvent->SerializedlParam != NULL) + { + ulSize += (wcslen((WCHAR*)(pSerEvent + 1)) + 1) * sizeof( WCHAR ); + } + // Round up to nearest DWORD + ulSize += 3; + ulSize -= ulSize % 4; + return ulSize; +} + +#endif //_WIN32_WCE + +/*** CSpEvent helper class +* +*/ +class CSpEvent : public SPEVENT +{ +public: + CSpEvent() + { + SpInitEvent(this); + } + ~CSpEvent() + { + SpClearEvent(this); + } + // If you need to take the address of a CSpEvent that is not const, use the AddrOf() method + // which will do debug checking of parameters. If you encounter this problem when calling + // GetEvents from an event source, you may want to use the GetFrom() method of this class. + const SPEVENT * operator&() + { + return this; + } + CSpEvent * AddrOf() + { + // Note: This method does not ASSERT since we assume the caller knows what they are doing. + return this; + } + void Clear() + { + SpClearEvent(this); + } + HRESULT CopyTo(SPEVENT * pDestEvent) const + { + memcpy(pDestEvent, this, sizeof(*pDestEvent)); + if ((elParamType == SPET_LPARAM_IS_POINTER) && lParam) + { + SPDBG_ASSERT(wParam && (wParam < 0x100000)); // this is too big! + pDestEvent->lParam = (LPARAM)::CoTaskMemAlloc(wParam); + if (pDestEvent->lParam) + { + memcpy((void *)pDestEvent->lParam, (void *)lParam, wParam); + } + else + { + pDestEvent->eEventId = SPEI_UNDEFINED; + return E_OUTOFMEMORY; + } + } + else if (elParamType == SPET_LPARAM_IS_STRING && lParam != NULL) + { + pDestEvent->lParam = (LPARAM)::CoTaskMemAlloc((wcslen((WCHAR*)lParam) + 1) * sizeof(WCHAR)); + if (pDestEvent->lParam) + { + wcscpy((WCHAR*)pDestEvent->lParam, (WCHAR*)lParam); + } + else + { + pDestEvent->eEventId = SPEI_UNDEFINED; + return E_OUTOFMEMORY; + } + } + else if (elParamType == SPET_LPARAM_IS_TOKEN || + elParamType == SPET_LPARAM_IS_OBJECT) + { + ((IUnknown*)lParam)->AddRef(); + } + return S_OK; + } + + HRESULT GetFrom(ISpEventSource * pEventSrc) + { + SpClearEvent(this); + return pEventSrc->GetEvents(1, this, NULL); + } + HRESULT CopyFrom(const SPEVENT * pSrcEvent) + { + SpClearEvent(this); + return static_cast(pSrcEvent)->CopyTo(this); + } + void Detach(SPEVENT * pDestEvent = NULL) + { + if (pDestEvent) + { + memcpy(pDestEvent, this, sizeof(*pDestEvent)); + } + memset(this, 0, sizeof(*this)); + } + + template + ULONG SerializeSize() const + { + return SpEventSerializeSize(this); + } + + // Call this method with either SPSERIALIZEDEVENT or SPSERIALIZEDEVENT64 + template + void Serialize(T * pSerEvent) const + { + SPDBG_ASSERT(elParamType != SPET_LPARAM_IS_OBJECT); + pSerEvent->eEventId = this->eEventId; + pSerEvent->elParamType = this->elParamType; + pSerEvent->ulStreamNum = this->ulStreamNum; + pSerEvent->ullAudioStreamOffset = this->ullAudioStreamOffset; + pSerEvent->SerializedwParam = static_cast(this->wParam); + pSerEvent->SerializedlParam = static_cast(this->lParam); + if (lParam) + { + switch(elParamType) + { + case SPET_LPARAM_IS_POINTER: + memcpy(pSerEvent + 1, (void *)lParam, wParam); + pSerEvent->SerializedlParam = sizeof(T); + break; + + case SPET_LPARAM_IS_STRING: + wcscpy((WCHAR *)(pSerEvent + 1), (WCHAR*)lParam); + pSerEvent->SerializedlParam = sizeof(T); + break; + + case SPET_LPARAM_IS_TOKEN: + { + CSpDynamicString dstrObjectId; + if( SUCCEEDED( ((ISpObjectToken*)lParam)->GetId( &dstrObjectId ) ) ) + { + pSerEvent->SerializedwParam = (dstrObjectId.Length() + 1) * sizeof( WCHAR );; + memcpy( pSerEvent + 1, (void *)dstrObjectId.m_psz, static_cast(pSerEvent->SerializedwParam) ); + } + pSerEvent->SerializedlParam = sizeof(T); + } + break; + + default: + break; + } + } + } + + template + HRESULT Serialize(T ** ppCoMemSerEvent, ULONG * pcbSerEvent) const + { +// WCE compiler does not work propertly with template +#ifndef _WIN32_WCE + *pcbSerEvent = SpEventSerializeSize(this); +#else + *pcbSerEvent = SpEventSerializeSize(this, sizeof(** ppCoMemSerEvent)); +#endif + *ppCoMemSerEvent = (T *)::CoTaskMemAlloc(*pcbSerEvent); + if (*ppCoMemSerEvent) + { + Serialize(*ppCoMemSerEvent); + return S_OK; + } + else + { + *pcbSerEvent = 0; + return E_OUTOFMEMORY; + } + } + + + // Call this method with either SPSERIALIZEDEVENT or SPSERIALIZEDEVENT64 + template + HRESULT Deserialize(const T * pSerEvent, ULONG * pcbUsed = NULL) + { + Clear(); + HRESULT hr = S_OK; + const UNALIGNED T * pTemp = pSerEvent; + this->eEventId = pTemp->eEventId; + this->elParamType = pTemp->elParamType; + this->ulStreamNum = pTemp->ulStreamNum; + this->ullAudioStreamOffset = pTemp->ullAudioStreamOffset; + this->wParam = static_cast(pTemp->SerializedwParam); + this->lParam = static_cast(pTemp->SerializedlParam); + if (pTemp->SerializedlParam) + { + ULONG cbAlloc = 0; + switch (pTemp->elParamType) + { + case SPET_LPARAM_IS_POINTER: + cbAlloc = static_cast(wParam); + break; + + case SPET_LPARAM_IS_STRING: + cbAlloc = sizeof(WCHAR) * (1 + wcslen((const WCHAR *)(pTemp + 1))); + break; + + case SPET_LPARAM_IS_TOKEN: + { + ULONG ulDataOffset = ULONG(lParam); + hr = SpGetTokenFromId( (const WCHAR*)(pTemp + 1), + (ISpObjectToken **)&lParam ); + wParam = 0; + } + break; + } + if (cbAlloc) + { + void * pvBuff = ::CoTaskMemAlloc(cbAlloc); + this->lParam = (LPARAM)pvBuff; + if (pvBuff) + { + memcpy(pvBuff, pTemp + 1, cbAlloc); + } + else + { + hr = E_OUTOFMEMORY; + } + } + } + + if( SUCCEEDED( hr ) && pcbUsed ) + { +// WCE compiler does not work propertly with template +#ifndef _WIN32_WCE + *pcbUsed = SpEventSerializeSize(this); +#else + *pcbUsed = SpEventSerializeSize(this, sizeof(*pTemp)); +#endif + } + return hr; + } + + // + // Helpers for access to events. Performs run-time checks in debug and casts + // data to the appropriate types + // + SPPHONEID Phoneme() const + { + SPDBG_ASSERT(eEventId == SPEI_PHONEME); + return (SPPHONEID)LOWORD(lParam); + } + SPVISEMES Viseme() const + { + SPDBG_ASSERT(eEventId == SPEI_VISEME); + return (SPVISEMES)LOWORD(lParam); + } + ULONG InputWordPos() const + { + SPDBG_ASSERT(eEventId == SPEI_WORD_BOUNDARY); + return ULONG(lParam); + } + ULONG InputWordLen() const + { + SPDBG_ASSERT(eEventId == SPEI_WORD_BOUNDARY); + return ULONG(wParam); + } + ULONG InputSentPos() const + { + SPDBG_ASSERT(eEventId == SPEI_SENTENCE_BOUNDARY); + return ULONG(lParam); + } + ULONG InputSentLen() const + { + SPDBG_ASSERT(eEventId == SPEI_SENTENCE_BOUNDARY); + return ULONG(wParam); + } + ISpObjectToken * ObjectToken() const + { + SPDBG_ASSERT(elParamType == SPET_LPARAM_IS_TOKEN); + return (ISpObjectToken *)lParam; + } + ISpObjectToken * VoiceToken() const // More explicit check than ObjectToken() + { + SPDBG_ASSERT(eEventId == SPEI_VOICE_CHANGE); + return ObjectToken(); + } + BOOL PersistVoiceChange() const + { + SPDBG_ASSERT(eEventId == SPEI_VOICE_CHANGE); + return (BOOL)wParam; + } + IUnknown * Object() const + { + SPDBG_ASSERT(elParamType == SPET_LPARAM_IS_OBJECT); + return (IUnknown*)lParam; + } + ISpRecoResult * RecoResult() const + { + SPDBG_ASSERT(eEventId == SPEI_RECOGNITION || eEventId == SPEI_FALSE_RECOGNITION || eEventId == SPEI_HYPOTHESIS); + return (ISpRecoResult *)Object(); + } + BOOL IsPaused() + { + SPDBG_ASSERT(eEventId == SPEI_RECOGNITION || eEventId == SPEI_SR_BOOKMARK); + return (BOOL)(wParam & SPREF_AutoPause); + } + BOOL IsEmulated() + { + SPDBG_ASSERT(eEventId == SPEI_RECOGNITION); + return (BOOL)(wParam & SPREF_Emulated); + } + const WCHAR * String() const + { + SPDBG_ASSERT(elParamType == SPET_LPARAM_IS_STRING); + return (const WCHAR*)lParam; + } + const WCHAR * BookmarkName() const + { + SPDBG_ASSERT(eEventId == SPEI_TTS_BOOKMARK); + return String(); + } + const WCHAR * RequestTypeOfUI() const + { + SPDBG_ASSERT(eEventId == SPEI_REQUEST_UI); + return String(); + } + SPRECOSTATE RecoState() const + { + SPDBG_ASSERT(eEventId == SPEI_RECO_STATE_CHANGE); + return static_cast(wParam); + } + const WCHAR * PropertyName() const + { + SPDBG_ASSERT((eEventId == SPEI_PROPERTY_NUM_CHANGE && elParamType == SPET_LPARAM_IS_STRING) || + (eEventId == SPEI_PROPERTY_STRING_CHANGE && elParamType == SPET_LPARAM_IS_POINTER)); + // Note: Don't use String() method here since in the case of string attributes, the elParamType + // field specifies LPARAM_IS_POINTER, but the attribute name IS the first string in this buffer + return (const WCHAR*)lParam; + } + const LONG PropertyNumValue() const + { + SPDBG_ASSERT(eEventId == SPEI_PROPERTY_NUM_CHANGE); + return static_cast(wParam); + } + const WCHAR * PropertyStringValue() const + { + // Search for the first NULL and return pointer to the char past it. + SPDBG_ASSERT(eEventId == SPEI_PROPERTY_STRING_CHANGE); + const WCHAR * psz = (const WCHAR *)lParam; // moved this from for init + for (; *psz; psz++) {} + return psz + 1; + } + SPINTERFERENCE Interference() const + { + SPDBG_ASSERT(eEventId == SPEI_INTERFERENCE); + return static_cast(lParam); + } + HRESULT EndStreamResult() const + { + SPDBG_ASSERT(eEventId == SPEI_END_SR_STREAM); + return static_cast(lParam); + } + BOOL InputStreamReleased() const + { + SPDBG_ASSERT(eEventId == SPEI_END_SR_STREAM); + return (wParam & SPESF_STREAM_RELEASED) ? TRUE : FALSE; + } +}; + +class CSpPhrasePtr +{ +public: + SPPHRASE * m_pPhrase; + CSpPhrasePtr() : m_pPhrase(NULL) {} + CSpPhrasePtr(ISpPhrase * pPhraseObj, HRESULT * phr) + { + *phr = pPhraseObj->GetPhrase(&m_pPhrase); + } + ~CSpPhrasePtr() + { + ::CoTaskMemFree(m_pPhrase); + } + //The assert on operator& usually indicates a bug. If this is really + //what is needed, however, take the address of the m_pPhrase member explicitly. + SPPHRASE ** operator&() + { + SPDBG_ASSERT(m_pPhrase == NULL); + return &m_pPhrase; + } + operator SPPHRASE *() const + { + return m_pPhrase; + } + SPPHRASE & operator*() const + { + SPDBG_ASSERT(m_pPhrase); + return *m_pPhrase; + } + SPPHRASE * operator->() const + { + return m_pPhrase; + } + bool operator!() const + { + return (m_pPhrase == NULL); + } + void Clear() + { + if (m_pPhrase) + { + ::CoTaskMemFree(m_pPhrase); + m_pPhrase = NULL; + } + } + HRESULT GetFrom(ISpPhrase * pPhraseObj) + { + Clear(); + return pPhraseObj->GetPhrase(&m_pPhrase); + } +}; + + +template +class CSpCoTaskMemPtr +{ +public: + T * m_pT; + CSpCoTaskMemPtr() : m_pT(NULL) {} + CSpCoTaskMemPtr(void * pv) : m_pT((T *)pv) {} + CSpCoTaskMemPtr(ULONG cElements, HRESULT * phr) + { + m_pT = (T *)::CoTaskMemAlloc(cElements * sizeof(T)); + *phr = m_pT ? S_OK : E_OUTOFMEMORY; + } + ~CSpCoTaskMemPtr() + { + ::CoTaskMemFree(m_pT); + } + void Clear() + { + if (m_pT) + { + ::CoTaskMemFree(m_pT); + m_pT = NULL; + } + } + HRESULT Alloc(ULONG cArrayElements = 1) + { + m_pT = (T *)::CoTaskMemRealloc(m_pT, sizeof(T) * cArrayElements); + SPDBG_ASSERT(m_pT); + return (m_pT ? S_OK : E_OUTOFMEMORY); + } + void Attach(void * pv) + { + Clear(); + m_pT = (T *)pv; + } + T * Detatch() + { + T * pT = m_pT; + m_pT = NULL; + return pT; + } + //The assert on operator& usually indicates a bug. If this is really + //what is needed, however, take the address of the m_pT member explicitly. + T ** operator&() + { + SPDBG_ASSERT(m_pT == NULL); + return &m_pT; + } + T * operator->() + { + SPDBG_ASSERT(m_pT != NULL); + return m_pT; + } + operator T *() + { + return m_pT; + } + bool operator!() const + { + return (m_pT == NULL); + } +}; + +/**** Helper function used to create a new phrase object from an array of + test words. Each word in the string is converted to a phrase element. + This is useful to create a phrase to pass to the EmulateRecognition method. + The method can convert standard words as well as words with the + "/display_text/lexical_form/pronounciation;" word format. + You can also specify the DisplayAttributes for each element if desired. + If prgDispAttribs is NULL then the DisplayAttribs for each element default to + SPAF_ONE_TRAILING_SPACE. ****/ +inline HRESULT CreatePhraseFromWordArray(const WCHAR ** ppWords, ULONG cWords, + SPDISPLYATTRIBUTES * prgDispAttribs, + ISpPhraseBuilder **ppResultPhrase, + LANGID LangId = 0, + CComPtr cpPhoneConv = NULL) +{ + SPDBG_FUNC("CreatePhraseFromWordArray"); + HRESULT hr = S_OK; + + if ( cWords == 0 || ppWords == NULL || ::IsBadReadPtr(ppWords, sizeof(*ppWords) * cWords ) ) + { + return E_INVALIDARG; + } + + if ( prgDispAttribs != NULL && ::IsBadReadPtr(prgDispAttribs, sizeof(*prgDispAttribs) * cWords ) ) + { + return E_INVALIDARG; + } + + ULONG cTotalChars = 0; + ULONG i; + WCHAR** pStringPtrArray = (WCHAR**)::CoTaskMemAlloc( cWords * sizeof(WCHAR *)); + if ( !pStringPtrArray ) + { + return E_OUTOFMEMORY; + } + for (i = 0; i < cWords; i++) + { + cTotalChars += wcslen(ppWords[i])+1; + } + + CSpDynamicString dsText(cTotalChars); + if(dsText.m_psz == NULL) + { + ::CoTaskMemFree(pStringPtrArray); + return E_OUTOFMEMORY; + } + CSpDynamicString dsPhoneId(cTotalChars); + if(dsPhoneId.m_psz == NULL) + { + ::CoTaskMemFree(pStringPtrArray); + return E_OUTOFMEMORY; + } + SPPHONEID* pphoneId = (SPPHONEID*)((WCHAR *)dsPhoneId); // improper casting + + SPPHRASE Phrase; + memset(&Phrase, 0, sizeof(Phrase)); + Phrase.cbSize = sizeof(Phrase); + + if(LangId == 0) + { + LangId = SpGetUserDefaultUILanguage(); + } + + if(cpPhoneConv == NULL) + { + hr = SpCreatePhoneConverter(LangId, NULL, NULL, &cpPhoneConv); + if(FAILED(hr)) + { + ::CoTaskMemFree(pStringPtrArray); + return hr; + } + } + + SPPHRASEELEMENT *pPhraseElement = new SPPHRASEELEMENT[cWords]; + if(pPhraseElement == NULL) + { + ::CoTaskMemFree(pStringPtrArray); + return E_OUTOFMEMORY; + } + memset(pPhraseElement, 0, sizeof(SPPHRASEELEMENT) * cWords); // !!! + + WCHAR * pText = dsText; + for (i = 0; SUCCEEDED(hr) && i < cWords; i++) + { + WCHAR *p = pText; + pStringPtrArray[i] = pText; + wcscpy( pText, ppWords[i] ); + pText += wcslen( p ) + 1; + + if (*p == L'/') + { + //This is a compound word + WCHAR* pszFirstPart = ++p; + WCHAR* pszSecondPart = NULL; + WCHAR* pszThirdPart = NULL; + + while (*p && *p != L'/') + { + p++; + } + if (*p == L'/') + { + //It means we stop at the second '/' + *p = L'\0'; + pszSecondPart = ++p; + while (*p && *p != L'/') + { + p++; + } + if (*p == L'/') + { + //It means we stop at the third '/' + *p = L'\0'; + pszThirdPart = ++p; + } + } + + pPhraseElement[i].pszDisplayText = pszFirstPart; + pPhraseElement[i].pszLexicalForm = pszSecondPart ? pszSecondPart : pszFirstPart; + + if ( pszThirdPart) + { + hr = cpPhoneConv->PhoneToId(pszThirdPart, pphoneId); + if (SUCCEEDED(hr)) + { + pPhraseElement[i].pszPronunciation = pphoneId; + pphoneId += wcslen((const wchar_t *)pphoneId) + 1; // improper casting + } + } + } + else + { + //It is the simple format, only have one form, use it for everything. + pPhraseElement[i].pszDisplayText = NULL; + pPhraseElement[i].pszLexicalForm = p; + pPhraseElement[i].pszPronunciation = NULL; + } + + pPhraseElement[i].bDisplayAttributes = (BYTE)(prgDispAttribs ? prgDispAttribs[i] : SPAF_ONE_TRAILING_SPACE); + pPhraseElement[i].RequiredConfidence = SP_NORMAL_CONFIDENCE; + pPhraseElement[i].ActualConfidence = SP_NORMAL_CONFIDENCE; + } + + Phrase.Rule.ulCountOfElements = cWords; + Phrase.pElements = pPhraseElement; + Phrase.LangID = LangId; + + CComPtr cpPhrase; + if (SUCCEEDED(hr)) + { + hr = cpPhrase.CoCreateInstance(CLSID_SpPhraseBuilder); + } + + if (SUCCEEDED(hr)) + { + hr = cpPhrase->InitFromPhrase(&Phrase); + } + if (SUCCEEDED(hr)) + { + *ppResultPhrase = cpPhrase.Detach(); + } + + delete pPhraseElement; + ::CoTaskMemFree(pStringPtrArray); + + return hr; +} + +/**** Helper function used to create a new phrase object from a + test string. Each word in the string is converted to a phrase element. + This is useful to create a phrase to pass to the EmulateRecognition method. + The method can convert standard words as well as words with the + "/display_text/lexical_form/pronounciation;" word format ****/ +inline HRESULT CreatePhraseFromText(const WCHAR *pszOriginalText, + ISpPhraseBuilder **ppResultPhrase, + LANGID LangId = 0, + CComPtr cpPhoneConv = NULL) +{ + SPDBG_FUNC("CreatePhraseFromText"); + HRESULT hr = S_OK; + + //We first trim the input text + CSpDynamicString dsText(pszOriginalText); + if(dsText.m_psz == NULL) + { + return E_OUTOFMEMORY; + } + dsText.TrimBoth(); + + ULONG cWords = 0; + BOOL fInCompoundword = FALSE; + + // Set first array pointer (if *p). + WCHAR *p = dsText; + while (*p) + { + if( iswspace(*p) && !fInCompoundword) + { + cWords++; + *p++ = L'\0'; + while (*p && iswspace(*p)) + { + *p++ = L'\0'; + } + // Add new array pointer. Use vector. + } + else if (*p == L'/' && !fInCompoundword) + { + fInCompoundword = TRUE; + } + else if (*p == L';' && fInCompoundword) + { + fInCompoundword = FALSE; + *p++ = L'\0'; + // Add new array element. + } + else + { + p++; + } + } + + cWords++; + + WCHAR** pStringPtrArray = (WCHAR**)::CoTaskMemAlloc( cWords * sizeof(WCHAR *)); + if ( !pStringPtrArray ) + { + hr = E_OUTOFMEMORY; + } + + if ( SUCCEEDED( hr ) ) + { + p = dsText; + for (ULONG i=0; i +#endif + +#ifndef SPError_h +#include +#endif + +#ifndef SPDebug_h +#include +#endif + +#ifndef SPHelper_h +#include +#endif + +#ifndef __ATLBASE_H__ +#include +#endif + +#ifndef __ATLCONV_H__ +#include +#endif + +/**************************************************************************** +* +* +* +********************************************************************* RAL ***/ + +// +// Dont call this function directly. Use SpInitTokenComboBox or SpInitTokenListBox. +// +inline HRESULT SpInitTokenList(UINT MsgAddString, UINT MsgSetItemData, UINT MsgSetCurSel, + HWND hwnd, const WCHAR * pszCatName, + const WCHAR * pszRequiredAttrib, const WCHAR * pszOptionalAttrib) +{ + HRESULT hr; + ISpObjectToken * pToken; // NOTE: Not a CComPtr! Be Careful. + CComPtr cpEnum; + hr = SpEnumTokens(pszCatName, pszRequiredAttrib, pszOptionalAttrib, &cpEnum); + if (hr == S_OK) + { + bool fSetDefault = false; + while (cpEnum->Next(1, &pToken, NULL) == S_OK) + { + CSpDynamicString dstrDesc; + hr = SpGetDescription(pToken, &dstrDesc); + if (SUCCEEDED(hr)) + { + USES_CONVERSION; + LRESULT i = ::SendMessage(hwnd, MsgAddString, 0, (LPARAM)W2T(dstrDesc)); + if (i == CB_ERR || i == CB_ERRSPACE) // Note: CB_ and LB_ errors are identical values... + { + hr = E_OUTOFMEMORY; + } + else + { + ::SendMessage(hwnd, MsgSetItemData, i, (LPARAM)pToken); + if (!fSetDefault) + { + ::SendMessage(hwnd, MsgSetCurSel, i, 0); + fSetDefault = true; + } + } + } + if (FAILED(hr)) + { + pToken->Release(); + } + } + } + else + { + hr = SPERR_NO_MORE_ITEMS; + } + return hr; +} + +inline HRESULT SpInitTokenComboBox(HWND hwnd, const WCHAR * pszCatName, + const WCHAR * pszRequiredAttrib = NULL, const WCHAR * pszOptionalAttrib = NULL) +{ + return SpInitTokenList(CB_ADDSTRING, CB_SETITEMDATA, CB_SETCURSEL, hwnd, pszCatName, pszRequiredAttrib, pszOptionalAttrib); +} + +inline HRESULT SpInitTokenListBox(HWND hwnd, const WCHAR * pszCatName, + const WCHAR * pszRequiredAttrib = NULL, const WCHAR * pszOptionalAttrib = NULL) +{ + return SpInitTokenList(LB_ADDSTRING, LB_SETITEMDATA, LB_SETCURSEL, hwnd, pszCatName, pszRequiredAttrib, pszOptionalAttrib); +} + +// +// Dont call this function directly. Use SpDestoyTokenComboBox or SpDestroyTokenListBox. +// +inline void SpDestroyTokenList(UINT MsgGetCount, UINT MsgGetItemData, HWND hwnd) +{ + LRESULT c = ::SendMessage(hwnd, MsgGetCount, 0, 0); + for (LRESULT i = 0; i < c; i++) + { + IUnknown * pUnkObj = (IUnknown *)::SendMessage(hwnd, MsgGetItemData, i, 0); + if (pUnkObj) + { + pUnkObj->Release(); + } + } +} + +inline void SpDestroyTokenComboBox(HWND hwnd) +{ + SpDestroyTokenList(CB_GETCOUNT, CB_GETITEMDATA, hwnd); +} + +inline void SpDestroyTokenListBox(HWND hwnd) +{ + SpDestroyTokenList(LB_GETCOUNT, LB_GETITEMDATA, hwnd); +} + + +inline ISpObjectToken * SpGetComboBoxToken(HWND hwnd, WPARAM Index) +{ + return (ISpObjectToken *)::SendMessage(hwnd, CB_GETITEMDATA, Index, 0); +} + +inline ISpObjectToken * SpGetListBoxToken(HWND hwnd, WPARAM Index) +{ + return (ISpObjectToken *)::SendMessage(hwnd, LB_GETITEMDATA, Index, 0); +} + +inline ISpObjectToken * SpGetCurSelComboBoxToken(HWND hwnd) +{ + LRESULT i = ::SendMessage(hwnd, CB_GETCURSEL, 0, 0); + return (i == CB_ERR) ? NULL : SpGetComboBoxToken(hwnd, i); +} + +inline ISpObjectToken * SpGetCurSelListBoxToken(HWND hwnd) +{ + LRESULT i = ::SendMessage(hwnd, LB_GETCURSEL, 0, 0); + return (i == LB_ERR) ? NULL : SpGetListBoxToken(hwnd, i); +} + +// +// Don't call this directly. Use SpUpdateCurSelComboBoxToken or SpUpdateCurSelListBoxToken +// +inline HRESULT SpUpdateCurSelToken(UINT MsgDelString, UINT MsgInsertString, UINT MsgGetItemData, UINT MsgSetItemData, UINT MsgGetCurSel, UINT MsgSetCurSel, + HWND hwnd) +{ + HRESULT hr = S_OK; + LRESULT i = ::SendMessage(hwnd, MsgGetCurSel, 0, 0); + if (i != CB_ERR) + { + ISpObjectToken * pToken = (ISpObjectToken *)::SendMessage(hwnd, MsgGetItemData, i, 0); + CSpDynamicString dstrDesc; + hr = SpGetDescription(pToken, &dstrDesc); + if (SUCCEEDED(hr)) + { + USES_CONVERSION; + ::SendMessage(hwnd, MsgDelString, i, 0); + ::SendMessage(hwnd, MsgInsertString, i, (LPARAM)W2T(dstrDesc)); + ::SendMessage(hwnd, MsgSetItemData, i, (LPARAM)pToken); + ::SendMessage(hwnd, MsgSetCurSel, i, 0); + } + } + return hr; +} + +inline HRESULT SpUpdateCurSelComboBoxToken(HWND hwnd) +{ + return SpUpdateCurSelToken(CB_DELETESTRING, CB_INSERTSTRING, CB_GETITEMDATA, CB_SETITEMDATA, CB_GETCURSEL, CB_SETCURSEL, hwnd); +} + +inline HRESULT SpUpdateCurSelListBoxToken(HWND hwnd) +{ + return SpUpdateCurSelToken(LB_DELETESTRING, LB_INSERTSTRING, LB_GETITEMDATA, LB_SETITEMDATA, LB_GETCURSEL, LB_SETCURSEL, hwnd); +} + +inline HRESULT SpAddTokenToList(UINT MsgAddString, UINT MsgSetItemData, UINT MsgSetCurSel, HWND hwnd, ISpObjectToken * pToken) +{ + CSpDynamicString dstrDesc; + HRESULT hr = SpGetDescription(pToken, &dstrDesc); + if (SUCCEEDED(hr)) + { + USES_CONVERSION; + LRESULT i = ::SendMessage(hwnd, MsgAddString, 0, (LPARAM)W2T(dstrDesc)); + if (i == CB_ERR || i == CB_ERRSPACE) // Note: CB_ and LB_ errors are identical values... + { + hr = E_OUTOFMEMORY; + } + else + { + ::SendMessage(hwnd, MsgSetItemData, i, (LPARAM)pToken); + ::SendMessage(hwnd, MsgSetCurSel, i, 0); + pToken->AddRef(); + } + } + return hr; +} + +inline HRESULT SpAddTokenToComboBox(HWND hwnd, ISpObjectToken * pToken) +{ + return SpAddTokenToList(CB_ADDSTRING, CB_SETITEMDATA, CB_SETCURSEL, hwnd, pToken); +} + +inline HRESULT SpAddTokenToListBox(HWND hwnd, ISpObjectToken * pToken) +{ + return SpAddTokenToList(LB_ADDSTRING, LB_SETITEMDATA, LB_SETCURSEL, hwnd, pToken); +} + + +inline HRESULT SpDeleteCurSelToken(UINT MsgGetCurSel, UINT MsgSetCurSel, UINT MsgGetItemData, UINT MsgDeleteString, HWND hwnd) +{ + HRESULT hr = S_OK; + LRESULT i = ::SendMessage(hwnd, MsgGetCurSel, 0, 0); + if (i == CB_ERR) + { + hr = S_FALSE; + } + else + { + ISpObjectToken * pToken = (ISpObjectToken *)::SendMessage(hwnd, MsgGetItemData, i, 0); + if (pToken) + { + pToken->Release(); + } + ::SendMessage(hwnd, MsgDeleteString, i, 0); + ::SendMessage(hwnd, MsgSetCurSel, i, 0); + } + return hr; +} + +inline HRESULT SpDeleteCurSelComboBoxToken(HWND hwnd) +{ + return SpDeleteCurSelToken(CB_GETCURSEL, CB_SETCURSEL, CB_GETITEMDATA, CB_DELETESTRING, hwnd); +} + +inline HRESULT SpDeleteCurSelListBoxToken(HWND hwnd) +{ + return SpDeleteCurSelToken(LB_GETCURSEL, CB_SETCURSEL, LB_GETITEMDATA, LB_DELETESTRING, hwnd); +} + +#endif /* #ifndef SPUIHelp_h -- This must be the last line in the file */ diff --git a/sp/src/utils/sapi51/Samples/CPP/Common/componentversiondlg.cpp b/sp/src/utils/sapi51/Samples/CPP/Common/componentversiondlg.cpp new file mode 100644 index 00000000..e6355c0b --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Common/componentversiondlg.cpp @@ -0,0 +1,193 @@ +/**************************************************************************** +* ComponentVersionDlg.cpp +* This module contains the implementation details of the +* "Component Version" dialog that may be accessible from all of the +* SAPI SDK samples and tools. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#include "stdafx.h" +#include "SapiSDKCommon.h" +#include "SapiSDKCommonResources.h" + + +/********************************************************************** +* ComponentVersionsDlgProc * +*--------------------------* +* Description: +* The DlgProc for the ComponentVersions dlg. It fills the edit +* control with the version & path info of all the .dll's & .exe's +* that are loaded by the app that is using us. +* +* If you wish to have other .dll's & .exe's included, then just +* add their names to the s_aszModules_c array. The rest happens +* automatically. +* +* Return: +* TRUE if have processed the message +* FALSE otherwise +**********************************************************************/ +LRESULT CALLBACK ComponentVersionsDlgProc( HWND hDlg, UINT uiMessage, WPARAM wParam, LPARAM lParam ) +{ + //--- basic dlg proc switch statement + switch( uiMessage ) + { + case WM_INITDIALOG: + { + //--- this array contains the full list of .dll's & .exe's that we will interogate. + // just add to this list when you want to add another module to the output + static const LPCTSTR s_aszModules_c[] = + { + _T("dictpad.exe"), + _T("reco.exe"), + _T("speak.exe"), + _T("sapi.cpl"), + _T("srsvr.exe"), + _T("ttshello.exe"), + _T("wavtotext.exe"), + _T("wintts.exe"), + _T("sapi.dll"), + _T("spttseng.dll"), + _T("spcwfe.DLL"), + _T("spsreng.DLL"), + _T("spsr.DLL"), + _T("spsrx.DLL"), + _T("gramcomp.dll"), + _T("Lexicon.dll"), + _T("advapi32.DLL"), + _T("atl.DLL"), + _T("comctl32.DLL"), + _T("gdi32.DLL"), + _T("icap.DLL"), + _T("kernel32.DLL"), + _T("lz32.DLL"), + _T("mfc42.DLL"), + _T("mfc42d.DLL"), + _T("mfc42u.DLL"), + _T("mfc42ud.DLL"), + _T("msasm32.DLL"), + _T("msvcrt.DLL"), + _T("msxml.DLL"), + _T("ntdll.DLL"), + _T("ole32.DLL"), + _T("oleaut32.DLL"), + _T("riched32.DLL"), + _T("rpcrt.DLL"), + _T("rpcrt4.DLL"), + _T("shell32.DLL"), + _T("shfolder.DLL"), + _T("shlwapi.DLL"), + _T("user32.DLL"), + _T("urlmon.DLL"), + _T("version.DLL"), + _T("winmm.DLL") + }; + static const int s_iNumModules_c = sizeof( s_aszModules_c ) / sizeof( s_aszModules_c[ 0 ] ); + + TCHAR acFinalBuff[10000]; + acFinalBuff[ 0 ] = L'\0'; + + //--- spin thru all the listed modules to find the ones that are loaded by the current app + for( int i = 0; i < s_iNumModules_c; ++i ) + { + //--- main discovery point - is the current module being used, or not + HMODULE hModule = GetModuleHandle( s_aszModules_c[ i ] ); + if( hModule ) + { + //--- the current module is being used, get it's path + TCHAR acModulePath[ _MAX_PATH ]; + DWORD dwSize = GetModuleFileName( hModule, acModulePath, sizeof( acModulePath ) ); + _ASSERTE( 0 < dwSize ); + + //--- now that we have the file, get the version info size from that file. If the + // size is non-trivial, then the file contains legitimate version info + DWORD dwDummy; + dwSize = GetFileVersionInfoSize( const_cast< LPTSTR >( acModulePath ), &dwDummy ); + TCHAR acBuff[1000]; + if( 0 < dwSize ) + { + //--- real version info exists for the current module - get it + char *pcVersionInfo = new char[ dwSize ]; + _ASSERTE( NULL != pcVersionInfo ); + BOOL fSuccess = GetFileVersionInfo( const_cast< LPTSTR >( acModulePath ), + 0, dwSize, pcVersionInfo ); + _ASSERTE( fSuccess ); + + //--- now convert the version info into something intelligible + VS_FIXEDFILEINFO *pFixedVersionInfo; + UINT uiFixedVersionSize; + fSuccess = VerQueryValue( pcVersionInfo, _T( "\\" ), + reinterpret_cast< LPVOID * >( &pFixedVersionInfo ), + &uiFixedVersionSize ); + _ASSERTE( fSuccess ); + + //--- esnure we have a correct structure version! + _ASSERTE( uiFixedVersionSize == sizeof( VS_FIXEDFILEINFO ) ); + + //--- format the module name, version info & module path all nice and pretty + _stprintf( acBuff, _T( "%-15.15s: %3d.%02d.%02d.%04d %s\r\n" ), + s_aszModules_c[ i ], + HIWORD( pFixedVersionInfo->dwProductVersionMS ), + LOWORD( pFixedVersionInfo->dwProductVersionMS ), + HIWORD( pFixedVersionInfo->dwProductVersionLS ), + LOWORD( pFixedVersionInfo->dwProductVersionLS ), + acModulePath ); + + //--- clean-up + delete [] pcVersionInfo; + } + else + { + //--- no version info, but the module itself, as well as it's path, are still interesting + // to know + _stprintf( acBuff, _T( "%-15.15s: %s\r\n" ), + s_aszModules_c[ i ], + acModulePath ); + } + + //--- accummulate all the info in a single buffer + if( ( _tcslen( acFinalBuff ) + _tcslen( acBuff ) ) < ( sizeof( acFinalBuff ) - 1 ) ) + { + //--- plenty of room + _tcscat( acFinalBuff, acBuff ); + } + else + { + //--- we just escaped a buffer overflow... + _tcscpy( acFinalBuff, _T( "" ) ); + break; + } + } + } + + //--- send the fully populated buffer to the edit control + HWND hEdit = ::GetDlgItem( hDlg, IDC_VERSION_EDIT ); + ::SetWindowText( hEdit, acFinalBuff ); + } + return TRUE; + + case WM_SIZE: + { + //--- as the dlg resizes, have the edit control follow the client area's size + RECT rect; + ::GetClientRect( hDlg, &rect ); + HWND hEdit = ::GetDlgItem( hDlg, IDC_VERSION_EDIT ); + ::SetWindowPos( hEdit, NULL, rect.left, rect.top, + LOWORD(lParam), HIWORD(lParam), SWP_NOZORDER | SWP_NOACTIVATE ); + } + return TRUE; + + case WM_COMMAND: + //--- kill the dialog when we get canceled by the user + if( IDCANCEL == LOWORD( wParam ) ) + { + EndDialog( hDlg, LOWORD( wParam )); + return TRUE; + } + break; + } + + //--- we didn't process this msg, let the default behavior prevail + return FALSE; + +} /* ComponentVersions */ diff --git a/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.h b/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.h new file mode 100644 index 00000000..de23c3b5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.h @@ -0,0 +1,23 @@ +/**************************************************************************** +* SapiSDKCommon.h +* This header is the main entry point for all the utilities & +* sub-features that are common the SAPI samples & tools. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#pragma once + +//--- Includes -------------------------------------------------------------- + +//--- Forward and External Declarations ------------------------------------- + +//--- TypeDef and Enumeration Declarations ---------------------------------- + +//--- Constants ------------------------------------------------------------- + +//--- Class, Struct and Union Definitions ----------------------------------- + +//--- Function Declarations ------------------------------------------------- +LRESULT CALLBACK ComponentVersionsDlgProc( HWND, UINT, WPARAM, LPARAM ); + +//--- Inline Function Definitions ------------------------------------------- diff --git a/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.rc2 b/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.rc2 new file mode 100644 index 00000000..141fc9f5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommon.rc2 @@ -0,0 +1,17 @@ +/**************************************************************************** +* SapiSDKCommon.rc2 +* This file contains the resource compiler directives for the dialogs +* exposed from the SAPI SDK common directory +* +* Copyright (c) 1999 Microsoft Corporation All Rights Reserved. +*****************************************************************************/ +#include "SapiSDKCommonResources.h" + +IDD_COMPONENT_VERSION_DLG DIALOG DISCARDABLE 0, 0, 354, 228 +STYLE WS_POPUP | WS_CAPTION | WS_MAXIMIZEBOX | WS_SYSMENU | WS_THICKFRAME +CAPTION "Component Versions" +FONT 9, "Courier New" +BEGIN + EDITTEXT IDC_VERSION_EDIT,7,7,340,214,ES_MULTILINE | ES_READONLY | WS_VSCROLL | + WS_HSCROLL +END diff --git a/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommonresources.h b/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommonresources.h new file mode 100644 index 00000000..d3325db7 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Common/sapisdkcommonresources.h @@ -0,0 +1,2 @@ +#define IDC_VERSION_EDIT 10000 +#define IDD_COMPONENT_VERSION_DLG 10001 diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.cpp new file mode 100644 index 00000000..6fb6b57f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.cpp @@ -0,0 +1,705 @@ +/****************************************************************************** +* candidatelist.cpp +* Implementation details for the CCandidateList object which is a +* class that manages the recognized alternatives for dictated +* text. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "candidatelist.h" +#include "dictpad.h" + +// Multi-Language Header File +#include + +#define MAX_ALTS_DISPLAYED 10 + +/***************************************************************************** +* CCandidateList::CCandidateList * +*--------------------------------* +* Description: +* Constructor for the CCandidateList class. +* Modifies the RICHEDIT_CLASS of the main +* application window to use our callback function +* and registers that window class. +*******************************************************************************/ +CCandidateList::CCandidateList( HWND hClient, CRecoEventMgr &rRecoMgr ) : + m_pwcParentClass( NULL ), + m_hMainClientWindow( hClient ), + m_hParent( NULL ), + m_hAltsList( NULL ), + // For now, set the langid to default. + // LangID can be set to something else + // later. + m_langid( ::GetUserDefaultLangID() ), + m_fMakeUIVisible( true ), + m_fPlaybackInProgress( false ), + m_pCurrentDictRun( NULL ), + m_cpTextSel( NULL ), + m_pRecoMgr( &rRecoMgr ), + m_hFont( NULL ), + m_ulNumAltsDisplayed( 0 ) +{ + m_hInst = (HINSTANCE) ::GetWindowLong( m_hMainClientWindow, GWL_HINSTANCE ); + + // Register a window class that is like the rich edit control class in every way + // except that it has space for an extra pointer and calls our wndproc + WNDCLASS wcModifiedRichEdit; + ::GetClassInfo( m_hInst, RICHEDIT_CLASS, &wcModifiedRichEdit ); + + // Bump the space by the size of a pointer + m_cbOffset = wcModifiedRichEdit.cbWndExtra; + int cbExtraSpace = sizeof(CCandidateList *); + wcModifiedRichEdit.cbWndExtra += cbExtraSpace; + + // Change the wndproc, storing the original wndproc + m_wpOrigWndProc = wcModifiedRichEdit.lpfnWndProc; + wcModifiedRichEdit.lpfnWndProc = CandidateUIProc; + + wcModifiedRichEdit.lpszClassName = MODIFIED_RICHEDIT_NAME; + ATOM atomRet = ::RegisterClass( &wcModifiedRichEdit ); + + if ( atomRet ) + { + m_pwcParentClass = new WNDCLASS; + *m_pwcParentClass = wcModifiedRichEdit; + } + + GetFontSettings(); +} /* CCandidateList::CCandidateList */ + +/****************************************************************************** +* CCandidateList::~CCandidateList * +*---------------------------------* +* Description: +* Destructor for the CCandidateListclass +*******************************************************************************/ +CCandidateList::~CCandidateList() +{ + if ( m_pwcParentClass ) + { + delete m_pwcParentClass; + } + + if (m_hFont) + { + DeleteObject(m_hFont); + } + + ::DestroyWindow( m_hButton ); + DoneWithAltsList(); +} /* CCandidateList::~CCandidateList */ + +/****************************************************************************** +* CCandidateList::GetFontSettings * +*---------------------------------* +* Description: +* Gets the font settings for the candidate list UI +*******************************************************************************/ +void CCandidateList::GetFontSettings() +{ + int iHeight = 0; // Will cause CreateFont() to use default in case we + // don't get the height below + HDC hdc = GetDC(m_hMainClientWindow); + HFONT hfontNew = 0; + + // Get the height of the text + if (hdc) + { + TEXTMETRIC tm; + + if (GetTextMetrics(hdc, &tm)) + { + iHeight = tm.tmHeight; + } + + ReleaseDC(m_hMainClientWindow, hdc); + } + + // Pick an appropriate font. On Windows 2000, let the system fontlink. + if (NT5orGreater()) + { + hfontNew = CreateFont(iHeight, 0, 0, 0, FW_NORMAL, 0, 0, 0, + DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + TEXT("Microsoft Sans Serif")); + } + else + { + LCID lcid = MAKELCID( m_langid, SORT_DEFAULT ); + UINT uiCodePage = SpCodePageFromLcid( lcid ); + + CComPtr cpMultiLanguage; + MIMECPINFO MimeCpInfo; + + if ( SUCCEEDED(cpMultiLanguage.CoCreateInstance(CLSID_CMultiLanguage)) + && SUCCEEDED(cpMultiLanguage->GetCodePageInfo(uiCodePage, &MimeCpInfo))) + { + USES_CONVERSION; + + hfontNew = CreateFont(iHeight, 0, 0, 0, FW_NORMAL, 0, 0, 0, + MimeCpInfo.bGDICharset, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + W2T(MimeCpInfo.wszProportionalFont)); + + } + } + + if (hfontNew) + { + if (m_hFont) + { + DeleteObject(m_hFont); + } + + m_hFont = hfontNew; + } +} /* CCandidateList::GetFontSettings */ + +/****************************************************************************** +* CCandidateList::SetParent * +*---------------------------* +* Description: +* Called after the parent window is created. +* Sets the parent window member and creates a button for the +* alternates UI +*******************************************************************************/ +void CCandidateList::SetParent( HWND hParent ) +{ + m_hParent = hParent; + m_hButton = ::CreateWindow( _T("BUTTON"), + _T(""), + WS_CHILD | BS_DEFPUSHBUTTON, + 0, + 0, + BUTTON_WIDTH, + BUTTON_HEIGHT, + m_hParent, + NULL, + m_hInst, + NULL ); +} /* CCandidateList::SetParent */ + +/****************************************************************************** +* CCandidateList::SetLangID * +*---------------------------* +* Description: +* Sets the m_langid and calls GetFontSettings() +*******************************************************************************/ +void CCandidateList::SetLangID( LANGID langid ) +{ + m_langid = langid; + GetFontSettings(); +} /* CCandidateList::SetLangID */ + +/****************************************************************************** +* CCandidateList::Update * +*------------------------* +* Description: +* Called whenever an EN_SELCHANGE notification is received. +* Shows the alternates button if the entire selection is +* dictated text from the same phrase. +* Return: +* If the entire selection is within a single dictated text range, returns +* the handle to the button and shows the button. +* Otherwise returns NULL and hides the button. +********************************************************************************/ +HWND CCandidateList::Update( CTextRunList *pTextRunList ) +{ + // Clicking off the alternates list should dismiss it + if ( m_hAltsList ) + { + DoneWithAltsList(); + } + + m_pCurrentDictRun = NULL; + + ::ShowWindow( m_hButton, SW_HIDE ); + ::InvalidateRect( m_hParent, NULL, true ); + + if ( !m_fMakeUIVisible ) + { + // The button should not be displayed + return NULL; + } + + if ( !m_cpTextSel || !pTextRunList || !m_hParent ) + { + // error + return NULL; + } + + long lStart; + long lEnd; + HRESULT hr = m_cpTextSel->GetStart( &lStart ); + if ( SUCCEEDED( hr ) ) + { + hr = m_cpTextSel->GetEnd( &lEnd ); + } + + // Show the alternates UI only if there is no reco computation + if ( SUCCEEDED( hr ) && m_pRecoMgr && !(m_pRecoMgr->IsProcessingPhrase()) ) + { + PTEXTRUNNODE pNode = pTextRunList->Find( lStart ); + if ( pNode && pNode->pTextRun->IsDict() && + ( lEnd <= pNode->pTextRun->GetEnd() ) ) + { + // The selection is completely contained within this dictated run. + // The button should appear at the lower right-hand + // corner of the selected text + POINT pt; + hr = m_cpTextSel->GetPoint( tomEnd | TA_BASELINE | TA_LEFT, + &(pt.x), &(pt.y) ); + if ( SUCCEEDED( hr ) ) + { + // Move the button to the new location + ::ScreenToClient( m_hParent, &pt ); + ::MoveWindow( m_hButton, pt.x, pt.y, + BUTTON_WIDTH, BUTTON_HEIGHT, true ); + ::ShowWindow( m_hButton, SW_SHOW ); + + // We know that this node contains a dictation run (see above) + m_pCurrentDictRun = + static_cast(pNode->pTextRun); + + return m_hButton; + } + } + } + + // Otherwise, hide the window and return NULL + return NULL; +} /* CCandidateList::Update */ + +/****************************************************************************** +* CCandidateList::ShowAlternates * +*--------------------------------* +* Description: +* Called whenever the alternates button is clicked. +* Hides the alternates button and displays the +* alternates dialog box. +* When the alternates dialog box is done, shows the button again. +********************************************************************************/ +void CCandidateList::ShowAlternates() +{ + _ASSERTE( m_pCurrentDictRun ); + _ASSERTE( m_cpTextSel ); + + // Get the alternates. The text for the alternates + // will have been CoTaskMemAlloced + WCHAR *apszAltsText[ALT_REQUEST_COUNT]; + bool apfFitsInRun[ ALT_REQUEST_COUNT ]; + long lAltStart; + long lAltEnd; + ULONG cAltsReturned = 0; + HRESULT hr = m_pCurrentDictRun->GetAlternatesText( + m_cpTextSel, ALT_REQUEST_COUNT, &lAltStart, &lAltEnd, + apszAltsText, apfFitsInRun, &cAltsReturned ); + + if ( FAILED(hr) ) + { + return; + } + + // Check to make sure that at least one alternate is displayable + bool fDisplayableAlts = false; + for ( ULONG ulAlt = 0; !fDisplayableAlts && (ulAlt < cAltsReturned); ulAlt++ ) + { + fDisplayableAlts = apfFitsInRun[ ulAlt ]; + } + if ( !fDisplayableAlts ) + { + // No alternates to display: Won't be doing anything here + return; + } + + // Hide and disable the alternates button + _ASSERTE( m_hParent ); + BOOL fVisible = ::ShowWindow( m_hButton, SW_HIDE ); + _ASSERTE( fVisible ); + ::EnableWindow( m_hButton, false ); + ::InvalidateRect( m_hParent, NULL, true ); + + // Create a window for the alternates list. + // The alternates list should appear at the lower + // right-hand corner of the text selection + POINT pt; + m_cpTextSel->GetPoint( tomEnd | TA_BASELINE | TA_LEFT, + &(pt.x), &(pt.y) ); + ::ScreenToClient( m_hParent, &pt ); + m_hAltsList = ::CreateWindow( _T("LISTBOX"), + _T(""), + WS_CHILD | WS_DLGFRAME | LBS_OWNERDRAWFIXED | LBS_NOTIFY | WS_VSCROLL, + pt.x, pt.y, // Dimensions will be determined by + // number and width of alternates + 0, 0, + m_hParent, + (HMENU) IDC_LIST_ALTS, + m_hInst, + NULL ); + + // Get the font with which to draw the alternates (this is an + // owner-drawn listbox) + HDC hdc = ::GetDC( m_hAltsList ); + HGDIOBJ hfontOld = m_hFont ? SelectObject(hdc, m_hFont) : 0; + + // Populate the alternates list. + ULONG ulAltIndex; + ULONG ulNumAltsDisplayed = 0; + WCHAR **ppszCoMemText; + SIZE size; + int cxMaxWidth = 0; + for ( ulAltIndex = 0, ppszCoMemText = apszAltsText; + ulAltIndex < cAltsReturned; + ulAltIndex++, ppszCoMemText++ ) + { + if ( !apfFitsInRun[ ulAltIndex ] ) + { + // This alt will not be displayed, since the alt covers elements + // not in this run + continue; + } + + // Keep track of which alternate is going into location + // cAltsListed in the alternates list + m_aulAltIndices[ ulNumAltsDisplayed ] = ulAltIndex; + + // Keep track of the widest alt so far + _ASSERTE( *ppszCoMemText ); + ::GetTextExtentPointW( + hdc, *ppszCoMemText, wcslen( *ppszCoMemText ), &size ); + cxMaxWidth = max( cxMaxWidth, size.cx ); + + // Owner-drawn list box, so the string is stored as item data (as a WCHAR *) + WCHAR *pwszListItem = wcsdup( *ppszCoMemText ); + ::SendMessage( m_hAltsList, LB_INSERTSTRING, ulNumAltsDisplayed, (LPARAM) pwszListItem ); + + ulNumAltsDisplayed++; + } + + // Keep track of how many alternates there are + m_ulNumAltsDisplayed = ulNumAltsDisplayed; + + // Get the old font back + hfontOld ? SelectObject(hdc, hfontOld) : NULL; + ::ReleaseDC( m_hAltsList, hdc ); + + // Bump up the maximum width by the list box border width and the + // vertical scroll bar width if necessary + cxMaxWidth += 2 * GetSystemMetrics( SM_CXDLGFRAME ); + if (ulNumAltsDisplayed > MAX_ALTS_DISPLAYED) + { + cxMaxWidth += GetSystemMetrics( SM_CXVSCROLL ); + } + + // The alternates text was CoTaskMemAlloced, so we must free + // it now + ULONG ul; + for ( ul = 0, ppszCoMemText = apszAltsText; + ul < cAltsReturned; + ul++, ppszCoMemText++ ) + { + if ( *ppszCoMemText ) + { + ::CoTaskMemFree( *ppszCoMemText ); + } + } + + // Resize the window to the correct width + // The alternates list should always go inside the parent window, + // so if the list is too wide, move it to the left. + RECT rectButton; + RECT rectParent; + POINT ptTopLeft; + ::GetWindowRect( m_hButton, &rectButton ); + ::GetWindowRect( m_hParent, &rectParent ); + int cyItemHeight = ::SendMessage( m_hAltsList, LB_GETITEMHEIGHT, 0, 0 ); + int cyHeight = __min(((int) ulNumAltsDisplayed + 1) * cyItemHeight, + (MAX_ALTS_DISPLAYED + 1) * cyItemHeight); + ptTopLeft.x = __min( rectButton.left, rectParent.right - cxMaxWidth ); + ptTopLeft.y = rectButton.top; + ::ScreenToClient( m_hParent, &ptTopLeft ); + ::MoveWindow( m_hAltsList, + ptTopLeft.x, + ptTopLeft.y, + cxMaxWidth, + cyHeight, + true ); + + + // Display the alternates list + ::ShowWindow( m_hAltsList, SW_SHOW ); + + // Highlight the text for the first alternate displayed + MakeTextSelReflectAlt(0); + + ::SetFocus( m_hAltsList ); +} /* CCandidateList::ShowAlternates */ + +/****************************************************************************** +* CCandidateList::ShowButton * +*----------------------------* +* Description: +* Shows/hides the alternates button. +********************************************************************************/ +void CCandidateList::ShowButton( bool bShow ) +{ + ::ShowWindow( m_hButton, bShow ? SW_SHOW : SW_HIDE ); + ::EnableWindow( m_hButton, bShow ); + ::InvalidateRect( m_hParent, NULL, true ); + m_fMakeUIVisible = bShow; +} /* CCandidateList::ShowButton */ + +/****************************************************************************** +* CCandidateList::MakeTextSelReflectAlt * +*---------------------------------------* +* Description: +* Called when an item in the alternates list is selected. +* Adjusts the text selection in order to jive with whichever +* elements that alternate replaces +********************************************************************************/ +void CCandidateList::MakeTextSelReflectAlt( ULONG ulAltIndexInList ) +{ + _ASSERTE( m_pCurrentDictRun ); + _ASSERTE( m_cpTextSel ); + _ASSERTE( ulAltIndexInList < m_ulNumAltsDisplayed ); + + long lSelStart; + long lSelEnd; + + HRESULT hr = m_pCurrentDictRun->GetAltEndpoints( + m_aulAltIndices[ ulAltIndexInList ], &lSelStart, &lSelEnd ); + + if ( SUCCEEDED(hr) ) + { + // The WM_STOPUPDATE message tells Dictpad that there is no + // new text, so it does not need to process this selection change + ::SendMessage( m_hMainClientWindow, WM_STOPUPDATE, 0, 0 ); + m_cpTextSel->SetStart( lSelStart ); + m_cpTextSel->SetEnd( lSelEnd ); + ::SendMessage( m_hMainClientWindow, WM_STARTUPDATE, 0, 0 ); + } +} /* CCandidateList::MakeTextSelReflectAlt */ + +/****************************************************************************** +* CCandidateList::AlternateChosen * +*---------------------------------* +* Description: +* Called when the user selects an alternate from the alternates UI. +* Notifies the appropriate CDictationRun that the alt has been +* chosen and changes the text. +* Dismisses the alternates list, since choosing an alternate means +* the user is done with the alternates list. +********************************************************************************/ +void CCandidateList::AlternateChosen( ULONG ulChosenAltInList ) +{ + _ASSERTE( m_hAltsList ); + _ASSERTE( m_pCurrentDictRun ); + _ASSERTE( m_cpTextSel ); + _ASSERTE( ulChosenAltInList < m_ulNumAltsDisplayed ); + + ::SendMessage( m_hMainClientWindow, WM_STOPUPDATE, 0, 0 ); + HRESULT hr = m_pCurrentDictRun->ChooseAlternate( + m_aulAltIndices[ ulChosenAltInList ] ); + ::SendMessage( m_hMainClientWindow, WM_STARTUPDATE, 0, 0 ); + + // The main window should update the alternates button + ::SendMessage( m_hMainClientWindow, WM_UPDATEALTSBUTTON, 0, 0 ); + + DoneWithAltsList(); +} /* CCandidateList::AlternateChosen */ + +/****************************************************************************** +* CCandidateList::DoneWithAltsList * +*----------------------------------* +* Description: +* Called when the alternates list no longer need be displayed. +* Either the user has chosen an alternate or the user has clicked +* off the list to dismiss it. +********************************************************************************/ +void CCandidateList::DoneWithAltsList() +{ + if ( !m_hAltsList ) + { + return; + } + + int cItems = ::SendMessage( m_hAltsList, LB_GETCOUNT, 0, 0 ); + for ( int i = 0; i < cItems; i++ ) + { + // Free the memory used for the strings in the list box + WCHAR *pwszListItem = (WCHAR *) ::SendMessage( + m_hAltsList, LB_GETITEMDATA, i, 0 ); + if ( pwszListItem ) + { + free( pwszListItem ); + ::SendMessage( m_hAltsList, LB_SETITEMDATA, i, NULL ); + } + } + + m_ulNumAltsDisplayed = 0; + + ::DestroyWindow( m_hAltsList ); + m_hAltsList = 0; + m_pCurrentDictRun = NULL; + + // Bring the button back + ::EnableWindow( m_hButton, true ); +} /* CCandidateList::DoneWithAltsList */ + +/****************************************************************************** +* CandidateUIProc() * +*-------------------* +* Description: +* Subclassing procedure for the richedit control so that it can process +* messages from the candidate list UI. +*******************************************************************************/ +LRESULT APIENTRY CandidateUIProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + static int cbOffset = 0; // Where the data to be used by this + // wndproc starts + // The window long points to the associated instance of the candidate list UI + CCandidateList *pCandidateList = + ( CCandidateList * ) ::GetWindowLong( hWnd, cbOffset ); + + switch( message ) + { + case WM_NCCREATE: + { + // lParam points to a CREATESTRUCT with the CCandidateList * object + // as its lpCreateParams + pCandidateList = (CCandidateList *) + ((LPCREATESTRUCT) lParam)->lpCreateParams; + + // Get the class info and find the offset that will give us + // the very end of the extra space + WNDCLASS wc; + TCHAR pszClassName[ MAX_CLASS_NAME ]; + ::GetClassName( hWnd, pszClassName, MAX_CLASS_NAME ); + ::GetClassInfo( (HINSTANCE) ::GetWindowLong( hWnd, GWL_HINSTANCE ), + pszClassName, &wc ); + _ASSERTE( wc.cbWndExtra >= sizeof( CCandidateList *) ); + if ( wc.cbWndExtra < sizeof( CCandidateList * ) ) + { + // No space for the CCandidateList * in the window long + return -1; + } + cbOffset = wc.cbWndExtra - sizeof( CCandidateList *); + + // Set the window long + ::SetWindowLong( hWnd, cbOffset, (long) pCandidateList ); + + // Tell the candidate list about the parent window + pCandidateList->SetParent( hWnd ); + + break; + } + + case WM_KEYDOWN: + case WM_CHAR: + // Ignore keystrokes as a recognition is being processed + if ( pCandidateList->m_pRecoMgr->IsProcessingPhrase() + || ( pCandidateList->IsPlaybackInProgress() && ( VK_ESCAPE != wParam )) ) + { + // Dropping these messages + return 0; + } + break; + + case WM_IME_STARTCOMPOSITION: + if ( pCandidateList->m_pRecoMgr->IsProcessingPhrase() + || ( pCandidateList->IsPlaybackInProgress() && ( VK_ESCAPE != wParam )) ) + { + HIMC himc = ::ImmGetContext( hWnd ); + ::ImmNotifyIME( himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 ); + } + break; + + case WM_COMMAND: + switch ( HIWORD( wParam ) ) + { + case BN_CLICKED: + // Clicking on the alternates button + pCandidateList->ShowAlternates(); + break; + + case LBN_SELCHANGE: + // Selecting a different alternate in the alternates list + pCandidateList->MakeTextSelReflectAlt( + ::SendMessage( pCandidateList->m_hAltsList, LB_GETCURSEL, 0, 0 ) ); + break; + + case LBN_DBLCLK: + // Choosing an alternate + pCandidateList->AlternateChosen( + ::SendMessage( pCandidateList->m_hAltsList, LB_GETCURSEL, 0, 0 ) ); + break; + + case LBN_SETFOCUS: + // When the alternates list first appears, we give it the input + // focus. The first alternate should start out selected + ::SendMessage( pCandidateList->m_hAltsList, LB_SETCURSEL, 0, 0 ); + break; + + default: + break; + } + break; + + case WM_DRAWITEM: + // Since we have an owner-draw list box we need to process this + // message + if (wParam == IDC_LIST_ALTS) + { + LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam; + + HGDIOBJ hfontOld = pCandidateList->m_hFont ? + SelectObject( pdis->hDC, pCandidateList->m_hFont ) : NULL; + UINT oldTextAlign = GetTextAlign(pdis->hDC); + + UINT options = ETO_OPAQUE | ETO_CLIPPED; + + // Strings are stored as item data + HWND hwndList = pCandidateList->m_hAltsList; + WCHAR *pwszItemText = (WCHAR *) ::SendMessage( hwndList, + LB_GETITEMDATA, pdis->itemID, 0 ); + + int cStringLen = wcslen( pwszItemText ); + + SetTextAlign(pdis->hDC, TA_UPDATECP); + MoveToEx(pdis->hDC, pdis->rcItem.left, pdis->rcItem.top, NULL); + ExtTextOutW(pdis->hDC, + pdis->rcItem.left, pdis->rcItem.top, + options, + &pdis->rcItem, + pwszItemText, + cStringLen, + NULL); + + + SetTextAlign(pdis->hDC, oldTextAlign); + + if (hfontOld) + { + SelectObject(pdis->hDC, hfontOld); + } + } + break; + + default: + break; + + } + + // Call the original WndProc + return ::CallWindowProc( pCandidateList->m_wpOrigWndProc, + hWnd, message, wParam, lParam ); +} /* CandidateUIProc */ + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.h new file mode 100644 index 00000000..c3ad013f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/candidatelist.h @@ -0,0 +1,108 @@ +/**************************************************************************** +* candidatelist.h +* This module contains the definition support for CCandidateList, +* the candidate list UI for Dictpad +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#ifndef __CANDIDATELIST_H +#define __CANDIDATELIST_H +#pragma once + +#include +#include +#include "resource.h" +#include "sapi.h" +#include "TextRunList.h" +#include "recomgr.h" + +#define BUTTON_WIDTH 16 +#define BUTTON_HEIGHT 16 +#define MODIFIED_RICHEDIT_NAME _T("modified_richedit") +#define MAX_CLASS_NAME 50 + + +/**************************************************************************** +* CCandidateList +* Handles the UI for the alternate list +*****************************************************************************/ +class CCandidateList +{ +public: + CCandidateList( HWND hClient, CRecoEventMgr &rRecoMgr ); + ~CCandidateList(); + + void GetFontSettings(); + + const WNDCLASS *GetParentClass() + { return m_pwcParentClass; } + void SetParent( HWND hParent ); + void SetTextSel( ITextSelection *pTextSel ) + { m_cpTextSel = pTextSel; } + void SetLangID( LANGID langid ); + + HWND Update( CTextRunList *pTextRunList ); + void ShowButton( bool fShow ); + + void StartPlayback() {m_fPlaybackInProgress = true;}; + void EndPlayback() {m_fPlaybackInProgress = false;}; + bool IsPlaybackInProgress() { return m_fPlaybackInProgress; }; + + friend LRESULT APIENTRY CandidateUIProc( + HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + + bool FHasAlternates() { return (m_pCurrentDictRun != NULL) && (m_cpTextSel != NULL); }; + +private: + void ShowAlternates(); + void MakeTextSelReflectAlt( ULONG ulAltIndexInList ); + void AlternateChosen( ULONG ulChosenAltInList ); + void DoneWithAltsList(); + +// Data members + + WNDCLASS *m_pwcParentClass; // The window class registered by the + // call to the constructor for a candidate list + // (a modified RichEdit control). + // The parent window will belong to this window class. + HINSTANCE m_hInst; + HWND m_hMainClientWindow;// Main application window + HWND m_hParent; // Parent window of the UI (richedit control) + int m_cbOffset; // Offset of the extra space in the parent window + WNDPROC m_wpOrigWndProc; // The wndproc of the parent window that will be + // subclassed + HWND m_hButton; // The button that triggers the alternates UI + HWND m_hAltsList; // Handle to the alternates list + LANGID m_langid; // Language of dictation + HFONT m_hFont; // Font for the owner-drawn alternates listbox + bool m_fMakeUIVisible; // If false, button and list not shown + bool m_fPlaybackInProgress; + // If true, richedit window needs to ignore keystrokes + + CDictationRun *m_pCurrentDictRun; + // The last dictation run that the alternates button + // corresponded to + + CComPtr m_cpTextSel; + CRecoEventMgr *m_pRecoMgr; + ULONG m_aulAltIndices[ ALT_REQUEST_COUNT ]; + ULONG m_ulNumAltsDisplayed; + // A map from indices in the list to alternate indices +}; + +// Subclassing wndproc for the richedit control (parent window of the candidate UI +LRESULT APIENTRY CandidateUIProc( + HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + +// Helper function for locale and font settings +inline BOOL NT5orGreater() +{ + DWORD dwVersion = GetVersion(); + + return !(dwVersion & 0x80000000) && LOBYTE(LOWORD(dwVersion)) >= 5; +} + + + +#endif // __CANDIDATELIST_H \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_cmdmode.xml b/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_cmdmode.xml new file mode 100644 index 00000000..c4361b43 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_cmdmode.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +

scroll

+

move

+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+ + + + + +

page

+

pages

+

line

+

lines

+

paragraph

+

paragraphs

+
+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+

+ +

+ +

page

+

line

+

paragraph

+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+

+ +
+ + + +

+ +

+

+

+ +

+ + + +

+
+
+ + + + +

go home

+

scroll home

+

go end

+

scroll end

+

?move left

+

scroll left

+

?move right

+

scroll right

+

word left

+

word right

+

?line end

+

?line home

+

?line start

+

?line beginning

+
+
+ + + + +

file

+

new

+

open

+

save

+

save as

+

exit

+

edit

+

cut

+

copy

+

paste

+

voice

+

listen for dictation

+

?start dictation

+

start dictating

+

end ?of command mode

+

listen for command

+

listen for commands

+

stop dictation

+

end ?of dictation

+

stop dictating

+

?turn microphone off

+

?turn mike off

+

close microphone

+

microphone on

+

grammars active

+

grammars inactive

+

activate grammars

+

deactivate grammars

+

play

+

play back

+

add ?and delete word

+

select whole word

+

select whole words

+

shared engine

+

shared recognition engine

+

shared reco engine

+

?voice training

+

microphone setup

+

help

+

about

+

cancel

+

escape

+
+
+ + + + +

twenty

+

thirty

+

forty

+

fifty

+

sixty

+

seventy

+

eighty

+

ninety

+
+
+ + + +

one

+

two

+

three

+

four

+

five

+

six

+

seven

+

eight

+

nine

+
+
+ + + +

+ +

+ +

zero

+

ten

+

eleven

+

twelve

+

thirteen

+

fourteen

+

fifteen

+

sixteen

+

seventeen

+

eighteen

+

nineteen

+
+
+
+ + +
diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictmode.xml b/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictmode.xml new file mode 100644 index 00000000..05d6c493 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictmode.xml @@ -0,0 +1,15 @@ + + + + + + + + + +

command

+

computer

+
+
+ +
diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictpad.rc b/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictpad.rc new file mode 100644 index 00000000..576630e8 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/chs_dictpad.rc @@ -0,0 +1,137 @@ +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_DICTPAD MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "E&xit\tCtrl+X", IDM_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Voice" + BEGIN + MENUITEM "Listen for &Dictation", IDM_DICTATION_MODE, CHECKED + MENUITEM "Listen for &Commands", IDM_COMMAND_MODE + MENUITEM "&Grammars active\tCtrl+M", IDM_MIC_TOGGLE + MENUITEM "Play&back\tCtrl+P", IDM_PLAY + MENUITEM SEPARATOR + MENUITEM "&Add/Delete Word(s)...", IDM_ADDREMOVEWORDS + MENUITEM SEPARATOR + MENUITEM "Select &Whole Words", IDM_WHOLE_WORDS, CHECKED + MENUITEM "S&hared recognition engine", IDM_SHAREDENGINE + MENUITEM SEPARATOR + MENUITEM "&Voice Training...", IDM_VOICE_TRAINING + MENUITEM "Micro&phone Setup...", IDM_MICROPHONE_SETUP + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_DICTPAD ACCELERATORS MOVEABLE PURE +BEGIN + "/", IDM_ABOUT, ASCII, ALT, NOINVERT + "?", IDM_ABOUT, ASCII, ALT, NOINVERT + "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "C", IDM_COMMAND_MODE, VIRTKEY, ALT, NOINVERT + "D", IDM_DICTATION_MODE, VIRTKEY, ALT, NOINVERT + "M", IDM_MIC_TOGGLE, VIRTKEY, CONTROL, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_PLAY, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 113 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_DICTPAD,IDC_MYICON,14,9,20,20 + LTEXT "DictPad Version",IDC_STATIC,49,10,58,8,SS_NOPREFIX + LTEXT "(c) 2001 Microsoft Corporation. All rights reserved.", + IDC_STATIC,49,20,177,11 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP + LTEXT "",IDC_ABOUT_DICTPAD_VERSION,107,10,79,8 + PUSHBUTTON "Components",IDC_ABOUT_COMPONENTS,176,54,49,11,NOT + WS_VISIBLE +END + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_COMMAND_MODE_CFG SRGRAMMAR DISCARDABLE "chs_cmdmode.cfg" +IDR_DICTATION_MODE_CFG SRGRAMMAR DISCARDABLE "chs_dictmode.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Dictpad" + IDC_DICTPAD "DICTPAD" + IDM_PLAY "Play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_FONT "Allow selection of a different font " + IDM_DICTATION_MODE "Dictation" + IDM_COMMAND_MODE "Command" + IDS_WAITING "..." + IDS_INVALIDFILEFORMAT "Invalid file format" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_MIC_TOGGLE "Grammars active/inactive" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CANNOTOPEN "This file cannot be opened by Dictpad" + IDS_ERRORSAVING "Dictpad encountered an error while saving to this file" + IDS_CANNOTSAVE "Error saving to file" + IDS_CONFIRMCLOSE "The text of this file has changed since the last save. Do you wish to save this file?" + IDS_MICROPHONESETUPWIZARD "Microphone Setup Wizard" + IDS_ACCESSDENIED "Cannot save to file: Access denied." + IDS_CANNOTSWITCHMODES "Error switching modes" + IDS_CANNOTFILENEW "A new file could not be opened." + IDS_UPDATEERROR "An error occurred updating the Dictpad document. Dictpad will now exit." + IDS_UNSUPPORTEDLANG "Error: The language of the engine is unsupported" +END + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/cmdmode.xml b/sp/src/utils/sapi51/Samples/CPP/DictPad/cmdmode.xml new file mode 100644 index 00000000..03ff4414 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/cmdmode.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +

scroll

+

move

+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+ + + + + +

page

+

pages

+

line

+

lines

+

paragraph

+

paragraphs

+
+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+

+ +

+ +

page

+

line

+

paragraph

+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+

+ +
+ + + +

+ +

+

+

+ +

+ + + +

+
+
+ + + + +

go home

+

scroll home

+

go end

+

scroll end

+

?move left

+

scroll left

+

?move right

+

scroll right

+

word left

+

word right

+

?line end

+

?line home

+

?line start

+

?line beginning

+
+
+ + + + +

file

+

new

+

open

+

save

+

save as

+

exit

+

edit

+

cut

+

copy

+

paste

+

voice

+

listen for dictation

+

?start dictation

+

start dictating

+

end ?of command mode

+

listen for command

+

listen for commands

+

stop dictation

+

end ?of dictation

+

stop dictating

+

?turn microphone off

+

?turn mike off

+

close microphone

+

microphone on

+

grammars active

+

grammars inactive

+

activate grammars

+

deactivate grammars

+

play

+

play back

+

add ?and delete word

+

select whole word

+

select whole words

+

shared engine

+

shared recognition engine

+

shared reco engine

+

?voice training

+

microphone setup

+

help

+

about

+

cancel

+

escape

+
+
+ + + + +

twenty

+

thirty

+

forty

+

fifty

+

sixty

+

seventy

+

eighty

+

ninety

+
+
+ + + +

one

+

two

+

three

+

four

+

five

+

six

+

seven

+

eight

+

nine

+
+
+ + + +

+ +

+ +

zero

+

ten

+

eleven

+

twelve

+

thirteen

+

fourteen

+

fifteen

+

sixteen

+

seventeen

+

eighteen

+

nineteen

+
+
+
+ + +
diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.cpp new file mode 100644 index 00000000..042c91ff --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.cpp @@ -0,0 +1,2060 @@ +/****************************************************************************** +* DictationRun.cpp +* This module contains the implementation details of the CDictationRun +* class which handles the dictation-specfic issues for a dictation +* text run. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "DictationRun.h" + +/****************************************************************************** +* CDictationRun::CDictationRun * +*------------------------------* +* Description: +* Constructor. +* +* Return: +* +******************************************************************************/ +CDictationRun::CDictationRun() : m_ulStartElement( 0 ), + m_cElements( 0 ), + m_fAltsGotten( false ), + m_pPhraseReplacement( NULL ), + m_pulElementOffsets( NULL ), + m_pResultContainer( NULL ) +{} /* CDictationRun::CDictationRun */ + +/****************************************************************************** +* CDictationRun::~CDictationRun * +*-------------------------------* +* Description: +* Destructor. +* +* Return: +* +******************************************************************************/ +CDictationRun::~CDictationRun( void ) +{ + // See CDictationRun::SetTextRange(), where this is allocated + delete[] m_pulElementOffsets; + + // Tell the result object (which might be shared with other DictationRuns) + // that we no longer need it. + if ( m_pResultContainer ) + { + m_pResultContainer->DeleteOwner( *this ); + } + + // The CPhraseReplacement object is going to need to stay around + // for as long as the CResultContainer does; thus when all + // CDictationRuns depending on this result object are deleted, + // the associated CPhraseReplacement object will also be deleted. + +} /* CDictationRun::~CDictationRun */ + +/****************************************************************************** +* CDictationRun::Initialize * +*---------------------------* +* Description: +* Constructor. +* This is the initialization routine that is called when a DictationRun +* is being created from scratch, either from a serialized DictationRun +* (if the optional param pDictHdr is NULL) or from newly-dictated text. +* Initializes the phrase element information and sets up the +* phrase data. +* +* Return: +* S_OK +* E_OUTOFMEMORY +* Return value of CPhraseReplacement::Initialize() +******************************************************************************/ +HRESULT CDictationRun::Initialize( ISpRecoResult &rRecoResult, DICTHEADER *pDictHdr ) +{ + // Get the phrase element information from the serialized header, if available + if ( pDictHdr ) + { + m_ulStartElement = pDictHdr->ulStartElement; + m_cElements = pDictHdr->cElements; + } + + // If this is a new DictationRun (not recreated from a serialized DictationRun), + // the element count will get properly initialized + // when the text range is set. + + // Create and initialize the phrase replacement info + m_pPhraseReplacement = new CPhraseReplacement(); + if ( !m_pPhraseReplacement ) + { + return E_OUTOFMEMORY; + } + HRESULT hr = m_pPhraseReplacement->Initialize( rRecoResult ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Create a CResultContainer to hold the result object + m_pResultContainer = new CResultContainer( rRecoResult, *this, + *m_pPhraseReplacement ); + if ( !m_pResultContainer ) + { + return E_OUTOFMEMORY; + } + + return S_OK; + +} /* CDictationRun::Initialize */ + +/****************************************************************************** +* CDictationRun::Initialize * +*---------------------------* +* Description: +* Constructor. +* This is the initialization routine that is called when a DictationRun +* is being created from the contents of another DictationRun +* (i.e. a DictationRun is being split). +* All of the phrase information is already contained in the +* CResultContainer. +* +* Return: +* S_OK +******************************************************************************/ +HRESULT CDictationRun::Initialize( CResultContainer &rResultContainer ) +{ + // Get the phrase element and result object information from the + // CResultContainer + m_pResultContainer = &rResultContainer; + m_pPhraseReplacement = rResultContainer.GetPhraseReplacement(); + + // The caller needs to call rResultContainer.AddOwner(). + + return S_OK; +} /* CDictationRun::Initialize */ + +/****************************************************************************** +* CDictationRun::SetTextRange * +*-----------------------------* +* Description: +* Stores the ITextRange * for this run. +* Creates the array of element offsets and initializes +* the entries. +* The two cases in which this function can be called are +* * New DictationRun, in which presumably all of +* the elements will be found +* * A DictationRun formed by being split off an old +* DictationRun, in which case not all of the elements +* will be present +* Return: +* S_OK +* E_POINTER +* E_OUTOFMEMORY +* Return value of ITextRange::FindTextStart() +******************************************************************************/ +HRESULT CDictationRun::SetTextRange( ITextRange *pTextRange ) +{ + if ( !pTextRange ) + { + return E_POINTER; + } + m_cpTextRange = pTextRange; + + if ( !m_pPhraseReplacement || !m_pResultContainer ) + { + return E_OUTOFMEMORY; + } + + // If we do not already know how many phrase elements we have, then + // this is a new run, so get it from the phrase replacement object + if ( !m_cElements ) + { + m_cElements = m_pPhraseReplacement->GetNumReplacementElements(); + } + + // Allocate enough space in our element offsets to hold information + // for all the elements. + // Each entry in this array will indicate where the given element + // starts (given as an offset from the start of the range) + m_pulElementOffsets = + new ULONG[ m_pPhraseReplacement->GetNumReplacementElements() ]; + if ( !m_pulElementOffsets ) + { + return E_OUTOFMEMORY; + } + + // Fill the array with an impossible value, right now the length of + // this range (since nothing can have an offset tha big) + const ULONG ulBogusVal = GetEnd() - GetStart(); + ULONG ulElement; + for ( ulElement = 0; + ulElement < m_pPhraseReplacement->GetNumReplacementElements(); + ulElement++ ) + { + m_pulElementOffsets[ ulElement ] = ulBogusVal; + } + + // Loop through the elements finding the character offset in the range + // for each one, if it is there. + // We will use a duplicate ITextRange and ITextRange::FindTextStart() + BSTR bstrElement; + long lStart = GetStart(); + long lElementStart; + CComPtr cpRangeDup; + HRESULT hr = pTextRange->GetDuplicate( &cpRangeDup ); + if ( !cpRangeDup ) + { + return E_OUTOFMEMORY; + } + for ( ulElement = 0; + SUCCEEDED( hr ) && + ( ulElement < m_pPhraseReplacement->GetNumReplacementElements() ); + ulElement++ ) + { + // Get the element text + BYTE bDisplayAttributes; + bstrElement = ::SysAllocString( + m_pPhraseReplacement->GetDisplayText( ulElement, &bDisplayAttributes ) ); + if ( !bstrElement ) + { + return E_OUTOFMEMORY; + } + + // Look for the element. + long lLength; + hr = cpRangeDup->FindTextStart( bstrElement, 0, 0, &lLength ); + + ::SysFreeString( bstrElement ); + + if ( lLength ) + { + // The element was found in cpRangeDup + + // The start of the cpRangeDup is now the start of the element + cpRangeDup->GetStart( &lElementStart ); + + // Give the offset relative to the start of the range + m_pulElementOffsets[ulElement] = lElementStart - lStart; + + // Advance the start past this word + cpRangeDup->MoveStart( tomCharacter, lLength, NULL ); + } + } + + return hr; +} /* CDictationRun::SetTextRange */ + +/********************************************************************** +* CDictationRun::Split * +*----------------------* +* Description: +* Splits up a DictationRun so that this text run now ends at +* lFirstEnd and a second dictation run (*ppTextRun) begins at +* lSecondBegin. +* "This" will now be a shorter range (it will end sooner), +* and *ppTextRun will point to the new text run for which +* space will be allocated here. +* In general, the phrase element information for the two +* DictationRuns will NOT be correct after exiting this +* function. The caller must call CorrectPhraseElementsAndRange +* to ensure that the phrase element information correctly reflects +* the new range, which it in general will not after this function. +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG: *plFirstEnd, *plSecondBegin out of bounds or +* in the wrong order +* E_OUTOFMEMORY +* Return value of CDictationRun::Initialize() +* Return value of ITextDocument::Range() +* Return value of CResultContainer::AddOwner() +**********************************************************************/ +HRESULT CDictationRun::Split( long *plFirstEnd, + long *plSecondBegin, + ITextDocument *cpTextDoc, + CTextRun **ppTextRun ) +{ + if ( !plFirstEnd || !plSecondBegin || !cpTextDoc || !ppTextRun ) + { + return E_POINTER; + } + if ( !m_cpTextRange || !m_pResultContainer ) + { + return E_UNEXPECTED; + } + + long lFirstEnd = *plFirstEnd; + long lSecondBegin = *plSecondBegin; + + if ( !WithinRange( lFirstEnd ) || (lFirstEnd > lSecondBegin) ) + { + // Cannot split somewhere that is not in the range + return E_INVALIDARG; + } + + if ( (GetStart() == lSecondBegin) || (GetEnd() == lFirstEnd) || + (lSecondBegin > GetEnd()) ) + { + // Don't need to do anything, since we are trying to split on a + // run boundary + *ppTextRun = NULL; + return S_OK; + } + + // Create a new dictation run to hold the text from lSecondBegin until + // the end of the original range. + // We create this new DictationRun off the same result object + // in m_pResultContainer + *ppTextRun = new CDictationRun(); + CDictationRun *pDictRun = (CDictationRun *) *ppTextRun; + if ( !pDictRun ) + { + return E_OUTOFMEMORY; + } + HRESULT hr = pDictRun->Initialize( *m_pResultContainer ); + if ( FAILED( hr ) ) + { + return hr; + } + + // This DictationRun should be on the owner list for this result container + hr = m_pResultContainer->AddOwner( *pDictRun ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Adjust the latter range so that it starts at lSecondBegin + // and ends where "this" used to end + long lEnd = GetEnd(); + CComPtr cpLatterRange; + hr = cpTextDoc->Range( lSecondBegin, lEnd, &cpLatterRange ); + if ( FAILED( hr ) ) + { + return hr; + } + hr = pDictRun->SetTextRange( cpLatterRange ); + + // Adjust the range of "this" so that it ends at lFirstEnd + m_cpTextRange->SetEnd( lFirstEnd ); + + // Just copy over the phrase element information, which will + // in general be incorrect until we call CorrectPhraseEltsAndRange() + pDictRun->m_ulStartElement = m_ulStartElement; + pDictRun->m_cElements = m_cElements; + + return hr; + +} /* CDictationRun::Split */ + +/********************************************************************** +* CDictationRun::Concatenate * +*----------------------------* +* Description: +* If bConcatenateAfter is true, pTextRun's range is appended +* to "this"'s range; else it is prepended. +* Concatenation happens according to the following rules: +* * If pTextRun is a DictationRun that refers to the same +* result object as "this" and its phrase elements adjoin +* ours, then concatenation is possible. +* * If pTextRun is a plain TextRun, then we try +* concatenating the whole thing on and seeing if +* some of that text can be appropriated as phrase elements +* Return: +* E_NOMERGE if no merging was possible +* E_PARTIALMERGE if some but not all of pTextRun's range +* could be appropriated by this +* E_FULLMERGE if all of pTextRun's range was appropriated +* E_LESSTEXT if by joining pText onto "this", we reduce +* the number of phrase elements that "this" has +* (e.g. pTextRun's text runs onto the end of "this"'s +* last phrase element, thus making that last word no +* longer a true phrase element) +***********************************************************************/ +MERGERESULT CDictationRun::Concatenate( CTextRun *pTextRun, + bool fConcatAfter ) +{ + // Validate params + if ( !pTextRun || !m_cpTextRange || !m_pResultContainer ) + { + _ASSERTE( false ); + return E_NOMERGE; + } + + // Check that the runs are indeed adjacent in the text + if (( fConcatAfter && ( GetEnd() != pTextRun->GetStart() ) ) || + ( !fConcatAfter && ( GetStart() != pTextRun->GetEnd() ) )) + { + // Non-consecutive runs can't be concatenated + _ASSERTE( false ); + return E_NOMERGE; + } + + if ( pTextRun->IsDict() ) + { + // pTextRun is a dictation run. + // This merge is easy to do: Check that the two DictationRuns + // share the same result object, then check if e.g. the + // first one has elements 2 through 4 and the second one + // has elements 5 through 8. + + // We know this is a DictationRun so do the cast + CDictationRun *pDictRun = (CDictationRun *) pTextRun; + + // Check to see if the result objects are the same (if they + // are then they'll point to the same CResultContainer + if ( pDictRun->m_pResultContainer != m_pResultContainer ) + { + // Dictation runs with different result objects + // cannot be concatenated + return E_NOMERGE; + } + + // See if phrase elements are consecutive + if ( fConcatAfter ) + { + // pDictRun's elements need to follow "this"'s + + if ( (m_ulStartElement + m_cElements) == + pDictRun->m_ulStartElement ) + { + // These can be merged, since pDictRun picks + // up where we leave off + + // Store the start indices so that we can update + // the element offsets + long lThisStart = GetStart(); + long lDictRunStart = pDictRun->GetStart(); + + // Adjust the ranges so that "this" contains + // all of pDictRun's text and so that + // pDictRun will be degenerate + SetEnd( pDictRun->GetEnd() ); + pDictRun->SetStart( pDictRun->GetEnd() ); + + // Update the element offsets for the new elements introduced by + // pDictRun. + // We will need to update every element accounted for + // by pDictRun to be relative to the start of this run rather + // than the start of pDictRun + for ( ULONG ulElement = pDictRun->m_ulStartElement; + ulElement < (pDictRun->m_ulStartElement + pDictRun->m_cElements); + ulElement++ ) + { + // Shift the offset of the new element. + // Add lDictRunStart to get an absolute offset (within the document), + // then subtract lThisStart for an offset relative to "this" + m_pulElementOffsets[ulElement] = + pDictRun->m_pulElementOffsets[ulElement] + + lDictRunStart - lThisStart; + } + + // Adjust the phrase element info so that "this" contains all of + // pDictRun's phrase elements + m_cElements += pDictRun->m_cElements; + + // pDictRun should now contain no elements + pDictRun->m_ulStartElement = m_ulStartElement + m_cElements; + pDictRun->m_cElements = 0; + + return E_FULLMERGE; + } + } + else + { + // Same as above, just in the opposite direction. + // Here pDictRun is being prepended to this run. + + if ( m_ulStartElement == + (pDictRun->m_ulStartElement + pDictRun->m_cElements) ) + { + // Store the start indices so that we can update + // the element offsets + long lThisStart = GetStart(); + long lDictRunStart = pDictRun->GetStart(); + + // Adjust the ranges so that "this" contains + // all of pDictRun's text and so that + // pDictRun will be degenerate + SetStart( pDictRun->GetStart() ); + pDictRun->SetEnd( pDictRun->GetStart() ); + + // Update the element offsets for the new elements introduced by + // pDictRun. + // The offsets in pDictRun are correct, since they are relative + // to the earlier start. + // The offsets for "this" need to be updated + ULONG ulElement; + for ( ulElement = pDictRun->m_ulStartElement; + ulElement < + (pDictRun->m_ulStartElement + pDictRun->m_cElements); + ulElement++ ) + { + // Copy over element offsets from pDictRun + m_pulElementOffsets[ulElement] = + pDictRun->m_pulElementOffsets[ulElement]; + } + + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + // Shift the offset of the element. + // Add lThisStart to get an absolute offset (within the document), + // then subtract lDictRunStart (the new start of the text range) + // for an offset relative to the new start + m_pulElementOffsets[ulElement] += + lThisStart - lDictRunStart; + } + + // Adjust the phrase element info so that "this" contains all of + // pDictRun's phrase elements + m_cElements += pDictRun->m_cElements; + m_ulStartElement = pDictRun->m_ulStartElement; + + // pDictRun should now contain no elements + pDictRun->m_cElements = 0; + + return E_FULLMERGE; + } + } + + // If we got here, then both runs are CDictationRuns pointing to the same + // CResultContainer but they did not contain adjacent elements + return E_NOMERGE; + } + + + // Merging a text run onto "this" + + // To do this, we first "guess" that the entire text run should go + // with "this". CorrectPhraseEltsAndRange() corrects this assumption + // if the entire phrase cannot in fact be used. + + if ( fConcatAfter ) + { + // Add on all of the text in pTextRun to the end of "this" + + // For determining how much of a merge will have taken place + long lOldBorder = pTextRun->GetStart(); + + // Temporarily set the range of "this" to the end of pTextRun, + // thus incorporating all of pTextRun's text into "this" + SetEnd( pTextRun->GetEnd() ); + + // Cut out whatever is not a phrase element. + // This may push back the end of "this"'s range + bool fCorrectionResult; + HRESULT hr = CorrectPhraseEltsAndRange( true, &fCorrectionResult ); + if ( FAILED( hr ) ) + { + return E_NOMERGE; + } + + // Now have pTextRun pick up where "this" leaves off, + // so that it includes everything that could not be + // merged into "this" + pTextRun->SetStart( GetEnd() ); + + if ( fCorrectionResult ) + { + // The entire range of pTextRun was appropriated by this + _ASSERTE( pTextRun->IsDegenerate() ); + return E_FULLMERGE; + } + else + { + if ( pTextRun->GetStart() == lOldBorder ) + { + // None of pTextRun's range was appropriated + return E_NOMERGE; + } + else + { + // If pTextRun starts earlier than it did before, + // then concatenating pTextRun onto "this" + // reduced the number of phrase elements it + // contained. + // If pTextRun starts later than it did before, + // then "this" appropriated some part of it as + // phrase elements. + return (pTextRun->GetStart() < lOldBorder) ? + E_LESSTEXT : E_PARTIALMERGE; + } + } + } + else + { + // Same as above, only in the reverse direction (try to merge + // pTextRun onto the beginning of "this" + + // For determining how much of a merge will have taken place + long lOldBorder = pTextRun->GetEnd(); + + // Temporarily set the range of "this" to include pTextRun, + // thus incorporating all of pTextRun's text into "this" + SetStart( pTextRun->GetStart() ); + + // Cut out whatever is not a phrase element. + // This may push forward the start of "this"'s range + bool fCorrectionResult; + HRESULT hr = CorrectPhraseEltsAndRange( false, &fCorrectionResult ); + if ( FAILED( hr ) ) + { + return E_NOMERGE; + } + + // Now have pTextRun end where "this" starts, + // so that it includes everything that could not be + // merged into "this" + pTextRun->SetEnd( GetStart() ); + + if ( fCorrectionResult ) + { + // The entire range of pTextRun was appropriated by this + _ASSERTE( pTextRun->IsDegenerate() ); + return E_FULLMERGE; + } + else + { + if ( pTextRun->GetEnd() == lOldBorder ) + { + // None of pTextRun's range was appropriated + return E_NOMERGE; + } + else + { + // If pTextRun ends later than it did before, + // then concatenating pTextRun onto "this" + // reduced the number of phrase elements it + // contained. + // If pTextRun ends earlier than it did before, + // then "this" appropriated some part of it as + // phrase elements. + return (pTextRun->GetEnd() > lOldBorder) ? + E_LESSTEXT : E_PARTIALMERGE; + } + } + } +} /* CDictationRun::Concatenate */ + + +/********************************************************************** +* CDictationRun::CorrectPhraseEltsAndRange * +*------------------------------------------* +* Description: +* Ensures that the m_ulStartElement and m_cElements correctly +* reflect the text range. If not, adjusts the phrase element +* info and the range so that they agree. +* +* Depending on whether fForward is true, either goes forwards +* from m_ulStartElement or backwards from +* m_ulStartElement + m_cElements in matching up the phrases. +* If fForward is true, then includes any between-word space +* after the last element it matches, if that space was +* included in the original range. +* +* If fForward is true, the end of "this"'s range may be +* pushed back if there is some text at the end of the +* range that does not match phrase elements. +* If fForward is false, the start of "this"'s range may be +* pushed forward. +* +* Note that the range will never be expanded here, only +* possibly contracted. +* +* *pfCorrectionResult will be true iff the phrase element info +* and range did not have to be changed +* Return: +* S_OK +* E_POINTER +* Return value of ITextRange::GetDuplicate() +**********************************************************************/ +HRESULT CDictationRun::CorrectPhraseEltsAndRange( bool fForward, + bool *pfCorrectionResult ) +{ + // Make sure current state is what we expect + _ASSERTE( m_pPhraseReplacement && m_pResultContainer ); + + // Store range and phrase element info. + // We will use these values later on to determine what has changed + const long lOldStart = GetStart(); + const long lOldEnd = GetEnd(); + const ULONG ulOldStartElement = m_ulStartElement; + const ULONG cOldElements = m_cElements; + +#ifdef _DEBUG + BSTR bstrRangeText; + m_cpTextRange->GetText( &bstrRangeText ); +#endif + + // Degenerate range case: Number of elements should be 0. + if ( IsDegenerate() ) + { + if ( m_cElements ) + { + // Phrase information is incorrect since it says + // that we contain some phrase elements + m_cElements = 0; + + if ( pfCorrectionResult ) + { + *pfCorrectionResult = false; + } + } + else + { + if ( pfCorrectionResult ) + { + *pfCorrectionResult = true; + } + } + return S_OK; + } + + // Nondegenerate case + + // Create a duplicate range. + // This range will correspond to text we skip during + // our search for phrase elements + CComPtr pSkippedRange; + HRESULT hr = m_cpTextRange->GetDuplicate( &pSkippedRange ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Depending on the direction, we will either want to start + // at the earliest element supposedly contained in this range + // (if fForward == true) or at the last element. + const ULONG ulFirstElement = fForward ? m_ulStartElement : + (m_ulStartElement + m_cElements - 1); + ULONG ulElement = ulFirstElement; + + long cch, lOldBound; + BSTR bstrElement, bstrSkippedText; + + // For each phrase element, find it in the range. + // We will use the start (resp. end) of "this"'s range + // in the calls to ITextRange::FindTextStart() + // which will move the start (or end) of our range just past + // each element that is found + while (ulElement < m_pPhraseReplacement->GetNumReplacementElements()) + { + // Get the next phrase element that we are expecting + BYTE bDisplayAttributes = 0; + bstrElement = ::SysAllocString( + m_pPhraseReplacement->GetDisplayText( ulElement, &bDisplayAttributes ) ); + + // Remember where "this"'s range started (resp. ended) + lOldBound = fForward ? GetStart() : GetEnd(); + + // Either move the start to right before this word + // or move the end to right after this word. + // Note that we want to match entire words only if the display attributes + // don't tell us to consume leading spaces (like a comma or something) + if ( GetStart() == GetEnd() ) + { + cch = 0; + } + else + { + fForward ? + m_cpTextRange->FindTextStart( + bstrElement, + 0, + (bDisplayAttributes & SPAF_CONSUME_LEADING_SPACES) ? 0 : tomMatchWord, + &cch ) + : m_cpTextRange->FindTextEnd( + bstrElement, + 0, + (bDisplayAttributes & SPAF_CONSUME_LEADING_SPACES) ? 0 : tomMatchWord, + &cch ); + } + + + ::SysFreeString( bstrElement ); + +#ifdef _DEBUG + ::SysFreeString( bstrRangeText ); + m_cpTextRange->GetText( &bstrRangeText ); +#endif + + // Set pSkippedRange to include whatever text is between + // the old start (resp end) of m_cpTextRange (which is at the + // end (resp start) of the last phrase element we found) + // and the new start (resp end) of m_cpTextRange (which is at the start + // (resp end) of the phrase element we just found, if we did + // indeed find one) + pSkippedRange->SetStart( fForward ? lOldBound : GetEnd() ); + pSkippedRange->SetEnd( fForward ? GetStart() : lOldBound ); + + // If this skipped range contains any text that is not whitespace, + // then there was something between the last phrase element and + // this phrase element that we just found. + pSkippedRange->GetText( &bstrSkippedText ); + if ( ContainsNonWhitespace( bstrSkippedText ) ) + { + // Contains some non-spaces, so this element should not + // count as found, since there is some text between + // where we are and the phrase element + cch = 0; + + // Set the start (resp. end) to the old bound, since we + // don't want to include this text (it does not consist + // solely of phrase elements + fForward ? SetStart( lOldBound ) : SetEnd( lOldBound ); + } + ::SysFreeString( bstrSkippedText ); + + if ( !cch ) + { + // Phrase element not found: + // Break out of the loop + break; + } + + // The phrase element was found; update the element + // offset array. + // For the time being, these are absolute indices + // (since if fForward is FALSE, then we don't yet know + // what the start of the range is. + // Later in the function they will be adjusted + // to be relative indices. + if ( fForward ) + { + // Because of ITextRange::FindTextStart(), + // the start of this range is the start of this element + m_pulElementOffsets[ ulElement ] = GetStart(); + } + else + { + // Because of ITextRange::FindTextEnd(), + // the end of this range is the end of this element. + // Subtract cch since cch is the length of the element + m_pulElementOffsets[ ulElement ] = GetEnd() - cch; + } + + // Move the start (resp. the end) past the phrase element + // (whose length is cch) + fForward ? m_cpTextRange->MoveStart( tomCharacter, cch, NULL ) : + m_cpTextRange->MoveEnd( tomCharacter, -cch, NULL ); + + +#ifdef _DEBUG + ::SysFreeString( bstrRangeText ); + m_cpTextRange->GetText( &bstrRangeText ); +#endif + + // Increment (decrement) ulElement to look for the next element + fForward ? ulElement++ : ulElement--; + } // (while loop) + +#ifdef _DEBUG + ::SysFreeString( bstrRangeText ); +#endif + + if ( fForward ) + { + // If all of the elements were there, ulElement is equal + // to the old start element plus the old number of elements. + // Otherwise, ulElement is equal to the first phrase element + // after ulFirstElement that was not found. + + // Adjust the phrase element information to reflect + // what we found + m_cElements = ulElement - ulFirstElement; + + // Adjust the end so that only phrase elements are in this range. + // This is where the start of the range is right now (since we + // just moved the start past the last phrase element + // that was found. + SetEnd( GetStart() ); + + // Reset the start to its original location (it was moved around + // by ITextRange::FindTextStart()) + SetStart( lOldStart ); + + // Now try to include any between-word space that can be included. + // up until the old end limit. + // We do not want to do this if there are no phrase elements found + // at all (in this case, the range should be degenerate). + if ( m_cElements ) + { + m_cpTextRange->MoveEnd( tomWord, 1, NULL ); + if ( GetEnd() > lOldEnd ) + { + // We overshot the old end, so we should just end at the old end + SetEnd( lOldEnd ); + } + } + } + else + { + // If all of the elements were there, ulElement is equal + // to the old start element - 1. + // Otherwise, ulElement is equal to the first phrase element + // going backwards from ulFirstElement that was not found. + + // Must adjust both the start element and the number of elements + m_ulStartElement = ulElement + 1; + m_cElements = ulFirstElement - ulElement; + + // Adjust the start so that only phrase elements are in this range. + // This is where the end of the range is right now (since we + // just moved the end before the last phrase element + // that was found. + SetStart( GetEnd() ); + + // Reset the end to its original location (it was moved around + // by ITextRange::FindTextEnd()) + SetEnd( lOldEnd ); + + // Do not include spaces leading up to this phrase + } + + // If no elements were found in the range, then set the range to be degenerate + if ( !m_cElements ) + { + fForward ? SetEnd( lOldStart ) : SetStart( lOldEnd ); + } + +#ifdef _DEBUG + // Fill the array with the bogus phrase element offset value wherever + // there is an element that did not fall into the "found" range + // of elements + const ULONG ulBogusVal = GetEnd() - GetStart(); + for ( ulElement = 0; + ulElement < m_pPhraseReplacement->GetNumReplacementElements(); + ulElement++ ) + { + if ( (ulElement < m_ulStartElement) || + (ulElement >= (m_ulStartElement + m_cElements)) ) + { + m_pulElementOffsets[ ulElement ] = ulBogusVal; + } + } +#endif + + // All elements in the range should have had their offsets updated above + // to be absolute locations within the document. + // Since we now know the start of the range, we can update the offsets + // of elements we have found relative to that. + long lStart = GetStart(); + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + // Element is in the range; make its index + // relative to the start index of the range + m_pulElementOffsets[ ulElement ] -= lStart; + } + + // Should return true iff nothing has changed (i.e. everything was already + // correct) + if ( pfCorrectionResult ) + { + *pfCorrectionResult = (( lOldStart == GetStart() ) && + ( lOldEnd == GetEnd() ) && + ( ulOldStartElement == m_ulStartElement ) && + ( cOldElements == m_cElements )); + } + return S_OK; + +} /* CDictationRun::CorrectPhraseEltsAndRange */ + +/********************************************************************** +* CDictationRun::GetAlternatesText * +*----------------------------------* +* Description: +* Called to get the alternates for the given range. +* Since pRangeForAlts does not necessarily line up +* with element boundaries, this method will get the +* alternates for the closest range it can get that +* contains whole elements. +* plAltStart and plAltEnd will point to the start +* and end of the range for which alternates are +* actually being returned. +* The text for the alternates is given in an array +* of CoTaskMemAlloced WCHAR *'s, and pcPhrasesReturned +* points to a count of how many of them there are. +* apfFitsInRun will be an array of bools indicating +* which alternates actually do fit in "this"'s range +* (since some may cover more phrase elements than +* are actually in our range right now) +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG +* Return value of CDictationRun::FindNearestWholeElementRange() +* Return value of CResultContainer::GetAlternatesText() +**********************************************************************/ +HRESULT CDictationRun::GetAlternatesText( ITextRange *pRangeForAlts, + ULONG ulRequestCount, + long *plAltStart, + long *plAltEnd, + WCHAR **ppszCoMemText, + bool *apfFitsInRun, + ULONG *pcPhrasesReturned ) +{ + if ( !pRangeForAlts || !plAltStart || !plAltEnd || + !ppszCoMemText || !pcPhrasesReturned || !apfFitsInRun ) + { + return E_POINTER; + } + + if ( !m_pResultContainer ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + + // Validate the pRangeForAlts param + long lRangeStart; + long lRangeEnd; + pRangeForAlts->GetStart( &lRangeStart ); + pRangeForAlts->GetEnd( &lRangeEnd ); + if ( !( WithinRange( lRangeStart ) && WithinRange( lRangeEnd ) ) ) + { + // Asking for alternates from an invalid range + return E_INVALIDARG; + } + + // Expand the range to the smallest range containing it that + // contains whole elements + ULONG ulStartElement; + ULONG cElements; + HRESULT hr = FindNearestWholeElementRange( lRangeStart, lRangeEnd, + plAltStart, plAltEnd, &ulStartElement, &cElements ); + + *pcPhrasesReturned = 0; + if ( SUCCEEDED( hr ) ) + { + // Get the alternates text from the result object + hr = m_pResultContainer->GetAlternatesText( + ulStartElement, cElements, ulRequestCount, ppszCoMemText, + pcPhrasesReturned ); + } + + if ( SUCCEEDED( hr ) ) + { + // Remember what these are alternates for + m_fAltsGotten = true; + m_ulStartAltElt = ulStartElement; + m_cAltElt = cElements; + } + + // For each alternate, mark whether or not it fits in the run + ULONG ulStartInParent; + ULONG cEltsInParent; + HRESULT hrAltInfo; + for ( ULONG ulAlt = 0; ulAlt < *pcPhrasesReturned; ulAlt++ ) + { + // Find out which elements this alternate covers + hrAltInfo = m_pResultContainer->GetAltInfo( ulStartElement, cElements, ulAlt, + &ulStartInParent, &cEltsInParent ); + + // Check if it falls within our m_ulStartElement and m_cElements + apfFitsInRun[ ulAlt ] = SUCCEEDED(hrAltInfo) && + ( ulStartInParent >= m_ulStartElement ) && + ( (ulStartInParent + cEltsInParent) <= (m_ulStartElement + m_cElements) ); + + // See if we got a NULL alternate back, if we did then mark it so it gets ignored. + if ( ppszCoMemText[ ulAlt ] == NULL ) + { + apfFitsInRun[ ulAlt ] = false; + } + } + + return hr; +} /* CDictationRun::GetAlternatesText */ + +/********************************************************************** +* CDictationRun::GetAltEndpoints * +*--------------------------------* +* Description: +* Returns the start and end points of the text in the document +* that the alternate (from the last call to GetAlternatesText()) +* would replace +* Return: +* S_OK +* return value of CResultContainer::GetAltInfo() +**********************************************************************/ +HRESULT CDictationRun::GetAltEndpoints( ULONG ulAlt, + long *plReplaceStart, + long *plReplaceEnd ) +{ + _ASSERTE( m_fAltsGotten ); + _ASSERTE( m_pResultContainer ); + if ( !m_fAltsGotten || !m_pResultContainer ) + { + return E_UNEXPECTED; + } + + // Find out which elements this alternate covers + ULONG ulReplaceStartElt; + ULONG cReplacedElts; + HRESULT hr = m_pResultContainer->GetAltInfo( + m_ulStartAltElt, m_cAltElt, ulAlt, + &ulReplaceStartElt, &cReplacedElts ); + if ( FAILED(hr) ) + { + return hr; + } + _ASSERTE( (ulReplaceStartElt + cReplacedElts) <= + m_pPhraseReplacement->GetNumReplacementElements() ); + + if ( plReplaceStart ) + { + // Get the start position of the first element that would be replaced + *plReplaceStart = GetStart() + m_pulElementOffsets[ ulReplaceStartElt ]; + } + + if ( plReplaceEnd ) + { + // The range that would be replaced ends where the first element that + // won't be replaced starts. + // Get the start position of the first element that would not be + // replaced (the endpoint), or the end of the run if the last element + // would be replaced. + if ( (ulReplaceStartElt + cReplacedElts) == (m_ulStartElement + m_cElements) ) + { + // The last element in the run would be replaced + *plReplaceEnd = GetEnd(); + } + else + { + // The last element in the run would not be replaced + *plReplaceEnd = GetStart() + + m_pulElementOffsets[ ulReplaceStartElt + cReplacedElts ]; + } + } + return S_OK; +} /* CDictationRun::GetAltEndpoints */ + +/********************************************************************** +* CDictationRun::ChooseAlternate * +*--------------------------------* +* Description: +* Called when the user wishes to commit an alternate +* from the last group obtained via GetAlternatesText() +* Return: +* S_OK +* return value of CResultContainer::ChooseAlternate +**********************************************************************/ +HRESULT CDictationRun::ChooseAlternate( ULONG ulAlt ) +{ + _ASSERTE( m_fAltsGotten && m_pResultContainer ); + if ( !m_fAltsGotten || !m_pResultContainer ) + { + return E_UNEXPECTED; + } + + // Find out which elements will be replaced + ULONG ulActualAltStart; + ULONG cActualAltElts; + HRESULT hr = m_pResultContainer->GetAltInfo( + m_ulStartAltElt, m_cAltElt, ulAlt, &ulActualAltStart, &cActualAltElts ); + + // Get the text for the alternate that will replace these elements + CSpDynamicString dstrText; + BYTE bDisplayAttributes = 0; + if (SUCCEEDED(hr)) + { + hr = m_pResultContainer->GetAltText( m_ulStartAltElt, m_cAltElt, + ulAlt, &dstrText, &bDisplayAttributes ); + } + + // cpRangeToReplace will cover the text of the elements to replace + CComPtr cpRangeToReplace; + if (SUCCEEDED(hr)) + { + hr = m_cpTextRange->GetDuplicate( &cpRangeToReplace ); + } + + // Set the range of cpRangeToReplace to contain the correct text + if (SUCCEEDED(hr)) + { + // The start is the start of the first element covered by the alternate + cpRangeToReplace->SetStart( GetStart() + m_pulElementOffsets[ulActualAltStart] ); + + // The end is the start of the first element not covered by the alternate, + // or the end of this DictationRun's range, if the last element in the run + // is covered by the alternate + if ( (ulActualAltStart + cActualAltElts) == (m_ulStartElement + m_cElements) ) + { + // The last element in the run is covered + cpRangeToReplace->SetEnd( GetEnd() ); + } + else + { + // The last element in the run is not covered + cpRangeToReplace->SetEnd( GetStart() + + m_pulElementOffsets[ulActualAltStart + cActualAltElts] ); + } + } + + // Deal with display attributes: + + // pwszTextToInsert will contain the actual text to insert, with the + // correct spaces + // At most, it will need space for the recognized text, a terminating nul, + // two spaces before, and two spaces after + WCHAR *pwszTextToInsert = new WCHAR[ wcslen( dstrText ) + 5 ]; + if ( !pwszTextToInsert ) + { + return E_OUTOFMEMORY; + } + pwszTextToInsert[0] = 0; + + // Consume spaces before the alternate if necessary, + // or add spaces before the alternate. + // To be safe, we will not consume leading spaces outside of + // this run + if ( (ulActualAltStart > m_ulStartElement) && + (SPAF_CONSUME_LEADING_SPACES & bDisplayAttributes) ) + { + // Move the start of the range back until is is + // right after a non-space character + HRESULT hrMove; + long lFirstChar; + do + { + hrMove = cpRangeToReplace->MoveStart( -1, tomCharacter, NULL ); + + // Look at the first character that is now in the range + lFirstChar = 0; + cpRangeToReplace->GetChar( &lFirstChar ); + + } while (( S_OK == hrMove ) && ( L' ' == ((WCHAR) lFirstChar) )); + + if ( S_OK == hrMove ) + { + // We have found a non-space character to the left of the start, + // move just past it + cpRangeToReplace->MoveStart( 1, tomCharacter, NULL ); + } + } + else + { + // If the previous element calls for trailing spaces and there aren't + // any, we need to add them + UINT uiNumLeadingSpacesNeeded = 1; + BYTE bPreviousDisplayAttributes = 0; + if (( ulActualAltStart > 0 ) && ( ulActualAltStart > m_ulStartElement )) + { + m_pPhraseReplacement->GetDisplayText( ulActualAltStart - 1, + &bPreviousDisplayAttributes ); + if ( bPreviousDisplayAttributes & SPAF_ONE_TRAILING_SPACE ) + { + uiNumLeadingSpacesNeeded = 1; + } + else if ( bPreviousDisplayAttributes & SPAF_TWO_TRAILING_SPACES ) + { + uiNumLeadingSpacesNeeded = 2; + } + else + { + uiNumLeadingSpacesNeeded = 0; + } + } + + if ( uiNumLeadingSpacesNeeded > 0 ) + { + // Now look back to previous characters + CComPtr cpDupRange; + if ( FAILED( cpRangeToReplace->GetDuplicate( &cpDupRange ) ) ) + { + hr = E_OUTOFMEMORY; + } + long lDupRangeStart = 0; + cpDupRange->GetStart( &lDupRangeStart ); + + if ( lDupRangeStart > 0 ) + { + cpDupRange->MoveStart( tomCharacter, -1, NULL ); + lDupRangeStart--; + + long lFirstChar = 0; + cpDupRange->GetChar( &lFirstChar ); + if ( !iswspace( (WCHAR) lFirstChar ) ) + { + wcscat( pwszTextToInsert, + (1 == uiNumLeadingSpacesNeeded) ? L" " : L" " ); + } + else if ( 2 == uiNumLeadingSpacesNeeded ) + { + // If two spaces are called for but only one is there, + // we need an additional space + if ( lDupRangeStart > 0 ) + { + cpDupRange->GetChar( &lFirstChar ); + if ( !iswspace( (WCHAR) lFirstChar ) ) + { + wcscat( pwszTextToInsert, L" " ); + } + } + } + } + } + } + + // Get the display attributes for the element to follow. + // (If the alt covers the last element, CPhraseReplacement::GetDisplayText() + // will return NULL) + BYTE bFollowingDisplayAttributes = 0; + const WCHAR *pwszText = m_pPhraseReplacement->GetDisplayText( + ulActualAltStart + cActualAltElts, + &bFollowingDisplayAttributes ); + bool fConsumeLeadingSpacesAfterAlt = + pwszText && (bFollowingDisplayAttributes & SPAF_CONSUME_LEADING_SPACES); + + // Append spaces if necessary: That is, if the attribute itself + // calls for trailing spaces and the next element is not + // CONSUME_LEADING_SPACES + if ( !fConsumeLeadingSpacesAfterAlt ) + { + if ( SPAF_TWO_TRAILING_SPACES & bDisplayAttributes ) + { + dstrText.Append( L" " ); + } + else if ( SPAF_ONE_TRAILING_SPACE & bDisplayAttributes ) + { + dstrText.Append( L" " ); + } + } + + // Get the recognized text and any trailing spaces + wcscat( pwszTextToInsert, dstrText ); + + if ( SUCCEEDED( hr ) ) + { + BSTR bstrText = ::SysAllocString( pwszTextToInsert ); + + // Change the text + hr = cpRangeToReplace->SetText( bstrText ); + + ::SysFreeString( bstrText ); + } + + delete[] pwszTextToInsert; + + if ( SUCCEEDED( hr ) ) + { + // Notify the common reco result so that all runs sharing + // this result can adjust their offset maps if necessary + // (as the indices of elements may have changed) + BYTE b; + hr = m_pResultContainer->ChooseAlternate( + m_ulStartAltElt, m_cAltElt, ulAlt, &b ); + } + + // At this point the alternate has been committed to the phrase, + // and our PhraseReplacement object knows about the committed alternate + + if ( SUCCEEDED( hr ) ) + { + // This will get us the new offsets for the phrase elements we + // now have + hr = CorrectPhraseEltsAndRange( true ); + } + + return hr; +} /* CDictationRun::ChooseAlternate */ + + +/********************************************************************** +* CDictationRun::OnAlternateCommit * +*----------------------------------* +* Description: +* Called right before an alternate is committed on this +* DictationRun's RecoResult. +* If the commit has resulted in an increase in the +* number of elements, the offset map will need to be freed +* and allocated again. +* Move the element offset information so that it is correct. +* Return: +* S_OK +* E_OUTOFMEMORY +**********************************************************************/ +HRESULT CDictationRun::OnAlternateCommit( ULONG ulStartEltToBeReplaced, + ULONG cEltsToBeReplaced, + ULONG cElementsInPhraseAfterCommit ) +{ + // Determine the change in element count (i.e. whether there will now be + // more, fewer, or the same number of elements) + long lElementShift = cElementsInPhraseAfterCommit + - m_pPhraseReplacement->GetNumReplacementElements(); + + if ( !lElementShift ) + { + // Nothing needs to be done + return S_OK; + } + + if ( (ulStartEltToBeReplaced + cEltsToBeReplaced) > + m_pPhraseReplacement->GetNumReplacementElements() ) + { + // Out-of-bounds arguments + _ASSERTE( false ); + return E_UNEXPECTED; + } + + if ( lElementShift > 0 ) + { + // The number of elements has increased: need to reallocate + ULONG *pulNewOffsets = new ULONG[ cElementsInPhraseAfterCommit ]; + if ( !pulNewOffsets ) + { + return E_OUTOFMEMORY; + } + ULONG ulElement; + +#ifdef _DEBUG + // Fill the element offsets with a bogus value + const ULONG ulBogusVal = GetEnd() - GetStart(); + for( ulElement = 0; + ulElement < cElementsInPhraseAfterCommit; + ulElement++ ) + { + pulNewOffsets[ulElement] = ulBogusVal; + } +#endif + + // Copy over the relevant elements. + if ( (m_ulStartElement + m_cElements) <= ulStartEltToBeReplaced ) + { + // The replacement occurs after this run + // so we can just copy over the entries. + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + pulNewOffsets[ulElement] = m_pulElementOffsets[ulElement]; + } + } + else if ( m_ulStartElement >= (ulStartEltToBeReplaced + cEltsToBeReplaced) ) + { + // The replacement occurs before this run, so shifting is necessary + // Shift the entries to the right (recall that lElementShift > 0) + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + pulNewOffsets[ulElement + lElementShift] = m_pulElementOffsets[ulElement]; + } + + // The start element also needs to be shifted + m_ulStartElement += lElementShift; + } + + // If this run is the run in which the replacement will take place, + // do not do anything here, as this run will later do its own thing to + // recalculate its element offsets + + // Delete the old map, and make the element offset map point to the new map + delete[] m_pulElementOffsets; + m_pulElementOffsets = pulNewOffsets; + } + else + { + // The number of phrase elements has decreased, so we already have + // enough space allocated for the map + + // Sanity check: We had better not be shifting back past zero + if ( (lElementShift < 0) && ((ulStartEltToBeReplaced + cEltsToBeReplaced) < (ULONG)(-lElementShift)) ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + + // Copy over the offset info if necessary + ULONG ulElement; + if ( m_ulStartElement >= (ulStartEltToBeReplaced + cEltsToBeReplaced) ) + { + // The replacement occurs before this run. + // Shift the entries to the left (recall that lElementShift < 0, + // and that is why we are adding lElementShift, not subtracting) + for ( ulElement = m_ulStartElement; + ulElement < (m_ulStartElement + m_cElements); + ulElement++ ) + { + m_pulElementOffsets[ulElement + lElementShift] = + m_pulElementOffsets[ulElement]; + } + + // The start element also needs to be shifted + m_ulStartElement += lElementShift; + } + + // If the replacement occurs after this run, all of the phrase + // element information is already correct. + + // If this is the run in which the alternate was committed, do not + // do anything here, as this run will later do its own thing to + // recalculate its element offsets + } + + return S_OK; +} /* CDictationRun::OnAlternateCommit */ + +/********************************************************************** +* CDictationRun::Speak * +*----------------------* +* Description: +* Speaks all of the audio associated with this text run. Uses +* TTS if there's a problem speaking the audio data. +* +* Return: +* S_OK +* S_FALSE for a degenerate run +* Return value of CResultContainer::SpeakAudio() +**********************************************************************/ +HRESULT CDictationRun::Speak( ISpVoice &rVoice ) +{ + _ASSERTE( m_pResultContainer && m_pPhraseReplacement && m_cpTextRange ); + if ( !m_pResultContainer || !m_pPhraseReplacement || !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + if ( !m_cElements ) + { + // This run is just a place-holder, no need to speak it + return S_FALSE; + } + + // Try to speak it as audio + HRESULT hr = m_pResultContainer->SpeakAudio( + m_ulStartElement, m_cElements ); + + if( FAILED( hr ) ) + { + // Speak it as text + hr = CTextRun::Speak( rVoice ); + } + return hr; + +} /* CDictationRun::Speak */ + +/********************************************************************** +* CDictationRun::Speak * +*----------------------* +* Description: +* Finds the smallest range that contains *plStart -> *plEnd +* and still contains whole elements. Returns the start +* and end of the text it actually spoke in *plStart and *plEnd. +* Speaks the audio associated with this range within this text run. +* Uses TTS if there's a problem speaking the audio data. +* +* Out-of-bounds *plStart causes the range to be spoken from +* the start. +* Out-of-bounds *plEnd causes the range to be spoken all the +* way to the end. +* Return: +* S_OK +* E_POINTER +* E_OUTOFMEMORY +* Return value of CDictationRun::FindNearestWholeElementRange() +* Return value of ITextRange::{Get,Set}{Start,End}() +* Return value of CDictationRun::Speak() +**********************************************************************/ +HRESULT CDictationRun::Speak( ISpVoice &rVoice, + long *plStart, + long *plEnd ) +{ + if ( !plStart || !plEnd ) + { + return E_POINTER; + } + + // This function actually temporarily shrinks this DictationRun's + // range, so we need to store all of its information before + // proceeding. + + // Save the old range + const long lOldStart = GetStart(); + const long lOldEnd = GetEnd(); + + // Save the old phrase element information + const ULONG ulOldStartElement = m_ulStartElement; + const ULONG cOldElements = m_cElements; + + // Save the element offsets + const ULONG ulOffsetArraySize = + sizeof(ULONG) * m_pPhraseReplacement->GetNumReplacementElements(); + ULONG *pulOldElementOffsets = new ULONG[ ulOffsetArraySize ]; + if ( !pulOldElementOffsets ) + { + return E_OUTOFMEMORY; + } + memcpy( pulOldElementOffsets, m_pulElementOffsets, ulOffsetArraySize ); + + // Fix out-of-bounds limits, since these mean to speak the entire run + if ( !WithinRange( *plStart ) ) + { + *plStart = lOldStart; + } + if ( !WithinRange( *plEnd ) ) + { + *plEnd = lOldEnd; + } + + // Find the smallest range containing this range that contains only + // whole elements + long lWholeEltStart; + long lWholeEltEnd; + HRESULT hr = FindNearestWholeElementRange( + *plStart, *plEnd, &lWholeEltStart, &lWholeEltEnd, NULL, NULL ); + + // Set the end to the end of the range to speak + if ( SUCCEEDED( hr ) ) + { + // The limits of this whole-element range are what we are going to speak + *plStart = lWholeEltStart; + *plEnd = lWholeEltEnd; + + hr = m_cpTextRange->SetEnd( *plEnd ); + } + + // Find out what phrase elements are now contained + if ( SUCCEEDED( hr ) ) + { + hr = CorrectPhraseEltsAndRange( true ); + } + + if ( SUCCEEDED( hr ) ) + { + // CDictationRun::CorrectPhraseEltsAndRange() might have moved the end + hr = m_cpTextRange->GetEnd( plEnd ); + } + + // Set the start to the start of the range to speak + if ( SUCCEEDED( hr ) ) + { + hr = m_cpTextRange->SetStart( *plStart ); + } + + // Find out what phrase elements are now contained + if ( SUCCEEDED( hr ) ) + { + hr = CorrectPhraseEltsAndRange( false ); + } + + if ( SUCCEEDED( hr ) ) + { + // CDictationRun::CorrectPhraseEltsAndRange() might have moved the start + hr = m_cpTextRange->GetStart( plStart ); + } + + if ( SUCCEEDED( hr ) ) + { + // Pass to CDictationRun::Speak() in order to speak the entire range, + // which now consists solely of what we want to speak + hr = Speak( rVoice ); + } + + // Restore old range and phrase element info + SetStart( lOldStart ); + SetEnd( lOldEnd ); + m_ulStartElement = ulOldStartElement; + m_cElements = cOldElements; + memcpy( m_pulElementOffsets, pulOldElementOffsets, ulOffsetArraySize ); + delete[] pulOldElementOffsets; + + return hr; +} /* CDictationRun::Speak */ + +/********************************************************************** +* CDictationRun::Serialize * +*--------------------------* +* Description: +* Serializes the text and audio data for this run. +* Writes the data to the pStream. +* There are two headers to precede the seralized run; +* one containing information about the run as a generic +* text run, and one containing information about the +* run and its dictation-specific information. +* Return: +* S_OK +* E_POINTER +* Return value of CResultContainer::Serialize() +* Return value of ISequentialStream::Write() +**********************************************************************/ +HRESULT CDictationRun::Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ) +{ + if ( !pStream || !pRecoCtxt ) + { + return E_POINTER; + } + _ASSERTE( m_cpTextRange && m_pResultContainer ); + if ( !m_cpTextRange || !m_pResultContainer ) + { + return E_UNEXPECTED; + } + + // Make the relevant headers + + // This header deals with the run as a generic text run + RUNHEADER runHdr; + runHdr.lStart = GetStart(); + runHdr.lEnd = GetEnd(); + runHdr.bResultFollows = true; + + // This header deals with the run as a CDictationRun + DICTHEADER dictHdr; + dictHdr.ulStartElement = m_ulStartElement; + dictHdr.cElements = m_cElements; + + // Get the phrase blob from the recoresult + SPSERIALIZEDRESULT * pResultBlock; + HRESULT hr = m_pResultContainer->Serialize( &pResultBlock ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Get the size of the result block + dictHdr.cbSize = pResultBlock->ulSerializedSize; + + // Write the headers and the phrase blob to the stream + ULONG cbWritten; + hr = pStream->Write( &runHdr, sizeof( RUNHEADER ), &cbWritten ); + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Write( &dictHdr, sizeof( DICTHEADER ), &cbWritten ); + } + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Write( pResultBlock, dictHdr.cbSize, &cbWritten ); + } + + return hr; +} /* CDictationRun::Serialize */ + +/********************************************************************** +* CDictationRun::IsConsumeLeadingSpaces * +*---------------------------------------* +* Description: +* Sets *pfConsumeLeadingSpaces to true iff any text inserted +* at lPos would have to consume a space that follows it. +* This value will be false UNLESS lPos is the first +* position of a phrase element that has the attribute +* SPAF_CONSUME_LEADING_SPACES +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if lPos is out of range +* return value of CDictationRun::FindNearestWholeElementRange() +* E_FAIL if the CPhraseReplacement::GetDisplayText() fails +**********************************************************************/ +HRESULT CDictationRun::IsConsumeLeadingSpaces( const long lPos, + bool *pfConsumeLeadingSpaces ) +{ + if ( !pfConsumeLeadingSpaces ) + { + return E_POINTER; + } + if ( !WithinRange( lPos ) ) + { + return E_INVALIDARG; + } + *pfConsumeLeadingSpaces = false; // by default + + // Expand lPos to the nearest element + long lEltStartPos; + long lEltEndPos; + ULONG ulStartElt; + ULONG cElts; + HRESULT hr = FindNearestWholeElementRange( lPos, lPos, + &lEltStartPos, &lEltEndPos, &ulStartElt, &cElts ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Should have found only one element + _ASSERTE( 1 == cElts ); + + // We definitely don't want to consume leading spaces unless + // this is the beginning of the element + if ( lPos != lEltStartPos ) + { + return S_OK; + } + + // Get the text and attributes for that element + BYTE bDisplayAttributes; + const WCHAR *pwszEltText = m_pPhraseReplacement->GetDisplayText( + ulStartElt, &bDisplayAttributes ); + if ( !pwszEltText ) + { + return E_FAIL; + } + + // Check for the CONSUME_LEADING_SPACES attribute + if ( SPAF_CONSUME_LEADING_SPACES & bDisplayAttributes ) + { + *pfConsumeLeadingSpaces = true; + } + + return S_OK; +} /* CDictationRun::IsConsumeLeadingSpaces */ + +/********************************************************************** +* CDictationRun::HowManySpacesAfter * +*-----------------------------------* +* Description: +* Returns the number of spaces that would need to precede text +* if text were to be inserted at position lPos. +* This number goes in the out param puiSpaces. +* The value returned will be zero UNLESS lPos immediately +* follows the text of a phrase element that has +* SPAF_ONE_TRAILING_SPACE or SPAF_TWO_TRAILINGSPACES attributes +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if lPos is out of range +* return value of CDictationRun::FindNearestWholeElementRange() +* E_FAIL if the CPhraseReplacement::GetDisplayText() fails +**********************************************************************/ +HRESULT CDictationRun::HowManySpacesAfter( const long lPos, + UINT *puiSpaces ) +{ + if ( !puiSpaces ) + { + return E_POINTER; + } + if ( !WithinRange( lPos ) ) + { + return E_INVALIDARG; + } + *puiSpaces = 0; // by default + + // Expand lPos to the nearest element + long lEltStartPos; + long lEltEndPos; + ULONG ulStartElt; + ULONG cElts; + HRESULT hr = FindNearestWholeElementRange( lPos, lPos, + &lEltStartPos, &lEltEndPos, &ulStartElt, &cElts ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Should have found only one element + _ASSERTE( 1 == cElts ); + + // Get the text and attributes for that element + BYTE bDisplayAttributes; + const WCHAR *pwszEltText = m_pPhraseReplacement->GetDisplayText( + ulStartElt, &bDisplayAttributes ); + if ( !pwszEltText ) + { + return E_FAIL; + } + + // If that element asks for leading spaces to be consumed and + // lPos is at the beginning of that element, we actually + // want to be looking at the element for the previous space, + // since those two elements may run together. + // (For instance, if lPos fell between the 'd' and the '.' in + // "This sentence ends with a period." We want attributes for + // "period", not ".") + if (( bDisplayAttributes & SPAF_CONSUME_LEADING_SPACES ) + && ( lPos == lEltStartPos ) + && ( lPos > GetStart() )) + { + // Get the element that (lPos - 1) is on + hr = FindNearestWholeElementRange( lPos - 1, lPos - 1, + &lEltStartPos, &lEltEndPos, &ulStartElt, &cElts ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Should have found only one element + _ASSERTE( 1 == cElts ); + + // Get the text and attributes for that element + pwszEltText = m_pPhraseReplacement->GetDisplayText( + ulStartElt, &bDisplayAttributes ); + if ( !pwszEltText ) + { + return E_FAIL; + } + } + + // Now look for attributes if lPos falls at the end of this element + if ( (lEltStartPos + (long) wcslen( pwszEltText )) == lPos ) + { + // lPos immediately follows the element text, + // so pay attention to the display attributes + if ( SPAF_ONE_TRAILING_SPACE & bDisplayAttributes ) + { + *puiSpaces = 1; + } + else if ( SPAF_TWO_TRAILING_SPACES & bDisplayAttributes ) + { + *puiSpaces = 2; + } + } + else if ( (lEltStartPos + (long) wcslen( pwszEltText ) + 1) == lPos ) + { + // lPos is the position after the position immediately following + // the element text. We care about this situation only if + // we want two trailing spaces, in which case we need only one more + if ( SPAF_TWO_TRAILING_SPACES & bDisplayAttributes ) + { + *puiSpaces = 1; + } + } + + // Otherwise text can be inserted right at lPos + + return S_OK; +} /* CDictationRun::HowManySpacesAfter */ + + +/********************************************************************** +* CDictationRun::FindNearestWholeElementRange * +*---------------------------------------------* +* Description: +* Finds the start and end of the smallest range containing +* the range with lStart and lEnd that contains whole elements. +* Upon return, pulStartElement and pcElements will point +* to information about the elements to which the range +* best corresponds. +* Upon return, plResultStart and plResultEnd will point +* to the start and end indices (in the document) of this +* element range. +* Return: +* S_OK +* E_POINTER +* E_FAIL if there are no elements in this range +* E_INVALIDARG if the range lStart...lEnd is not contained +* within our range +**********************************************************************/ +HRESULT CDictationRun::FindNearestWholeElementRange( long lStart, + long lEnd, + long *plResultStart, + long *plResultEnd, + ULONG *pulStartElement, + ULONG *pcElements ) +{ + if ( !plResultStart || !plResultEnd ) + { + return E_POINTER; + } + _ASSERTE( m_cpTextRange && m_pulElementOffsets ); + if ( !m_cpTextRange || !m_pulElementOffsets ) + { + return E_UNEXPECTED; + } + + if ( !m_cElements ) + { + return E_FAIL; + } + + if ( !( WithinRange( lStart ) && WithinRange( lEnd ) ) ) + { + // Asking for out-of-range text + return E_INVALIDARG; + } + + ULONG ulThisRunStart = (ULONG) GetStart(); + ULONG ulStart = (ULONG)lStart; + + // Find the last element offset that is + // less than or equal to lStart. + // This is accomplished by going backwards through the + // elements until we find one with an offset that is <= lStart, + // or until we hit the start element + ULONG ulElement; + for ( ulElement = m_ulStartElement + m_cElements - 1; + (ulElement > m_ulStartElement) && ((ulThisRunStart + m_pulElementOffsets[ulElement]) > ulStart); + ulElement-- ) + ; + ULONG ulStartElement = ulElement; + _ASSERTE( m_pulElementOffsets[ulStartElement] <= ulStart ); + + // Get the result into the out params + *plResultStart = ulThisRunStart + m_pulElementOffsets[ulStartElement]; + if ( pulStartElement ) + { + *pulStartElement = ulStartElement; + } + + // Find the first element offset that is + // greater than or equal to lEnd. + // This is the first element that we will not include. + ULONG ulEnd = (ULONG) lEnd; + for ( ulElement = ulStartElement; + (ulElement < m_ulStartElement + m_cElements) && + ((ulThisRunStart + m_pulElementOffsets[ulElement]) < ulEnd); + ulElement++ ) + ; + _ASSERTE( ulElement >= ulStartElement ); + if ( ulElement == ulStartElement ) + { + // The range was degenerate and at the beginning of a phrase element; + // we should include one element + ulElement++; + } + + // Get the result into the out params + if ( (m_ulStartElement + m_cElements) == ulElement ) + { + // Our range contains part of the final element, + // so get the end of the range from the end of + // the document + *plResultEnd = GetEnd(); + } + else + { + // Get the end of the range from the offset of the + // first element not included. + *plResultEnd = ulThisRunStart + m_pulElementOffsets[ulElement]; + } + if ( pcElements ) + { + // ulElement is the index of the first element not included. + // If the last element in the run was included, then ulElement will + // be one more than that. + *pcElements = ulElement - ulStartElement; + } + + return S_OK; +} /* CDictationRun::FindNearestWholeElementRange */ + +// Helper function + +/********************************************************************* +* ContainsNonWhitespace() * +*-------------------------* +* Description: +* Returns true iff some character in the string is +* not whitespace. +**********************************************************************/ +bool ContainsNonWhitespace( const WCHAR *pwsz ) +{ + if ( !pwsz ) + { + return false; + } + + const WCHAR *pwc; + for ( pwc = pwsz; *pwc; pwc++ ) + { + if ( !iswspace( *pwc ) ) + { + return true; + } + } + + // Did not hit a whitespace character + return false; +} /* ContainsNonWhitespace */ diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.h new file mode 100644 index 00000000..9088518d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictationrun.h @@ -0,0 +1,141 @@ +/****************************************************************************** +* DictationRun.h +* This module contains the definition of CDictationRun. CDictationRun +* keeps track of the dictation-specific items that go with runs of test +* that were dictated to DictPad. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "TextRun.h" +#include "phrasereplace.h" +#include "resultcontainer.h" + +// Forward definition +class CResultContainer; + +// Header for serialized CDictationRuns +typedef struct DICTHEADER +{ + ULONG cbSize; // Size of the reco result to follow + ULONG ulStartElement; + ULONG cElements; +} DICTHEADER; + +/****************************************************************************** +* CDictationRun * +*---------------* +* Description: +* This class inherits from CTextRun (in textrun.h). It handles +* a consecutive run of text in the document that was dictated. +* It can be a full dictated phrase or part of a phrase that +* was dictated, but all of the text in a CDictationRun exists +* exactly as it had originally been dictated. +********************************************************************************/ +class CDictationRun : public CTextRun +{ + public: + CDictationRun(); + virtual ~CDictationRun(); + + // Initialization methods + HRESULT Initialize( ISpRecoResult &rRecoResult, DICTHEADER *pDictHdr = NULL ); + HRESULT Initialize( CResultContainer &rResultContainer ); + HRESULT SetTextRange( ITextRange *pTextRange ); + + // Phrase element-related methods + HRESULT Split( long *plFirstEnd, long *plSecondBegin, + ITextDocument *cpTextDoc, CTextRun **ppTextRun ); + MERGERESULT Concatenate( CTextRun *pTextRun, bool fConcatAfter ); + HRESULT CorrectPhraseEltsAndRange( bool fForward, bool *pfCorrectionResult = NULL ); + // Adjust the phrase element members + // and the range so that they are + // consistent + + // Alternates methods + HRESULT GetAlternatesText( ITextRange *pRangeForAlts, + ULONG ulRequestCount, + long *plAltStart, + long *plAltEnd, + WCHAR **ppszCoMemText, + bool *apfFitsInRun, + ULONG *pcPhrasesReturned ); + // Get the text of the alternates + // for the closest range possible + HRESULT GetAltEndpoints( ULONG ulAlt, + long *plReplaceStart, + long *plReplaceEnd ); + // Get the start and end of the + // range that would be replaced by + // alternate ulAlt from the last time + // GetAlternatesText() was called + HRESULT ChooseAlternate( ULONG ulAlt ); + // Choose alternate number ulAlt + // from the last time GetAlternatesText() + // was called + void DoneWithAlternates() { m_fAltsGotten = false; } + // Called when the last set of alternates + // obtained is no longer needed + HRESULT OnAlternateCommit( ULONG ulFirstEltToBeReplaced, ULONG cEltsToBeReplaced, + ULONG cElementsInPhraseAfterCommit ); + // Called right before an alternate + // is committed somewhere in the + // associated result object's phrase + + + // Playback methods + HRESULT Speak( ISpVoice &rVoice ); // Speak the entire block + HRESULT Speak( ISpVoice &rVoice, long *plStart, long *plEnd ); + // Speak part of the block + + // Serialization method + HRESULT Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ); + // Write the phrase blob to a stream + + // Display attributes methods + HRESULT IsConsumeLeadingSpaces( const long lPos, bool *pfConsumeLeadingSpaces ); + // Do leading spaces need to be + // consumed at lPos? + HRESULT HowManySpacesAfter( const long lPos, UINT *puiSpaces ); + // How many spaces would need to be + // at lPos if new text were inserted there? + + bool IsDict() { return true; }; + + + + private: + HRESULT FindNearestWholeElementRange( long lStart, + long lEnd, + long *plResultStart, + long *plResultEnd, + ULONG *pulStartElement, + ULONG *pcElements ); + // Finds the nearest range containing + // pRange that contains entire elements + + // data members + private: + + ULONG m_ulStartElement; // Where in the RecoResult this dictation run starts + ULONG m_cElements; // How many elements are in this run + + bool m_fAltsGotten; // Whether alternates have been requested for some range + // of elements + ULONG m_ulStartAltElt; // These two members indicate the range of elements + ULONG m_cAltElt; // for which alternates were last requested + + CPhraseReplacement *m_pPhraseReplacement; // Phrase replacement (ITN) info + ULONG *m_pulElementOffsets; // Where each element starts + // relative to the start of the range + CResultContainer *m_pResultContainer; // Holds the result object +}; + + +// Helper functions + +bool ContainsNonWhitespace( const WCHAR *pwsz );// Return true iff some + // character in the string + // is not whitespace + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictmode.xml b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictmode.xml new file mode 100644 index 00000000..60be24ef --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictmode.xml @@ -0,0 +1,15 @@ + + + + + + + + + +

command

+

computer

+
+
+ +
diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.cpp new file mode 100644 index 00000000..fcd530be --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.cpp @@ -0,0 +1,2135 @@ +/****************************************************************************** +* dictpad.cpp +* This file contains the entry point for the Dictpad application +* and some of the definitions for methods of CDictationPad, the +* main object. +* dictpad_sapi.cpp contains the methods of CDictationPad that +* pertain to the SAPI interfaces used in this app. +* +* Copyright (c) 2001 Microsoft Corporation. All Rights Reserved. +******************************************************************************/ + +#include "stdafx.h" +#include +#include +#include +#include "dictpad.h" + +// Stream names for saving and opening Dictpad files +#define DICTPAD_TEXT L"dictpad_text" +#define DICTPAD_RECORESULTS L"dictpad_recoresults" + +/************************************************************************ +* WinMain() * +*-----------* +* Description: +* Main entry point for the application +**************************************************************************/ +int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow ) +{ + int iRet = 0; + HRESULT hr = CoInitialize( NULL ); + if( SUCCEEDED( hr ) ) + { + CDictationPad *pDictPad = new CDictationPad( hInstance ); + if( pDictPad ) + { + if ( pDictPad->Initialize( nCmdShow, lpCmdLine ) ) + { + iRet = pDictPad->Run(); + } + + delete pDictPad; + } + CoUninitialize(); + } + + return iRet; +} /* WinMain */ + +/**************************************************************************** +* CDictationPad::CDictationPad() * +*--------------------------------* +* Description: +* Constructor +*****************************************************************************/ +CDictationPad::CDictationPad( HINSTANCE hInst ) : + m_hAccelTable( NULL ), + m_hInst( hInst ), + m_hRtfLib( NULL ), + m_hEdit( NULL ), + m_hToolBar( NULL ), + m_hStatusBar( NULL ), + m_hFont( NULL ), + m_hAltsButton( NULL ), + m_dwFlags( DP_SHARED_RECOGNIZER ), + m_ullDictInterest( +#ifdef _DEBUG + // Dictpad doesn't actually need SOUND_START + // or SOUND_END + SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | +#endif + SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | + SPFEI(SPEI_RECO_OTHER_CONTEXT) | + SPFEI(SPEI_FALSE_RECOGNITION) | SPFEI(SPEI_HYPOTHESIS) | + SPFEI(SPEI_INTERFERENCE) | SPFEI(SPEI_RECO_STATE_CHANGE) ), + m_ullCCInterest( SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | + SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | + SPFEI(SPEI_INTERFERENCE) | SPFEI(SPEI_RECO_STATE_CHANGE) ), + m_pCandidateList( NULL ), + m_pszFile( NULL ) +{ + // Zero out the various STRUCTs we are using + memset( (void *) &m_LastSelInfo, 0, sizeof( SELINFO ) ); + memset( (void *) &m_CurSelInfo, 0, sizeof( SELINFO ) ); + memset( (void *) &m_SpeakInfo, 0, sizeof( SPEAKINFO ) ); +} + +/**************************************************************************** +* CDictationPad::~CDictationPad() * +*---------------------------------* +* Description: +* Destructor +*****************************************************************************/ +CDictationPad::~CDictationPad() +{ + // Release the richedit/TOM objects. These need to be released before + // the RTF library gets freed. + m_cpRichEdit = NULL; + m_cpTextDoc = NULL; + m_cpTextSel = NULL; + + // Delete objects we have new-ed + if ( m_pTextRunList ) + { + delete m_pTextRunList; + } + if ( m_pCandidateList ) + { + delete m_pCandidateList; + } + if ( m_pRecoEventMgr ) + { + delete m_pRecoEventMgr; + } + + if( m_hFont ) + { + ::DeleteObject( m_hFont ); + } + if( m_hRtfLib ) + { + ::FreeLibrary( m_hRtfLib ); + } +} + +/**************************************************************************** +* CDictationPad::Initialize * +*---------------------------* +* Description: +* Set up the windows, as well as the RichEdit objects. +* Calls InitializeSAPIObjs, which in initializes the SAPI objects +* and sets up notification for SAPI events. +*****************************************************************************/ +BOOL CDictationPad::Initialize( int nCmdShow, LPSTR lpCmdLine ) +{ + TCHAR szTitle[MAX_LOADSTRING]; // The title bar text + TCHAR szWindowClass[MAX_LOADSTRING]; + BOOL bRet = false; // assume failure + + // Initialize window strings + ::LoadString( m_hInst, IDS_APP_TITLE, szTitle, MAX_LOADSTRING ); + ::LoadString( m_hInst, IDC_DICTPAD, szWindowClass, MAX_LOADSTRING ); + + // register our window class + WNDCLASSEX wcex; + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = m_hInst; + wcex.hIcon = ::LoadIcon(m_hInst, (LPCTSTR)IDI_DICTPAD); + wcex.hCursor = ::LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = (LPCTSTR)IDC_DICTPAD; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = ::LoadIcon( wcex.hInstance, (LPCTSTR)IDI_SMALL ); + ATOM atomRet = ::RegisterClassEx( &wcex ); + + HRESULT hr = E_FAIL; + if( atomRet ) + { + // Set up the text run list and the reco event manager + m_pTextRunList = new CTextRunList(); + m_pRecoEventMgr = new CRecoEventMgr( m_hInst ); + if ( !m_pTextRunList || !m_pRecoEventMgr ) + { + return false; + } + + // Load DLL for Rich Edit 3.0 + m_hRtfLib = LoadLibrary( _T("RICHED20.DLL") ); + + // Create the main application window + m_hClient = ::CreateWindow( szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, m_hInst, this ); + + // The richedit window (m_hEdit) will have been created by the WM_CREATE + // message-handling in the WNDPROC for the main window + if( m_hClient && m_hEdit ) + { + // Set interest in various events from the richedit control + ::SendMessage( m_hEdit, EM_SETEVENTMASK, 0, + ENM_KEYEVENTS | ENM_MOUSEEVENTS | ENM_CHANGE | ENM_UPDATE | ENM_SELCHANGE | ENM_SCROLL ); + + // Show the window if it is supposed to be shown upon startup + ::ShowWindow( m_hClient, nCmdShow ); + + // Update the window so that the window is drawn without having to + // wait for all of the SAPI initialization + ::UpdateWindow( m_hClient ); + + // Accelerators + m_hAccelTable = ::LoadAccelerators( m_hInst, (LPCTSTR)IDC_DICTPAD ); + + // Get the TOM objects (an ITextDocument and an ITextSelection) + // from the richedit control + ::SendMessage( m_hEdit, EM_GETOLEINTERFACE, 0, (LPARAM)(LPVOID FAR *)&m_cpRichEdit ); + if ( !m_cpRichEdit ) + { + ::MessageBox( m_hClient, _T("Error getting the RichEdit interface"), NULL, MB_OK ); + return false; + } + hr = m_cpRichEdit->QueryInterface( IID_ITextDocument, (void**)&m_cpTextDoc ); + if( SUCCEEDED( hr ) ) + { + // Hand the pointer to the ITextDocument for this document to the + // data members that need that pointer. + m_pTextRunList->SetTextDoc( m_cpTextDoc ); + + hr = m_cpTextDoc->GetSelection( &m_cpTextSel ); + } + else + { + ::MessageBox( m_hClient, _T("Error getting ITextDocument"), NULL, MB_OK ); + } + + if ( SUCCEEDED( hr ) ) + { + // Hand the pointer to the TOM objects for this document to the + // data members that need that pointer. + m_pRecoEventMgr->SetTextSel( m_cpTextSel ); + m_pCandidateList->SetTextSel( m_cpTextSel ); + } + else + { + ::MessageBox( m_hClient, _T("Error getting ITextSelection"), NULL, MB_OK ); + } + + + // Do the initialization of SAPI objects + if ( SUCCEEDED( hr ) ) + { + hr = InitializeSAPIObjs(); + } + } + } + + if ( FAILED( hr ) ) + { + // Bail, since some initialization did not happen correctly + ::MessageBox( m_hClient, _T("Cannot initialize Dictpad; exiting."), NULL, MB_OK ); + ::DestroyWindow( m_hClient ); + } + + if ( SUCCEEDED( hr ) && lpCmdLine && *lpCmdLine ) + { + // lpInitialFileName will come surrounded by quotation marks, + // which we need to strip off + USES_CONVERSION; + TCHAR *pszFileName = _tcsdup( A2T(lpCmdLine) ); + if ( !pszFileName ) + { + return E_OUTOFMEMORY; + } + TCHAR *pchBeginQuote = _tcschr( pszFileName, _T('\"') ); + if ( pchBeginQuote ) + { + // Copy everything after the first quote + _tcscpy( pszFileName, pchBeginQuote + 1 ); + + TCHAR *pchEndQuote = _tcschr( pszFileName, _T('\"') ); + if ( pchEndQuote ) + { + // Cut it off at the end quote + *pchEndQuote = 0; + } + } + + hr = DoFileOpen( pszFileName ); + + free( pszFileName ); + } + + return SUCCEEDED( hr ); +} /* CDictationPad::Initialize */ + +/**************************************************************************************** +* CDictationPad::Run() * +*----------------------* +* Description: +* Contains the message loop for the application +*****************************************************************************************/ +int CDictationPad::Run() +{ + // Main message loop: + MSG msg; + while( ::GetMessage( &msg, NULL, 0, 0 ) ) + { + if( !::TranslateAccelerator( m_hClient, m_hAccelTable, &msg ) ) + { + ::TranslateMessage( &msg ); + ::DispatchMessage( &msg ); + } + } + + return msg.wParam; +} /* CDictationPad::Run */ + + +/***************************************************************************************** +* CDictationPad::WndProc() * +*--------------------------* +* Description: +* Main message handler for Dictpad. +******************************************************************************************/ +LRESULT CALLBACK CDictationPad::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + int wmId, wmEvent; + HRESULT hr; + HMENU hMenu; + + // The CDictationPad object was set to be the USERDATA in the window long + // associated with this window when WM_CREATE was called + CDictationPad * pThis = (CDictationPad *)::GetWindowLong( hWnd, GWL_USERDATA ); + + switch( message ) + { + case WM_CREATE : + { + // store pointer to the object that created this window + pThis = (CDictationPad *)(((LPCREATESTRUCT)lParam)->lpCreateParams); + _ASSERTE(pThis); + ::SetWindowLong(hWnd, GWL_USERDATA, (LONG)pThis); + + // This call draws the toolbar buttons, gets the richedit control, etc. + if ( !( pThis->InitializeWindow( hWnd ) ) ) + { + ::DestroyWindow( hWnd ); + break; + } + + ::SetFocus( pThis->m_hEdit ); + + // Indicate whether whole words are being selected + hMenu = ::GetMenu( hWnd ); + ::CheckMenuItem( hMenu, IDM_WHOLE_WORDS, + (pThis->m_dwFlags & DP_WHOLE_WORD_SEL) ? MF_CHECKED : MF_UNCHECKED ); + + // Set the appropriate menu info for the type of engine + ::CheckMenuItem( hMenu, IDM_SHAREDENGINE, + (pThis->m_dwFlags & DP_SHARED_RECOGNIZER) ? MF_CHECKED : MF_UNCHECKED ); + + //--- get us into dictation mode + ::SendMessage( hWnd, WM_COMMAND, IDM_DICTATION_MODE, 0 ); + + break; + } + + case WM_SIZE: + { + // If the frame changes size, change the size of the edit control, + // taking the toolbar & status bar into consideration + RECT r; + ::GetWindowRect( pThis->m_hToolBar, &r ); + LONG lToolBarHeight = r.bottom - r.top; + + ::GetWindowRect( pThis->m_hStatusBar, &r ); + LONG lStatusBarHeight = r.bottom - r.top; + + ::SetWindowPos( pThis->m_hToolBar, hWnd, 0, 0, LOWORD(lParam), + lToolBarHeight, SWP_NOMOVE | SWP_NOZORDER ); + ::SetWindowPos( pThis->m_hEdit, hWnd, 0, 0, LOWORD(lParam), + HIWORD(lParam) - lToolBarHeight - lStatusBarHeight, + SWP_NOMOVE | SWP_NOZORDER ); + ::SetWindowPos( pThis->m_hStatusBar, hWnd, 0, + HIWORD(lParam) - lStatusBarHeight, LOWORD(lParam), lStatusBarHeight, + SWP_NOZORDER ); + break; + } + + case WM_COMMAND: + // If the SR engine is currently cranking, then save this message for later + if ( pThis->m_pRecoEventMgr->IsProcessingPhrase() ) + { + // The message will get handled later, when the result comes back + pThis->m_pRecoEventMgr->QueueCommand( hWnd, message, wParam, lParam ); + break; + } + + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + + // Look for notifications from the edit control about gaining and losing + // input focus + if ( ((HWND) lParam) == pThis->m_hEdit ) + { + switch ( wmEvent ) + { + case EN_KILLFOCUS: + if ( pThis->m_dwFlags & DP_DICTATION_MODE ) + { + // Turn off the "mic" + pThis->SetGrammarState( false ); + } + break; + + case EN_SETFOCUS: + if ( pThis->m_dwFlags & DP_DICTATION_MODE ) + { + // Restore the "mic" to its state when we last lost focus + pThis->SetGrammarState( pThis->m_dwFlags & DP_MICROPHONE_ON ); + } + + // Trigger an update so that the alternates button appears + // if appropriate + pThis->m_hAltsButton = pThis->m_pCandidateList->Update( + pThis->m_pTextRunList ); + break; + } + break; + } + + + // Handle menu item selections + switch (wmId) + { + //---------------------- + // FILE + //---------------------- + case ID_FILE_NEW: + { + hr = pThis->DoFileNew(); + if ( FAILED( hr ) ) + { + MessageBoxFromResource( hWnd, IDS_CANNOTFILENEW, NULL, MB_ICONEXCLAMATION ); + ::DestroyWindow( hWnd ); + } + + break; + } + case ID_FILE_OPEN: + { + hr = pThis->DoFileOpen( NULL ); + + if ( FAILED( hr ) ) + { + MessageBoxFromResource( hWnd, IDS_CANNOTOPEN, NULL, MB_ICONEXCLAMATION ); + + // Open a new file instead + ::SendMessage( pThis->m_hClient, WM_COMMAND, ID_FILE_NEW, 0 ); + } + + break; + } + + case ID_FILE_SAVE: + case ID_FILE_SAVEAS: + { + if ( (ID_FILE_SAVE == wmId) && pThis->m_pszFile ) + { + // The file already has a name. + // Just save under the existing name + hr = pThis->DoFileSave(); + } + else + { + // Need to get a name + hr = pThis->DoFileSaveAs(); + } + + if (FAILED(hr)) + { + TCHAR pszCaptionText[ MAX_LOADSTRING ]; + ::LoadString( pThis->m_hInst, IDS_CANNOTSAVE, + pszCaptionText, MAX_LOADSTRING ); + + if (STG_E_ACCESSDENIED == hr) + { + // The user has a readonly file open + MessageBoxFromResource( hWnd, IDS_ACCESSDENIED, pszCaptionText, + MB_ICONEXCLAMATION ); + + // Ask user to save under a different name + ::SendMessage( pThis->m_hClient, WM_COMMAND, ID_FILE_SAVEAS, 0 ); + } + else + { + MessageBoxFromResource( hWnd, IDS_ERRORSAVING, pszCaptionText, + MB_ICONEXCLAMATION ); + } + } + + // Return 1 only if we saved the file + return (S_OK == hr); + + break; + } + + case IDM_EXIT: + ::SendMessage( hWnd, WM_CLOSE, 0, 0 ); + break; + + case ID_EDIT_CUT: + // Cut the selected text to the clipboard + pThis->m_cpTextSel->Cut( NULL ); + break; + + case ID_EDIT_COPY: + // Copy the selected text to the clipboard + pThis->m_cpTextSel->Copy( NULL ); + break; + + case ID_EDIT_PASTE: + // Paste the text from the clipboard into the document + + // This flag will be used when the selection changed is processed. + // It will indicate that there is new text present, even if the + // length of the text in the document has not changed. + pThis->m_dwFlags |= DP_JUST_PASTED_TEXT; + pThis->m_cpTextSel->Paste( NULL, 0 ); + pThis->m_dwFlags &= ~DP_JUST_PASTED_TEXT; + break; + + case IDM_FONT: + { + LOGFONT lf; + CHOOSEFONT cf; + ZeroMemory( &cf, sizeof(cf) ); + cf.lStructSize = sizeof(cf); + cf.lpLogFont = &lf; + cf.Flags = CF_SCREENFONTS; + if( ::ChooseFont( &cf ) ) // Display the choose font dialog + { + ::DeleteObject( (HGDIOBJ)pThis->m_hFont ); + pThis->m_hFont = ::CreateFontIndirect( &lf ); + ::SendMessage( pThis->m_hEdit, WM_SETFONT, (WPARAM)pThis->m_hFont, MAKELPARAM(true, 0) ); + ::SetFocus( pThis->m_hEdit ); + } + } + break; + + case IDM_DICTATION_MODE: + case IDM_COMMAND_MODE: + // Choose between dictation mode and command mode + hr = pThis->SetMode( IDM_DICTATION_MODE == wmId ); + if (FAILED(hr)) + { + MessageBoxFromResource( hWnd, IDS_CANNOTSWITCHMODES, NULL, + MB_ICONEXCLAMATION ); + } + break; + + case IDM_VOICE_TRAINING: + { + // Brings up the SR-engine-specific user training UI + pThis->m_cpRecoEngine->DisplayUI(hWnd, NULL, SPDUI_UserTraining, NULL, 0); + } + break; + + case IDM_MICROPHONE_SETUP: + { + // Brings up the SR-engine-specific mic training UI + pThis->m_cpRecoEngine->DisplayUI(hWnd, NULL, SPDUI_MicTraining, NULL, 0); + } + break; + + case IDM_ADDREMOVEWORDS: + // Brings up the SR-engine-specific Add/Remove Words UI + pThis->RunAddDeleteUI(); + break; + + case IDM_MODE_TOGGLE: + // Toggles between dictation mode and command mode + hMenu = ::GetMenu( hWnd ); + if( pThis->m_dwFlags & DP_DICTATION_MODE ) + { + ::SendMessage( hWnd, WM_COMMAND, IDM_COMMAND_MODE, 0 ); + } + else + { + ::SendMessage( hWnd, WM_COMMAND, IDM_DICTATION_MODE, 0 ); + } + break; + + case IDM_WHOLE_WORDS: + // Toggles between selecting whole words and normal selection + hMenu = ::GetMenu( hWnd ); + if( pThis->m_dwFlags & DP_WHOLE_WORD_SEL ) + { + pThis->m_dwFlags &= ~DP_WHOLE_WORD_SEL; + ::CheckMenuItem( hMenu, IDM_WHOLE_WORDS, MF_UNCHECKED ); + } + else + { + pThis->m_dwFlags |= DP_WHOLE_WORD_SEL; + ::CheckMenuItem( hMenu, IDM_WHOLE_WORDS, MF_CHECKED ); + } + break; + + case IDM_SHAREDENGINE: + // Toggles between inproc reco engine and shared reco engine + hMenu = ::GetMenu( hWnd ); + if ( pThis->m_dwFlags & DP_SHARED_RECOGNIZER ) + { + pThis->m_dwFlags &= ~DP_SHARED_RECOGNIZER; + ::CheckMenuItem( hMenu, IDM_SHAREDENGINE, MF_UNCHECKED ); + } + else + { + pThis->m_dwFlags |= DP_SHARED_RECOGNIZER; + ::CheckMenuItem( hMenu, IDM_SHAREDENGINE, MF_CHECKED ); + } + + // When the reco engine changes, all of the SAPI objects need + // to be unplugged and reinitialized. + if ( FAILED(pThis->InitializeSAPIObjs()) ) + { + // New SAPI objects couldn't get set up: need to bail + ::DestroyWindow( hWnd ); + } + break; + + case IDM_PLAY: + // if we're already speaking then stop + if( pThis->m_dwFlags & DP_IS_SPEAKING ) + { + pThis->EndSpeaking(); + } + else + { + pThis->DoPlay(); + } + break; + + case IDM_MIC_TOGGLE: + { + DWORD dwOldFlags = pThis->m_dwFlags; + if ( !(pThis->m_dwFlags & DP_GRAMMARS_ACTIVE) ) + { + // If the user sees the microphone button not pressed and tries + // to press it, the grammars should be activated regardless + // of what the state is + pThis->m_dwFlags |= DP_MICROPHONE_ON; + } + else + { + // Flip the microphone flag + pThis->m_dwFlags ^= DP_MICROPHONE_ON; + } + + if ( pThis->m_dwFlags & DP_MICROPHONE_ON ) + { + // Since the grammars are active, we want the dictation + // window to have the input focus + ::SetFocus( pThis->m_hEdit ); + } + + // Set the microphone accordingly + hr = pThis->SetGrammarState( pThis->m_dwFlags & DP_MICROPHONE_ON ); + + if ( FAILED( hr ) ) + { + // Couldn't do this: switch the microphone flag back + pThis->m_dwFlags = dwOldFlags; + } + + break; + } + + case IDM_ABOUT: + ::DialogBox( pThis->m_hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About ); + break; + + default: + return ::DefWindowProc( hWnd, message, wParam, lParam ); + } + + break; + + case WM_KILLFOCUS: + OutputDebugString( _T("Kill focus\r\n") ); + + if ( pThis->m_dwFlags & DP_DICTATION_MODE ) + { + // No focus, no microphone + pThis->SetGrammarState( false ); + } + break; + + case WM_CLOSE: + if ( S_OK == pThis->DoFileClose() ) + { + ::DestroyWindow( hWnd ); + } + break; + + case WM_DESTROY: + ::PostQuitMessage( 0 ); + break; + + // The following three window messages were defined by the call to + // ISpNotifyTranslator::InitWindowMessage() in + // CDictationPad::InitSAPICallback (see dictpad_sapi.cpp) to be + // the messages this window receives whenever SAPI wants to + // notify us of one of the events in which we said we were interested + + case WM_DICTRECOEVENT: + { + // Something happened with the dictation recognition context + bool fSuccess = pThis->SRDictEventHandler(); + + // We expect this to succeed; otherwise exit + _ASSERTE( fSuccess ); + if ( !fSuccess ) + { + MessageBoxFromResource( hWnd, IDS_UPDATEERROR, + NULL, MB_ICONEXCLAMATION ); + ::SendMessage( hWnd, WM_CLOSE, 0, 0 ); + } + break; + } + + case WM_CCRECOEVENT: + // Something happened with the command-and-control reco context + pThis->SRCCEventHandler(); + break; + + case WM_TTSEVENT: + // Some TTS event happened + pThis->TTSEventHandler(); + break; + + // The following two messages have to do with "updating", which is + // Dictpad's way of dealing with selection changes in the richedit + // control (which is how Dictpad knows that the text in the document + // has changed + + case WM_STOPUPDATE: + pThis->m_dwFlags |= DP_SKIP_UPDATE; + break; + + case WM_STARTUPDATE: + pThis->m_dwFlags &= ~DP_SKIP_UPDATE; + break; + + case WM_UPDATEALTSBUTTON: + pThis->m_hAltsButton = pThis->m_pCandidateList->Update( pThis->m_pTextRunList ); + break; + + // Notifications from the richedit control + case WM_NOTIFY: + + // Set the tooltips if that is what this notification is about + pThis->SetTooltipText( lParam ); + + switch ( ((LPNMHDR)lParam)->code) + { + case EN_MSGFILTER: + { + MSGFILTER *pMsgFilter = (MSGFILTER*)lParam; + pThis->ProcessMsgFilter( pMsgFilter ); + break; + } + + case EN_SELCHANGE: + // Selection has changed; Dictpad needs to update + // its state + hr = pThis->ProcessSelChange( (SELCHANGE *) lParam ); + + // We expect this to succeed; otherwise exit + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + MessageBoxFromResource( hWnd, IDS_UPDATEERROR, + NULL, MB_ICONEXCLAMATION ); + ::SendMessage( hWnd, WM_CLOSE, 0, 0 ); + } + break; + } + break; + + + default: + return ::DefWindowProc( hWnd, message, wParam, lParam ); + break; + } + return 0; +} /* CDictationPad::WndProc */ + + +/**************************************************************************************** +* CDictationPad::InitializeWindow() * +*-----------------------------------* +* Description: +* Sets up and creates the application window, along with the toolbar, +* status bar, and richedit control. +* In order for the alternates list UI to trap window messages from +* the richedit control, we subclass the richedit control so that it +* actually uses the WndProc in candidatelist.cpp +* Return: +* TRUE iff successful +*****************************************************************************************/ +BOOL CDictationPad::InitializeWindow( HWND hWnd ) +{ + // Create a toolbar + m_hToolBar = ::CreateToolbarEx( hWnd, WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS, + IDR_TOOLBAR, 5, m_hInst, IDR_TOOLBAR, NULL, 0, 0, 0, 0, 0, sizeof(TBBUTTON) ); + if ( !m_hToolBar ) + { + return FALSE; + } + + // add the buttons + TBBUTTON tbButtons[5]; + + tbButtons[0].iBitmap = 0; + tbButtons[0].idCommand = IDM_DICTATION_MODE; + tbButtons[0].fsState = TBSTATE_ENABLED; + tbButtons[0].fsStyle = TBSTYLE_BUTTON; + tbButtons[0].dwData = 0; + tbButtons[0].iString = 0; + + tbButtons[1].iBitmap = 1; + tbButtons[1].idCommand = IDM_COMMAND_MODE; + tbButtons[1].fsState = TBSTATE_ENABLED; + tbButtons[1].fsStyle = TBSTYLE_BUTTON; + tbButtons[1].dwData = 0; + tbButtons[1].iString = 0; + + tbButtons[2].iBitmap = 0; + tbButtons[2].idCommand = 0; + tbButtons[2].fsState = TBSTATE_ENABLED; + tbButtons[2].fsStyle = TBSTYLE_SEP; + tbButtons[2].dwData = 0; + tbButtons[2].iString = 0; + + tbButtons[3].iBitmap = 2; + tbButtons[3].idCommand = IDM_PLAY; + tbButtons[3].fsState = TBSTATE_ENABLED; + tbButtons[3].fsStyle = TBSTYLE_BUTTON; + tbButtons[3].dwData = 0; + tbButtons[3].iString = 0; + + tbButtons[4].iBitmap = 3; + tbButtons[4].idCommand = IDM_MIC_TOGGLE; + tbButtons[4].fsState = TBSTATE_ENABLED; + tbButtons[4].fsStyle = TBSTYLE_BUTTON; + tbButtons[4].dwData = 0; + tbButtons[4].iString = 0; + + + ::SendMessage( m_hToolBar, TB_ADDBUTTONS, 5, (LONG)tbButtons ); + ::SendMessage( m_hToolBar, TB_AUTOSIZE, 0, 0 ); + + // Create a status bar + m_hStatusBar = ::CreateStatusWindow( WS_CHILD | WS_VISIBLE, NULL, hWnd, IDC_STATUSBAR ); + if ( !m_hStatusBar ) + { + return FALSE; + } + + // Set up the candidate list UI manager. + // This will register a window class to which our richedit control should belong + m_pCandidateList = new CCandidateList( hWnd, *m_pRecoEventMgr ); + if ( !m_pCandidateList ) + { + return FALSE; + } + + // Create a rich edit control from the candidate UI object's registered parent class + + // The richedit control should fill the client area, taking the toolbar & status bar + // into consideration + POINT ptToolBar; + RECT r; + LONG lToolBarHeight; + LONG lStatusBarHeight; + ::GetWindowRect( m_hToolBar, &r ); + lToolBarHeight = r.bottom - r.top; + ptToolBar.x = r.left; + ptToolBar.y = r.bottom; + ::ScreenToClient( hWnd, &ptToolBar ); + + ::GetWindowRect( m_hStatusBar, &r ); + lStatusBarHeight = r.bottom - r.top; + + ::GetClientRect (hWnd, &r); + + // Get the modified richedit window class registered by m_pCandidateList + const WNDCLASS *pwcEditWindowClass = m_pCandidateList->GetParentClass(); + if ( pwcEditWindowClass ) + { + // Create the modified richedit control. + // We pass the candidate UI manager in as lParam + m_hEdit = ::CreateWindowEx( WS_EX_CLIENTEDGE, + pwcEditWindowClass->lpszClassName, + _T(""), + WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE | + WS_VSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL, + 0, + ptToolBar.y, r.right, + ( r.bottom - ( lToolBarHeight + lStatusBarHeight ) ), + + hWnd, + (HMENU)1, + m_hInst, + (LPVOID) m_pCandidateList ); + } + + if ( !m_hEdit ) + { + return FALSE; + } + + return TRUE; +} /* CDictationPad::InitializeWindow() */ + +/**************************************************************************************** +* CDictationPad::SetTooltipText() * +*---------------------------------* +* Description: +* Puts the appropriate tooltip text into the LTOOLTIPTEXT struct pointed to +* by lParam. +******************************************************************************************/ +void CDictationPad::SetTooltipText( LPARAM lParam ) +{ + LPTOOLTIPTEXT pToolTipText; + static TCHAR szBuffer[64]; + + pToolTipText = (LPTOOLTIPTEXT)lParam; + if( pToolTipText->hdr.code == TTN_NEEDTEXT ) + { + ::LoadString( m_hInst, pToolTipText->hdr.idFrom, szBuffer, sizeof(szBuffer) ); + pToolTipText->lpszText = szBuffer; + } +} /* CDictationPad::SetTooltipText */ + +/*************************************************************************************** +* CDictationPad::UpdateList * +*---------------------------* +* Description: +* Updates the TextRunList by inserting a TextRun that has the given range. +* This is called when the RichEdit control notifies us of some change to the +* text. The node added to the TextRunList is to be a TextRun -- not a +* DictationRun -- since the case of dictated text is handled separately in +* ProcessDictation() +* Return: +* Return value of CTextRunList::Insert() +****************************************************************************************/ +HRESULT CDictationPad::UpdateList( long lStart, long lEnd ) +{ + _ASSERTE( m_pTextRunList ); + + // Create a new CTextRun for the text in the range lStart->lEnd + CTextRun *pTextRun = new CTextRun(); + if ( !pTextRun ) + { + return E_OUTOFMEMORY; + } + + // Create a range for that text. + CComPtr pTextRange; + HRESULT hr = m_cpTextDoc->Range( lStart, lEnd, &pTextRange ); + if ( FAILED(hr) ) + { + return hr; + } + + // Hand the range to the pTextRun + pTextRun->SetTextRange( pTextRange ); + + // Any text entering the TextRunList should be the normal font. + // This is necessary in the case of typing and hypotheses occurring + // in the same place at the same time in the text. + CComPtr cpFont; + hr = pTextRange->GetFont( &cpFont ); + if ( SUCCEEDED( hr ) ) + { + cpFont->SetForeColor( tomAutoColor ); + pTextRange->SetFont( cpFont ); + } + + // Insert the new CTextRun into the TextRunList + hr = m_pTextRunList->Insert( pTextRun ); + + // The alternate UI needs to be notified of this change + if ( SUCCEEDED( hr ) && m_pCandidateList ) + { + m_hAltsButton = m_pCandidateList->Update( m_pTextRunList ); + } + + return hr; +} /* CDictationPad::UpdateList */ + +/**************************************************************************************** +* CDictationPad::ProcessMsgFilter() * +*-----------------------------------* +* Description: +* Called whenever one of the events that we set in our event mask +* for the edit window happened +******************************************************************************************/ +void CDictationPad::ProcessMsgFilter( MSGFILTER *pMsgFilter ) +{ + switch( pMsgFilter->msg ) + { + case WM_CHAR: + { + switch( pMsgFilter->wParam ) + { + case VK_BACK: + if( m_dwFlags & DP_WHOLE_WORD_SEL ) + { + // Delete whole words at a time + + // Use the information on the last selection + // to see whether a selected range was being deleted + // or whether the selection was an IP + long lStart = m_LastSelInfo.selchange.chrg.cpMin; + long lEnd = m_LastSelInfo.selchange.chrg.cpMax; + if ( lStart == lEnd ) + { + // Select and then delete the current word + m_cpTextSel->MoveStart( tomWord, -1, NULL ); + m_cpTextSel->MoveEnd( tomWord, 1, NULL ); + m_cpTextSel->Delete(tomWord, 0, NULL); + } + } + break; + + case VK_ESCAPE: + if ( m_dwFlags & DP_IS_SPEAKING ) + { + // Esc stops a playback + EndSpeaking(); + } + break; + + default: + break; + } + break; + } + case WM_LBUTTONDOWN: + { + if( m_dwFlags & DP_WHOLE_WORD_SEL ) + { + // Mouse capture will expand the text selection to + // include whole words when the left button is back up + ::SetCapture( m_hClient ); + } + + else if ( m_dwFlags & DP_IS_SPEAKING ) + { + // Clicking anywhere in the document should kill the speak + EndSpeaking(); + } + + break; + } + case WM_LBUTTONUP: + { + if( m_dwFlags & DP_WHOLE_WORD_SEL ) + { + // Get the selection, expanded to whole words + ::ReleaseCapture(); + m_cpTextSel->Expand( tomWord, NULL ); + } + + break; + } + default: + break; + } +} /* CDictationPad::ProcessMsgFilter */ + +/**************************************************************************************** +* CDictationPad::ProcessSelChange() * +*-----------------------------------* +* Description: +* Called whenever there is an EN_SELCHANGE notification. Updates the state +* info and processes new non-dictated text. +* New text is detected by comparing the current state of the document +* against the state when this function was last called. +* Return: +* S_OK +* E_POINTER +* return value of CDictationPad::UpdateList() +******************************************************************************************/ +HRESULT CDictationPad::ProcessSelChange( SELCHANGE *pSelChange ) +{ + _ASSERTE( m_cpTextSel ); + if ( !pSelChange ) + { + return E_POINTER; + } + + // Store the previous selection info into m_LastSelInfo + // and the previous text length into lLastTextLen + m_LastSelInfo = m_CurSelInfo; + const long lLastTextLen = m_LastSelInfo.lTextLen; + + // Get the current selection info and document length + + m_CurSelInfo.selchange = *pSelChange; + + long lCurrentTextLen; + GETTEXTLENGTHEX gtl; + gtl.flags = GTL_PRECISE | GTL_NUMCHARS; + gtl.codepage = CP_ACP; + lCurrentTextLen = ::SendMessage( m_hEdit, + EM_GETTEXTLENGTHEX, (WPARAM) >l, 0 ); + m_CurSelInfo.lTextLen = lCurrentTextLen; + + // These variables are here for the purpose of clarity + const SELCHANGE lastSelChange = m_LastSelInfo.selchange; + const SELCHANGE curSelChange = m_CurSelInfo.selchange; + + // Move the alternates button to the new location + if ( !( m_dwFlags & DP_SKIP_UPDATE ) ) + { + m_hAltsButton = m_pCandidateList->Update( m_pTextRunList ); + } + + // The DP_SKIP_UPDATE flag is set when Dictpad is elsewhere making + // changes to the document (or moving around the selection) + // but handling the changes itself. + if (( m_dwFlags & DP_SKIP_UPDATE ) || ( m_dwFlags & DP_IS_SPEAKING )) + { + // Nothing needs to be done + return S_OK; + } + + // Tell the recoevent manager if the selection is being + // moved around, because it is possible that if an utterance + // is currently being processed that we may want it to appear + // here. + if ( lCurrentTextLen == lLastTextLen ) + { + m_dwFlags |= DP_SKIP_UPDATE; + HRESULT hr = m_pRecoEventMgr->SelNotify( *m_cpTextSel ); + m_dwFlags &= ~DP_SKIP_UPDATE; + if ( FAILED( hr ) ) + { + return hr; + } + } + + // Find out if this selection is editable (it is not if there is + // hypothesis text here) + CComPtr cpNextEditableRange; + if ( !(m_pRecoEventMgr->IsEditable( m_cpTextSel, &cpNextEditableRange )) ) + { + // Move the selection to an IP at the next point that can be edited + long lStart; + long lEnd; + if ( cpNextEditableRange ) + { + cpNextEditableRange->GetStart( &lStart ); + cpNextEditableRange->GetEnd( &lEnd ); + } + else + { + // This is an error: means IsEditable() ran out of memory + // (see recomgr.cpp) + lStart = lEnd = m_pTextRunList->GetTailEnd(); + } + ::SendMessage( m_hEdit, EM_SETSEL, lStart, lEnd ); + + // We can return now, since there is no way that text could have + // been added to a non-editable range + return S_OK; + } + + // The following works backwards to determine what must have happened since + // the last time this function was called and whether there is new text + // to deal with (or text that has been deleted). + + // Consider all combinations of {nondegenerate, degenerate} among the current + // selection and the last selection + HRESULT hr = E_FAIL; + if ( lastSelChange.chrg.cpMin == lastSelChange.chrg.cpMax ) + { + // Last selection was degenerate (an IP). + if ( lCurrentTextLen < lLastTextLen ) + { + // Something was deleted; insert the current (degenerate) range + long lStart; + long lEnd; + lStart = lEnd = curSelChange.chrg.cpMax; + hr = UpdateList( lStart, lEnd ); + } + else if ( lCurrentTextLen > m_LastSelInfo.lTextLen ) + { + // Something has been inserted. The start of the new text + // is the start of the old text selection, + // and the end of the new text is the end of the current + // text selection + long lStart = lastSelChange.chrg.cpMin;; + long lEnd = curSelChange.chrg.cpMax; + hr = UpdateList( lStart, lEnd ); + } + else + { + // If the text length has not changed, then no text was changed + hr = S_OK; + } + } + else + { + // Last selection was not degenerate. + + // The new text starts at the start of the last selection and ends at the + // end of the current selection (think about what happens when you + // highlight some text and type over it) + long lStart = lastSelChange.chrg.cpMin; + long lEnd = curSelChange.chrg.cpMax; + + // If the text length has stayed the same, unless we just did a paste, + // there is no new text to deal with + if (( lLastTextLen == lCurrentTextLen ) && !(m_dwFlags & DP_JUST_PASTED_TEXT) ) + { + return S_OK; + } + + // Something changed, so we need to update + hr = UpdateList( lStart, lEnd ); + } + + return hr; +} /* CDictationPad::ProcessSelChange */ + +/*************************************************************************************** +* CDictationPad::DoPlay * +*-----------------------* +* Description: +* Does a playback according to the following rules. +* If the selection is an IP: +* If it's at the end of the document, speak the entire document +* Otherwise speak from the IP until the end of the document. +* Otherwise speak the selection. +* Return: +* S_OK +* S_FALSE if there is nothing to speak +* Return value of CDictationRun::StartSpeaking() +* Return value of CTextRunList::Speak() +****************************************************************************************/ +HRESULT CDictationPad::DoPlay() +{ + _ASSERTE( m_cpTextSel && m_pTextRunList ); + + if ( m_pTextRunList->GetTailEnd() == 0 ) + { + // Nothing to speak + return S_FALSE; + } + + // Save the info on the selection so that we can restore it after + // tracking the spoken text. + // This will occur in CDictationPad::EndSpeaking() + long lSpeakStart = 0; + long lSpeakEnd = 0; + m_cpTextSel->GetStart( &lSpeakStart ); + m_cpTextSel->GetEnd( &lSpeakEnd ); + m_SpeakInfo.lSelStart = lSpeakStart; + m_SpeakInfo.lSelEnd = lSpeakEnd; + + if( lSpeakStart == lSpeakEnd ) // denotes insertion point + { + if ( lSpeakStart >= m_pTextRunList->GetTailEnd() ) + { + // IP is at the end of the document: + // Speak from beginning to end + lSpeakStart = 0; + } + // Else lSpeakStart is already correct + + // Speak all the way to the end + lSpeakEnd = m_pTextRunList->GetTailEnd(); + } + + // This will deactivate the grammars and set things up for + // a playback + HRESULT hr = StartSpeaking( lSpeakStart, lSpeakEnd ); + if ( S_OK != hr ) + { + EndSpeaking(); + return hr; + } + + // Do the playback. + // If we are in the middle of a word or a dictated phrase element, + // the endpoints of the speak will be expanded + hr = m_pTextRunList->Speak( *m_cpVoice, &lSpeakStart, &lSpeakEnd ); + if (S_OK != hr) + { + // Something went wrong, or there was nothing to speak; bail out + EndSpeaking(); + } + else + { + // If the start and end have been tweaked by m_pTextRunList->Speak(), + // then adjust them so that text tracking looks right + _ASSERTE( m_SpeakInfo.pSpeakRange ); + m_SpeakInfo.pSpeakRange->SetStart( lSpeakStart ); + m_SpeakInfo.pSpeakRange->SetEnd( lSpeakEnd ); + } + + return hr; + +} /* CDictationPad::DoPlay */ + +/*************************************************************************************** +* CDictationPad::StartSpeaking * +*------------------------------* +* Description: +* Called when a playback is about to begin. +* Initializes the speak info. +* Return: +* S_OK +* Return value of ITextDocument::Range() +* Return value of CDictationPad::SetGrammarState() +* Return value of ITextRange::Collapse() +****************************************************************************************/ +HRESULT CDictationPad::StartSpeaking( long lStartSpeakRange, long lEndSpeakRange ) +{ + // Stop being interested in SR events for the time being + SetSREventInterest( false ); + + // Cancel any current IME stuff + HIMC himc = ::ImmGetContext( m_hClient ); + ::ImmNotifyIME( himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 ); + + // Hide the alternates UI for the duration of the speak + m_pCandidateList->ShowButton( false ); + + // Tell the candidate list UI to turn off character input + m_pCandidateList->StartPlayback(); + + // Set the range for the playback state info + _ASSERTE( !m_SpeakInfo.pSpeakRange ); + HRESULT hr = m_cpTextDoc->Range( lStartSpeakRange, lEndSpeakRange, + &(m_SpeakInfo.pSpeakRange) ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Set the flag and the toolbar buttons + m_dwFlags |= DP_IS_SPEAKING; + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED | TBSTATE_PRESSED, 0 ) ); + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_MIC_TOGGLE, + MAKELONG( 0, 0 ) ); + + // Disable all the menu items + HMENU hMenu = ::GetMenu( m_hClient ); + int nItems = ::GetMenuItemCount( hMenu ); + for ( int i=0; i < nItems; i++ ) + { + ::EnableMenuItem( hMenu, i, MF_BYPOSITION | MF_GRAYED ); + } + ::DrawMenuBar( m_hClient ); + + // The focus will remain in the edit window. + // If the user types anything, it will just appear at the beginning + // of the spoken text. + + // Deactivate the grammars + hr = SetGrammarState( false ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Set the speak info + m_SpeakInfo.ulCurrentStream = 1; + m_SpeakInfo.pCurrentNode = + m_pTextRunList->Find( lStartSpeakRange ); + + _ASSERTE( !(lStartSpeakRange) || m_SpeakInfo.pCurrentNode ); + if ( lStartSpeakRange && !m_SpeakInfo.pCurrentNode ) + { + return E_UNEXPECTED; + } + + // Move the selection to an IP at the beginning of the selection for the + // time being (so that the highlighting can still be seen if the selection is + // nondegenerate. + m_cpTextSel->Collapse( tomStart ); + + return S_OK; +} /* CDictationPad::StartSpeaking */ + +/*************************************************************************************** +* CDictationPad::EndSpeaking * +*----------------------------* +* Description: +* Called when a playback has ended (whether it has +* ended on its own or by the user interrupting it. +* Restores the selection to what it was before +* the playback started +****************************************************************************************/ +void CDictationPad::EndSpeaking() +{ + // This forces the voice to stop speaking + m_cpVoice->Speak( NULL, SPF_PURGEBEFORESPEAK, NULL ); + + // Bring back the candidate list UI + m_pCandidateList->ShowButton( true ); + + // Set the flag and the toolbar buttons + m_dwFlags &= ~DP_IS_SPEAKING; + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_MIC_TOGGLE, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + + // Re-enable all the menu items + HMENU hMenu = ::GetMenu( m_hClient ); + int nItems = ::GetMenuItemCount( hMenu ); + for ( int i=0; i < nItems; i++ ) + { + ::EnableMenuItem( hMenu, i, MF_BYPOSITION | MF_ENABLED ); + } + ::DrawMenuBar( m_hClient ); + + // Restore the default background color + CComPtr cpFont; + HRESULT hr = m_SpeakInfo.pSpeakRange->GetFont( &cpFont ); + if ( SUCCEEDED( hr ) ) + { + cpFont->SetBackColor( tomAutoColor ); + m_SpeakInfo.pSpeakRange->SetFont( cpFont ); + } + + // Restore the selection to what it was before the playback started + m_cpTextSel->SetRange( m_SpeakInfo.lSelStart, + m_SpeakInfo.lSelEnd ); + + // If the selection is no longer visible, then scroll it into view + POINT pt; + hr = m_cpTextSel->GetPoint( tomEnd | TA_BOTTOM | TA_RIGHT, + &(pt.x), &(pt.y) ); + if ( hr == S_FALSE ) + { + // Out of view + m_cpTextSel->ScrollIntoView( tomStart ); + } + + // There is no current speaking node + m_SpeakInfo.pCurrentNode = NULL; + + // Release the current speaking range + m_SpeakInfo.pSpeakRange->Release(); + m_SpeakInfo.pSpeakRange = NULL; + + // Restore the input focus and place the candidate button in the + // appropriate place + ::SetFocus( m_hEdit ); + m_hAltsButton = m_pCandidateList->Update( m_pTextRunList ); + + // Restore the mic if it was on before the playback started + SetGrammarState( m_dwFlags & DP_MICROPHONE_ON ); + + // Re-allow character input + m_pCandidateList->EndPlayback(); + + // Become interested in SR events again + SetSREventInterest( true ); + +} /* CDictationPad::EndSpeaking */ + +/*************************************************************************************** +* CDictationPad::DoFileNew * +*--------------------------* +* Description: +* Opens a new file, closing any file that's already open. +* Return: +* S_OK +* S_FALSE if the user cancelled +* E_OUTOFMEMORY +* Return value of CDictationPad::DoFileClose() +* Return value of ITextDocument::New() +****************************************************************************************/ +HRESULT CDictationPad::DoFileNew() +{ + HRESULT hr = DoFileClose(); + if ( S_FALSE == hr ) + { + return S_FALSE; + } + + if ( S_OK == hr ) + { + // DoFileClose() better have deleted m_pTextRunList + // and m_pszFile + _ASSERTE( !m_pTextRunList && !m_pszFile ); + + // Notify m_cpTextDoc that this is a new file, + // and create a new CTextRunList off of m_cpTextDoc. + // Note that we do not want the current TextRunList updated, since + // we threw it away + m_dwFlags |= DP_SKIP_UPDATE; + hr = m_cpTextDoc->New(); + m_pTextRunList = new CTextRunList(); + m_dwFlags &= ~DP_SKIP_UPDATE; + + if ( !m_pTextRunList ) + { + return E_OUTOFMEMORY; + } + } + + // The TextRunList now uses a different ITextDocument + if ( SUCCEEDED( hr ) ) + { + m_pTextRunList->SetTextDoc( m_cpTextDoc ); + } + + return hr; + +} /* CDictationPad::DoFileNew */ + + +/*************************************************************************************** +* CDictationPad::DoFileOpen * +*---------------------------* +* Description: +* Opens the file whose full path is lpFileName, or if lpFileName is NULL +* gets the name by using the GetOpenFileName common control. +* Attempts to open the file in the Dictpad format +* (an IStorage with two IStreams, one for text, and one with the +* serialized TextRunList). +* Failing that, opens the file as text. +* Return: +* S_OK +* S_FALSE if the user cancelled +* E_FAIL if the GetOpenFileName() function fails +* Return value of CDictationPad::DoFileClose() +* Return value of ITextDocument::Open() +****************************************************************************************/ +HRESULT CDictationPad::DoFileOpen( LPTSTR lpFileName ) +{ + if ( !m_hClient ) + { + return E_FAIL; + } + + // Stop listening for dictation, and do not start listening + // again unless the user explicitly asks to do so + if ( m_dwFlags & DP_MICROPHONE_ON ) + { + ::SendMessage( m_hClient, WM_COMMAND, IDM_MIC_TOGGLE, 0 ); + } + + // Close whatever file is currently open + HRESULT hr; + if ( (hr = DoFileClose()) != S_OK ) + { + // User cancelled + return hr; + } + + if ( lpFileName ) + { + m_pszFile = _tcsdup( lpFileName ); + } + else + { + // Start an "Open" dialog box + TCHAR pszFileName[ MAX_PATH ]; + *pszFileName = 0; + OPENFILENAME ofn; + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + ZeroMemory( &ofn, ofnsize); + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hClient; + ofn.hInstance = m_hInst; + ofn.lpstrFilter = _T("Dictpad Files (*.dpd;*.txt)\0*.dpd;*.txt\0All Files (*.*)\0*.*\0\0"); + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = pszFileName; + ofn.nMaxFile = MAX_PATH; + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrFileTitle = NULL; + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = NULL; + ofn.Flags = OFN_CREATEPROMPT; + ofn.lpstrDefExt = _T("dpd"); + BOOL fSuccess = ::GetOpenFileName( &ofn ); + + if ( !fSuccess ) + { + // Check what caused fSuccess to be false + DWORD dwErr = ::CommDlgExtendedError(); + + if ( 0 == dwErr ) + { + // User cancelled the open + + // If there isn't a file currently open, then put up a new file + if ( !m_pszFile ) + { + hr = DoFileNew(); + } + + if ( FAILED( hr ) ) + { + return hr; + } + else + { + return S_FALSE; + } + } + else + { + // Error saving + return E_FAIL; + } + } + + // Store the file name + _ASSERTE( !m_pszFile ); + m_pszFile = _tcsdup( ofn.lpstrFile ); + } + + if ( !m_pszFile ) + { + return E_OUTOFMEMORY; + } + + // Open the new file into this document + + // We do not want to trigger updates for introducing this new text, + // since we will take care of constructing the CTextRunList + // for this file below. + m_dwFlags |= DP_SKIP_UPDATE; + + // Attempt to open an IStorage from that file + USES_CONVERSION; + IStorage *pStorage = NULL; + hr = ::StgOpenStorage( T2W(m_pszFile), NULL, STGM_READ | STGM_TRANSACTED, + NULL, 0, &pStorage ); + + // Attempt to open an IStream from the IStorage + IStream *pStream = NULL; + if ( SUCCEEDED( hr ) && pStorage ) + { + // Open an IStream off that storage + hr = pStorage->OpenStream( DICTPAD_TEXT, 0, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, + 0, &pStream ); + } + + // Read in from that IStream + if ( SUCCEEDED( hr ) && pStream ) + { + // Set up a callback function (defined below) that will accept + // the text from the IStream and put it into the document + EDITSTREAM es; + es.dwCookie = (DWORD) pStream; + es.pfnCallback = (EDITSTREAMCALLBACK) EditStreamCallbackReadIn; + ::SendMessage( m_hEdit, EM_STREAMIN, SF_RTF, (LPARAM) &es ); + + // Release the stream + pStream->Release(); + pStream = NULL; + } + else + { + // Reading in the text in from the IStorage failed; just open this file as text + CComVariant var; + USES_CONVERSION; + BSTR bstrFile = ::SysAllocString( T2W( m_pszFile ) ); + var = bstrFile; + hr = m_cpTextDoc->Open( &var, tomReadOnly | tomOpenAlways, 0 ); + ::SysFreeString( bstrFile ); + } + + // Create a TextRunList + _ASSERTE( !m_pTextRunList ); + m_pTextRunList = new CTextRunList(); + m_pTextRunList->SetTextDoc( m_cpTextDoc ); + + if ( SUCCEEDED( hr ) && pStorage ) + { + // We will be here if we could open the DICTPAD_TEXT stream + // from pStorage + + // Open the IStream with the serialized result objects + hr = pStorage->OpenStream( DICTPAD_RECORESULTS, 0, + STGM_READWRITE | STGM_SHARE_EXCLUSIVE, + 0, &pStream ); + } + if ( SUCCEEDED( hr ) && pStream ) + { + // Recreate the TextRunList using this stream + hr = m_pTextRunList->Deserialize( pStream, m_cpDictRecoCtxt ); + } + //else + if ( FAILED( hr ) || !pStream ) + { + // All of the text in this document will be treated as typed + // text + hr = m_pTextRunList->CreateSimpleList(); + } + + // We need to know how long the text run list is starting out + m_CurSelInfo.lTextLen = m_pTextRunList->GetTailEnd(); + + if ( pStream ) + { + pStream->Release(); + } + if ( pStorage ) + { + pStorage->Release(); + } + + // Turn updates back on + m_dwFlags &= ~DP_SKIP_UPDATE; + + // Set the saved flag in m_cpTextDoc to true to indicate that + // there are no outstanding changes + m_cpTextDoc->SetSaved( tomTrue ); + + return hr; +} /* CDictationPad::DoFileOpen */ + +/*************************************************************************************** +* CDictationPad::DoFileSave * +*---------------------------* +* Description: +* Saves the file in the Dictpad format, unless fTextOnly is set, +* in which case the file is just saved as text +* Return: +* S_OK +* E_FAIL if there is no file name to save to +* E_OUTOFMEMORY +* Return value of ITextDocument::Save() +* Return value of StgCreateDocfile() +* Return value of IStorage::CreateStream() +* Return value of IStream::Commit() +* Return value of CTextRunList::Serialize() +* Return value of IStorage::Commit() +****************************************************************************************/ +HRESULT CDictationPad::DoFileSave( bool fTextOnly ) +{ + if ( !m_pszFile ) + { + return E_FAIL; + } + + // Stop listening for dictation, and do not start listening + // again unless the user explicitly asks to do so + if ( m_dwFlags & DP_MICROPHONE_ON ) + { + ::SendMessage( m_hClient, WM_COMMAND, IDM_MIC_TOGGLE, 0 ); + } + + if ( fTextOnly ) + { + // Just do a simple save as text + + // Get the file name into a VARIANT for ITextDocument::Save() + USES_CONVERSION; + BSTR bstrFile = ::SysAllocString( T2W( m_pszFile ) ); + if ( !bstrFile ) + { + return E_OUTOFMEMORY; + } + CComVariant var = bstrFile; + + HRESULT hr = m_cpTextDoc->Save( &var, tomCreateAlways | tomText, 0 ); + + ::SysFreeString( bstrFile ); + + if ( SUCCEEDED( hr ) ) + { + m_cpTextDoc->SetSaved( tomTrue ); + } + + return hr; + } + + // Associate an IStorage with this file + IStorage *pStorage = NULL; + USES_CONVERSION; + HRESULT hr = ::StgCreateDocfile( T2W(m_pszFile), + STGM_CREATE | STGM_READWRITE | STGM_TRANSACTED, + 0, &pStorage ); + + // Create a stream for the text of the document in the storage object + IStream *pStream = NULL; + if ( SUCCEEDED( hr ) ) + { + hr = pStorage->CreateStream( DICTPAD_TEXT, + STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); + } + + if ( SUCCEEDED( hr ) ) + { + // Write the text out to pStream. + // EditStreamCallbackWriteOut() is a callback function (defined below) + // that will suck the text into pStream + EDITSTREAM es; + es.dwCookie = (DWORD) pStream; + es.pfnCallback = (EDITSTREAMCALLBACK) EditStreamCallbackWriteOut; + ::SendMessage( m_hEdit, EM_STREAMOUT, SF_RTF, (LPARAM) &es ); + + // Commit the changes to the IStream + hr = pStream->Commit( STGC_DEFAULT ); + } + + if ( pStream ) + { + pStream->Release(); + pStream = NULL; + } + + if ( SUCCEEDED( hr ) ) + { + // The text document has been saved (if this doesn't succeed then + // we will just be prompted to save next time, even if we didn't make + // any changes; this is not serious. + m_cpTextDoc->SetSaved( tomTrue ); + } + + // Serialize the TextRunList into a separate stream + _ASSERTE( m_pTextRunList ); + if ( SUCCEEDED(hr) ) + { + hr = pStorage->CreateStream( DICTPAD_RECORESULTS, + STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream ); + } + if ( SUCCEEDED( hr ) ) + { + hr = m_pTextRunList->Serialize( pStream, m_cpDictRecoCtxt ); + } + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Commit( STGC_DEFAULT ); + } + + if ( pStream ) + { + pStream->Release(); + } + + // Commit the changes to the IStorage + if ( SUCCEEDED( hr ) ) + { + hr = pStorage->Commit( STGC_DEFAULT ); + } + + if ( pStorage ) + { + pStorage->Release(); + } + + return hr; +} /* CDictationPad::DoFileSave */ + +/*************************************************************************************** +* CDictationPad::DoFileSaveAs * +*-----------------------------* +* Description: +* Saves the file, using the GetSaveFileName common control. +* Return: +* S_OK +* S_FALSE if user cancelled save +* E_FAIL if no client window or if unsuccessful at obtaining the file name +* Return value of CDictationPad::DoFileSave() +****************************************************************************************/ +HRESULT CDictationPad::DoFileSaveAs() +{ + if ( !m_hClient ) + { + return E_FAIL; + } + + // Stop listening for dictation, and do not start listening + // again unless the user explicitly asks to do so + if ( m_dwFlags & DP_MICROPHONE_ON ) + { + ::SendMessage( m_hClient, WM_COMMAND, IDM_MIC_TOGGLE, 0 ); + } + + // Launch the Save As... common control + TCHAR pszFileName[ MAX_PATH ]; + *pszFileName = 0; + OPENFILENAME ofn; + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + ZeroMemory( &ofn, ofnsize); + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hClient; + ofn.hInstance = m_hInst; + ofn.lpstrFilter = + _T("Dictpad Files (*.dpd)\0*.dpd\0Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0"); + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = pszFileName; + ofn.nMaxFile = MAX_PATH; + ofn.nMaxFileTitle = MAX_PATH; + ofn.lpstrFileTitle = NULL; + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = NULL; + ofn.Flags = OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT; + ofn.lpstrDefExt = _T("dpd"); + BOOL fSuccess = ::GetSaveFileName( &ofn ); + + if ( fSuccess ) + { + // Get the name of the file to save to + if ( m_pszFile ) + { + // If there is already a file name in use, ditch its name + free( m_pszFile ); + } + m_pszFile = _tcsdup( ofn.lpstrFile ); + + // If the filter index is 2, that means the user wants a ".txt" extension + return DoFileSave( 2 == ofn.nFilterIndex ); + } + else + { + // Check what caused fSuccess to be false + DWORD dwErr = ::CommDlgExtendedError(); + + if ( 0 == dwErr ) + { + // User cancelled the save + return S_FALSE; + } + else + { + // Error saving + return E_FAIL; + } + } +} /* CDictationPad::DoFileSaveAs */ + + +/*************************************************************************************** +* CDictationPad::DoFileClose * +*----------------------------* +* Description: +* If there is currently an open file, closes the file (checking to see if +* it needs saving). +* Always frees the file name string if successful +* Return: +* S_OK +* S_FALSE if the user cancelled the close +* E_FAIL if there is no associated window +****************************************************************************************/ +HRESULT CDictationPad::DoFileClose() +{ + if ( !m_hClient ) + { + return E_FAIL; + } + + if ( m_pCandidateList ) + { + m_pCandidateList->ShowButton( false ); + } + + // Have unsaved changes been made? + long lSaved = tomFalse; + m_cpTextDoc->GetSaved( &lSaved ); + + // If there is something to save, then confirm the close with the user + int iResult = IDNO; + if ( (lSaved != tomTrue) && m_pTextRunList && (m_pTextRunList->GetTailEnd() > 0) ) + { + // Find out whether the user wants to save the current file + TCHAR pszCaption[ MAX_LOADSTRING ]; + ::LoadString( m_hInst, IDS_APP_TITLE, pszCaption, MAX_LOADSTRING ); + int iResult = MessageBoxFromResource( m_hClient, IDS_CONFIRMCLOSE, pszCaption, + MB_YESNOCANCEL | MB_ICONEXCLAMATION ); + + if ( IDCANCEL == iResult ) + { + return S_FALSE; + } + else if ( IDYES == iResult ) + { + // Save the file before closing it. + int iSaved = ::SendMessage( m_hClient, WM_COMMAND, ID_FILE_SAVE, 0 ); + if ( !iSaved ) + { + // Save cancelled or did not work + return S_FALSE; + } + } + else + { + // The user said don't save. + // If we opened the file via ITextDocument::Open(), TOM will save + // the file anyways, unless we set the saved flag, which we do here + m_cpTextDoc->SetSaved( tomTrue ); + } + } + + // Free the memory associated with this file + if ( m_pszFile ) + { + free( m_pszFile ); + m_pszFile = NULL; + } + if ( m_pTextRunList ) + { + delete m_pTextRunList; + m_pTextRunList = NULL; + } + + return S_OK; +} /* CDictationPad::DoFileClose */ + +/***************************************************************************************** +* EditStreamCallbackReadIn() * +*----------------------------* +* Description: +* Repeatedly called by RichEdit when an EM_STREAMIN message is sent. +* dwCookie is the IStream from which we will be reading +* pbBuff is the buffer into which we will put the bytes from the IStream +* cb is the number of bytes we are requested to read, and *pcb is the +* number of bytes actually read. +* This function ceases to be called when it returns a nonzero value or sets +* *pcb to 0. +* Return values: +* 0 if successful +* -1 if error +*******************************************************************************************/ +DWORD CALLBACK EditStreamCallbackReadIn( DWORD dwCookie, LPBYTE pbBuff, ULONG cb, ULONG *pcb ) +{ + if ( !dwCookie || !pbBuff || !pcb ) + { + // Error: invalid stream + return -1; + } + IStream *pStream = (IStream *) dwCookie; + + HRESULT hr = pStream->Read( pbBuff, cb, pcb ); + if ( SUCCEEDED( hr ) ) + { + return 0; + } + else + { + return -1; + } +} + +/***************************************************************************************** +* EditStreamCallbackWriteOut() * +*------------------------------* +* Description: +* Repeatedly called by RichEdit when an EM_STREAMOUT message is sent. +* dwCookie is the IStream to which we will be writing +* pbBuff is the buffer from which we will get the bytes to write to the IStream +* cb is the number of bytes we are requested to write, and *pcb is the +* number of bytes actually written. +* This function ceases to be called when it returns a nonzero value or sets +* *pcb to 0. +* Return values: +* 0 if successful +* -1 if error +*******************************************************************************************/ +DWORD CALLBACK EditStreamCallbackWriteOut( DWORD dwCookie, LPBYTE pbBuff, ULONG cb, ULONG *pcb ) +{ + if ( !dwCookie || !pbBuff || !pcb ) + { + // Error: invalid stream + return -1; + } + IStream *pStream = (IStream *) dwCookie; + + HRESULT hr = pStream->Write( pbBuff, cb, pcb ); + if ( SUCCEEDED( hr ) ) + { + return 0; + } + else + { + return -1; + } +} + +/***************************************************************************************** +* MessageBoxFromResource() * +*--------------------------* +* Description: +* Calls a message box with text loaded from the resource with ID uID. +* Return values: +* error value of LoadString() or return value of MessageBox() +*******************************************************************************************/ +int MessageBoxFromResource( HWND hWnd, UINT uID, LPCTSTR lpCaption, UINT uType ) +{ + TCHAR pszMessageBoxText[ MAX_LOADSTRING ]; + int iRet = ::LoadString( (HINSTANCE) ::GetWindowLong( hWnd, GWL_HINSTANCE ), + uID, pszMessageBoxText, MAX_LOADSTRING ); + if ( iRet ) + { + iRet = ::MessageBox( hWnd, pszMessageBoxText, lpCaption, uType ); + } + return iRet; +} /* MessageBoxFromResource */ + + +/***************************************************************************************** +* About() * +*---------* +* Description: +* Message handler for the "About" box. +******************************************************************************************/ +LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch( message ) + { + case WM_COMMAND: + { + WORD wId = LOWORD(wParam); + WORD wEvent = HIWORD(wParam); + + switch( wId ) + { + case IDOK: + case IDCANCEL: + EndDialog( hDlg, LOWORD(wParam) ); + return TRUE; + } + + break; + } + } + return FALSE; +} /* About */ + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.dsp b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.dsp new file mode 100644 index 00000000..5995fbf9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.dsp @@ -0,0 +1,443 @@ +# Microsoft Developer Studio Project File - Name="dictpad" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=dictpad - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "dictpad.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dictpad.mak" CFG="dictpad - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "dictpad - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "dictpad - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dictpad___Win32_Debug_x86" +# PROP BASE Intermediate_Dir "dictpad___Win32_Debug_x86" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\ddk\include" /I "..\..\..\include" /I "..\Common" /I "..\..\Common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib version.lib imm32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBCMTD" /pdbtype:sept /libpath:"..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "dictpad___Win32_Release_x86" +# PROP BASE Intermediate_Dir "dictpad___Win32_Release_x86" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\ddk\include" /I "..\..\..\..\patch\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /Zi /O2 /I "..\Common" /I "..\..\Common" /I "..\..\..\..\ddk\include" /I "..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib version.lib imm32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBCMT" /libpath:"..\..\..\lib\i386" /debugtype:cv,fixup +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "dictpad - Win32 Debug x86" +# Name "dictpad - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\candidatelist.cpp +# End Source File +# Begin Source File + +SOURCE=..\common\ComponentVersionDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\DictationRun.cpp +# End Source File +# Begin Source File + +SOURCE=.\dictpad.cpp + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# ADD CPP /I "..\common" + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dictpad.rc +# ADD BASE RSC /l 0x409 +# ADD RSC /l 0x409 /i "..\..\..\..\build" /i "..\Common" /i "..\..\Common" +# End Source File +# Begin Source File + +SOURCE=.\dictpad_sapi.cpp +# End Source File +# Begin Source File + +SOURCE=.\phrasereplace.cpp +# End Source File +# Begin Source File + +SOURCE=.\recomgr.cpp +# End Source File +# Begin Source File + +SOURCE=.\resultcontainer.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\textrun.cpp +# End Source File +# Begin Source File + +SOURCE=.\TextRunList.cpp +# End Source File +# Begin Source File + +SOURCE=.\tom_i.c +# SUBTRACT BASE CPP /YX /Yc /Yu +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\candidatelist.h +# End Source File +# Begin Source File + +SOURCE=.\DictationRun.h +# End Source File +# Begin Source File + +SOURCE=.\dictpad.h +# End Source File +# Begin Source File + +SOURCE=.\phrasereplace.h +# End Source File +# Begin Source File + +SOURCE=.\recomgr.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\resultcontainer.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\textrun.h +# End Source File +# Begin Source File + +SOURCE=.\TextRunList.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\bitmap1.bmp +# End Source File +# Begin Source File + +SOURCE=.\cursor1.cur +# End Source File +# Begin Source File + +SOURCE=.\dictpad.ico +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\chs_cmdmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +InputDir=. +InputPath=.\chs_cmdmode.xml + +"$(InputDir)\chs_cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +InputDir=. +InputPath=.\chs_cmdmode.xml + +"$(InputDir)\chs_cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\chs_dictmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +InputDir=. +InputPath=.\chs_dictmode.xml + +"$(InputDir)\chs_dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +InputDir=. +InputPath=.\chs_dictmode.xml + +"$(InputDir)\chs_dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\cmdmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\cmdmode.xml +InputName=cmdmode + +BuildCmds= \ + ..\..\..\bin\gc /h cmdmode.h $(InputName) + +"$(ProjDir)\cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cmdmode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\cmdmode.xml +InputName=cmdmode + +BuildCmds= \ + ..\..\..\bin\gc /h cmdmode.h $(InputName) + +"$(ProjDir)\cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cmdmode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\dictmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\dictmode.xml +InputName=dictmode + +BuildCmds= \ + ..\..\..\bin\gc /h dictmode.h $(InputName) + +"$(ProjDir)\dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\dictmode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\dictmode.xml +InputName=dictmode + +BuildCmds= \ + ..\..\..\bin\gc /h dictmode.h $(InputName) + +"$(ProjDir)\dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\dictmode.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\jpn_cmdmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +InputDir=. +InputPath=.\jpn_cmdmode.xml + +"$(InputDir)\jpn_cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +InputDir=. +InputPath=.\jpn_cmdmode.xml + +"$(InputDir)\jpn_cmdmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\jpn_dictmode.xml + +!IF "$(CFG)" == "dictpad - Win32 Debug x86" + +# Begin Custom Build +InputDir=. +InputPath=.\jpn_dictmode.xml + +"$(InputDir)\jpn_dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "dictpad - Win32 Release x86" + +# Begin Custom Build +InputDir=. +InputPath=.\jpn_dictmode.xml + +"$(InputDir)\jpn_dictmode.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\cmdmode.cfg +# End Source File +# Begin Source File + +SOURCE=.\dictmode.cfg +# End Source File +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.h new file mode 100644 index 00000000..8a4e4ed5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.h @@ -0,0 +1,202 @@ +/****************************************************************************** +* DictPad.h +* This module contains the base definitions for the DictPad SAPI 5 +* premier app. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" +#include "candidatelist.h" + +// Flags that determine the state of the app +typedef enum DPFLAGS +{ + DP_DICTATION_MODE = ( 1L << 0 ), // Toggles between dictation and command mode + DP_WHOLE_WORD_SEL = ( 1L << 1 ), // Indicates that whole words should be selected + DP_MICROPHONE_ON = ( 1L << 2 ), // Indicates that the "mic" is on (really that + // the appropriate grammars are active + DP_SHARED_RECOGNIZER = ( 1L << 3 ), // Shared reco engine (false if engine is inproc) + DP_IS_SPEAKING = ( 1L << 4 ), // Indicates that we are in the midst of a playback + DP_GRAMMARS_ACTIVE = ( 1L << 5 ), // Indicates the the "mic" is on + DP_JUST_PASTED_TEXT = ( 1L << 6 ), // Indicates that text has just been pasted + DP_SKIP_UPDATE = ( 1L << 7 ) // Indicates that selection changes should not be processed +} DPFLAGS; + +// There are three grammars loaded +typedef enum GRAMMARIDS +{ + GID_DICTATION, // ID for the dictation grammar + GID_DICTATIONCC, // ID for the C&C grammar that's active during dictation + GID_CC // ID for the C&C grammar that's active when dictation is not +}; + +// State having to do with the text selection +typedef struct SELINFO +{ + SELCHANGE selchange; // SELCHANGE struct + long lTextLen; // Total text length +} SELINFO; + +// State having to do with an ongoing playback +typedef struct SPEAKINFO +{ + long lSelStart, lSelEnd; + ITextRange *pSpeakRange; + PTEXTRUNNODE pCurrentNode; + ULONG ulCurrentStream; // The stream number we are currently on +} SPEAKINFO; + +// A way of mapping between recognized voice command and window messages. +// The details of what gets executed in response to voice-enable menus is very consistent and predictable. +// Effectively, we will send a message to the client window, simulating the menu item itself. +// This structure is used for bundling these details. +// An instance of this map is created in dictpad_sapi.cpp +struct PROPERTYMAP +{ + DWORD dwPropertyID; // The specific property Id + UINT uiMessage; // Speicific msg that will be sent to the apps client window + WPARAM wParam; // First param - value is dependent upon the msg + LPARAM lParam; // Second param - value is dependent upon the msg +}; + +// Constants +#define MAX_LOADSTRING 1000 +#define WM_DICTRECOEVENT WM_USER + 1 +#define WM_CCRECOEVENT WM_USER + 2 +#define WM_TTSEVENT WM_USER + 3 +#define WM_STOPUPDATE WM_USER + 4 +#define WM_STARTUPDATE WM_USER + 5 +#define WM_UPDATEALTSBUTTON WM_USER + 6 + +class CDictationPad +{ +public: + CDictationPad( HINSTANCE hInst = NULL ); + ~CDictationPad(); + + // Functions for running Dictpad (in dictpad.cpp) + BOOL Initialize( int nCmdShow, LPSTR lpCmdLine ); + int Run( void ); + +private: + // In dictpad.cpp: + + // Window proc + static LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + + // Initialization methods + BOOL InitializeWindow( HWND hWnd ); + void SetTooltipText( LPARAM lParam ); + + // Methods to process typed input and other notifications from the edit window + HRESULT UpdateList( long lStart, long lEnd ); // Updates the list by inserting a block + void ProcessMsgFilter( MSGFILTER *pMsgFilter ); // Handle the various notificaton events + // that we were interested in + HRESULT ProcessSelChange( SELCHANGE *pSelChange); + // Handle notification of selection change + // (this is how keyboard input gets processed) + + // Playback + HRESULT DoPlay(); // Executes a playback + HRESULT StartSpeaking( long lStartSpeakRange, // Called before a playback starts + long lEndSpeakRange); + void EndSpeaking(); // Called when a playback is through + + // File new/open/save/close + HRESULT DoFileNew(); // Opens a new file + HRESULT DoFileOpen( LPTSTR lpFileName ); // Opens a file from GetOpenFileName + HRESULT DoFileSave( bool fTextOnly = false ); // Saves a file in the appropriate format + HRESULT DoFileSaveAs(); // Gets a name from GetSaveFileName and saves + HRESULT DoFileClose(); // Closes the file if there is currently one open + + // In dictpad_sapi.cpp: + + // Initialization methods + HRESULT InitializeSAPIObjs(); // Set up the SAPI objects + HRESULT InitSAPICallback( HWND hWnd ); // Hook up the client window for SAPI notifications + HRESULT LoadGrammars(); // Load the various grammars + + // SR and TTS notification functions + bool SRDictEventHandler( void ); // Handle notifications from the dictation context + bool SRCCEventHandler( void ); // Handle notifications from the C&C context + void TTSEventHandler( void ); // Handle notifications from the voice + void SetSREventInterest( bool fOn ); // Sets/unsets interest in SR notification events + + // Methods to process events from the SR engine + bool ProcessDictationModeCommands( ISpRecoResult &rResult ); + // Process commands recognized while in dictation mode + bool ProcessCommandModeCommands( ISpRecoResult &rResult ); + // Process commands recognized while in command mode + bool ProcessDictation( ISpRecoResult &rResult, int eEventId ); + // Process dictation recognitions + bool ProcessDictationHypothesis( ISpRecoResult &rResult ); + // Process dictation hypotheses + + // Switching between the two recognition contexts + HRESULT SetMode( bool fDictationMode ); // Switches between dictation and command modes + + // Controlling the "mic" (really, whether grammar rules are active) + HRESULT SetGrammarState( BOOL bOn ); // Sets the grammar rules to the desired state + + // Add/delete Words UI + HRESULT RunAddDeleteUI(); // Starts up the Add/Delete words UI + // with in params as appropriate +private: + // Win32-related handles + HACCEL m_hAccelTable; // handle to the accelerators + HINSTANCE m_hInst; // handle to the current instance + HMODULE m_hRtfLib; // handle to the rich edit control dll + HWND m_hClient; // handle to the app's client window + HWND m_hEdit; // handle to the rich edit control + HWND m_hToolBar; // handle to the toolbar + HWND m_hStatusBar; // handle to the status bar + HFONT m_hFont; // handle to the current font + HWND m_hAltsButton; // handle to alternates UI button + + // Application state + DWORD m_dwFlags; // DPFLAGS (see above) + SELINFO m_LastSelInfo; // Information on the last selection + SELINFO m_CurSelInfo; // Information on the current selection + SPEAKINFO m_SpeakInfo; // Information about the current speaking state + TCHAR *m_pszFile; // Name of the current file + + + // Richedit/TOM + CComPtr m_cpRichEdit; // OLE interface to the rich edit control + CComPtr m_cpTextDoc; + CComPtr m_cpTextSel; + + // SAPI objects + CComPtr m_cpRecoEngine; // SR engine + CComPtr m_cpDictRecoCtxt; // Recognition context for dictation + CComPtr m_cpCCRecoCtxt; // Recognition context for C&C + CComPtr m_cpDictGrammar; // Dictation grammar + CComPtr m_cpDictCCGrammar; // Grammar for the few commands that are accessible while dictating + CComPtr m_cpCCGrammar; // Grammar for full command & control mode + CComPtr m_cpVoice; // TTS voice + + // Event interests + const ULONGLONG m_ullDictInterest; // Events in which Dictpad will be interested in + const ULONGLONG m_ullCCInterest; + + // Classes related to CDictationPad + CTextRunList *m_pTextRunList; // List of dictated and non-dictated runs (textrunlist.cpp) + CRecoEventMgr *m_pRecoEventMgr; // Handles placement of recognized text (recomgr.cpp) + CCandidateList *m_pCandidateList; // Handles alternates UI (candidatelist.cpp) +}; + + +//--- Function Prototypes ----------------------------------------------------- + +// In dictpad.cpp +LRESULT CALLBACK About( HWND, UINT, WPARAM, LPARAM ); +DWORD CALLBACK EditStreamCallbackReadIn( DWORD dwCookie, LPBYTE pbBuff, ULONG cb, ULONG *pcb ); +DWORD CALLBACK EditStreamCallbackWriteOut( DWORD dwCookie, LPBYTE pbBuff, ULONG cb, ULONG *pcb ); +int MessageBoxFromResource( HWND hWnd, UINT uID, LPCTSTR lpCaption, UINT uType ); + +// In dictpad_sapi.cpp +void HighlightAndBringIntoView( ITextDocument &rTextDoc, long lStart, long lEnd ); +void DumpCommandToScreen( HWND hwndClient, ISpPhrase &rPhrase ); + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.ico b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.ico new file mode 100644 index 00000000..feea2daa Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.rc b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.rc new file mode 100644 index 00000000..1285a014 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad.rc @@ -0,0 +1,257 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_DICTPAD ICON DISCARDABLE "dictpad.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_DICTPAD MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "E&xit\tCtrl+X", IDM_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Voice" + BEGIN + MENUITEM "Listen for &Dictation", IDM_DICTATION_MODE, CHECKED + MENUITEM "Listen for &Commands", IDM_COMMAND_MODE + MENUITEM "&Grammars active\tCtrl+M", IDM_MIC_TOGGLE + MENUITEM "Play&back\tCtrl+P", IDM_PLAY + MENUITEM SEPARATOR + MENUITEM "&Add/Delete Word(s)...", IDM_ADDREMOVEWORDS + MENUITEM SEPARATOR + MENUITEM "Select &Whole Words", IDM_WHOLE_WORDS, CHECKED + MENUITEM "S&hared recognition engine", IDM_SHAREDENGINE + MENUITEM SEPARATOR + MENUITEM "&Voice Training...", IDM_VOICE_TRAINING + MENUITEM "Micro&phone Setup...", IDM_MICROPHONE_SETUP + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_DICTPAD ACCELERATORS MOVEABLE PURE +BEGIN + "/", IDM_ABOUT, ASCII, ALT, NOINVERT + "?", IDM_ABOUT, ASCII, ALT, NOINVERT + "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT + "C", IDM_COMMAND_MODE, VIRTKEY, ALT, NOINVERT + "D", IDM_DICTATION_MODE, VIRTKEY, ALT, NOINVERT + "M", IDM_MIC_TOGGLE, VIRTKEY, CONTROL, NOINVERT + "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT + "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT + "P", IDM_PLAY, VIRTKEY, CONTROL, NOINVERT + "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT + "X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 62 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_DICTPAD,IDC_MYICON,14,9,20,20 + LTEXT "DictPad ",IDC_STATIC,49,10,58,8,SS_NOPREFIX + LTEXT "(c) 2001 Microsoft Corporation.",IDC_STATIC,49,23,177, + 11 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP + LTEXT "All rights reserved.",IDC_STATIC,49,39,177,11 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""SapiSDKCommon.rc2""\r\n" + "#include ""chs_dictpad.rc""\r\n" + "#include ""jpn_dictpad.rc""\r\n" + "#include ""version.rc2""\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""chs_dictpad.rc""\r\n" + "#include ""jpn_dictpad.rc""\r\n" + "\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_COMMAND_MODE_CFG SRGRAMMAR DISCARDABLE "cmdmode.cfg" +IDR_DICTATION_MODE_CFG SRGRAMMAR DISCARDABLE "dictmode.cfg" + + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_TOOLBAR TOOLBAR DISCARDABLE 16, 16 +BEGIN + BUTTON IDB_DICTMODE + BUTTON IDB_COMMANDMODE + SEPARATOR + BUTTON IDB_PLAY + BUTTON IDB_MICTOGGLE + BUTTON 65535 + BUTTON 65535 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_TOOLBAR BITMAP DISCARDABLE "toolbar1.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Dictpad" + IDC_DICTPAD "DICTPAD" + IDM_PLAY "Play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_FONT "Allow selection of a different font " + IDM_DICTATION_MODE "Dictation" + IDM_COMMAND_MODE "Command" + IDS_ADD "Add" + IDS_CHANGE "Change" + IDS_NONEWWORDS "No new words" + IDS_NOWORDSADDED "No new words have been added to the lexicon." + IDS_WAITING "..." + IDS_INVALIDFILEFORMAT "Invalid file format" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_MIC_TOGGLE "Grammars active/inactive" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CANNOTOPEN "This file cannot be opened by Dictpad" + IDS_ERRORSAVING "Dictpad encountered an error while saving to this file" + IDS_CANNOTSAVE "Error saving to file" + IDS_CONFIRMCLOSE "The text of this file has changed since the last save. Do you wish to save this file?" + IDS_MICROPHONESETUPWIZARD "Microphone Setup Wizard" + IDS_ACCESSDENIED "Cannot save to file: Access denied." + IDS_CANNOTSWITCHMODES "Error switching modes" + IDS_CANNOTFILENEW "A new file could not be opened." + IDS_UPDATEERROR "An error occurred updating the Dictpad document. Dictpad will now exit." + IDS_UNSUPPORTEDLANG "Error: The language of the engine is unsupported" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "SapiSDKCommon.rc2" +#include "chs_dictpad.rc" +#include "jpn_dictpad.rc" +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad_sapi.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad_sapi.cpp new file mode 100644 index 00000000..af18b593 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/dictpad_sapi.cpp @@ -0,0 +1,2024 @@ +/****************************************************************************** +* dictpad_sapi.cpp +* This file contains the methods of CDictationPad that +* pertain to the SAPI interfaces used in this app. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "dictpad.h" +#include "cmdmode.h" +#include "dictmode.h" +#include +#include + +#define SAPIINITERR _T("SAPI Inititalization Error") + +#ifndef _DEBUG + #define DUMP_EVENT_NAME(x) +#else + void DumpEventName(int id); // forward definition + #define DUMP_EVENT_NAME(x) DumpEventName(x) +#endif + +/**************************************************************************** +* CDictationPad::InitializeSAPIObjs() * +*-------------------------------------* +* Description: +* "Unplugs" any SAPI objects that we may currently have around. +* Set up the SR and TTS objects and obtains the relevant information +* about them. +* If any errors occur in the initialization, compains. +* Return: +* S_OK +* failed HRESULTs of the various SAPI initialization routines +*****************************************************************************/ +HRESULT CDictationPad::InitializeSAPIObjs() +{ + HRESULT hr = S_OK; + + // If we're waiting for a recognition, give up on it. + if ( m_pRecoEventMgr->IsProcessingPhrase() && (m_dwFlags & DP_DICTATION_MODE) ) + { + m_pRecoEventMgr->FalseRecognition(); + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + if ( m_pCandidateList ) + { + m_pCandidateList->ShowButton( true ); + } + + // This will unleash any WM_COMMANDs that were waiting + m_pRecoEventMgr->DoneProcessingPhrase(); + } + SetGrammarState( FALSE ); + + + // Before releasing the dictation reco context, serialize all of the current + // reco results that depend on this reco context. + // All of the active reco results live in the text-run list. + CComPtr cpTextRunListStream; + if ( m_cpDictRecoCtxt ) + { + if ( !m_pTextRunList ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + + // Create an IStream for the text-run list and write the serialized + // text-run list to that stream + hr = ::CreateStreamOnHGlobal( NULL, TRUE, &cpTextRunListStream ); + if ( SUCCEEDED( hr ) ) + { + hr = m_pTextRunList->Serialize( + cpTextRunListStream, m_cpDictRecoCtxt ); + } + + // Commit the changes to the stream so that we can read them later + if ( SUCCEEDED( hr ) ) + { + hr = cpTextRunListStream->Commit( STGC_DEFAULT ); + } + + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error serializing the text run list"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + } + + // Release the SAPI object in the reverse order in which they + // were created. This will ensure that everything really does + // get released + if ( m_cpVoice ) + { + m_cpVoice.Release(); + } + if ( m_cpCCRecoCtxt ) + { + m_cpCCRecoCtxt.Release(); + } + if ( m_cpDictRecoCtxt ) + { + m_cpDictRecoCtxt.Release(); + } + if ( m_cpRecoEngine ) + { + m_cpRecoEngine.Release(); + } + + // Set up the SR engine + hr = S_OK; + HMENU hMenu = ::GetMenu( m_hClient ); + if ( ::GetMenuState( hMenu, IDM_SHAREDENGINE, MF_BYCOMMAND ) == MF_CHECKED ) + { + // Shared reco engine. + // For a shared reco engine, the audio gets setup automatically + hr = m_cpRecoEngine.CoCreateInstance( CLSID_SpSharedRecognizer ); + } + else + { + // Inproc reco engine. + hr = m_cpRecoEngine.CoCreateInstance( CLSID_SpInprocRecognizer ); + + // For an inproc reco engine, we need to call ISpRecognizer::SetInput() + // ourselves. + CComPtr cpAudioToken; + if (SUCCEEDED(hr)) + { + // Get a token for the default audio input + hr = SpGetDefaultTokenFromCategoryId(SPCAT_AUDIOIN, &cpAudioToken); + } + if (SUCCEEDED(hr)) + { + hr = m_cpRecoEngine->SetInput(cpAudioToken, TRUE); + } + } + + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error creating reco engine"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + + // Create the recognition contexts (one for dictation mode and one for command mode). + // An ISpRecoContext is created off an ISpRecognizer + hr = m_cpRecoEngine->CreateRecoContext( &m_cpDictRecoCtxt ); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error creating dictation reco context"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + hr = m_cpRecoEngine->CreateRecoContext( &m_cpCCRecoCtxt ); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error creating C&C reco context"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + + // Now that there is a recognition context, deserialize the text-run list + // (serialized before any pre-existing recognition context was released) + // using the new reco context + if ( cpTextRunListStream ) + { + // Move the seek pointer in the stream to the beginning, since + // that is where we want to start reading from + LARGE_INTEGER li0; + ::memset( (void *) &li0, 0, sizeof( li0 ) ); + hr = cpTextRunListStream->Seek( li0, STREAM_SEEK_SET, NULL ); + + // Deserialize the text-run list using the new reco context + if ( SUCCEEDED( hr ) ) + { + hr = m_pTextRunList->Deserialize( cpTextRunListStream, m_cpDictRecoCtxt ); + } + + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error deserializing the text run list"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + } + + // Create an ISpVoice for TTS + // This is the voice associated with our recognition context + hr = m_cpDictRecoCtxt->GetVoice(&m_cpVoice); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error creating voice"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + + // Set up the reco context for retaining audio in the dictation reco context. + // Get the stream format for 8kHz, 8-bit mono + GUID guidFormatId = GUID_NULL; + WAVEFORMATEX *pWaveFormatEx = NULL; + hr = SpConvertStreamFormatEnum(SPSF_8kHz8BitMono, &guidFormatId, &pWaveFormatEx); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error converting stream format"), SAPIINITERR, MB_OK ); +#endif + } + else + { + // Tell the reco contexts to retain its audio in this format + hr = m_cpDictRecoCtxt->SetAudioOptions( SPAO_RETAIN_AUDIO, &guidFormatId, pWaveFormatEx ); + } +#ifdef _DEBUG + if ( FAILED( hr ) ) + { + ::MessageBox( m_hClient, _T("Error setting retained audio data option for dictation reco context"), SAPIINITERR, MB_OK ); + } +#endif + ::CoTaskMemFree(pWaveFormatEx); + if ( FAILED( hr ) ) + { + return hr; + } + + // Now that we have a reco engine, we can get its LangID and give that to + // the candidate list UI, which needs it for locale information + if ( m_pCandidateList ) + { + SPRECOGNIZERSTATUS stat; + ZeroMemory( &stat, sizeof( stat ) ); + hr = m_cpRecoEngine->GetStatus( &stat ); + m_pCandidateList->SetLangID( stat.aLangID[0] ); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error getting the status of the reco engine"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + } + else + { + return E_OUTOFMEMORY; + } + + // This allows the main window to be notified of SAPI events + hr = InitSAPICallback( m_hClient ); + if ( FAILED( hr ) ) + { +#ifdef _DEBUG + ::MessageBox( m_hClient, _T("Error setting up SAPI event notification"), SAPIINITERR, MB_OK ); +#endif + return hr; + } + + // Load the appropriate grammars + hr = LoadGrammars(); + if ( FAILED( hr ) ) + { + HRESULT hr2 = ERROR_RESOURCE_LANG_NOT_FOUND; + if (( SPERR_UNSUPPORTED_LANG == hr ) || ( ERROR_RESOURCE_LANG_NOT_FOUND == (0xffff & hr))) + { + MessageBoxFromResource( m_hClient, IDS_UNSUPPORTEDLANG, SAPIINITERR, MB_ICONEXCLAMATION ); + } +#ifdef _DEBUG + else + { + ::MessageBox( m_hClient, _T("Error loading the grammars"), SAPIINITERR, MB_OK ); + } +#endif + return hr; + } + + // Update menu items that are engine specific + // Errors in this realm are not horrible, so we carry on happily afterward + BOOL fSupported; + + // User training UI + HRESULT hrUISupport = m_cpRecoEngine->IsUISupported( SPDUI_UserTraining, NULL, 0, &fSupported); +#ifdef _DEBUG + if (FAILED( hrUISupport ) ) + { + ::MessageBox( m_hClient, _T("Querying engine for 'SPDUI_UserTraining' support failed"), SAPIINITERR, MB_OK ); + } +#endif + ::EnableMenuItem( hMenu, IDM_VOICE_TRAINING, + ( (SUCCEEDED(hrUISupport) && fSupported) ? MF_ENABLED: MF_GRAYED ) ); + + // Mic training UI + hrUISupport = m_cpRecoEngine->IsUISupported( SPDUI_MicTraining, NULL, 0, &fSupported ); +#ifdef _DEBUG + if (FAILED( hrUISupport ) ) + { + ::MessageBox( m_hClient, _T("Querying engine for 'SPDUI_MicTraining' support failed"), SAPIINITERR, MB_OK ); + } +#endif + ::EnableMenuItem( hMenu, IDM_MICROPHONE_SETUP, + ( (SUCCEEDED(hrUISupport) && fSupported) ? MF_ENABLED: MF_GRAYED ) ); + + // Add/Remove words UI + hrUISupport = m_cpRecoEngine->IsUISupported( SPDUI_AddRemoveWord, NULL, 0, &fSupported ); +#ifdef _DEBUG + if (FAILED( hrUISupport ) ) + { + ::MessageBox( m_hClient, _T("Querying engine for 'SPDUI_AddRemoveWord' support failed"), SAPIINITERR, MB_OK ); + } +#endif + ::EnableMenuItem( hMenu, IDM_ADDREMOVEWORDS, + ( (SUCCEEDED(hrUISupport) && fSupported) ? MF_ENABLED: MF_GRAYED ) ); + + return S_OK; +} /* CDictationPad::InitializeSAPIObjs */ + + +/****************************************************************************************** +* CDictationPad::InitSAPICallback() * +*-----------------------------------* +* Description: +* Sets up the notification mechanisms for dictation, C&C, +* and TTS. We will be using window messages as our +* notification method +* Indicates which SR and TTS events we are interested in. +* Also sets up the dictation and C&C grammars +* Return value: +* S_OK +* Error code from any of the calls to SAPI +********************************************************************************************/ +HRESULT CDictationPad::InitSAPICallback( HWND hWnd ) +{ + // Set recognition notification for dictation + CComPtr cpDictNotify; + HRESULT hr = cpDictNotify.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpDictNotify->InitWindowMessage(hWnd, WM_DICTRECOEVENT, 0, 0); + } + if (SUCCEEDED(hr)) + { + hr = m_cpDictRecoCtxt->SetNotifySink(cpDictNotify); + } + + // Set recognition notification for C & C + CComPtr cpCCNotify; + hr = cpCCNotify.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpCCNotify->InitWindowMessage(hWnd, WM_CCRECOEVENT, 0, 0); + } + if (SUCCEEDED(hr)) + { + hr = m_cpCCRecoCtxt->SetNotifySink(cpCCNotify); + } + + // Set recognition notification for TTS + CComPtr cpTTSNotify; + hr = cpTTSNotify.CoCreateInstance(CLSID_SpNotifyTranslator); + if (SUCCEEDED(hr)) + { + hr = cpTTSNotify->InitWindowMessage(hWnd, WM_TTSEVENT, 0, 0); + } + if (SUCCEEDED(hr)) + { + hr = m_cpVoice->SetNotifySink(cpTTSNotify); + } + + // ISpRecoContext::SetInterest() allows the caller to indicate + // which types of SAPI events it wants to be notified about. + // Initially set interest in no events for the recognition contexts; + // The event interests will be set when the grammars are first activated + if ( SUCCEEDED( hr ) ) + { + hr = m_cpDictRecoCtxt->SetInterest( m_ullDictInterest, m_ullDictInterest ); + } + if ( SUCCEEDED( hr ) ) + { + hr = m_cpCCRecoCtxt->SetInterest( m_ullCCInterest, m_ullCCInterest ); + } + + // Set interest for voice events + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->SetInterest(SPFEI_ALL_TTS_EVENTS, SPFEI_ALL_TTS_EVENTS); + } + + return hr; +} /* CDictationPad::InitSAPICallback */ + +/****************************************************************************************** +* CDictationPad::LoadGrammars() * +*-------------------------------* +* Description: +* Loads the grammars for dictation and C&C. +* (Note that the grammars still need to be activated +* in order for anything to be recognized from them) +* Return value: +* S_OK +* Return value of ISpRecoContext::CreateGrammar() +* Return value of ISpRecoGrammar::LoadDictation() +* Return value of ISpRecoGrammar::LoadCmdFromResource() +********************************************************************************************/ +HRESULT CDictationPad::LoadGrammars() +{ + // Create the grammar for general dictation, and make it the statistical + // language model for dictation + m_cpDictGrammar.Release(); + HRESULT hr = m_cpDictRecoCtxt->CreateGrammar(GID_DICTATION, &m_cpDictGrammar); + if (SUCCEEDED(hr)) + { + hr = m_cpDictGrammar->LoadDictation(NULL, SPLO_STATIC); + } + if (FAILED(hr)) + { + m_cpDictGrammar.Release(); + } + + // We need a langid from the engine in order to load the grammars in the correct language + SPRECOGNIZERSTATUS Stat; + LANGID langid = 0; + ::memset( &Stat, 0, sizeof( Stat ) ); + if ( SUCCEEDED( hr ) ) + { + hr = m_cpRecoEngine->GetStatus( &Stat ); + } + if ( SUCCEEDED( hr ) ) + { + langid = Stat.aLangID[0]; + } + + + // Create the grammar for the commands that are available for dictation mode. + // The compiled C&C grammars are resources in this project + if( SUCCEEDED( hr ) ) + { + m_cpDictCCGrammar.Release(); + hr = m_cpDictRecoCtxt->CreateGrammar(GID_DICTATIONCC, &m_cpDictCCGrammar); + if (SUCCEEDED(hr)) + { + hr = m_cpDictCCGrammar->LoadCmdFromResource(NULL, (const WCHAR*)MAKEINTRESOURCE(IDR_DICTATION_MODE_CFG), + L"SRGRAMMAR", langid, + SPLO_STATIC); + } + if (FAILED(hr)) + { + m_cpDictCCGrammar.Release(); + } + } + + // Create the grammar for command mode + if( SUCCEEDED( hr ) ) + { + m_cpCCGrammar.Release(); + hr = m_cpCCRecoCtxt->CreateGrammar(GID_CC, &m_cpCCGrammar); + if (SUCCEEDED(hr)) + { + hr = m_cpCCGrammar->LoadCmdFromResource(NULL, (const WCHAR*)MAKEINTRESOURCE( IDR_COMMAND_MODE_CFG ), + L"SRGRAMMAR", langid, + SPLO_STATIC); + } + if (FAILED(hr)) + { + m_cpCCGrammar.Release(); + } + } + + return hr; +} /* CDictationPad::LoadGrammars */ + + +/************************************************************************************** +* CDictationPad::SRDictEventHandler() * +*-------------------------------------* +* Description: +* Called whenever there is an SR event from the dictation +* reco context. +* Processes the event appropriately. +* Return: +* true iff successful +****************************************************************************************/ +bool CDictationPad::SRDictEventHandler() +{ + // There may be multiple events that come through in one notification, so we must + // look for all of them + CSpEvent event; + while ( event.GetFrom(m_cpDictRecoCtxt) == S_OK ) + { + DUMP_EVENT_NAME(event.eEventId); + + switch (event.eEventId) + { + // PHRASE_START: The engine heard the start of sounds that it thinks + // is recognizable speech. + // This event is guaranteed to be followed eventually by either an + // SPEI_RECOGNITION or an SPEI_FALSE_RECOGNITION + case SPEI_PHRASE_START: + { + // We don't expect SR events during a playback + _ASSERTE( !(m_dwFlags & DP_IS_SPEAKING) ); + + HIMC himc = ::ImmGetContext( m_hClient ); + ::ImmNotifyIME( himc, NI_COMPOSITIONSTR, CPS_CANCEL, 0 ); + + // Throw out this event unless our grammars are active + // and we are in dictation mode. + // This will get rid of PHRASE_STARTs from other reco contexts + if ( !(m_dwFlags & DP_GRAMMARS_ACTIVE) || !(m_dwFlags & DP_DICTATION_MODE) ) + { + break; + } + + // Alternates UI and playback should be disabled + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, MAKELONG(TBSTATE_INDETERMINATE, 0) ); + if ( m_pCandidateList ) + { + m_pCandidateList->ShowButton( false ); + } + + // Tell the recoevent manager about what the selection is now, + // and move the selection to an IP at the end of the "waiting" text (...) + // This move should not trigger an update + m_dwFlags |= DP_SKIP_UPDATE; + HRESULT hr = m_pRecoEventMgr->PhraseStart( *m_cpTextSel ); + m_dwFlags &= ~DP_SKIP_UPDATE; + if ( FAILED( hr ) ) + { + return false; + } + + // Status bar update + { + USES_CONVERSION; + CSpDynamicString dstr; + dstr = L"Dictation mode"; + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)W2T( dstr ) ); + } + break; + } + + // SPEI_RECO_STATE_CHANGE: For whatever reason, SAPI found it necessary to change the + // reco state. + // This can happen e.g. if a shared recognizer is running and some other context using + // that recognizer changes its RecoState + case SPEI_RECO_STATE_CHANGE: + if (event.RecoState() == SPRST_INACTIVE) + SetGrammarState( (event.RecoState() != SPRST_INACTIVE) ); + break; + + // FALSE_RECOGNITION: The engine thought this utterance might be recognizable speech, + // but it turned out not to be + // RECO_OTHER_CONTEXT: This will happen in the shared case. If some other app + // is using the engine at the same time, and it gets a recognition, then Dictpad + // will get this message to indicate that the utterance was recognized, just for + // someone else + case SPEI_FALSE_RECOGNITION: + case SPEI_RECO_OTHER_CONTEXT: + // Throw out this event unless our grammars are active + // and we are in dictation mode. + // This will get rid of PHRASE_STARTs from other reco contexts + if ( !(m_dwFlags & DP_GRAMMARS_ACTIVE) || !(m_dwFlags & DP_DICTATION_MODE) ) + { + break; + } + + m_pRecoEventMgr->FalseRecognition(); + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + if ( m_pCandidateList ) + { + m_pCandidateList->ShowButton( m_pCandidateList->FHasAlternates() ); + } + + // This will unleash any WM_COMMANDs that were waiting + m_pRecoEventMgr->DoneProcessingPhrase(); + + break; + + // HYPOTHESIS: One of a set of ongoing "guesses" that the engine makes. + // Any number of these can precede an SPEI_RECOGNITION + // RECOGNITION: The engine is done processing the utterance and has a result + case SPEI_HYPOTHESIS: + case SPEI_RECOGNITION: + { + if ( m_dwFlags & DP_IS_SPEAKING ) + { + // Don't handle reco notifications if a playback is going on + break; + } + + ISpRecoResult *pResult = event.RecoResult(); + if ( !pResult ) + { + // We expect these events to come with reco results + return false; + } + + // The result can be either from the dictation grammar + // or from the dictation-mode C&C grammar + SPPHRASE * pPhrase = NULL; + HRESULT hr = pResult->GetPhrase( &pPhrase ); + + bool fSuccess = false; + if ( SUCCEEDED( hr ) ) + { + switch( pPhrase->ullGrammarID ) + { + case GID_DICTATION: + + // Put the hypotesis or recognition into the edit window + fSuccess = ProcessDictation( *pResult, event.eEventId ); + break; + + case GID_DICTATIONCC: + + // Don't handle hypotheses, since this is just a command + if ( event.eEventId == SPEI_HYPOTHESIS ) + { + fSuccess = true; + break; + } + + // Carry out the command + fSuccess = ProcessDictationModeCommands( *pResult ); + break; + + default: + // We should not be seeing any events from other grammars + _ASSERTE( false ); + fSuccess = false; + break; + } + ::CoTaskMemFree(pPhrase); + } + + if ( SPEI_RECOGNITION == event.eEventId ) + { + // The playback option will have been disabled by the + // PHRASE_START event for this utterance. + // Since we are done processing this utterance, + // playback can now be re-enabled + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_PLAY, + MAKELONG( TBSTATE_ENABLED, 0 ) ); + } + + if ( !fSuccess || FAILED( hr ) ) + { + // Bail: something went wrong + return false; + } + + break; + } + + default: + break; + } + } + + return true; +} /* CDictationPad::SRDictEventHandler */ + + +/************************************************************************************** +* CDictationPad::SRCCEventHandler() * +*-----------------------------------* +* Description: +* Called whenever there is an SR or a TTS event. +* Processes the event appropriately. +* Return: +* true iff successful +****************************************************************************************/ +bool CDictationPad::SRCCEventHandler() +{ + // Numerous events may have come at once, hence the loop + CSpEvent event; + while (S_OK == event.GetFrom(m_cpCCRecoCtxt)) + { + DUMP_EVENT_NAME(event.eEventId); + + if ( SPEI_RECOGNITION == event.eEventId ) + { + // Get the reco result from the event + ISpRecoResult *pResult; + pResult = event.RecoResult(); + if ( !pResult ) + { + return false; + } + + bool fSuccess = ProcessCommandModeCommands( *pResult ); + + if ( !fSuccess ) + { + // We really expect to succeed + _ASSERTE( false ); + return false; + } + } + else if ( SPEI_RECO_STATE_CHANGE == event.eEventId ) + { + // SPEI_RECO_STATE_CHANGE: For whatever reason, SAPI found it necessary to change the + // reco state + if (event.RecoState() == SPRST_INACTIVE) + SetGrammarState( (event.RecoState() != SPRST_INACTIVE) ); + } + } + + return true; +} /* CDictationPad::SRCCEventHandler */ + + +/****************************************************************************** +* CDictationPad::TTSEventHandler * +*--------------------------------* +* Description: +* This method gets called when we receive a TTS event. +* We use TTS events mostly for the "follow-the-bouncing- +* ball" text tracking during a playback. +* Return: +* none. If this function fails, the text tracking will be +* wrong, which is not serious. +******************************************************************************/ +void CDictationPad::TTSEventHandler() +{ + CSpEvent event; + + // Process the TTS events only if we are speaking, + // otherwise just take them off the queue + if ( !(m_dwFlags & DP_IS_SPEAKING) ) + { + // Empty the queue of all waiting events + while ( S_OK == event.GetFrom( m_cpVoice ) ) + { + } + + return; + } + + // CDictationPad::StartSpeaking() should have been called before the playback + // begins. This would have set m_SpeakInfo.pCurrentNode to the appropriate + // start node in the TextRunList + _ASSERTE( m_SpeakInfo.pCurrentNode ); + if ( !m_SpeakInfo.pCurrentNode ) + { + // Error: bail + return; + } + + // There might be numerous events coming at once, hence the loop + SPVOICESTATUS Stat; + HRESULT hr = m_cpVoice->GetStatus( &Stat, NULL ); + while ( SUCCEEDED( hr ) && (event.GetFrom(m_cpVoice) == S_OK) ) + { + switch( event.eEventId ) + { + // Each TextRun in the TextRunList gets its own call to + // ISpVoice::Speak() (or ISpVoice::SpeakAudio()), and + // thus each one will generate its own SPEI_START_INPUT_STREAM + // and SPEI_END_INPUT_STREAM + + case SPEI_START_INPUT_STREAM: + + // If the node is a dictation node, highlight the whole thing + if ( m_SpeakInfo.pCurrentNode->pTextRun->IsDict() ) + { + // Find out where the speaking range starts and ends + // (since these might be somewhere within this TextRun + long lSpeakRangeStart, lSpeakRangeEnd; + m_SpeakInfo.pSpeakRange->GetStart( &lSpeakRangeStart ); + m_SpeakInfo.pSpeakRange->GetEnd( &lSpeakRangeEnd ); + + // The highlighting should start at the beginning of the speaking range + // and end at the end of pCurrentNode's run or the end of the speaking + // range, whichever comes first + HighlightAndBringIntoView( *m_cpTextDoc, lSpeakRangeStart, + __min( m_SpeakInfo.pCurrentNode->pTextRun->GetEnd(), lSpeakRangeEnd ) ); + } + + break; + + case SPEI_END_INPUT_STREAM: + + // Stat.ulLastStreamQueued is the index of the last TextRun we have asked + // to speak (starting with the first one in the TextRunList that we asked + // to speak). + if ( m_SpeakInfo.ulCurrentStream >= Stat.ulLastStreamQueued ) + { + // We just got to the end of the final input stream + // for this speak. + EndSpeaking(); + } + else + { + // We have moved on to the next stream, so move the pCurrentNode along + m_SpeakInfo.pCurrentNode = m_SpeakInfo.pCurrentNode->pNext; + m_SpeakInfo.ulCurrentStream++; + } + + break; + + // SPEI_WORD_BOUNDARY events are generated from calls to ISpVoice::Speak(), + // and the status of the voice indicates offsets in the text input to that + // call to tell us where the voice is. + // ISpVoice::SpeakAudio() does not generate these events + case SPEI_WORD_BOUNDARY: + { + // Highlight the word being spoken + + // The voice's status will tell us where the word is relative + // to the start of the current run (in characters) + // and how long it is (in bytes) + ULONG ulWordPos = Stat.ulInputWordPos; + ULONG ulWordLen = Stat.ulInputWordLen / sizeof( char ); + + // Find out where the speak started to determine whether + // it started somewhere in this run + long lSpeakRangeStart; + m_SpeakInfo.pSpeakRange->GetStart( &lSpeakRangeStart ); + if (m_SpeakInfo.pCurrentNode->pTextRun->WithinRange( lSpeakRangeStart )) + { + // This run is the first run we are speaking, + // and thus the start of the speak range may not + // be the same as the start of this run. + // The position of the word is relative to the start of the + // speak range + ulWordPos += lSpeakRangeStart; + } + else + { + // This is not the first textrun in this speaking range. + // The word position is relative to the start of this run. + ulWordPos += m_SpeakInfo.pCurrentNode->pTextRun->GetStart(); + } + + // The highlighting will end at the end of this word + long lHighlightEnd; + lHighlightEnd = ulWordPos + ulWordLen; + + // Highlight from the beginning of the speak range to the end of + // this word + HighlightAndBringIntoView( *m_cpTextDoc, lSpeakRangeStart, lHighlightEnd ); + + break; + } + + default: + break; + } + } +} /* CDictationPad::TTSEventHandler */ + +/************************************************************************************ +* CDictationPad::SetSREventInterest() * +*-------------------------------------* +* Description: +* Sets/unsets interest in SR events for both SR contexts. +*************************************************************************************/ +void CDictationPad::SetSREventInterest( bool fOn ) +{ + ULONGLONG ullInterest = fOn ? m_ullDictInterest : 0; + m_cpDictRecoCtxt->SetInterest( ullInterest, ullInterest ); + + ullInterest = fOn ? m_ullCCInterest : 0; + m_cpCCRecoCtxt->SetInterest( ullInterest, ullInterest ); +} /* CDictationPad::SetSREventInterest */ + +/************************************************************************************ +* CDictationPad::ProcessDictationModeCommands() * +*-----------------------------------------------* +* Description: +* Processes commands spoken while in dictation mode (i.e. from the +* DictCC grammar. +* Return: +* true iff successful +*************************************************************************************/ +bool CDictationPad::ProcessDictationModeCommands( ISpRecoResult &rResult ) +{ + // Get the phrase associated with this reco result. + // This SPPHRASE gets CoTaskMemAlloced, and we free it below. + SPPHRASE *pPhrase = NULL; + HRESULT hr = rResult.GetPhrase( &pPhrase ); + if ( FAILED( hr ) ) + { + // Couldn't get the phrase + return false; + } + + // Set the status bar text + CSpDynamicString dstr = L"Dictation Mode: "; + if( pPhrase->Rule.pszName ) + { + dstr.Append( pPhrase->Rule.pszName ); + } + else + { + dstr.Append( L"" ); + } + USES_CONVERSION; + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)W2T( dstr ) ); + + // We are done processing this utterance + m_pRecoEventMgr->DoneProcessingPhrase(); + + // The Rule.ulId member of an SPPHRASE tells which C&C rule needs to be fired + switch( pPhrase->Rule.ulId ) + { + case PID_DictMode: + // This rule sends us to command mode + ::SendMessage( m_hClient, WM_COMMAND, IDM_COMMAND_MODE, 0 ); + break; + + default: + { + // Default - just dump the command to the screen + DumpCommandToScreen( m_hClient, rResult ); + break; + } + } + + ::CoTaskMemFree( pPhrase ); + + // Success + return( true ); + +} /* CDictationPad::ProcessDictationModeCommands */ + +/************************************************************************************ +* DATA FOR PROCESSING COMMANDS * +*************************************************************************************/ +// This array bundles the responses for all of the voice-enabled menu & toolbar items accessible during command mode. +// NOTE: Items that use the WM_NULL uiMessage are place holders. When the app actually implements those features, +// then those lines will need to be updated +static PROPERTYMAP s_aCmdModePropertyMap[] = +{ + { PID_CmdMenuFile, WM_SYSCOMMAND, SC_KEYMENU, 'f' }, + { PID_CmdMenuEdit, WM_SYSCOMMAND, SC_KEYMENU, 'e' }, + { PID_CmdMenuVoice, WM_SYSCOMMAND, SC_KEYMENU, 'v' }, + { PID_CmdMenuHelp, WM_SYSCOMMAND, SC_KEYMENU, 'h' }, + { PID_CmdNew, WM_COMMAND, ID_FILE_NEW, 0 }, + { PID_CmdOpen, WM_COMMAND, ID_FILE_OPEN, 0 }, + { PID_CmdSave, WM_COMMAND, ID_FILE_SAVE, 0 }, + { PID_CmdSaveAs, WM_COMMAND, ID_FILE_SAVEAS, 0 }, + { PID_CmdExit, WM_COMMAND, IDM_EXIT, 0 }, + { PID_CmdCut, WM_COMMAND, ID_EDIT_CUT, 0 }, + { PID_CmdCopy, WM_COMMAND, ID_EDIT_COPY, 0 }, + { PID_CmdPaste, WM_COMMAND, ID_EDIT_PASTE, 0 }, + { PID_CmdDictationMode, WM_COMMAND, IDM_DICTATION_MODE, 0 }, + { PID_CmdCommandMode, WM_COMMAND, IDM_COMMAND_MODE, 0 }, + { PID_CmdMicrophone, WM_COMMAND, IDM_MIC_TOGGLE, 0 }, + { PID_CmdPlayback, WM_COMMAND, IDM_PLAY, 0 }, + { PID_CmdAddDeleteWords, WM_COMMAND, IDM_ADDREMOVEWORDS, 0 }, + { PID_CmdSelectWholeWords, WM_COMMAND, IDM_WHOLE_WORDS, 0 }, + { PID_CmdSharedRecoEngine, WM_COMMAND, IDM_SHAREDENGINE, 0 }, + { PID_CmdVoiceTraining, WM_COMMAND, IDM_VOICE_TRAINING, 0 }, + { PID_CmdMicrophoneSetup, WM_COMMAND, IDM_MICROPHONE_SETUP, 0 }, + { PID_CmdAbout, WM_COMMAND, IDM_ABOUT, 0 }, + { PID_CmdEscape, WM_KEYDOWN, VK_ESCAPE, 0x10001} +}; +static const int s_iCmdModePropertyMapSize_c = sizeof( s_aCmdModePropertyMap ) / sizeof( *s_aCmdModePropertyMap ); + + +/************************************************************************************ +* CDictationPad::ProcessCommandModeCommands() * +*---------------------------------------------* +* Description: +* Processes commands spoken while in command mode. +* Return: +* true iff successful +*************************************************************************************/ +bool CDictationPad::ProcessCommandModeCommands( ISpRecoResult &rResult ) +{ + SPPHRASE *pPhrase = NULL; + HRESULT hr = rResult.GetPhrase( &pPhrase ); + if ( FAILED( hr ) || pPhrase->ullGrammarID != GID_CC ) + { + ::CoTaskMemFree(pPhrase); + return false; + } + + // Set the status bar text + CSpDynamicString dstr; + dstr = L"Command Mode: "; + dstr.Append( pPhrase->Rule.pszName ); + USES_CONVERSION; + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0, (LPARAM)W2T( dstr ) ); + if( pPhrase->Rule.pszName ) + { + dstr.Append( pPhrase->Rule.pszName ); + } + else + { + dstr.Append( L"" ); + } + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0 | SBT_NOBORDERS, (LPARAM)W2T( dstr ) ); + + switch( pPhrase->Rule.ulId ) + { + case PID_CmdMenu: + { + _ASSERTE( pPhrase->pProperties ); + + // Spin through the property map array to figure out + // which voice-enabled menu item just got triggered + for( int i = 0; i < s_iCmdModePropertyMapSize_c; ++i ) + { + if( pPhrase->pProperties[0].vValue.ulVal == s_aCmdModePropertyMap[ i ].dwPropertyID ) + { + // WM_CANCELMODE will destroy any active popup menus, which is what we want + // if the user selects a menu item + if ( WM_SYSCOMMAND != s_aCmdModePropertyMap[ i ].uiMessage ) + { + ::SendMessage( m_hClient, WM_CANCELMODE, 0, 0 ); + + // Turn off grammars while we are processing this command, + // unless this is a command to deactivate the grammars + if ( IDM_MIC_TOGGLE != s_aCmdModePropertyMap[ i ].wParam ) + { + SetGrammarState( FALSE ); + } + + } + + // When we've discovered which voice-enabled menu item just got triggered, we'll + // use our property map to figure out how we simulate that menu item + ::SendMessage( m_hClient, + s_aCmdModePropertyMap[ i ].uiMessage, + s_aCmdModePropertyMap[ i ].wParam, + s_aCmdModePropertyMap[ i ].lParam ); + + if (( WM_SYSCOMMAND != s_aCmdModePropertyMap[ i ].uiMessage ) + && ( IDM_MIC_TOGGLE != s_aCmdModePropertyMap[ i ].wParam )) + { + // Reactivate grammars + SetGrammarState( TRUE ); + } + + break; + } + } + + } + break; + + case PID_CmdNavigationVertical: + { + // Vertical navigation has 3 components: direction, unit of travel & number of units. + // The grammar was created to allow some flexibility in the way the user says these 3 components. + // So, the first task is to figure out which components the user actually said - default values will + // be used for the component not explicitly mentioned. + + // Default values: scroll down 1 page + long lUnit = tomScreen; + long lCount = 1; + BOOL bDown = TRUE; + const SPPHRASEPROPERTY *pProp = pPhrase->pProperties; + + // Spin thru all of the properties, identifying the individual components + // It is possible to have the 'direction' specified twice - the last value will be used. + while( pProp ) + { + switch( pProp->ulId ) + { + case PID_CmdDirection: + if( PID_CmdUp == pProp->vValue.ulVal ) + { + bDown = FALSE; + } + else + { + bDown = TRUE; + } + break; + + case PID_CmdUnits: + switch( pProp->vValue.ulVal ) + { + case PID_CmdPage: + lUnit = tomScreen; + break; + + case PID_CmdLine: + lUnit = tomLine; + break; + + case PID_CmdParagraph: + lUnit = tomParagraph; + break; + } + break; + + case PID_CmdNumber: + // Calculate the number. + // See cmdmode.xml for details on how this grammar is constructed. + // It consists of an optional tens value followed by a ones value. + _ASSERTE( pProp->pFirstChild ); + const SPPHRASEPROPERTY *pPropNum; + lCount = 0; + for ( pPropNum = pProp->pFirstChild; pPropNum; pPropNum = pPropNum->pNextSibling ) + { + lCount += pPropNum->vValue.uiVal; + } + break; + + default: + _ASSERTE( FALSE ); + break; + } + + // Get the next property. A 'NULL' value terminates our hunt + pProp = pProp->pNextSibling; + } + + // Now, actually navigate. + if( bDown ) + { + m_cpTextSel->MoveDown( lUnit, lCount, 0, NULL ); + } + else + { + m_cpTextSel->MoveUp( lUnit, lCount, 0, NULL ); + } + } + break; + + case PID_CmdNavigationOther: + // This handles the rule that covers the extraneous navigation + // not explicitly handled in PID_CmdNavigation1 + if( pPhrase->pProperties ) + { + switch( pPhrase->pProperties[0].vValue.ulVal ) + { + case PID_CmdCharacterLeft: + m_cpTextSel->MoveLeft( tomCharacter, 1, 0, NULL ); + break; + case PID_CmdCharacterRight: + m_cpTextSel->MoveRight( tomCharacter, 1, 0, NULL ); + break; + case PID_CmdWordLeft: + m_cpTextSel->MoveLeft( tomWord, 1, 0, NULL ); + break; + case PID_CmdWordRight: + m_cpTextSel->MoveRight( tomWord, 1, 0, NULL ); + break; + + case PID_CmdLineEnd: + m_cpTextSel->EndKey( tomLine, 0, NULL ); + break; + case PID_CmdLineHome: + m_cpTextSel->HomeKey( tomLine, 0, NULL ); + break; + case PID_CmdScrollEnd: + m_cpTextSel->EndKey( tomStory, 0, NULL ); + break; + case PID_CmdScrollHome: + m_cpTextSel->HomeKey( tomStory, 0, NULL ); + break; + } + } + else + { + _ASSERTE( pPhrase->pProperties ); + } + break; + + default: + // Default - just dump the command to the screen + DumpCommandToScreen( m_hClient, rResult ); + break; + } + + ::CoTaskMemFree( pPhrase ); + + // Success + return( true ); + +} /* CDictationPad::ProcessCommandModeCommands */ + + +/************************************************************************************ +* CDictationPad::ProcessDictation() * +*-----------------------------------* +* Description: +* Processes recognized and hypothesized dictation. +* Types the dictated text to where the selection was when the text was +* dictated. Inserts spaces on either side of the dictated text as +* necessary (observing the display attributes) +* +* Return: +* true iff successful +*************************************************************************************/ +bool CDictationPad::ProcessDictation( ISpRecoResult &rResult, int eEventId ) +{ + _ASSERTE(( eEventId == SPEI_RECOGNITION ) || ( eEventId == SPEI_HYPOTHESIS )); + if ( eEventId == SPEI_HYPOTHESIS ) + { + // A separate method to handle hypotheses + return ProcessDictationHypothesis( rResult ); + } + + // Set the flag to indicate that the next insertion will be a dictation run + // and so Dictpad does not need to process the next selection change + m_dwFlags |= DP_SKIP_UPDATE; + + // Get the range to replace from the RecoEventManager. + // In order to do this, we need to tell m_pRecoEventMgr when this + // dictation was spoken. + // Why we need this: If the user moved the IP around while dictating + // this phrase, we want to put the text where the IP was when he actually + // dictated this phrase. + SPRECORESULTTIMES times; + rResult.GetResultTimes( × ); + ITextRange *pRecoRange = NULL; + HRESULT hr = m_pRecoEventMgr->Recognition( times.ftStreamTime, &pRecoRange ); + if ( FAILED( hr ) ) + { + return false; + } + else if ( S_FALSE == hr ) + { + // For whatever reason, this recognition was thrown out. + // So there's nothing to display. + return true; + } + else if ( !pRecoRange ) + { + // unexpected error + return false; + } + + // Does the current selection overlap or adjoin the range in + // which the recognized text will go? + bool bRecoAndSelDisjoint = AreDisjointRanges( pRecoRange, m_cpTextSel ); + + ITextRange *pOldSel = NULL; + if ( bRecoAndSelDisjoint ) + { + // The recognized text will appear in an entirely different part of + // the document from the current selection. + // Remember where the text selection was. + // If this call fails, then it is not serious; the text selection + // will simply not be restored to this location + m_cpTextSel->GetDuplicate( &pOldSel ); + } + + // Set the text selection to be the range in which dictated + // text should appear. + // lStart and lEnd indicate where the dictation should go. + long lStart, lEnd; + pRecoRange->GetStart( &lStart ); + pRecoRange->GetEnd( &lEnd ); + m_cpTextSel->SetRange( lStart, lEnd ); + + // Determine whether whatever is currently at lEnd wants leading spaces + // (i.e. the spaces at the end of this newly-dictated text) consumed + bool fConsumeLeadingSpaces; + HRESULT hrConsumeSpaces = m_pTextRunList->IsConsumeLeadingSpaces( + lEnd, &fConsumeLeadingSpaces ); + + // Get the text and display attributes from the result object + CSpDynamicString dstrText; + BYTE dwAttributes; + hr = rResult.GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, &dwAttributes ); + if ( FAILED( hr ) ) + { + return false; + } + + bool bRet = false; + + // Deal with the display attributes of the text: + + // Determine how much space should follow the result text. + // Space should not follow the text if leading spaces at lEnd are to + // be consumed + if ( !( SUCCEEDED( hrConsumeSpaces ) && fConsumeLeadingSpaces ) ) + { + long lIsDelimiter = + ::SendMessage( m_hEdit, EM_FINDWORDBREAK, WB_ISDELIMITER, lEnd ); + if ( !lIsDelimiter ) + { + // If the dictated text is put here, it will run into whatever + // follows it. + // Add as many trailing spaces as the attributes call for + if ( dwAttributes & SPAF_ONE_TRAILING_SPACE ) + { + dstrText.Append( L" " ); + } + else if ( dwAttributes & SPAF_TWO_TRAILING_SPACES ) + { + dstrText.Append( L" " ); + } + + } + else + { + // There is at least one space here. If there isn't a second + // space and the attributes call for two trailing spaces, + // add another space. + if ( (dwAttributes & SPAF_TWO_TRAILING_SPACES) && + !::SendMessage( m_hEdit, EM_FINDWORDBREAK, WB_ISDELIMITER, lEnd+1 ) ) + { + dstrText.Append( L" " ); + } + } + } + + // Determine how much space should precede the new text + UINT uiSpacesNeeded = 0; + bool fSpacePrepended = false; + if ( lStart > 0 ) + { + // This call determines how many spaces would be needed if + // we inserted text at lStart. + // If this call fails, we'll get the spacing wrong + m_pTextRunList->HowManySpacesAfter( lStart, &uiSpacesNeeded ); + _ASSERTE( uiSpacesNeeded <= 2 ); + } + if ( (dwAttributes & SPAF_CONSUME_LEADING_SPACES) && (lStart > 0) ) + { + // This result requires that we consume leading space; + // move the start back until we have consumed all leading spaces + + // Create a degenerate range one space before + ITextRange *pRange; + hr = m_cpTextDoc->Range( lStart - 1, lStart - 1, &pRange ); + + if ( SUCCEEDED( hr ) ) + { + // Push the start and pRange back until the first character of + // pRange is no longer whitespace. + long lChar = 0; + pRange->GetChar( &lChar ); + while ( (lStart >= 0) && (L' ' == ((WCHAR) lChar )) ) + { + lStart--; + pRange->MoveStart( tomCharacter, -1, NULL ); + + pRange->GetChar( &lChar ); + } + + // The character at lStart is now not space + m_cpTextSel->SetStart( lStart ); + + pRange->Release(); + } + } + else + { + // Prepend a space, since we must make sure + // that this does not run into the text preceding it + // as we are adding it + fSpacePrepended = true; + + // Temporarily turn off the SkipUpdate flag in order to add a space + // and have Dictpad handle the new space + m_dwFlags &= ~DP_SKIP_UPDATE; + + // Insert a space at the beginning of the range. + // We do this right now even if the space is not needed + // so that the dictated text is inserted intact (not running + // into anything else). + // If the space is not needed, we get rid of it below + m_cpTextSel->SetText( L"" ); + BSTR bstrSpace = ::SysAllocString( L" " ); + hr = m_cpTextSel->TypeText( bstrSpace ); + ::SysFreeString( bstrSpace ); + + // Restore the SkipUpdate flag + m_dwFlags |= DP_SKIP_UPDATE; + } + if ( FAILED( hr ) ) + { + return false; + } + + // lWhereNewTextBegins is the beginning of the new text (not the space + // that may precede it) + const long lWhereNewTextBegins = lStart; + + // Get the text of the reco result + BSTR bstrText = ::SysAllocString( dstrText ); + if ( !bstrText ) + { + return false; + } + + // Create a dictation run to contain the new text + CDictationRun *pRun = new CDictationRun(); + if ( !pRun ) + { + return false; + } + hr = pRun->Initialize( rResult ); + if ( FAILED( hr ) ) + { + return false; + } + + // Type the text into the document + m_cpTextSel->SetText( L"" ); + hr = m_cpTextSel->TypeText( bstrText ); + ::SysFreeString( bstrText ); + + // Get the dictated range (it ends wherever the text selection ends now), + // and give it to the new dictation run + long lDictRunEnd; + m_cpTextSel->GetEnd( &lDictRunEnd ); + ITextRange *pDictRunRange; + hr = m_cpTextDoc->Range( lWhereNewTextBegins, lDictRunEnd, &pDictRunRange ); + if ( SUCCEEDED( hr ) ) + { + hr = pRun->SetTextRange( pDictRunRange ); + } + if ( FAILED( hr ) ) + { + return false; + } + + // Set the font back to normal (in case hypotheses had changed the font + CComPtr cpFont; + hr = pDictRunRange->GetFont( &cpFont ); + if ( SUCCEEDED( hr ) ) + { + cpFont->SetForeColor( tomAutoColor ); + pDictRunRange->SetFont( cpFont ); + } + + // Release pDictRunRange, since this range is now the run's responsibility + pDictRunRange->Release(); + + // Now that the range is set, can insert it into the TextRunList. + hr = m_pTextRunList->Insert( pRun ); + + if ( SUCCEEDED( hr ) ) + { + if (( 0 == uiSpacesNeeded ) && fSpacePrepended ) + { + // Need to get rid of this space, since we prepended a + // space but no space is needed. + // Dictpad should handle the deletion of this space. + // If the deletion fails, the spacing will be wrong. + m_cpTextSel->SetRange( lWhereNewTextBegins, lWhereNewTextBegins ); + m_dwFlags &= ~DP_SKIP_UPDATE; + m_cpTextSel->Delete( tomCharacter, 1, NULL ); + m_dwFlags |= DP_SKIP_UPDATE; + + // Restore the selection, realizing that it is going to be + // one behind because of the deletion + m_cpTextSel->SetRange( lDictRunEnd - 1, lDictRunEnd - 1 ); + } + else if (( uiSpacesNeeded > 0 ) && + !(dwAttributes & SPAF_CONSUME_LEADING_SPACES) ) // SPAF_CONSUME_LEADING_SPACES + // trumps the trailing spaces + // attribs of previous runs + { + // Determine how many more spaces are needed, since we + // may have already taken care of it if we already prepended + // a space + INT iAdditionalSpacesNeeded = uiSpacesNeeded - (fSpacePrepended ? 1 : 0); + _ASSERTE( (iAdditionalSpacesNeeded >= 0) + && (iAdditionalSpacesNeeded <= 2) ); + + if ( iAdditionalSpacesNeeded ) + { + // Type in those spaces where the text begins. + // Dictpad should handle the insertion of this space. + // If the insertion fails, the spacing will be wrong + m_cpTextSel->SetRange( lWhereNewTextBegins, lWhereNewTextBegins ); + m_dwFlags &= ~DP_SKIP_UPDATE; + BSTR bstrSpaces = ::SysAllocString( + (1 == iAdditionalSpacesNeeded) ? L" " : L" " ); + m_cpTextSel->TypeText( bstrSpaces ); + ::SysFreeString( bstrSpaces ); + m_dwFlags |= DP_SKIP_UPDATE; + + // Restore the selection, realizing that it's going to be further along + // than it was because of the spaces + m_cpTextSel->SetRange( lDictRunEnd + iAdditionalSpacesNeeded, + lDictRunEnd + iAdditionalSpacesNeeded ); + } + } + } + + // Success + bRet = SUCCEEDED(hr); + + // If the recognized text was placed into a range that overlaps or abuts + // the current selection, then the selection will have been moved to an IP + // at the end of the recognized text. + // If the recognized text and the original text selection were disjoint, then + // move the selection back to the old selection. + if ( bRecoAndSelDisjoint ) + { + // Restore the old selection + pOldSel->GetStart( &lStart ); + pOldSel->GetEnd( &lEnd ); + m_cpTextSel->SetRange( lStart, lEnd ); + + pOldSel->Release(); + } + + if ( m_pCandidateList ) + { + // Show the alternates button and update it with the changed TextRunList + m_pCandidateList->ShowButton( true ); + m_hAltsButton = m_pCandidateList->Update( m_pTextRunList ); + } + + // This will unleash any WM_COMMANDs that were waiting + m_pRecoEventMgr->DoneProcessingPhrase(); + + // We're done, and Dictpad should now be processing updates again. + m_dwFlags &= ~DP_SKIP_UPDATE; + + return bRet; + +} /* CDictationPad::ProcessDictation */ + +/*************************************************************************************** +* CDictationPad::ProcessDictationHypothesis * +*-------------------------------------------* +* Description: +* Called when a hypothesis notification is received. +* Puts the text in the appropriate location +* Return: +* true iff successful +****************************************************************************************/ +bool CDictationPad::ProcessDictationHypothesis( ISpRecoResult &rResult ) +{ + // Set the flag to indicate that the next insertion will be a dictation run + m_dwFlags |= DP_SKIP_UPDATE; + + // Get the text + CSpDynamicString dstrText; + HRESULT hr = rResult.GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, NULL ); + if ( FAILED( hr ) ) + { + return false; + } + + // Get the range to replace from the RecoEventManager. + // Just like in CDictationPad::ProcessDictation() above, when the + // utterance was occurred determines where it will go. + SPRECORESULTTIMES times; + rResult.GetResultTimes( × ); + ITextRange *pRecoRange = m_pRecoEventMgr->Hypothesis( times.ftStreamTime ); + if ( !pRecoRange ) + { + // For whatever reason the hypothesis was dropped, and nothing needs + // to be done with it. + return true; + } + + // Put the text in the range. + // If this fails, then we just won't see the hypothesis. + BSTR bstrText = ::SysAllocString( dstrText ); + pRecoRange->SetText( bstrText ); + ::SysFreeString( bstrText ); + + // Check if the selection now interferes with some non-editable range. + // (A range is not editable if it currently contains hypotheses) + // If so, move it to the end of that range + CComPtr cpNextEditableRange; + if ( !(m_pRecoEventMgr->IsEditable( m_cpTextSel, &cpNextEditableRange )) ) + { + if ( !cpNextEditableRange ) + { + // This indicates an out-of-memory error condition + // (see recomgr.cpp) + return false; + } + + // Move the selection to the next editable phrase + long lStart, lEnd; + cpNextEditableRange->GetStart( &lStart ); + cpNextEditableRange->GetEnd( &lEnd ); + m_cpTextSel->SetStart( lStart ); + m_cpTextSel->SetEnd( lEnd ); + } + + // Make the hypothesized text gray + CComPtr cpFont; + pRecoRange->GetFont( &cpFont ); + if ( cpFont ) + { + cpFont->SetForeColor( PALETTERGB( 128, 128, 128 ) ); + pRecoRange->SetFont( cpFont ); + } + + // Dictpad should resume processing selection changes + m_dwFlags &= ~DP_SKIP_UPDATE; + + return SUCCEEDED( hr ); +} /* CDictationPad::ProcessDictationHypothesis */ + +/**************************************************************************************** +* CDictationPad::SetMode() * +*--------------------------* +* Description: +* Switches to dictation or to command mode (depending +* on the value of fDictationMode). +* Updates the toolbar/statusbar accordingly. +* Switching between dictation and command mode involves +* activating and deactivating grammars +* Return: +* S_OK +* Return value of CDictationPad::SetMode() +*****************************************************************************************/ +HRESULT CDictationPad::SetMode( bool fDictationMode ) +{ + bool fAlreadyInDictMode = m_dwFlags & DP_DICTATION_MODE; + if ( fAlreadyInDictMode != fDictationMode ) + { + // Request to change the mode + + // Deactivate any currently-active grammars + HRESULT hr = SetGrammarState( false ); + + if ( SUCCEEDED( hr ) ) + { + // Flip the mode flag + m_dwFlags ^= DP_DICTATION_MODE; + + // Since the flags are now set to the mode that the + // user wanted to switch to, this will now activate the + // rules in the correct grammar (if the user had the + // mic on when he switched grammars + hr = SetGrammarState( m_dwFlags & DP_MICROPHONE_ON ); + } + + _ASSERTE(SUCCEEDED(hr)); + if ( FAILED(hr) ) + { + return hr; + } + } + + + // Keep the toolbar button in sync with the current mode + ::SendMessage( m_hToolBar, TB_PRESSBUTTON, IDM_DICTATION_MODE, MAKELONG( fDictationMode, 0 ) ); + ::SendMessage( m_hToolBar, TB_PRESSBUTTON, IDM_COMMAND_MODE, MAKELONG( !fDictationMode, 0 ) ); + + // Keep the menu items in sync with the current mode + HMENU hMenu = ::GetMenu( m_hClient ); + ::CheckMenuItem( hMenu, IDM_DICTATION_MODE, fDictationMode ? MF_CHECKED : MF_UNCHECKED ); + ::CheckMenuItem( hMenu, IDM_COMMAND_MODE, fDictationMode ? MF_UNCHECKED : MF_CHECKED ); + + // Keep the status bar in sync with the current mode + { + USES_CONVERSION; + CSpDynamicString dstr; + dstr = fDictationMode ? L"Dictation mode" : L"Command mode"; + ::SendMessage( m_hStatusBar, SB_SETTEXT, 0, (LPARAM)W2T( dstr ) ); + } + + return S_OK; +} /* CDictationPad::SetMode */ + +/**************************************************************************************** +* CDictationPad::SetGrammarState() * +*--------------------------------* +* Description: +* Sets the rules in the relevant grammars to the desired state +* (active or inactive). +* If the edit window does not have the input focus and we are +* turning the grammars on, set the input focus to the edit +* window. +* Sets the microphone button to reflect whether the rules are active +* Return: +* Return value of ISpRecognizer::SetRecoState() +* Return value of ISpRecoGrammar::SetRuleState() +* Return value of ISpRecoGrammar::SetDictationState() +*****************************************************************************************/ +HRESULT CDictationPad::SetGrammarState( BOOL bOn ) +{ + // Check the reco state, to make sure that the reco state is active. + // If not, activate it. + if ( bOn ) + { + SPRECOSTATE rs; + HRESULT hrRecoState = m_cpRecoEngine->GetRecoState( &rs ); + if ( SUCCEEDED( hrRecoState ) && (SPRST_INACTIVE == rs) ) + { + // Set the reco state to active + hrRecoState = m_cpRecoEngine->SetRecoState( SPRST_ACTIVE ); + } + + if ( FAILED( hrRecoState ) ) + { + return hrRecoState; + } + } + + // Check to make sure that we're actually making a change + const BOOL fGrammarsActive = m_dwFlags & DP_GRAMMARS_ACTIVE; + if ( fGrammarsActive == bOn ) + { + // Asking for the current state; nothing needs to be done + return S_OK; + } + +#ifdef _DEBUG + TCHAR debugstring[100]; + wsprintf( debugstring, _T("Trying to %s grammars..."), bOn ? _T("activate") : _T("deactivate") ); + OutputDebugString( debugstring ); +#endif + + HRESULT hr = S_OK; + if ( m_dwFlags & DP_DICTATION_MODE ) + { + // We are in dictation mode. + + if ( !m_cpDictCCGrammar || !m_cpDictGrammar ) + { + return E_FAIL; + } + + // Dictation and the dictation-mode command rules should be (in)active + hr = m_cpDictCCGrammar->SetRuleState(NULL, NULL, bOn ? SPRS_ACTIVE : SPRS_INACTIVE); + if ( SUCCEEDED( hr ) ) + { + hr = m_cpDictGrammar->SetDictationState(bOn ? SPRS_ACTIVE : SPRS_INACTIVE); + } + } + else + { + // We are in command mode + + if ( !m_cpCCGrammar ) + { + return E_FAIL; + } + // Command-mode command rules should be (in)active + hr = m_cpCCGrammar->SetRuleState(NULL, NULL, bOn ? SPRS_ACTIVE : SPRS_INACTIVE); + } + + if ( SUCCEEDED( hr ) ) + { + // Grammars successfully (de)activated, set the flag + bOn ? ( m_dwFlags |= DP_GRAMMARS_ACTIVE ) + : ( m_dwFlags &= ~DP_GRAMMARS_ACTIVE ); +#ifdef _DEBUG + OutputDebugString( _T("success\r\n") ); +#endif + } + else + { + return hr; + } + + // Update the menu items + HMENU hMenu = ::GetMenu( m_hClient ); + ::CheckMenuItem( hMenu, IDM_MIC_TOGGLE, bOn ? MF_CHECKED : MF_UNCHECKED ); + + // Update the toolbar button + long lButtonState; + if ( bOn ) + { + if ( DP_IS_SPEAKING & m_dwFlags ) + { + lButtonState = MAKELONG( TBSTATE_PRESSED, 0 ); + } + else + { + lButtonState = MAKELONG( TBSTATE_ENABLED | TBSTATE_PRESSED, 0 ); + } + } + else + { + if ( DP_IS_SPEAKING & m_dwFlags ) + { + lButtonState = MAKELONG( 0, 0 ); + } + else + { + lButtonState = MAKELONG( TBSTATE_ENABLED, 0 ); + } + } + ::SendMessage( m_hToolBar, TB_SETSTATE, IDM_MIC_TOGGLE, lButtonState ); + + if ( bOn && ( ::GetFocus() != m_hEdit ) ) + { + // Asking to turn the microphone on, but the edit window does not have + // the input focus: Set the input focus to the edit window + ::SetFocus( m_hEdit ); + } + + return S_OK; +} /* CDictationPad::SetGrammarState() */ + +/*************************************************************************************** +* CDictationPad::RunAddDeleteUI * +*-------------------------------* +* Description: +* Gets the first word in the current selection, if the selection +* contains any words. +* Displays the UI for adding and deleting words with the word as +* a parameter. +* Return: +* S_OK +* Return value of CDictationPad::SetGrammarState() +* Return value of ISpRecognizer::DisplayUI() +****************************************************************************************/ +HRESULT CDictationPad::RunAddDeleteUI() +{ + HRESULT hr; + + // Stop listening + hr = SetGrammarState( false ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Get the word nearest the beginning of the selection + // If these calls fail, we just won't get the word. + + CComPtr cpFirstWordRange; + BSTR bstrFirstWordSelected = NULL; + long lStart = m_pTextRunList->GetTailEnd(); + hr = m_cpTextSel->GetDuplicate( &cpFirstWordRange ); + if ( SUCCEEDED(hr) ) + { + hr = cpFirstWordRange->Collapse( true ); + cpFirstWordRange->GetStart( &lStart ); + } + if ( SUCCEEDED(hr) ) + { + hr = cpFirstWordRange->Expand( tomWord, NULL ); + } + // If lStart is equal to m_pTextRunList, we don't get useful + // text in bstrFirstWordSelected + if ( SUCCEEDED(hr) && (lStart < m_pTextRunList->GetTailEnd()) ) + { + hr = cpFirstWordRange->GetText( &bstrFirstWordSelected ); + } + + WCHAR *pwszNewWord = NULL; + if ( bstrFirstWordSelected ) + { + pwszNewWord = wcsdup( bstrFirstWordSelected ); + ::SysFreeString( bstrFirstWordSelected ); + } + + ULONG ulDataSize = pwszNewWord ? + (sizeof(WCHAR) * wcslen( pwszNewWord )) : 0; + + USES_CONVERSION; + hr = m_cpRecoEngine->DisplayUI( + m_hClient, NULL, SPDUI_AddRemoveWord, pwszNewWord, ulDataSize ); + + if ( pwszNewWord ) + { + free(pwszNewWord); + } + + return hr; +} /* CDictationPad::RunAddDeleteUI */ + + + +/****************************************************************************** +* HighlightAndBringIntoView * +*---------------------------* +* Description: +* Highlight the given text in the document and bring it into view +* Return: +* none. If this function fails, the text tracking will be +* wrong, which is not serious. +******************************************************************************/ +void HighlightAndBringIntoView( ITextDocument &rTextDoc, long lStart, long lEnd ) +{ + CComPtr cpWordRange; + HRESULT hr = rTextDoc.Range( lStart, lEnd, &cpWordRange ); + + CComPtr cpHighlightFont; + if ( SUCCEEDED( hr ) ) + { + hr = cpWordRange->GetFont( &cpHighlightFont ); + } + if ( SUCCEEDED( hr ) ) + { + cpHighlightFont->SetBackColor( PALETTERGB( 255, 255, 0 ) ); + cpWordRange->SetFont( cpHighlightFont ); + } + + // Bring the most recently-spoken text into view + POINT pt; + hr = cpWordRange->GetPoint( tomEnd | TA_BOTTOM | TA_RIGHT, + &(pt.x), &(pt.y) ); + if ( hr == S_FALSE ) + { + // An S_FALSE return value from ITextRange::GetPoint() means that + // the requested point is not visible + cpWordRange->ScrollIntoView( tomEnd ); + } +} /* HighlightAndBringIntoView */ + +/****************************************************************************** +* DumpCommandToScreen * +*---------------------* +* Description: +* Dumps the command whose spoken text is in the phrase object +* rPhrase to the screen +* Return: +* none. If this function fails, the command will not be dumped. +******************************************************************************/ +void DumpCommandToScreen( HWND hwndClient, ISpPhrase &rPhrase ) +{ + // Get the rule name + SPPHRASE *pPhrase = NULL; + HRESULT hr = rPhrase.GetPhrase( &pPhrase ); + if ( FAILED( hr ) ) + { + return; + } + CSpDynamicString dstr = L"Rule: \""; + if( pPhrase->Rule.pszName ) + { + dstr.Append( pPhrase->Rule.pszName ); + } + ::CoTaskMemFree( pPhrase ); + + // Now get the text + WCHAR *pwszSpokenText = NULL; + BYTE b; + hr = rPhrase.GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, true, + &pwszSpokenText, &b ); + if ( FAILED( hr ) ) + { + return; + } + dstr.Append( L"\"\nSpoken Text: \"" ); + _ASSERTE( pwszSpokenText ); + if( pwszSpokenText ) + { + dstr.Append( pwszSpokenText ); + } + dstr.Append( L"\"" ); + ::CoTaskMemFree( pwszSpokenText ); + + USES_CONVERSION; + ::MessageBox( hwndClient, W2T( dstr ), _T("Command Mode"), MB_OK ); + +} /* DumpCommandToScreen */ + +/****************************************************************************** +* DEBUG CODE * +******************************************************************************/ +#ifdef _DEBUG +const char * apszTtsEventNames[] = +{ + "SPEI_START_INPUT_STREAM", // = 1 + "SPEI_END_INPUT_STREAM", // = 2 + "SPEI_VOICE_CHANGE", // = 3 + "SPEI_BOOKMARK", // = 4 + "SPEI_WORDBOUNDARY", // = 5 + "SPEI_PHONEME", // = 6 + "SPEI_SENTENCEBOUNDARY", // = 7 + "SPEI_VISEME", // = 8 + "SPEI_TTS_UNDEFINED_0", // = 9 + "SPEI_TTS_UNDEFINED_1", // = 10 + "SPEI_TTS_UNDEFINED_2", // = 11 + "SPEI_TTS_UNDEFINED_3", // = 12 + "SPEI_TTS_UNDEFINED_4", // = 13 + "SPEI_TTS_UNDEFINED_5", // = 14 + "SPEI_TTS_UNDEFINED_6", // = 15 +}; + +const char * apszSrEventNames[] = +{ + "SPEI_END_SR_STREAM", // = 34 + "SPEI_SOUNDSTART", // = 35 + "SPEI_SOUNDEND", // = 36 + "SPEI_PHRASESTART", // = 37 + "SPEI_RECOGNITION", // = 38 + "SPEI_HYPOTHESIS", // = 39 + "SPEI_ATTRIBCHANGED", // = 40 + "SPEI_SR_BOOKMARK", // = 41 + "SPEI_ASYNC_COMPLETED", // = 42 + "SPEI_FALSERECOGNITION", // = 43 + "SPEI_INTERFERENCE", // = 44 + "SPEI_REQUESTUI", // = 45 + "SPEI_RECO_STATE_CHANGE", // = 46 + "SPEI_SR_UNDEFINED_1", // = 47 +}; + +void DumpEventName(int id) +{ + SPDBG_FUNC( "DictPad - DumpEventName" ); + + const char * pszEventName; + + if (id >= SPEI_MIN_SR && id <= SPEI_MAX_SR) + { + pszEventName = apszSrEventNames[id - SPEI_MIN_SR]; + } + else if (id >= SPEI_MIN_TTS && id <= SPEI_MAX_TTS) + { + pszEventName = apszTtsEventNames[id - SPEI_MIN_TTS]; + } + else + { + pszEventName = NULL; + } + + if (pszEventName) + { + SPDBG_DMSG1("dictpad: event = %s\r\n", pszEventName); + } + else + { + SPDBG_DMSG1("dictpad: event = #%d\r\n", id); + } +} +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_cmdmode.xml b/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_cmdmode.xml new file mode 100644 index 00000000..15c24529 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_cmdmode.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +

scroll

+

move

+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+ + + + + +

page

+

pages

+

line

+

lines

+

paragraph

+

paragraphs

+
+
+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+
+

+ +

+ +

page

+

line

+

paragraph

+ + +

up

+

backward

+

backwards

+

down

+

forward

+

forwards

+
+

+ +
+ + + +

+ +

+

+

+ +

+ + + +

+
+
+ + + + +

go home

+

scroll home

+

go end

+

scroll end

+

?move left

+

scroll left

+

?move right

+

scroll right

+

word left

+

word right

+

?line end

+

?line home

+

?line start

+

?line beginning

+
+
+ + + + +

file

+

new

+

open

+

save

+

save as

+

exit

+

edit

+

cut

+

copy

+

paste

+

voice

+

listen for dictation

+

?start dictation

+

start dictating

+

end ?of command mode

+

listen for command

+

listen for commands

+

stop dictation

+

end ?of dictation

+

stop dictating

+

?turn microphone off

+

?turn mike off

+

close microphone

+

microphone on

+

grammars active

+

grammars inactive

+

activate grammars

+

deactivate grammars

+

play

+

play back

+

add ?and delete word

+

select whole word

+

select whole words

+

shared engine

+

shared recognition engine

+

shared reco engine

+

?voice training

+

microphone setup

+

help

+

about

+

cancel

+

escape

+
+
+ + + + +

twenty

+

thirty

+

forty

+

fifty

+

sixty

+

seventy

+

eighty

+

ninety

+
+
+ + + +

one

+

two

+

three

+

four

+

five

+

six

+

seven

+

eight

+

nine

+
+
+ + + +

+ +

+ +

zero

+

ten

+

eleven

+

twelve

+

thirteen

+

fourteen

+

fifteen

+

sixteen

+

seventeen

+

eighteen

+

nineteen

+
+
+
+ + +
diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictmode.xml b/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictmode.xml new file mode 100644 index 00000000..3e7399c3 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictmode.xml @@ -0,0 +1,15 @@ + + + + + + + + + +

command

+

computer

+
+
+ +
diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictpad.rc b/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictpad.rc new file mode 100644 index 00000000..790f6755 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/jpn_dictpad.rc @@ -0,0 +1,111 @@ +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_DICTPAD MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&New\tCtrl+N", ID_FILE_NEW + MENUITEM SEPARATOR + MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN + MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE + MENUITEM "Save &As...", ID_FILE_SAVEAS + MENUITEM SEPARATOR + MENUITEM "E&xit\tCtrl+X", IDM_EXIT + END + POPUP "&Edit" + BEGIN + MENUITEM "Cu&t\tCtrl+X", ID_EDIT_CUT + MENUITEM "&Copy\tCtrl+C", ID_EDIT_COPY + MENUITEM "&Paste\tCtrl+V", ID_EDIT_PASTE + END + POPUP "&Voice" + BEGIN + MENUITEM "Listen for &Dictation", IDM_DICTATION_MODE, CHECKED + MENUITEM "Listen for &Commands", IDM_COMMAND_MODE + MENUITEM "&Grammars active\tCtrl+M", IDM_MIC_TOGGLE + MENUITEM "Play&back\tCtrl+P", IDM_PLAY + MENUITEM SEPARATOR + MENUITEM "&Add/Delete Word(s)...", IDM_ADDREMOVEWORDS + MENUITEM SEPARATOR + MENUITEM "Select &Whole Words", IDM_WHOLE_WORDS, CHECKED + MENUITEM "S&hared recognition engine", IDM_SHAREDENGINE + MENUITEM SEPARATOR + MENUITEM "&Voice Training...", IDM_VOICE_TRAINING + MENUITEM "Micro&phone Setup...", IDM_MICROPHONE_SETUP + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_DICTPAD ACCELERATORS MOVEABLE PURE +BEGIN + "/", IDM_ABOUT, ASCII, ALT, NOINVERT + "?", IDM_ABOUT, ASCII, ALT, NOINVERT + "C", IDM_COMMAND_MODE, VIRTKEY, ALT, NOINVERT + "D", IDM_DICTATION_MODE, VIRTKEY, ALT, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 62 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System" +BEGIN + ICON IDI_DICTPAD,IDC_MYICON,14,9,20,20 + LTEXT "DictPad ",IDC_STATIC,49,10,58,8,SS_NOPREFIX + LTEXT "(c) 2001 Microsoft Corporation.",IDC_STATIC,49,23,177, + 11 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP + LTEXT "All rights reserved.",IDC_STATIC,49,39,177,11 +END + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_COMMAND_MODE_CFG SRGRAMMAR DISCARDABLE "jpn_cmdmode.cfg" +IDR_DICTATION_MODE_CFG SRGRAMMAR DISCARDABLE "jpn_dictmode.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "dictpad" + IDC_DICTPAD "DICTPAD" + IDM_PLAY "Play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_FONT "Allow selection of a different font " + IDM_DICTATION_MODE "Dictation" + IDS_ADD "Add" + IDS_CHANGE "Change" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDM_MIC_TOGGLE "Grammars active/inactive" +END + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.cpp new file mode 100644 index 00000000..da1fed4a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.cpp @@ -0,0 +1,548 @@ +/****************************************************************************** +* phrasereplace.cpp +* Implementation details for the CPhraseReplacement object which +* does the bookkeeping to translate between a phrase as +* displayed with ITN replacements and a phrase as seen +* by the associated RecoResult. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "phrasereplace.h" + +/***************************************************************************** +* CPhraseReplacement::CPhraseReplacement * +*----------------------------------------* +* Description: +* Constructor for the CPhraseReplacement class +*******************************************************************************/ +CPhraseReplacement::CPhraseReplacement() : m_fUseMaps( false ), + m_fSuccessfulSetup( false ), + m_pPhrase( NULL ), + m_cReplacementElements( 0 ), + m_pulPreToPostTable( NULL ), + m_pulPostToPreTable( NULL ), + m_pulPostToReplacementTable( NULL ) +{} /* CPhraseReplacement::CPhraseReplacement */ + +/***************************************************************************** +* CPhraseReplacement::~CPhraseReplacement * +*-----------------------------------------* +* Description: +* Destructor for the CPhraseReplacement class +* Deletes the tables and frees the SPPHRASE. +*******************************************************************************/ +CPhraseReplacement::~CPhraseReplacement() +{ + // If memory was allocated for these, then free + delete[] m_pulPreToPostTable; + delete[] m_pulPostToPreTable; + delete[] m_pulPostToReplacementTable; + + if ( m_pPhrase ) + { + // The SPPHRASE was CoTaskMemAlloc()ed by CPhraseReplacement::Initialize() + // so it needs to be freed + ::CoTaskMemFree( m_pPhrase ); + } +} /* CPhraseRepalcement::~CPhraseReplacement */ + + +/***************************************************************************** +* CPhraseReplacement::Initialize * +*--------------------------------* +* Description: +* Gets the phrase from the ISpPhrase object and calls SetUpMaps(). +* This initialization routine can be called either from a +* client with a new CPhraseReplacement object or +* when an alternate is committed (or the recoresult has +* otherwise changed). +* Return: +* Return value of ISpRecoResult::GetPhrase() +* Return value of CPhraseReplacement::SetUpMaps() +*******************************************************************************/ +HRESULT CPhraseReplacement::Initialize( ISpPhrase &rPhrase ) +{ + // Get (or re-get) the phrase + if ( m_pPhrase ) + { + ::CoTaskMemFree( m_pPhrase ); + } + HRESULT hr = rPhrase.GetPhrase( &m_pPhrase ); + if ( FAILED( hr ) ) + { + return hr; + } + + hr = SetUpMaps(); + m_fSuccessfulSetup = SUCCEEDED( hr ); + m_fUseMaps = (S_OK == hr); + + return hr; +} /* CPhraseReplacement::Initialize */ + +/***************************************************************************** +* CPhraseReplacement::SetUpMaps * +*-------------------------------* +* Description: +* Initializes the various maps in the CPhraseReplacement object. +* Called from within the initialization routines. +* Return: +* S_OK +* S_FALSE if no maps necessary +* E_OUTOFMEMORY +*******************************************************************************/ +HRESULT CPhraseReplacement::SetUpMaps() +{ + _ASSERTE( m_pPhrase ); + if ( !m_pPhrase ) + { + return E_UNEXPECTED; + } + + if ( !m_pPhrase->cReplacements ) + { + // No phrase replacements; nothing needs to be done for this phrase + m_cReplacementElements = m_pPhrase->Rule.ulCountOfElements; + return S_FALSE; + } + + // Temporary place to keep replacement info: + // This array will indicate which elements in the original (non-replaced) + // phrase start off a replacement. + // For instance, in the phrase "I have three dollars", pulPreToReplacementTable[2] + // would indicate that "three" starts off a replacement; there is one replacement + // ($3), so pulPreToReplacementTable[2] would have the value 0. + ULONG *pulPreToReplacementTable = + new ULONG[ m_pPhrase->Rule.ulCountOfElements ]; + if ( !pulPreToReplacementTable ) + { + return E_OUTOFMEMORY; + } + + // Set the value to that will indicate that no replacement starts with this element: + // Since there are m_pPhrase->cReplacements replacements, + // no replacement is going to have the index m_pPhrase->cReplacements + m_ulNoReplacementValue = m_pPhrase->cReplacements; + + // Initialize this array to indicate that no elements kick off replacements + for ( ULONG ul = 0; ul < m_pPhrase->Rule.ulCountOfElements; ul++ ) + { + pulPreToReplacementTable[ul] = m_ulNoReplacementValue; + } + + // Fill in the temporary array that maps pre-replacement elements to the + // replacements they start (if any). + // Count up the number of elements that get replaced. + ULONG cReplacedElements = 0; + for ( ULONG ulReplacement = 0; + ulReplacement < m_pPhrase->cReplacements; + ulReplacement++ ) + { + // Record the replacement's index in the ulFirstElement'th position in the + // temporary array + pulPreToReplacementTable[(m_pPhrase->pReplacements[ulReplacement]).ulFirstElement] + = ulReplacement; + + // Bump the number of replaced elements + cReplacedElements += + (m_pPhrase->pReplacements[ulReplacement]).ulCountOfElements; + } + + // Calculate how many phrase elements there will be after replacement. + // Note that each replacement will be counted as only one element ("$3" is + // one element, as is "June 28, 1977") + m_cReplacementElements = m_pPhrase->Rule.ulCountOfElements + + m_pPhrase->cReplacements - cReplacedElements ; + + // Allocate the appropriate amount of space for the tables. + // Note that a CPhraseReplace object may be initialized more than once + // in its lifetime, so we may need to free up memory previously + // allocated for these tables. + delete[] m_pulPreToPostTable; + delete[] m_pulPostToPreTable; + delete[] m_pulPostToReplacementTable; + + // This table maps from pre-replacement elements to post-replacement elements + // There are ulCountOfElements elements in the pre-replacement phrase + m_pulPreToPostTable = new ULONG[ m_pPhrase->Rule.ulCountOfElements ]; + + // This table maps from post-replacement elements to pre-replacement elements + // There are m_cReplacementElements elements in the post-replacement phrase + m_pulPostToPreTable = new ULONG[ m_cReplacementElements ]; + + // This table maps from post-replacement elements to the replacement (if any) + // to which they correspond. + m_pulPostToReplacementTable = new ULONG[ m_cReplacementElements]; + + // Check to make sure we haven't run into any memory issues + if ( !m_pulPreToPostTable || !m_pulPostToPreTable || !m_pulPostToReplacementTable ) + { + delete[] pulPreToReplacementTable; + + return E_OUTOFMEMORY; + } + + // Fill in the tables. + // There will be two counters + // ulPreReplElement which walks through the elements of the original phrase; + // ulPostReplElement which walks through the elements of the post-replacement phrase. + // Usually with replacements, a post-replacement elements ($3) corresponds to more + // than one pre-replacement element ("three dollars") + ULONG ulPreReplElement = 0; + for ( ULONG ulPostReplElement = 0; + ulPostReplElement < m_cReplacementElements; + ulPostReplElement++ ) + { + // Right now, ulPreReplElement and upPostReplElement are referring to the + // same element (though they may have different values, of course) + m_pulPostToPreTable[ulPostReplElement] = ulPreReplElement; + m_pulPostToReplacementTable[ulPostReplElement] = + pulPreToReplacementTable[ulPreReplElement]; + + if ( m_pulPostToReplacementTable[ulPostReplElement] < m_ulNoReplacementValue ) + { + // This is a replaced element; so several of the pre-replacement + // elements will correspond to this post-replacement element. + + // Use the element-to-replacement info to determine which one, so that + // we know how many pre-replacement elements to grab. + const SPPHRASEREPLACEMENT *pRepl = m_pPhrase->pReplacements + + m_pulPostToReplacementTable[ulPostReplElement]; + + // For each element covered by the replacement, make another pre-replacement + // element map to this post-replacement element and increment + // ulPreReplElement. + // (i.e. both "three" and "dollars" would map to "$3") + for ( ULONG ul = 0; ul < pRepl->ulCountOfElements; ul++, ulPreReplElement++ ) + { + _ASSERTE( ulPreReplElement < m_pPhrase->Rule.ulCountOfElements ); + m_pulPreToPostTable[ulPreReplElement] = ulPostReplElement; + } + } + else + { + // This is not a replaced element, so there is a 1-1 relationship + // between it and the ulPreReplElement'th pre-replacement element + _ASSERTE( ulPreReplElement < m_pPhrase->Rule.ulCountOfElements ); + m_pulPreToPostTable[ulPreReplElement++] = ulPostReplElement; + } + + } + + // Free up temporary array + delete[] pulPreToReplacementTable; + + return S_OK; +} /* CPhraseReplacement::SetUpMaps */ + +/******************************************************************************** +* CPhraseReplacement::GetNumNoReplacementElements * +*-------------------------------------------------* +* Description: +* Gets the number of elements as seen from the recoresult's point of view +* (i.e., without replacement) +**********************************************************************************/ +ULONG CPhraseReplacement::GetNumNoReplacementElements() +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return 0; + } + + return m_pPhrase->Rule.ulCountOfElements; +} /* CPhraseReplacement::GetNumReplacementElements */ + + +/******************************************************************************** +* CPhraseReplacement::GetNumReplacementElements * +*-----------------------------------------------* +* Description: +* Gets the number of elements as seen from the caller's point of view +* (i.e., with replacement) +**********************************************************************************/ +ULONG CPhraseReplacement::GetNumReplacementElements() +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return 0; + } + + if ( m_fUseMaps ) + { + // There are replacements + return m_cReplacementElements; + } + else + { + // There are no replacements + return m_pPhrase->Rule.ulCountOfElements; + } +} /* CPhraseReplacement::GetNumReplacementElements */ + +/******************************************************************************** +* CPhraseReplacement::GetDisplayText * +*------------------------------------* +* Description: +* Hands back the text associated with the given phrase "element" +* If bUseReplacedElements is false or this phrase has no replacements, +* simply returns the display text for the appropriate element. +* Otherwise, consults the element mappings and returns the +* replacement text or the display text for the ulElement'th pre- +* replacement element, as appropriate. +* Return: +* Pointer to a text buffer containing the display text +* NULL if failed +**********************************************************************************/ +const WCHAR * CPhraseReplacement::GetDisplayText( ULONG ulElement, + BYTE *pbDisplayAttributes, + bool bUseReplacedElements ) +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return NULL; + } + + const WCHAR *pwszRetText = NULL; + BYTE bDisplayAttributes = 0; + + if ( !m_fUseMaps || !bUseReplacedElements ) + { + // Do not map; just hand back the display text for the requested + // element + if ( ulElement < m_pPhrase->Rule.ulCountOfElements ) + { + bDisplayAttributes = + m_pPhrase->pElements[ulElement].bDisplayAttributes; + pwszRetText = m_pPhrase->pElements[ulElement].pszDisplayText; + } + } + else + { + // Caller is using a post-replacement index and wants the text from that + // replacement + if ( ulElement < m_cReplacementElements ) + { + if ( m_pulPostToReplacementTable[ulElement] < m_pPhrase->cReplacements ) + { + // This is a replaced element; hand back the replacement text + // and attributes + const SPPHRASEREPLACEMENT *pRepl = m_pPhrase->pReplacements + + m_pulPostToReplacementTable[ulElement]; + pwszRetText = pRepl->pszReplacementText; + bDisplayAttributes = pRepl->bDisplayAttributes; + } + else + { + // This element has not been replaced; hand back the text + // and attributes corresponding to the appropriate + // pre-replacement element + ULONG ulPreReplElement = m_pulPostToPreTable[ulElement]; + pwszRetText = m_pPhrase->pElements[ulPreReplElement].pszDisplayText; + bDisplayAttributes = + m_pPhrase->pElements[ulPreReplElement].bDisplayAttributes; + } + } + } + + if ( pbDisplayAttributes ) + { + *pbDisplayAttributes = bDisplayAttributes; + } + + // In case of error, this remains NULL + return pwszRetText; + +} /* CPhraseReplacement::GetDisplayText */ + +/******************************************************************************** +* CPhraseReplacement::PreToPostReplacementIndex * +*-----------------------------------------------* +* Description: +* Converts from a pre-replacement index to a with-replacement index. +* If ulSPPHRASEIndex is equal to the number of (pre-replacement) elements +* will return the number of post-replacement elements in +* *pulReplacedPhraseIndex +* Return: +* S_OK +* E_POINTER +* E_FAIL +* E_INVALIDARG if ulSPPHRASEIndex is out-of-bounds +**********************************************************************************/ +HRESULT CPhraseReplacement::PreToPostReplacementIndex( ULONG ulSPPHRASEIndex, + ULONG *pulReplacedPhraseIndex) +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return E_FAIL; + } + + if ( !pulReplacedPhraseIndex ) + { + return E_POINTER; + } + if ( ulSPPHRASEIndex > m_pPhrase->Rule.ulCountOfElements ) + { + // Out of bounds index + return E_INVALIDARG; + } + + if ( ulSPPHRASEIndex == m_pPhrase->Rule.ulCountOfElements ) + { + *pulReplacedPhraseIndex = m_fUseMaps ? + m_cReplacementElements : m_pPhrase->Rule.ulCountOfElements; + } + else + { + // If the maps are valid, do a lookup; + // otherwise just return the original index + *pulReplacedPhraseIndex = m_fUseMaps ? + m_pulPreToPostTable[ulSPPHRASEIndex] : ulSPPHRASEIndex; + } + + return S_OK; +} /* CPhraseReplacement::PreToPostReplacementIndex */ + +/******************************************************************************** +* CPhraseReplacement::PostToPreReplacementIndex * +*-----------------------------------------------* +* Description: +* Converts from a with-replacement index to a pre-replacement index +* If ulReplacedPhraseIndex is equal to the number of (post-replacement) +* elements, will return the number of pre-replacement elements in +* *pulSPPHRASEIndex +* Return: +* S_OK +* E_POINTER +* E_FAIL +* E_INVALIDARG if ulReplacedPhraseIndex is out-of-bounds +**********************************************************************************/ +HRESULT CPhraseReplacement::PostToPreReplacementIndex( ULONG ulReplacedPhraseIndex, + ULONG *pulSPPHRASEIndex ) +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return E_FAIL; + } + + if ( !pulSPPHRASEIndex ) + { + return E_POINTER; + } + if ( ulReplacedPhraseIndex > m_cReplacementElements ) + { + // Out of bounds index + return E_INVALIDARG; + } + + if ( ulReplacedPhraseIndex == m_cReplacementElements ) + { + *pulSPPHRASEIndex = m_pPhrase->Rule.ulCountOfElements; + } + else + { + // If the maps are valid, do a lookup; + //otherwise just return the original index + *pulSPPHRASEIndex = m_fUseMaps ? + m_pulPostToPreTable[ulReplacedPhraseIndex] : ulReplacedPhraseIndex; + } + + return S_OK; +} /* CPhraseReplacement::PostToPreReplacementIndex */ + +/******************************************************************************** +* CPhraseReplacement::ExpandToIncludeWholeReplacements * +*------------------------------------------------------* +* Description: +* Takes pre-replacement indices in the in/out params pulPreReplStart and +* pcPreReplElts and expands them, if necessary, to contain entire +* replacements. +* Example: "Thirty nine is the first uninteresting number." +* If *pulPreReplStart = 1 and *pcPreReplElts = 4, then when this +* function returns *pulPreReplStart = 0 and *pcPreReplElts = 5 (in order +* to include "thirty" at the beginning) +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if *pulPreReplStart and *pcPreReplElts indicate an +* out-of-bounds range or if *pcPreReplElts is 0 +**********************************************************************************/ +HRESULT CPhraseReplacement::ExpandToIncludeWholeReplacements( ULONG *pulPreReplStart, + ULONG *pcPreReplElts ) +{ + if ( !m_fSuccessfulSetup ) + { + _ASSERTE( false ); + return E_FAIL; + } + + if ( !pulPreReplStart || !pcPreReplElts ) + { + return E_POINTER; + } + + if ( !m_fUseMaps ) + { + // Don't need to do anything since there are no maps + return S_OK; + } + + // Validate params + if ( (*pulPreReplStart >= GetNumNoReplacementElements()) || + (0 == *pcPreReplElts) || + ((*pulPreReplStart + *pcPreReplElts) > GetNumNoReplacementElements()) ) + { + // Out-of-bounds range or degenerate element range + return E_INVALIDARG; + } + + // Convert the start to a post-replacement value and see if that + // element has any replacement associated with it + ULONG ulPostReplStart; + HRESULT hr = PreToPostReplacementIndex( *pulPreReplStart, &ulPostReplStart ); + if ( SUCCEEDED( hr ) ) + { + ULONG ulReplacement = m_pulPostToReplacementTable[ ulPostReplStart ]; + if ( ulReplacement < m_ulNoReplacementValue ) + { + // There is an associated replacement + // Move back *pulPreReplStart to the beginning of what that replacement replaces + const SPPHRASEREPLACEMENT *pRepl = m_pPhrase->pReplacements + ulReplacement; + *pulPreReplStart = pRepl->ulFirstElement; + } + } + else + { + return hr; + } + + // Do the same for the last element + ULONG ulPreReplLast = *pulPreReplStart + *pcPreReplElts - 1; + ULONG ulPostReplLast; + hr = PreToPostReplacementIndex( ulPreReplLast, &ulPostReplLast ); + if ( SUCCEEDED( hr ) ) + { + ULONG ulReplacement = m_pulPostToReplacementTable[ ulPostReplLast ]; + if ( ulReplacement < m_ulNoReplacementValue ) + { + // There is an associated replacement + // Advance ulPreReplLast to the last element that the replacement replaces + const SPPHRASEREPLACEMENT *pRepl = m_pPhrase->pReplacements + ulReplacement; + ulPreReplLast = pRepl->ulFirstElement + pRepl->ulCountOfElements - 1; + } + } + else + { + return hr; + } + + // Adjust the count of elements + *pcPreReplElts = ulPreReplLast - *pulPreReplStart + 1; + + return S_OK; +} /* CPhraseReplacement::ExpandToIncludeWholeReplacements */ diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.h new file mode 100644 index 00000000..24f9f629 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/phrasereplace.h @@ -0,0 +1,61 @@ +/**************************************************************************** +* phrasereplace.h +* This module contains the definition support for CPhraseReplacement, +* which does the bookkeeping to translate between a phrase as +* displayed with ITN replacements and a phrase as thought of +* by the associated RecoResult +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#pragma once + +#ifndef __PHRASEREPLACE_H +#define __PHRASEREPLACE_H + +class CPhraseReplacement +{ +public: + CPhraseReplacement(); + ~CPhraseReplacement(); + + HRESULT Initialize( ISpPhrase &rSpPhrase ); + + ULONG GetNumNoReplacementElements(); + ULONG GetNumReplacementElements(); + + // Gets the text of a given element + const WCHAR * GetDisplayText( ULONG ulElement, + BYTE *pbDisplayAttributes = NULL, + bool bUseReplacedElements = true ); + + // Conversion methods + HRESULT PreToPostReplacementIndex( ULONG ulSPPHRASEIndex, + ULONG *pulReplacePhraseIndex ); + HRESULT PostToPreReplacementIndex( ULONG ulReplacedPhraseIndex, + ULONG *pulSPPHRASEIndex ); + HRESULT ExpandToIncludeWholeReplacements( ULONG *pulPreReplStart, + ULONG *pcPreReplElts ); + +private: + HRESULT SetUpMaps(); // Does the real initialization work + + bool m_fUseMaps; // Indicates whether to use the maps + bool m_fSuccessfulSetup; // Indicates the this object is usable + + SPPHRASE *m_pPhrase; + ULONG m_cReplacementElements; // Number of elements after + // replacements have been made + ULONG *m_pulPreToPostTable; // Given the index of an element in the phrase, + // contains the index of that element with + // replacements + ULONG *m_pulPostToPreTable; // Given the index of an element with replacements, + // contains the index of that element in the + // original phrase + ULONG *m_pulPostToReplacementTable; // Given the index of an element with replacements, + // indicates which replacement (if any) that + // element corresponds to + ULONG m_ulNoReplacementValue; // Value in tables to indicate that no + // replacement corresponds to this element. +}; // class CPhraseReplacement + +#endif // __PHRASEREPLACE_H \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/readme.txt b/sp/src/utils/sapi51/Samples/CPP/DictPad/readme.txt new file mode 100644 index 00000000..99fd1c7d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/readme.txt @@ -0,0 +1,56 @@ +======================================================================== + WIN32 APPLICATION : dictpad +======================================================================== + + +AppWizard has created this dictpad application for you. + +This file contains a summary of what you will find in each of the files that +make up your dictpad application. + +dictpad.cpp + This is the main application source file. + +dictpad.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + + +///////////////////////////////////////////////////////////////////////////// +AppWizard has created the following resources: + +dictpad.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +res\dictpad.ico + This is an icon file, which is used as the application's icon (32x32). + This icon is included by the main resource file dictpad.rc. + +small.ico + %%This is an icon file, which contains a smaller version (16x16) + of the application's icon. This icon is included by the main resource + file dictpad.rc. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named dictpad.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + + +///////////////////////////////////////////////////////////////////////////// diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.cpp new file mode 100644 index 00000000..5ba94243 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.cpp @@ -0,0 +1,546 @@ +/**************************************************************************** +* recomgr.cpp +* Support for queuing insertion points and correctly placing +* recognized text +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include +#include "recomgr.h" + +/**************************************************************************** +* CRecoEventMgr::CRecoEventMgr * +*------------------------------* +* Description: +* Constructor for the recoevent manager +*****************************************************************************/ +CRecoEventMgr::CRecoEventMgr( HINSTANCE hInstance ) : + m_hInst( hInstance ), + m_fPhraseStarted( false ), + m_pTextSel( NULL ), + m_pHeadLP( NULL ), + m_pHeadWM( NULL ), + m_pTailWM( NULL ) +{ +} /* CRecoEventMgr::CRecoEventMgr */ + +/**************************************************************************** +* CRecoEventMgr::~CRecoEventMgr * +*-------------------------------* +* Description: +* Destructor for the recoevent manager +*****************************************************************************/ +CRecoEventMgr::~CRecoEventMgr() +{ + CleanUp(); +} /* CRecoEventMgr::~CRecoEventMgr */ + + +/**************************************************************************** +* CRecoEventMgr::PhraseStart * +*----------------------------* +* Description: +* Sets the flag to indicate that a phrase has been started. +* Drops a listen point by calling SelNotify() +* Return: +* S_OK +* E_OUTOFMEMORY +* Return value of CRecoEventMgr::SelNotify() +*****************************************************************************/ +HRESULT CRecoEventMgr::PhraseStart( ITextRange &rSelRange ) +{ + // There should not be any phrases in progress or any listen points + _ASSERTE( !m_fPhraseStarted && !m_pHeadLP ); + m_fPhraseStarted = true; + + // Should add a listening point right now + HRESULT hr = SelNotify( rSelRange ); + if ( FAILED( hr ) ) + { + return hr; + } + + if ( !m_pHeadLP ) + { + return E_OUTOFMEMORY; + } + + m_pHeadLP->fFromPhraseStart = true; + + return S_OK; +} /* CRecoEventMgr::PhraseStart */ + +/**************************************************************************** +* CRecoEventMgr::SelNotify * +*--------------------------* +* Description: +* Called whenever the selection changes. +* Drops a new listening point onto the list of listening points for +* this phrase if there is a phrase currently being processed +* being listened to. +* Hands back the range to be eventually replaced by recognized +* text (or deleted). +* Return: +* S_OK +* S_FALSE if nothing had to be done +* E_OUTOFMEMORY +* Return value of ITextRange::GetDuplicate() +* Return value of ITextRange::Collapse() +*****************************************************************************/ +HRESULT CRecoEventMgr::SelNotify( ITextRange &rSelRange ) +{ + // Only want to queue this listen if we are listening to a phrase + HRESULT hr = S_FALSE; + if ( m_fPhraseStarted ) + { + // Get the time now + FILETIME ftNow; + ::CoFileTimeNow( &ftNow ); + + // Does this range overlap any of the existing ranges in the list? + LISTENPOINT *p; + for ( p = m_pHeadLP; + p && AreDisjointRanges( &rSelRange, p->cpRangeToReplace ); + p = p->pNext ) + ; + + // If p is not NULL, that means that there is already some listen point + // that is adjacent to or overlaps this range, so another listen point + // is not necessary + if ( !p ) + { + // Add a new listen point + LISTENPOINT *pNewPoint = new LISTENPOINT; + if ( !pNewPoint ) + { + return E_OUTOFMEMORY; + } + + // Get the ranges + hr = rSelRange.GetDuplicate( &(pNewPoint->cpRangeToReplace) ); + + // Get the timestamp + pNewPoint->ftTime = ftNow; + + // This flag will be set by PhraseStart() if appropriate + pNewPoint->fFromPhraseStart = false; + + // No hypothesis text here yet + pNewPoint->fHasHypothesisText = false; + + // Put this new listenpoint onto the head of the list + pNewPoint->pNext = m_pHeadLP; + m_pHeadLP = pNewPoint; + + long lEndOfRangeToReplace; + pNewPoint->cpRangeToReplace->GetEnd( &lEndOfRangeToReplace ); + + // The selection should be forced to the end of the range to replace; + // this keeps the selection out of ranges that might be replaced + // by recognized text + m_pTextSel->SetRange( + lEndOfRangeToReplace, lEndOfRangeToReplace ); + + // If we got here, we were successful + hr = S_OK; + } + } + return hr; +} /* CRecoEventMgr::SelNotify */ + +/**************************************************************************** +* CRecoEventMgr::IsEditable * +*---------------------------* +* Description: +* Determines whether pRange overlaps any of the current listen points. +* If it does, and if pNextEditableRange is non-NULL, sets +* pNextEditableRange to the next range that can be edited with +* impunity +* Return: +* true iff the RecoEventMgr is okay with this text being edited +*****************************************************************************/ +bool CRecoEventMgr::IsEditable( ITextRange *pRange, + ITextRange **ppNextEditableRange ) +{ + if ( !pRange ) + { + return false; + } + if ( !m_fPhraseStarted ) + { + // Always editable if there's no reco computation + return true; + } + + // Does this range overlap or abut any of the existing ranges in the list? + LISTENPOINT *p; + for ( p = m_pHeadLP; + p && AreDisjointRanges( pRange, p->cpRangeToReplace ); + p = p->pNext ) + ; + + if ( p ) + { + // There is a phrase that overlaps or abuts this one. + // If pRange dovetails onto the end of it, then the + // range is editable; otherwise it is not + long lRangeStart = 0; + long lLPEnd = 0; + pRange->GetStart( &lRangeStart ); + p->cpRangeToReplace->GetEnd( &lLPEnd ); + + if ( lRangeStart < lLPEnd ) + { + // If pNextEditableRange is non-NULL, set it a degenerate range + // at the end of the listen point range + if ( ppNextEditableRange ) + { + // Release whatever is already there + if ( *ppNextEditableRange ) + { + (*ppNextEditableRange)->Release(); + } + + // Get a duplicate of the range to replace and collapse at the end + HRESULT hr = p->cpRangeToReplace->GetDuplicate( ppNextEditableRange ); + if ( SUCCEEDED( hr ) ) + { + (*ppNextEditableRange)->Collapse( tomEnd ); + } + else + { + *ppNextEditableRange = NULL; + } + } + return false; + } + } + + // pRange is editable + // Leave ppNextEditableRange, whatever it is + + return true; +} /* CRecoEventMgr::IsEditable */ + +/**************************************************************************** +* CRecoEventMgr::QueueCommand * +*-----------------------------* +* Description: +* Called when the engine is currently processing a phrase. +* Puts the command at the tail of the command queue. +*****************************************************************************/ +void CRecoEventMgr::QueueCommand( HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam ) +{ + if ( !m_fPhraseStarted ) + { + // Don't queue commands unless a phrase is being processed + return; + } + + QUEUEDWM *pWM = new QUEUEDWM; + if ( !pWM ) + { + // Out of memory: This WM_COMMAND will get dropped + return; + } + pWM->hWnd = hWnd; + pWM->message = message; + pWM->wParam = wParam; + pWM->lParam = lParam; + pWM->pNext = NULL; + + if ( m_pTailWM ) + { + // Non-empty queue + m_pTailWM->pNext = pWM; + m_pTailWM = pWM; + } + else + { + // Empty queue + m_pHeadWM = m_pTailWM = pWM; + } +} /* CRecoEventMgr::QueueCommand */ + +/**************************************************************************** +* CRecoEventMgr::Hypothesis * +*---------------------------* +* Description: +* Called whenever a hypothesis comes back to Dictpad. +* Looks for the latest listening point whose timestamp predates ftRecoTime +* or for the phrase-start-generated listening point, +* whichever came later. +* Hands back the range to be replaced by the recognized text, or NULL +* if this hypothesis is to be dropped (i.e. did not come between +* a PHRASE_START and a RECOGNITION/FALSE_RECOGNITION +* Return: +* A pointer to an ITextRange in which the hypothesis should go. +* NULL in case of error. +*****************************************************************************/ +ITextRange * CRecoEventMgr::Hypothesis( FILETIME ftRecoTime ) +{ + if ( !m_fPhraseStarted || !m_pHeadLP ) + { + // This hypothesis did not come between a PHRASE_START and a RECOGNITION, + // so we drop it + return NULL; + } + + // Since the listen points are ordered by most recent first, we are + // looking for the first element whose timestamp predates ftRecoTime + LISTENPOINT *p = m_pHeadLP; + for ( p = m_pHeadLP; + p && (CompareFiletimes( ftRecoTime, p->ftTime ) < 0) && + !(p->fFromPhraseStart); + p = p->pNext ) + ; + + if ( !p ) + { + // Should not happen! There should at least be a listen point queued + // from PhraseStart() on this phrase + _ASSERTE( false ); + return NULL; + } + + // This listen point has now been marked to receive hypothesis text + p->fHasHypothesisText = true; + + return p->cpRangeToReplace; +} /* CRecoEventMgr::Hypothesis */ + +/**************************************************************************** +* CRecoEventMgr::Recognition * +*----------------------------* +* Description: +* Called whenever a recognition comes back to Dictpad. +* Looks for the latest listening point whose timestamp predates +* ftRecoTime or for the phrase-start-generated listening point, +* whichever came later. +* Deletes all earlier listening points. +* Hands back a duplicate of the range to be replaced by the recognized +* text. +* Return: +* S_OK +* S_FALSE if the recognition was from some phrase that was started +* when our grammars were inactive. +* Return value from ITextRange::GetDuplicate() +*****************************************************************************/ +HRESULT CRecoEventMgr::Recognition( FILETIME ftRecoTime, ITextRange **ppRecoRange ) +{ + + // A SPEI_RECOGNITION without a SPEI_PHRASE_START means that the phrase was + // started when our grammars were inactive, so we'd like to ignore this one. + if ( !m_fPhraseStarted || !m_pHeadLP ) + { + return S_FALSE; + } + + // Since the listen points are ordered by most recent first, we are + // looking for the first element whose timestamp predates ftRecoTime + LISTENPOINT *p = m_pHeadLP; + for ( p = m_pHeadLP; + p && (CompareFiletimes( ftRecoTime, p->ftTime ) < 0) && !(p->fFromPhraseStart); + p = p->pNext ) + ; + + _ASSERTE( p ); + if ( !p ) + { + // Should not happen! + return E_UNEXPECTED; + } + + // Get rid of all subsequent (earlier) listening points + DeleteAfter( p ); + + // Get the range to return. + // Make a duplicate, since this range will be destroyed before the caller + // can AddRef it. + HRESULT hr = p->cpRangeToReplace->GetDuplicate( ppRecoRange ); + + // This listen point will now contain real (non-hypothesis) text + p->fHasHypothesisText = false; + + // p will get cleaned up later when DoneProcessingPhrase() is called + + return hr; +} /* CRecoEventMgr::Recognition */ + +/**************************************************************************** +* CRecoEventMgr::FalseRecognition * +*---------------------------------* +* Description: +* Called whenever a false recognition comes back to Dictpad. +* Finds the phrase-start-marked listen point +* and deletes everything after it +*****************************************************************************/ +void CRecoEventMgr::FalseRecognition() +{ + if ( !m_fPhraseStarted || !m_pHeadLP ) + { + // This means that this is a RECO_OTHER_CONTEXT, or a recognition for + // a grammar other than dictation within our own context, neither of + // which we care about + return; + } + + // Clean up anything that happened before the start of this utterance + for ( LISTENPOINT *p = m_pHeadLP; p && !(p->fFromPhraseStart); p = p->pNext ) + { + ; + } + if ( p ) + { + DeleteAfter( p ); + } + + // p will get cleaned up later when DoneProcessingPhrase() is called + +} /* CRecoEventMgr::FalseRecognition */ + +/**************************************************************************** +* CRecoEventMgr::DoneProcessingPhrase * +*-------------------------------------* +* Description: +* Sets m_fPhraseStarted to false. +* Calls CleanUp() to clean up the listen point list +* and WM_COMMAND queue. +*****************************************************************************/ +void CRecoEventMgr::DoneProcessingPhrase() +{ + m_fPhraseStarted = false; + CleanUp(); +} /* CRecoEventMgr::DoneProcessingPhrase */ + +/**************************************************************************** +* CRecoEventMgr::CleanUp * +*------------------------* +* Description: +* Deletes all nodes. +* Resends the queued messages and cleans up the queue +*****************************************************************************/ +void CRecoEventMgr::CleanUp() +{ + m_fPhraseStarted = false; + + // Remove any hypothesis text + for ( LISTENPOINT *p = m_pHeadLP; p; p = p->pNext ) + { + if ( p->fHasHypothesisText && p->cpRangeToReplace ) + { + p->cpRangeToReplace->SetText( L"" ); + } + } + + // Clean up the listen point list + if ( m_pHeadLP ) + { + DeleteAfter( m_pHeadLP ); + delete m_pHeadLP; + m_pHeadLP = NULL; + } + + // Resend the WM_x messages that had been waiting during the computation + // on the phrase and clean up the queue + QUEUEDWM *pWM; + while ( m_pHeadWM ) + { + pWM = m_pHeadWM; + ::SendMessage( pWM->hWnd, pWM->message, pWM->wParam, pWM->lParam ); + + m_pHeadWM = m_pHeadWM->pNext; + delete pWM; + } + m_pHeadWM = m_pTailWM = NULL; +} /* CRecoEventMgr::CleanUp */ + + +/**************************************************************************** +* CRecoEventMgr::DeleteAfter * +*----------------------------* +* Description: +* Deletes all nodes after pCutoff. +*****************************************************************************/ +void CRecoEventMgr::DeleteAfter( LISTENPOINT *pCutoff ) +{ + if ( pCutoff ) + { + LISTENPOINT *p, *pNextInLine; + for ( p = pCutoff->pNext; p; p = pNextInLine ) + { + pNextInLine = p->pNext; + delete p; + } + } + + pCutoff->pNext = NULL; +} /* CRecoEventMgr::DeleteAfter */ + +/**************************************************************************** +* CompareFiletimes * +*------------------* +* Return: +* -1 if ft1 is earlier than ft2 +* 0 if ft1 == ft2 +* 1 if ft1 is greater than ft2 +*****************************************************************************/ +int CompareFiletimes( FILETIME ft1, FILETIME ft2 ) +{ + if ( ft1.dwHighDateTime < ft2.dwHighDateTime ) + { + return -1; + } + else if ( ft1.dwHighDateTime > ft2.dwHighDateTime ) + { + return 1; + } + else + { + if ( ft1.dwLowDateTime < ft2.dwLowDateTime ) + { + return -1; + } + else if ( ft1.dwLowDateTime > ft2.dwLowDateTime ) + { + return 1; + } + else + { + return 0; + } + } +} /* CompareFiletimes */ + +/**************************************************************************** +* AreDisjointRanges * +*-------------------* +* Description: +* Suppose Range1 has limits cpMin1, cpMax1. +* Suppose Range2 has limits cpMin2, cpMax2. +* Range1 and Range2 are disjoint iff +* cpMin2 > cpMax1 OR cpMax2 < cpMin1. +* That is, they are disjoint iff there is no overlap and they do not +* dovetail. +* Return: +* true iff the two ranges neither overlap nor abut. +*****************************************************************************/ +bool AreDisjointRanges( ITextRange *pRange1, ITextRange *pRange2 ) +{ + if ( !( pRange1 && pRange2 ) ) + { + return true; + } + + long cpMin1, cpMax1, cpMin2, cpMax2; + pRange1->GetStart( &cpMin1 ); + pRange1->GetEnd( &cpMax1 ); + pRange2->GetStart( &cpMin2 ); + pRange2->GetEnd( &cpMax2 ); + + return (( cpMin2 > cpMax1 ) || ( cpMax2 < cpMin1 )); +} /* AreDisjointRanges */ diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.h new file mode 100644 index 00000000..bda1facd --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/recomgr.h @@ -0,0 +1,101 @@ +/**************************************************************************** +* recomgr.h +* Support for queuing insertion points and correctly placing +* recognized text +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#pragma once + +#ifndef __RECOMGR_H +#define __RECOMGR_H + +// A structure that represents a range waiting for a possible dictation result +typedef struct LISTENPOINT +{ + CComPtr cpRangeToReplace; // The entire range to be replaced + // when a recognition comes back + FILETIME ftTime; + bool fFromPhraseStart; // Indicates that this + // listening point was added + // because a phrasestart + // happened + bool fHasHypothesisText; // Indicates that this listen point + // has some hypothesis text associated + // with it + LISTENPOINT *pNext; +} LISTENPOINT; + +// A queued message +typedef struct QUEUEDWM +{ + HWND hWnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + QUEUEDWM *pNext; +} QUEUEDWM; + + +/***************************************************************************** +* CRecoEventMgr * +*---------------* +* Handles the placement of recognized text according to the timing of +* the events +******************************************************************************/ +class CRecoEventMgr +{ + public: + CRecoEventMgr( HINSTANCE hInstance ); + ~CRecoEventMgr(); + + void SetTextSel( ITextSelection *pTextSel ) { m_pTextSel = pTextSel; } + bool IsProcessingPhrase() { return m_fPhraseStarted; } + + // Methods called by app to notify CRecoEventMgr of events + HRESULT PhraseStart( ITextRange &rSelRange ); + // Called when a PHRASE_START + // notification is received + HRESULT SelNotify( ITextRange &rSelRange ); // Called whenever the + // selection has changed + bool IsEditable( ITextRange *pRange, ITextRange **ppNextEditableRange ); + // Returns false iff there is + // currently a reco computation + // going on and the current sel + // overlaps a listen point + void QueueCommand( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + // Called when a WM_ messsage + // is received during a + // reco computation + ITextRange * Hypothesis( FILETIME ftRecoTime ); + HRESULT Recognition( FILETIME ftRecoTime, ITextRange **ppRecoRange ); + void FalseRecognition(); + + // Methods called by app when phrase-computation is over + void DoneProcessingPhrase(); // Turns off m_fPhraseStarted + // and cleans up the list + private: + void CleanUp(); // Frees up the lists and + // unleashes the waiting WM_s + + void DeleteAfter( LISTENPOINT *pCutoff ); + // Will delete all points in + // in the listening point list + // after pCutoff + // the head of the list + + HINSTANCE m_hInst; // HINSTANCE for LoadString() + bool m_fPhraseStarted; // true iff there is a phrase being processed + ITextSelection *m_pTextSel; // The selection in dictpad's window + LISTENPOINT *m_pHeadLP; // List of listening points, most recent first + QUEUEDWM *m_pHeadWM; // Queue of WM_s + QUEUEDWM *m_pTailWM; + +}; /* class CRecoEventMgr */ + +// Helper function +int CompareFiletimes( FILETIME ft1, FILETIME ft2 ); +bool AreDisjointRanges( ITextRange *pRange1, ITextRange *pRange2 ); +bool AreNonOverlappingRanges( ITextRange *pRange1, ITextRange *pRange2 ); + +#endif // __RECOMGR_H \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/resource.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/resource.h new file mode 100644 index 00000000..c831321e --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/resource.h @@ -0,0 +1,136 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by dictpad.rc +// +#define IDC_MYICON 2 +#define IDC_REMOVEFROMLEX 3 +#define IDC_ADDBACKTOLEX 4 +#define IDD_DICTPAD_DIALOG 101 +#define IDD_ABOUTBOX 102 +#define IDS_APP_TITLE 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDS_HELLO 106 +#define IDI_DICTPAD 107 +#define IDI_SMALL 108 +#define IDC_DICTPAD 109 +#define IDC_TOOLBAR 110 +#define IDM_PLAY 111 +#define IDM_MIC_TOGGLE 112 +#define IDC_STATUSBAR 113 +#define IDR_MAINFRAME 128 +#define IDB_BITMAP2 132 +#define IDB_BITMAP1 134 +#define IDR_TOOLBAR 135 +#define IDB_BITMAP3 139 +#define IDR_DICTATION_MODE_CFG 140 +#define IDR_COMMAND_MODE_CFG 141 +#define IDD_ADDREMOVEWORDS 142 +#define IDD_ADDREMOVEBOX 142 +#define IDD_WORDPRONUNCIATIONBOX 142 +#define IDD_ADDREMOVEWORDSBOX 146 +#define IDD_REVIEWPRONUNCIATIONSBOX 147 +#define IDD_USERLEXBOX 148 +#define IDR_TOOLBAR1 149 +#define IDD_ALTERNATES 154 +#define IDC_ABOUT_DICTPAD_VERSION 1000 +#define IDC_ABOUT_COMPONENTS 1001 +#define IDC_CHANGE 1006 +#define IDC_DELETE 1007 +#define IDC_PLAY 1009 +#define IDC_SOUNDSLIKE 1011 +#define IDC_WORD 1013 +#define IDC_COMBO_AUDIO 1014 +#define IDC_COMBO_POS 1018 +#define IDC_LIST_PRONS 1025 +#define IDC_ADD 1027 +#define IDC_RADIO_SINGLEWORD 1030 +#define IDC_RADIO_ADDFROMDOC 1031 +#define IDC_LIST_NEWWORDS 1031 +#define IDC_RADIO_ADDFROMSEL 1032 +#define IDC_RADIO_ADDFROMSPELLING 1033 +#define IDC_REMOVE 1034 +#define IDC_LIST_WORDSINLEX 1034 +#define IDC_LIST_WORDSOUTOFLEX 1035 +#define IDC_LIST1 1037 +#define IDC_CANDIDATELIST 1037 +#define IDM_FONT 32771 +#define IDM_DICTATION_MODE 32772 +#define IDS_TB0 32773 +#define IDM_COMMAND_MODE 32774 +#define ID_VOICE_ADDREMOVEWORDS 32775 +#define IDM_VOICE_ADDREMOVEWORDS 32776 +#define IDM_ADDREMOVEWORDS 32776 +#define IDM_COMMANDS 32777 +#define IDS_ADD 32778 +#define IDM_VOICE_TRAINING 32779 +#define IDS_CHANGE 32779 +#define IDM_WHOLE_WORDS 32780 +#define IDS_NONEWWORDS 32780 +#define IDM_AUTO_PLAYBACK 32781 +#define IDS_NOWORDSADDED 32781 +#define IDS_TB1 32782 +#define IDS_WAITING 32782 +#define IDM_MODE_TOGGLE 32783 +#define IDS_INVALIDFILEFORMAT 32783 +#define IDS_CANNOTOPEN 32784 +#define IDS_ERRORSAVING 32785 +#define IDS_CANNOTSAVE 32786 +#define IDS_CONFIRMCLOSE 32787 +#define IDS_MICROPHONESETUPWIZARD 32791 +#define IDS_ACCESSDENIED 32793 +#define IDS_CANNOTSWITCHMODES 32794 +#define IDS_CANNOTFILENEW 32795 +#define ID_BUTTON32796 32796 +#define IDS_UPDATEERROR 32796 +#define ID_BUTTON32797 32797 +#define IDS_UNSUPPORTEDLANG 32797 +#define ID_BUTTON32798 32798 +#define ID_BUTTON32799 32799 +#define ID_BUTTON32800 32800 +#define ID_BUTTON32801 32801 +#define ID_BUTTON32802 32802 +#define ID_BUTTON32803 32803 +#define ID_BUTTON32804 32804 +#define ID_BUTTON32805 32805 +#define ID_BUTTON32806 32806 +#define ID_BUTTON32807 32807 +#define ID_BUTTON32808 32808 +#define ID_BUTTON32809 32809 +#define ID_BUTTON32810 32810 +#define ID_BUTTON32811 32811 +#define ID_BUTTON32812 32812 +#define ID_BUTTON32813 32813 +#define ID_BUTTON32814 32814 +#define ID_BUTTON32815 32815 +#define ID_FILE_OPEN 32816 +#define ID_FILE_SAVE 32817 +#define ID_FILE_SAVEAS 32818 +#define ID_FILE_NEW 32819 +#define ID_EDIT_UNDO 32820 +#define ID_EDIT_REDO 32821 +#define ID_EDIT_CUT 32822 +#define ID_EDIT_COPY 32823 +#define ID_EDIT_PASTE 32824 +#define ID_HELP_CONTENTS 32825 +#define ID_HELP_SEARCH 32826 +#define ID_HELP_INDEX 32827 +#define IDM_USERLEX 32828 +#define IDB_DICTMODE 32829 +#define IDB_COMMANDMODE 32830 +#define IDB_PLAY 32831 +#define IDB_MICTOGGLE 32832 +#define IDM_MICROPHONE_SETUP 32835 +#define IDM_SHAREDENGINE 32836 +#define IDC_LIST_ALTS 32837 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 157 +#define _APS_NEXT_COMMAND_VALUE 32839 +#define _APS_NEXT_CONTROL_VALUE 1038 +#define _APS_NEXT_SYMED_VALUE 114 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.cpp new file mode 100644 index 00000000..d952ab66 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.cpp @@ -0,0 +1,755 @@ +/****************************************************************************** +* resultcontainer.cpp +* This module contains the definition of CResultContainer. +* CResultContainer makes all of the recognition-object- +* specific SAPI5 calls +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resultcontainer.h" + +/********************************************************************** +* CResultContainer::CResultContainer * +*------------------------------------* +* Description: +* Constructor for the CResultContainer class. +* A CResultContainer is created by the first CDictationRun +* to be created for a given result object. +**********************************************************************/ +CResultContainer::CResultContainer( ISpRecoResult &rResult, + CDictationRun &rFirstOwner, + CPhraseReplacement &rPhraseReplacement ) : + m_cpRecoResult( &rResult ), + m_pPhraseReplacement( &rPhraseReplacement ), + m_pOwnerListHead( NULL ), + m_cLastRequestedAltsReturned( 0 ), + m_ulStartOfLastRequestedAlts( 0 ), + m_cElementsInLastRequestedAlts( 0 ) +{ + // The owner should go onto the list + m_pOwnerListHead = new OWNERNODE; + if ( m_pOwnerListHead ) + { + m_pOwnerListHead->pOwner = &rFirstOwner; + m_pOwnerListHead->pNext = NULL; + } + // If the allocation failed, all calls that need it + // will return E_OUTOFMEMORY + + // Zero out the requested phrase alternates array + memset( (void *) m_apLastRequestedPhraseAlts, 0, + ALT_REQUEST_COUNT * sizeof( ISpPhraseAlt *) ); +} /* CResultContainer::CResultContainer */ + +/********************************************************************** +* CResultContainer::~CResultContainer * +*-------------------------------------* +* Description: +* Destructor for the CResultContainer class. +* This object gets destroyed when there are no longer +* any CDictationRuns referencing it. +**********************************************************************/ +CResultContainer::~CResultContainer() +{ + _ASSERTE( !m_pOwnerListHead ); + + if ( m_pPhraseReplacement ) + { + delete m_pPhraseReplacement; + } + + // Release any ISpPhraseAlt's that are still around from the + // last call to ISpPhrase::GetAlternates() + for (int i = 0; i < ALT_REQUEST_COUNT; i++) + { + if (m_apLastRequestedPhraseAlts[i]) + { + m_apLastRequestedPhraseAlts[i]->Release(); + } + } +} /* CResultContainer::~CResultContainer */ + +/********************************************************************** +* CResultContainer::AddOwner * +*----------------------------* +* Description: +* Called whenever a new CDictationRun is created to use this +* same RecoResult. Adds that CDictationRun to the front of +* the list of owners. +* Return: +* S_OK +* E_OUTOFMEMORY +**********************************************************************/ +HRESULT CResultContainer::AddOwner( CDictationRun &rNewOwner ) +{ + if ( !m_pOwnerListHead ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + + OWNERNODE *pNode = new OWNERNODE; + if ( pNode ) + { + pNode->pNext = m_pOwnerListHead; + pNode->pOwner = &rNewOwner; + m_pOwnerListHead = pNode; + + return S_OK; + } + else + { + return E_OUTOFMEMORY; + } +} /* CResultContainer::AddOwner */ + +/********************************************************************** +* CResultContainer::DeleteOwner * +*-------------------------------* +* Description: +* Called whenever a DictationRun using this RecoResult +* has been deleted. Removes the CDictationRun from the +* list and deletes itself if that was the last owner +**********************************************************************/ +void CResultContainer::DeleteOwner( CDictationRun &rOldOwner ) +{ + _ASSERTE( m_pOwnerListHead ); + if ( !m_pOwnerListHead ) + { + return; + } + + OWNERNODE **ppNode; + for ( ppNode = &m_pOwnerListHead; + (*ppNode) && ((*ppNode)->pOwner != &rOldOwner); + ppNode = &((*ppNode)->pNext) ) + ; + + if ( *ppNode ) + { + // Found: Delete it + OWNERNODE *pNodeToDelete = *ppNode; + *ppNode = (*ppNode)->pNext; + delete pNodeToDelete; + } + else + { + // Should be on the list! + _ASSERTE( false ); + } + + if ( !m_pOwnerListHead ) + { + // There are no more CDictationRuns referencing this + delete this; + } +} /* CResultContainer::DeleteOwner */ + +/********************************************************************** +* CResultContainer::SpeakAudio * +*------------------------------* +* Description: +* Calls ISpRecoResult::SpeakAudio() on the recoresult. +* Converts the arguments to pre-replacement elements +* Return: +* S_OK +* S_FALSE if no elements are to be spoken. +* Return value of CPhraseReplacement conversion routines +* Return value of ISpRecoResult::SpeakAudio() +**********************************************************************/ +HRESULT CResultContainer::SpeakAudio( ULONG ulStartElement, + ULONG cElements ) +{ + if (!cElements) + { + return S_FALSE; + } + + // Convert the start and end to phrase element indices + // as seen from the result object's point of view + ULONG ulPreReplStart; + ULONG ulPreReplEnd; + ULONG cPreReplElts; + HRESULT hr = m_pPhraseReplacement->PostToPreReplacementIndex( + ulStartElement, &ulPreReplStart ); + if (SUCCEEDED(hr)) + { + hr = m_pPhraseReplacement->PostToPreReplacementIndex( + ulStartElement + cElements, &ulPreReplEnd ); + } + + // Call ISpRecoResult::SpeakAudio() + if (SUCCEEDED(hr)) + { + cPreReplElts = ulPreReplEnd - ulPreReplStart; + hr = m_cpRecoResult->SpeakAudio( + ulPreReplStart, cPreReplElts, SPF_ASYNC, NULL ); + } + + return hr; +} /* CResultContainer::SpeakAudio */ + +/********************************************************************** +* CResultContainer::GetAlternatesText * +*-------------------------------------* +* Description: +* Called to get the text of the alternates for +* a specific range of elements in this result. +* ppszCoMemText is expected to point to a buffer +* of size at least sizeof( WCHAR * ) * ulRequestCount, +* and the text in it will be CoTaskMemAlloced. +* Return: +* S_OK +* S_FALSE if there are no alternates +* E_POINTER +* return value of CResultContainer::GetAlternates() +* return value of CResultContainer::GetAltText() +**********************************************************************/ +HRESULT CResultContainer::GetAlternatesText( ULONG ulStartElement, + ULONG cElements, + ULONG ulRequestCount, + WCHAR **ppszCoMemText, + ULONG *pcPhrasesReturned ) +{ + SPDBG_FUNC("CResultContainer::GetAlternatesText"); + if ( !ppszCoMemText || !pcPhrasesReturned ) + { + return E_POINTER; + } + + // Get as many alternates as we can + ULONG cAvailableAlts; + HRESULT hr = GetAlternates( ulStartElement, cElements, ulRequestCount, + &cAvailableAlts ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Sanity check: We didn't get more than we asked for + _ASSERTE( cAvailableAlts <= ulRequestCount ); + + if ( !cAvailableAlts ) + { + // No alternates + *pcPhrasesReturned = 0; + *ppszCoMemText = NULL; + return S_FALSE; + } + + // Null out the pointers to text buffers first + memset(ppszCoMemText, 0, ulRequestCount * sizeof(WCHAR *)); + + // Get the text + for ( ULONG ulAlt = 0; + SUCCEEDED(hr) && (ulAlt < cAvailableAlts); + ulAlt++ ) + { + // ppszCoMemText[ulAlt] is the ulAlt'th (WCHAR *) + // in the array. + // Its address will give us a WCHAR ** which will + // point to a buffer that is to be CoTaskMemAlloced + // by GetAltText() + hr = GetAltText( ulStartElement, cElements, ulAlt, + &(ppszCoMemText[ulAlt]), NULL ); + } + *pcPhrasesReturned = cAvailableAlts; + + return hr; +} /* CResultContainer::GetAlternatesText */ + +/********************************************************************** +* CResultContainer::GetAlternates * +*---------------------------------* +* Description: +* Gets the ISpPhraseAlts for this range of elements +* (indices are given taking replacement into account). +* The phrase alternates are pointed to by +* m_apLastRequestedPhraseAlts. +* It is very likely that GetAlternates() would be called +* numerous times consecutively for the same set of +* alternates. Thus, these are cached between calls. +* Return: +* S_OK +* E_INVALIDARG: Out-of-bounds elements +* Return value of CPhraseReplacement conversion routines +* Return value of ISpRecoResult::GetAlternates +**********************************************************************/ +HRESULT CResultContainer::GetAlternates( ULONG ulStartElement, + ULONG cElements, + ULONG ulRequestCount, + ULONG *pcPhrasesReturned ) +{ + // First check to see if we have these alternates cached. + // We check that there is at least one alternate cached, + // that the alternates are for the same set of phrase elements, + // and that there are enough. + if ( m_apLastRequestedPhraseAlts[0] && + ( m_ulStartOfLastRequestedAlts == ulStartElement ) && + ( m_cElementsInLastRequestedAlts == cElements ) && + ( m_cLastRequestedAltsReturned >= ulRequestCount) ) + { + if ( pcPhrasesReturned ) + { + // We already have these alternates, so don't bother + // getting them again + *pcPhrasesReturned = __min( + ulRequestCount, m_cLastRequestedAltsReturned ); + } + return S_OK; + } + + if ( (ulStartElement + cElements) > + m_pPhraseReplacement->GetNumReplacementElements() ) + { + // Out of bounds + return E_INVALIDARG; + } + + // Convert the start and end to phrase element indices + // as seen from the result object's point of view + ULONG ulPreReplStart; + ULONG ulPreReplLast; + HRESULT hr = m_pPhraseReplacement->PostToPreReplacementIndex( + ulStartElement, &ulPreReplStart ); + if ( SUCCEEDED(hr) ) + { + hr = m_pPhraseReplacement->PostToPreReplacementIndex( + ulStartElement + cElements, &ulPreReplLast ); + } + ULONG cPreReplElements = ulPreReplLast - ulPreReplStart; + + // Release any ISpPhraseAlts that are around from last time + for (int i = 0; i < ALT_REQUEST_COUNT; i++) + { + if ( m_apLastRequestedPhraseAlts[i] ) + { + m_apLastRequestedPhraseAlts[i]->Release(); + m_apLastRequestedPhraseAlts[i] = 0; + } + } + + // Get as many alternates as we can by calling + // ISpRecoResult::GetAlternates() + ULONG cPhrasesReturned; + if (SUCCEEDED(hr)) + { + hr = m_cpRecoResult->GetAlternates( ulPreReplStart, + cPreReplElements, ulRequestCount, m_apLastRequestedPhraseAlts, + &cPhrasesReturned ); + } + if ( pcPhrasesReturned ) + { + *pcPhrasesReturned = cPhrasesReturned; + } + + // Cache information about this alternate request + m_ulStartOfLastRequestedAlts = ulStartElement; + m_cElementsInLastRequestedAlts = cElements; + m_cLastRequestedAltsReturned = cPhrasesReturned; + + return hr; +} /* CResultContainer::GetAlternates */ + +/********************************************************************** +* CResultContainer::GetAltInfo * +*------------------------------* +* Description: +* Given the alternates index, gets the info for the +* alternate (i.e. which elements it replaces in the +* parent and how many elements it has). +* Returns element indices TAKING REPLACEMENTS INTO +* ACCOUNT, unless the fReturnPostReplIndices flag has +* been set to false (it is set to true by default). +* +* If the end of the alternate falls in the middle of +* a replacement, then the result indices are expanded +* to include the entire replacement. +* Return: +* S_OK +* E_FAIL if we couldn't get ulAlternateIndex alternates +* Return value of CResultContainer::GetAlternates() +* Return value of ISpPhraseAlt::GetAltInfo() +* Return value of +* CResultContainer::ExpandToIncludeWholeReplacements() +* Return value of CPhraseReplacement::Initialize() +* Return value of CPhraseReplacement conversion routines +**********************************************************************/ +HRESULT CResultContainer::GetAltInfo( ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + ULONG *pulStartInParent, + ULONG *pcEltsInParent, + ULONG *pcEltsInAlt, + bool fReturnPostReplIndices) +{ + // First make sure we actually have this alternate + ULONG cPhrasesReturned; + HRESULT hr = GetAlternates( + ulStartElement, cElements, ulAlternateIndex + 1, &cPhrasesReturned ); + if ( FAILED( hr ) ) + { + return hr; + } + if ( cPhrasesReturned < (ulAlternateIndex + 1) ) + { + // There aren't enough alternates to accommodate + // this one + return E_FAIL; + } + + // Sanity check: The pointer to the ISpPhraseAlt for this + // alternate is non-NULL + _ASSERTE( m_apLastRequestedPhraseAlts[ ulAlternateIndex ] ); + + // Call to ISpPhraseAlt::GetAltInfo() + ULONG ulStartInParent; + ULONG cEltsInParent; + ULONG cEltsInAlt; + hr = (m_apLastRequestedPhraseAlts[ ulAlternateIndex ])->GetAltInfo( + NULL, &ulStartInParent, &cEltsInParent, &cEltsInAlt ); + +#ifdef _DEBUG + // Debug code for seeing the text of the entire alternate + // (which covers the entire parent phrase) and for seeing + // the text for just the part of the alternate that + // covers the elements in the parent that we are interested in + WCHAR * pwszWhole = 0; + WCHAR * pwszAlt = 0; + BYTE b; + m_apLastRequestedPhraseAlts[ ulAlternateIndex ]->GetText( + SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, true, &pwszWhole, &b ); + m_apLastRequestedPhraseAlts[ ulAlternateIndex ]->GetText( + ulStartInParent, cEltsInAlt, true, &pwszAlt, &b ); + ::CoTaskMemFree( pwszWhole ); + ::CoTaskMemFree( pwszAlt ); +#endif + + // If there is replaced (ITNed) text anywhere in this set of + // elements in the parent, we should be getting alternate + // text for the entire replacement. + // That is, if a replacement covers the word "thirty" in the + // phrase "I have thirty nine dollars", we should also be + // showing alternate text for the elements "nine dollars", + // since it appears to all be one element ("$39.00") to the + // user + if ( SUCCEEDED( hr ) ) + { + const ULONG cEltsInParentBeforeExpansion = cEltsInParent; + + // Expand the endpoints to include entire replacements + hr = m_pPhraseReplacement->ExpandToIncludeWholeReplacements( + &ulStartInParent, &cEltsInParent ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Adjust the number of elements in the alternate accordingly + // (all of the extra elements we have just included are the + // same in the alternate as they are in the parent, so it + // will be the same number of extra elements in the alternate + cEltsInAlt += cEltsInParent - cEltsInParentBeforeExpansion; + } + + if ( !fReturnPostReplIndices ) + { + // We're done; no need to convert, since the caller wants + // output in phrase element indices from the result object's + // point of view + if ( pulStartInParent ) + { + *pulStartInParent = ulStartInParent; + } + if ( pcEltsInParent ) + { + *pcEltsInParent = cEltsInParent; + } + if ( pcEltsInAlt ) + { + *pcEltsInAlt = cEltsInAlt; + } + return hr; + } + + // Convert these element indices to post-replacement indices + if ( SUCCEEDED( hr ) ) + { + // First convert the start element + ULONG ulPostReplStartInParent; + hr = m_pPhraseReplacement->PreToPostReplacementIndex( + ulStartInParent, &ulPostReplStartInParent ); + if (FAILED(hr)) + { + return hr; + } + if ( pulStartInParent ) + { + *pulStartInParent = ulPostReplStartInParent; + } + + // Convert the end element to determine how many post-replacement + // elements this alternate replaces + if ( pcEltsInParent ) + { + ULONG ulEndInParent = ulStartInParent + cEltsInParent; + ULONG ulEndPostReplElement; + hr = m_pPhraseReplacement->PreToPostReplacementIndex( + ulEndInParent, &ulEndPostReplElement ); + if (FAILED(hr)) + { + return hr; + } + *pcEltsInParent = ulEndPostReplElement - ulPostReplStartInParent; + } + } + + // Find the number of elements in the alternate, if that was requested + if ( SUCCEEDED(hr) && pcEltsInAlt ) + { + // Since this ISpPhraseAlt is a completely different ISpPhrase + // from the one associated with m_cpRecoResult, we have to + // construct a new CPhraseReplacement object to deal specifically + // with this phrase. + CPhraseReplacement newPhraseRepl; + hr = newPhraseRepl.Initialize(*(m_apLastRequestedPhraseAlts[ ulAlternateIndex ])); + + // First convert the start element + ULONG ulPostReplStartInAlt; + if ( SUCCEEDED( hr ) ) + { + hr = newPhraseRepl.PreToPostReplacementIndex( + ulStartInParent, &ulPostReplStartInAlt ); + } + + // Convert the end element to determine how many post-replacement + // elements this alternate replaces + ULONG ulEndInAlt = ulStartInParent + cEltsInAlt; + ULONG ulEndPostReplElement; + if ( SUCCEEDED(hr) ) + { + hr = newPhraseRepl.PreToPostReplacementIndex( + ulEndInAlt, &ulEndPostReplElement ); + } + *pcEltsInAlt = ulEndPostReplElement - ulPostReplStartInAlt; + } + return hr; +} /* CResultContainer::GetAltInfo */ + +/********************************************************************** +* CResultContainer::GetAltText * +*------------------------------* +* Description: +* Given the alternates index, gets the text for the +* alternate and display attributes. +* Return: +* S_OK +* Return value of CResultContainer::GetAlternates() +* Return value of CResultContainer::GetAltInfo() +* Return value of ISpPhraseAlt::GetText() +**********************************************************************/ +HRESULT CResultContainer::GetAltText( ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + WCHAR **ppszCoMemText, + BYTE *pbDisplayAttributes ) +{ + // First make sure we actually have this alternate + ULONG cPhrasesReturned; + HRESULT hr = GetAlternates( + ulStartElement, cElements, ulAlternateIndex + 1, &cPhrasesReturned ); + if ( FAILED( hr ) ) + { + return hr; + } + if ( cPhrasesReturned < (ulAlternateIndex + 1) ) + { + // There aren't enough alternates to accommodate + // this one + return E_FAIL; + } + + // Sanity check: The pointer to the ISpPhraseAlt for this + // alternate is non-NULL + _ASSERTE( m_apLastRequestedPhraseAlts[ ulAlternateIndex ] ); + + // Find out what elements in the parent this alternate replaces + // Note that we do NOT want text replacements taken into effect, + // since we are calling ISpPhrase::GetText() directly with + // these phrase element indices, so we need those indices + // from the result object's point of view + ULONG ulStartInParent; + ULONG cEltsInParent; + ULONG cEltsInAlt; + hr = GetAltInfo( ulStartElement, cElements, ulAlternateIndex, + &ulStartInParent, &cEltsInParent, &cEltsInAlt, false ); + if ( FAILED(hr) ) + { + return hr; + } + + // Call to ISpPhraseAlt::GetText() + return m_apLastRequestedPhraseAlts[ ulAlternateIndex ]->GetText( + ulStartInParent, cEltsInAlt, true, ppszCoMemText, pbDisplayAttributes ); +} /* CResultContainer::GetAltText */ + + +/********************************************************************** +* CResultContainer::ChooseAlternate * +*-----------------------------------* +* Description: +* Called when the caller wishes to commit one of the alternates. +* If pbDisplayAttributes is non-NULL, hands back the display +* attributes of the alternate text going in. +* Adjusts the phrase element mapping in CPhraseReplacement +* to the new result object. +* Return: +* S_OK +* Return value of CResultContainer::GetAlternates() +* Return value of CResultContainer::GetAltText() +* Return value of CResultContainer::NotifyOwnersOfCommit() +* Return value of ISpPhraseAlt::Commit() +* Return value of CPhraseReplacement::Initialize() +**********************************************************************/ +HRESULT CResultContainer::ChooseAlternate( ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + BYTE *pbDisplayAttributes ) +{ + // First make sure we actually have this alternate + ULONG cPhrasesReturned; + HRESULT hr = GetAlternates( + ulStartElement, cElements, ulAlternateIndex + 1, &cPhrasesReturned ); + if ( FAILED( hr ) ) + { + return hr; + } + if ( cPhrasesReturned < (ulAlternateIndex + 1) ) + { + // There aren't enough alternates to accommodate + // this one + return E_FAIL; + } + + // Sanity check: The pointer to the ISpPhraseAlt for this + // alternate is non-NULL + _ASSERTE( m_apLastRequestedPhraseAlts[ ulAlternateIndex ] ); + + // If there is interest in the display attributes for the alternate, + // get them + if ( pbDisplayAttributes ) + { + WCHAR *pszCoMemText; + hr = GetAltText( ulStartElement, cElements, ulAlternateIndex, + &pszCoMemText, pbDisplayAttributes ); + if ( FAILED( hr ) ) + { + return hr; + } + ::CoTaskMemFree( pszCoMemText ); + } + + // Notify owners of the alternate committal so that they can adjust + // their element offset maps + hr = NotifyOwnersOfCommit( ulStartElement, cElements, ulAlternateIndex ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Call to ISpPhraseAlt::Commit() + hr = m_apLastRequestedPhraseAlts[ulAlternateIndex]->Commit(); + if ( FAILED( hr ) ) + { + return hr; + } + + // The alternate is now "dead" + + // Re-initialize the phrase replacement info, as the element indices + // and text replacment (ITN) situations are likely to have changed + return m_pPhraseReplacement->Initialize( *m_cpRecoResult ); + +} /* CResultContainer::ChooseAlternate */ + +/********************************************************************** +* CResultContainer::NotifyOwnersOfCommit * +*----------------------------------------* +* Description: +* Called when an alternate is about to be committed BEFORE +* the commit happens. +* Notifies all DictationRuns that hold onto this result +* that their phrase element offset maps will need to change +* Return: +* S_OK +* E_OUTOFMEMORY if the head of the owner list wasn't +* allocated at construction time +* Return value of CResultContainer::GetAlternates() +* Return value of CPhraseReplacement::Initialize() +* Return value of CResultContainer::GetAltInfo() +**********************************************************************/ +HRESULT CResultContainer::NotifyOwnersOfCommit( ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex ) + //ISpPhraseAlt *pChosenAlternate ) +{ + if ( !m_pOwnerListHead ) + { + return E_OUTOFMEMORY; + } + + // First make sure we actually have this alternate + ULONG cPhrasesReturned; + HRESULT hr = GetAlternates( + ulStartElement, cElements, ulAlternateIndex + 1, &cPhrasesReturned ); + if ( FAILED( hr ) ) + { + return hr; + } + if ( cPhrasesReturned < (ulAlternateIndex + 1) ) + { + // There aren't enough alternates to accommodate + // this one + return E_FAIL; + } + + // Sanity check: The pointer to the ISpPhraseAlt for this + // alternate is non-NULL + _ASSERTE( m_apLastRequestedPhraseAlts[ ulAlternateIndex ] ); + + // We need to determine how many post-replacement elements the new + // phrase will have, but the alternate has not yet been committed to + // m_cpRecoResult, so we need to construct a different CPhraseReplacement + // to get that information + CPhraseReplacement newPhraseRepl; + hr = newPhraseRepl.Initialize( *(m_apLastRequestedPhraseAlts[ ulAlternateIndex ]) ); + if ( FAILED( hr ) ) + { + return hr; + } + ULONG cPostReplElementsAfterCommit = newPhraseRepl.GetNumReplacementElements(); + + // Find out which (post-replacement) elements in the parent + // this alternate will replace + ULONG ulStartInParent; + ULONG cEltsInParent; + hr = GetAltInfo( ulStartElement, cElements, ulAlternateIndex, + &ulStartInParent, &cEltsInParent ); + if ( FAILED(hr) ) + { + return hr; + } + + // Loop through the owner list, and let each one adjust its maps + for ( OWNERNODE *pNode = m_pOwnerListHead; pNode; pNode = pNode->pNext ) + { + hr = pNode->pOwner->OnAlternateCommit( ulStartInParent, + cEltsInParent, cPostReplElementsAfterCommit ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + return S_OK; +} /* CResultContainer::NotifyOwnersOfCommit */ + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.h new file mode 100644 index 00000000..c7356ae5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/resultcontainer.h @@ -0,0 +1,119 @@ +/****************************************************************************** +* resultcontainer.h +* This module contains the definition of CResultContainer. +* CResultContainer makes all of the recognition-object- +* specific SAPI5 calls +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "DictationRun.h" + +// Forward definition +class CDictationRun; + +// List node for the result container's list of owner DictationRuns +typedef struct OWNERNODE +{ + CDictationRun *pOwner; + OWNERNODE *pNext; +} OWNERNODE; + +// Constant for alternate retrieval +#define ALT_REQUEST_COUNT 15 + +/****************************************************************************** +* CResultContainer * +*------------------* +* Description: +* CResultContainer is the class that handles the recognition result +* object that corresponds to one or more CDictationRun's (see +* DictationRun.h) that hold phrase elements from that result. +* All SAPI5 calls on recognition result objects are made from +* the appropriate instance of CResultContainer +*******************************************************************************/ +class CResultContainer +{ +public: + + CResultContainer( ISpRecoResult &rResult, + CDictationRun &rFirstOwner, + CPhraseReplacement &rPhraseReplacement ); + ~CResultContainer(); + + HRESULT AddOwner( CDictationRun &rNewOwner ); + void DeleteOwner( CDictationRun &rOldOwner ); + + CPhraseReplacement *GetPhraseReplacement() + { return m_pPhraseReplacement; } + + // These methods that behave exactly like the methods of + // the same name in ISpRecoResult, except the arguments + // to these take into account possible ITN replacement + HRESULT SpeakAudio( + ULONG ulStartElement, + ULONG cElements ); + HRESULT Serialize( + SPSERIALIZEDRESULT **ppResultBlock) + { return m_cpRecoResult->Serialize( ppResultBlock );} + + // These methods are closely related to ISpRecoResult + // methods, altered slightly for the purposes of this app + HRESULT GetAlternatesText( + ULONG ulStartElement, + ULONG cElements, + ULONG ulRequestCount, + WCHAR **ppszCoMemText, + ULONG *pcPhrasesReturned ); + HRESULT GetAltInfo( + ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + ULONG *pulStartInParent, + ULONG *pcEltsInParent, + ULONG *pcEltsInAlt = NULL, + bool fReturnPostReplIndices = true); + HRESULT GetAltText( + ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + WCHAR **ppwszCoMemText, + BYTE *pbDisplayAttributes ); + HRESULT ChooseAlternate( + ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex, + BYTE *pbDisplayAttributes ); + +private: + + HRESULT GetAlternates( + ULONG ulStartElement, + ULONG cElements, + ULONG ulRequestCount, + ULONG *pcPhrasesReturned ); + + // Called whenever the RecoResult has changed as a result of some + // owner committing an alternate + HRESULT NotifyOwnersOfCommit( + ULONG ulStartElement, + ULONG cElements, + ULONG ulAlternateIndex ); + +private: + + CComPtr m_cpRecoResult; + CPhraseReplacement *m_pPhraseReplacement; + OWNERNODE *m_pOwnerListHead; + + // Information about the last-requested set of alternates. + // Note that m_ulStartOfLastRequestedAlts and m_cElementsInLastRequestedAlts + // are indices with ITN replacements figured in + ISpPhraseAlt * m_apLastRequestedPhraseAlts[ALT_REQUEST_COUNT]; + ULONG m_cLastRequestedAltsReturned; + ULONG m_ulStartOfLastRequestedAlts; + ULONG m_cElementsInLastRequestedAlts; +}; // class CResultContainer + + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/small.ico b/sp/src/utils/sapi51/Samples/CPP/DictPad/small.ico new file mode 100644 index 00000000..feea2daa Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/DictPad/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.cpp new file mode 100644 index 00000000..2806c8d9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// dictpad.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.h new file mode 100644 index 00000000..975f2d86 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/stdafx.h @@ -0,0 +1,37 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include +#include +#include +#include "tom.h" + +// Local Header Files + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/textrun.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/textrun.cpp new file mode 100644 index 00000000..f72db669 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/textrun.cpp @@ -0,0 +1,559 @@ +/****************************************************************************** +* textrun.cpp +* Implementation details for the CTextRun object which is our base class +* for tracking all the text (be it dictated or typed) in our product. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "textrun.h" + +/********************************************************************** +* CTextRun::CTextRun * +*--------------------* +* Description: +* CTextRun constructor +**********************************************************************/ +CTextRun::CTextRun() : m_cpTextRange( NULL ), + m_dwRefCount( NULL ) +{ +} /* CTextRun::CTextRun */ + + +/********************************************************************** +* CTextRun::~CTextRun * +*---------------------* +* Description: +* CTextRun destructor +**********************************************************************/ +CTextRun::~CTextRun() +{ +} /* CTextRun::~CTextRun */ + +/********************************************************************** +* CTextRun::IncrementCount * +*--------------------------* +* Description: +* Increments a reference count on this text run. +* +* Return: +* The current count +**********************************************************************/ +DWORD CTextRun::IncrementCount() +{ + m_dwRefCount++; + return m_dwRefCount; +} /* CTextRun::IncrementCount */ + +/********************************************************************** +* CTextRun::DecrementCount * +*--------------------------* +* Description: +* Decrements a reference count on this text run. If the +* count drops to zero, the text run is deleted. +* +* Return: +* The current count +**********************************************************************/ +DWORD CTextRun::DecrementCount() +{ + _ASSERTE( m_dwRefCount ); + + DWORD dwRefCount = --m_dwRefCount; + if( !m_dwRefCount ) + { + delete this; + } + return dwRefCount; +} /* CTextRun::DecrementCount */ + +/****************************************************************************** +* CTextRun::SetTextRange * +*------------------------* +* Description: +* Stores the text range interface pointer for this run +* Return: +* S_OK +* E_POINTER if pTextRange is NULL +******************************************************************************/ +HRESULT CTextRun::SetTextRange( ITextRange *pTextRange ) +{ + if ( !pTextRange ) + { + return E_POINTER; + } + + m_cpTextRange = pTextRange; + + return S_OK; +} /* CTextRun::SetTextRange */ + +/********************************************************************** +* CTextRun::Split * +*-----------------* +* Description: +* Splits up a TextRun so that this text run now ends at lFirstEnd +* and the second text run begins at lSecondBegin. +* "This" will now be a shorter range (it will end sooner), +* and *ppTextRun will point to the new text run +* (space will be allocated here for *ppTextRun) +* to be inserted in the list. +* +* Return: +* S_OK +* E_INVALIDARG +* E_OUTOFMEMORY +* Return value of ITextDocument::Range() +**********************************************************************/ +HRESULT CTextRun::Split( long *plFirstEnd, long *plSecondBegin, + ITextDocument *cpTextDoc, + CTextRun **ppTextRun ) +{ + if ( !plFirstEnd || !plSecondBegin || !cpTextDoc || !ppTextRun ) + { + return E_INVALIDARG; + } + _ASSERTE( m_cpTextRange ); + if ( !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + // These values won't be changing, since this run has no associated + // RecoResult. + // We can chop this block right at these positions. + long lFirstEnd = *plFirstEnd; + long lSecondBegin = *plSecondBegin; + + if ( !WithinRange( lFirstEnd ) || (lFirstEnd > lSecondBegin) ) + { + return E_INVALIDARG; + } + + if ( (GetStart() == lSecondBegin) || (GetEnd() == lFirstEnd) || (lSecondBegin > GetEnd()) ) + { + // Don't need to do anything, since we are asking for both of the + // cuts to be made on already-existing TextRun boundaries + *ppTextRun = NULL; + return S_OK; + } + + *ppTextRun = new CTextRun(); + if ( !(*ppTextRun) ) + { + return E_OUTOFMEMORY; + } + + // The latter range will start at lSecondBegin and end where "this" ended + long lEnd = GetEnd(); + CComPtr pLatterRange; + HRESULT hr = cpTextDoc->Range( lSecondBegin, lEnd, &pLatterRange ); + if ( FAILED( hr ) ) + { + return hr; + } + (*ppTextRun)->SetTextRange( pLatterRange ); + + // Adjust the end of "this"'s range; it will end at lFirstEnd + m_cpTextRange->SetEnd( lFirstEnd ); + + return S_OK; + +} /* CTextRun::Split */ + + +/********************************************************************** +* CTextRun::Concatenate * +*-----------------------* +* Description: +* If possible, concatenates pNext (pPrev if fConcatAfter is false) +* onto the end of this. +* Another CTextRun can always be concatenated on, unless it +* contains dictation. +* +* Return: +* E_NOMERGE if could not be merged (because pTextRun is dictation) +* E_FULLMERGE +**********************************************************************/ +MERGERESULT CTextRun::Concatenate( CTextRun *pTextRun, bool fConcatAfter ) +{ + if ( !pTextRun || !m_cpTextRange ) + { + return E_NOMERGE; + } + + // Check for compatibility: In this case, neither mergee can be + // a dict run + if ( IsDict() || pTextRun->IsDict() ) + { + return E_NOMERGE; + } + + // lNewBound will be the new end (resp. start) of the run, if the + // concatenation is successful + long lNewBound; + + // Concatenation is possible iff one run ends exactly where the other + // begins. + // If concatenation is possible, do it. + if ( fConcatAfter ) + { + // Will be concatenating pTextRun onto the end of this + if ( GetEnd() != pTextRun->GetStart() ) + { + // They are not consecutive runs + return E_NOMERGE; + } + + // lNewBound will be the new end of the run, if the + // concatenation is successful + lNewBound = pTextRun->GetEnd(); + + // Swallow up pTextRun by setting our end to its end + SetEnd( lNewBound ); + + // Make pTextRun degenerate + pTextRun->SetStart( lNewBound ); + + } + else + { + // Will be concatenating pTextRun onto the beginning of this + if ( GetStart() != pTextRun->GetEnd() ) + { + return E_NOMERGE; + } + + // lNewBound will be the new start of the run, if the + // concatenation is successful + lNewBound = pTextRun->GetStart(); + + // Swallow up pTextRun by setting our start to its start + SetStart( lNewBound ); + + // Make pTextRun degenerate + pTextRun->SetEnd( lNewBound ); + } + + return E_FULLMERGE; +} /* CTextRun::Concatenate */ + +/********************************************************************** +* CTextRun::Speak * +*-----------------* +* Description: +* Speaks the text associated with this CTextRun using TTS. +* +* Return: +* S_OK +* Return value of ITextRange::GetText() +* Return value of ISpVoice::Speak() +**********************************************************************/ +HRESULT CTextRun::Speak( ISpVoice &rVoice ) +{ + _ASSERTE( m_cpTextRange ); + if ( !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + // Get the text and speak it. + BSTR bstrText; + HRESULT hr = m_cpTextRange->GetText( &bstrText ); + if( SUCCEEDED( hr ) ) + { + hr = rVoice.Speak( bstrText, SPF_ASYNC, NULL ); + + ::SysFreeString( bstrText ); + } + return hr; +} /* CTextRun::Speak */ + +/********************************************************************** +* CTextRun::Speak() * +*-------------------* +* Description: +* Uses *plStart and *plEnd to find the nearest start and +* endpoints for speaking (to the nearest word). +* Returns these values in plStart and plEnd. +* Speaks the text associated with this CTextRun from *plStart +* to *plEnd. +* +* If *plStart is not within the range, then +* start at the beginning. If lEnd is not within range, then +* end at the end. +* +* Return: +* S_OK +* E_POINTER +* Return value of CTextRun::Speak() +**********************************************************************/ +HRESULT CTextRun::Speak( ISpVoice &rVoice, + long *plStart, + long *plEnd ) +{ + if ( !plStart || !plEnd ) + { + return E_POINTER; + } + _ASSERTE( m_cpTextRange ); + if ( !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + // Save the old range + long lOldStart = GetStart(); + long lOldEnd = GetEnd(); + + // Out of range start or end means we start speaking from the start + // or end (resp.) of the text range. + + if ( WithinRange( *plStart ) ) + { + // The start needs to be moved + SetStart( *plStart ); + } + else + { + *plStart = GetStart(); + } + + if ( WithinRange( *plEnd ) ) + { + // The end needs to be moved + SetEnd( *plEnd ); + } + else + { + *plEnd = GetEnd(); + } + + // Expand to include whole words + m_cpTextRange->Expand( tomWord, NULL ); + + // Get the new start and end so that we can pass them back + m_cpTextRange->GetStart( plStart ); + m_cpTextRange->GetEnd( plEnd ); + + // We should never speak past the end of this run, even if expanding to include + // whole words caused extra text to be included + // (e.g. if you typed "This is a sentence" and dictated some text that + // consumed leading spaces right afterwards) + *plStart = __max( *plStart, lOldStart ); + *plEnd = __min( *plEnd, lOldEnd ); + SetStart( *plStart ); + SetEnd( *plEnd ); + + // Pass to the CTextRun::Speak() that speaks an entire run + HRESULT hr = Speak( rVoice ); + + // Restore the old range limits + SetStart( lOldStart ); + SetEnd( lOldEnd ); + + return hr; +} /* CTextRun::Speak */ + +/********************************************************************** +* CTextRun::Serialize * +*---------------------* +* Description: +* Serializes the text for this run. +* Simply writes a small header that contains the start +* and end indices of this run and indicates that +* no phrase blob follows. +* Return: +* S_OK +* E_INVALIDARG +* E_UNEXPECTED +* Return value of ISequentialStream::Write() +**********************************************************************/ +HRESULT CTextRun::Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ) +{ + if ( !pStream ) + { + return E_INVALIDARG; + } + _ASSERTE( m_cpTextRange ); + if ( !m_cpTextRange ) + { + return E_UNEXPECTED; + } + + RUNHEADER runHdr; + runHdr.lStart = GetStart(); + runHdr.lEnd = GetEnd(); + runHdr.bResultFollows = false; + + // Write the header to the stream + ULONG cbWritten; + HRESULT hr = pStream->Write( &runHdr, sizeof( RUNHEADER ), &cbWritten ); + + return hr; +} /* CTextRun::Serialize */ + +/********************************************************************** +* CTextRun::IsConsumeLeadingSpaces * +*----------------------------------* +* Description: +* Sets *pfConsumeLeadingSpaces to true iff leading spaces before +* lPos would need to be consumed. +* For a text run this value will always be false, since +* typed text has no "display attributes" +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if lPos is out of range +**********************************************************************/ +HRESULT CTextRun::IsConsumeLeadingSpaces( const long lPos, + bool *pfConsumeLeadingSpaces ) +{ + if ( !pfConsumeLeadingSpaces ) + { + return E_POINTER; + } + if ( !WithinRange( lPos ) ) + { + return E_INVALIDARG; + } + + *pfConsumeLeadingSpaces = false; + + return S_OK; +} /* CTextRun::IsConsumeLeadingSpaces */ + +/********************************************************************** +* CTextRun::HowManySpacesAfter * +*------------------------------* +* Description: +* Returns the number of spaces that would need to precede text +* if text were to be inserted at position lPos. +* This number is in the out param puiSpaces. +* For a text run this value will always be zero, since +* typed text has no "display attributes" +* Return: +* S_OK +* E_POINTER +* E_INVALIDARG if lPos is out of range +**********************************************************************/ +HRESULT CTextRun::HowManySpacesAfter( const long lPos, UINT *puiSpaces ) +{ + if ( !puiSpaces ) + { + return E_POINTER; + } + if ( !WithinRange( lPos ) ) + { + return E_INVALIDARG; + } + + *puiSpaces = 0; + + return S_OK; +} /* CTextRun::HowManySpacesAfter */ + +/********************************************************************** +* CTextRun::GetStart * +*--------------------* +* Description: +* Returns the start of the associated TextRange, -1 in case +* of error. +**********************************************************************/ +long CTextRun::GetStart() +{ + if ( !m_cpTextRange ) + { + return -1; + } + + long lRet; + HRESULT hr = m_cpTextRange->GetStart( &lRet ); + + return (SUCCEEDED( hr )) ? lRet : -1; +} /* CTextRun::GetStart */ + +/********************************************************************** +* CTextRun::SetStart * +*--------------------* +* Description: +* Sets the start of the associated TextRange. +**********************************************************************/ +void CTextRun::SetStart( long lStart ) +{ + m_cpTextRange->SetStart( lStart ); +} /* CTextRun::SetStart */ + +/********************************************************************** +* CTextRun::GetEnd * +*------------------* +* Description: +* Returns the end of the associated TextRange, -1 in case +* of error. +**********************************************************************/ +long CTextRun::GetEnd() +{ + if ( !m_cpTextRange ) + { + return -1; + } + + long lRet; + HRESULT hr = m_cpTextRange->GetEnd( &lRet ); + + return (SUCCEEDED( hr )) ? lRet : -1; +} /* CTextRun::GetEnd */ + +/********************************************************************** +* CTextRun::SetEnd * +*------------------* +* Description: +* Sets the end of the associated TextRange +**********************************************************************/ +void CTextRun::SetEnd( long lEnd ) +{ + m_cpTextRange->SetEnd( lEnd ); +} /* CTextRun::SetEnd */ + + +/********************************************************************* +* CTextRun::WithinRange * +*-----------------------* +* Description: +* Determines whether lCursorPos falls within the range of +* this CTextRun. +* Return: +* true iff RunStart <= lCursorPos < RunEnd +**********************************************************************/ +bool CTextRun::WithinRange( long lCursorPos ) +{ + if ( !m_cpTextRange ) + { + return false; + } + + long lStart= -1; + long lEnd= -1; + + HRESULT hr = m_cpTextRange->GetStart( &lStart ); + if ( SUCCEEDED( hr ) ) + { + hr = m_cpTextRange->GetEnd( &lEnd ); + } + + return (SUCCEEDED( hr ) && ( lCursorPos >= lStart ) && ( lCursorPos <= lEnd )); +} /* CTextRun::WithinRange */ + +/********************************************************************* +* CTextRun::IsDegenerate * +*------------------------* +* Description: +* Determines whether "this" has a degenerate range associated +* with it. +* Return: +* true iff start == end +**********************************************************************/ +bool CTextRun::IsDegenerate() +{ + return ( GetStart() == GetEnd() ); +} /* CTextRun::IsDegenerate */ \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/textrun.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/textrun.h new file mode 100644 index 00000000..504a9364 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/textrun.h @@ -0,0 +1,90 @@ +/**************************************************************************** +* textrun.h +* This module contains the definition support for CTextRun which is +* our base class for holding onto all the text with DictPad. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +#pragma once + +// Enumerated return type for CTextRun merging functions +typedef enum MERGERESULT +{ + E_NOMERGE, // No merging could be done at all + E_PARTIALMERGE, // Part but not all of the range could be merged in + E_LESSTEXT, // Some of the range had to be given up + E_FULLMERGE // All of the range was merged +}; + +// Header for serialized CTextRuns +typedef struct RUNHEADER +{ + bool bResultFollows; // true iff this is a dictation run with the + // associated reco result following in the stream + long lStart; // Start index of the associated text + long lEnd; // End index of the associated text +} RUNHEADER; + +/****************************************************************************** +* CTextRun * +*----------* +* Description: +* This class handles a consecutive run of text in the document. +********************************************************************************/ +class CTextRun +{ + public: + // Constructor / destructor + CTextRun(); + virtual ~CTextRun(); + + // Refcounting methods + DWORD IncrementCount(); + DWORD DecrementCount(); + + // Initialization method + virtual HRESULT SetTextRange( ITextRange *pTextRange ); + + // Phrase element-related methods + virtual HRESULT Split( long *plFirstEnd, long *plSecondBegin, + ITextDocument *cpTextDoc, CTextRun **ppTextRun ); + virtual MERGERESULT Concatenate( CTextRun *pTextRun, bool bConcatAfter ); + virtual HRESULT CorrectPhraseEltsAndRange( bool bForward, bool *pfCorrectionResult = NULL ) + { + if ( pfCorrectionResult ) + { + *pfCorrectionResult = true; + } + return S_OK; + }; + + // Playback methods + virtual HRESULT Speak( ISpVoice &rVoice ); // Speak a whole block + virtual HRESULT Speak( ISpVoice &rVoice, long *plStart, long *plEnd ); + // Speak part of a block + + // Serialization method + virtual HRESULT Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt = NULL ); + // Serialize and write to stream + + // Display attributes methods + virtual HRESULT IsConsumeLeadingSpaces( const long lPos, bool *pfConsumeLeadingSpaces ); + virtual HRESULT HowManySpacesAfter( const long lPos, UINT *puiSpaces ); + + virtual bool IsDict() { return FALSE; }; + + // Endpoints-related methods + long GetStart(); + void SetStart( long lStart ); + long GetEnd(); + void SetEnd( long lEnd ); + bool WithinRange( long lCursorPos ); + bool IsDegenerate(); + + protected: + CComPtr m_cpTextRange; + + private: + DWORD m_dwRefCount; +}; /* class CTextRun */ + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.cpp b/sp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.cpp new file mode 100644 index 00000000..5faaa722 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.cpp @@ -0,0 +1,1596 @@ +/****************************************************************************** +* TextRunList.cpp +* This module contains the implementation details of the CTextRunList +* class which is responsible for maintaining the collection of all the +* text runs in the DictPad program as a doubly linked list. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#include "stdafx.h" +#include "TextRunList.h" + +/********************************************************************** +* CTextRunList::CTextRunList * +*----------------------------* +* Description: +* Constructor. +**********************************************************************/ +CTextRunList::CTextRunList( ITextDocument *pTextDoc ) : + m_pHead( NULL ), + m_pTail( NULL ), + m_pCurrent( NULL ), + m_cpTextDoc( pTextDoc ) +{ +} /* CTextRunList::CTextRunList */ + +/********************************************************************** +* CTextRunList::~CTextRunList * +*-----------------------------* +* Description: +* Destructor +* Deletes everything in the list. +**********************************************************************/ +CTextRunList::~CTextRunList() +{ + DeleteAllNodes(); +} /* CTextRunList::~CTextRunList */ + +/********************************************************************** +* CTextRunList::CreateSimpleList * +*--------------------------------* +* Description: +* Creates a simple list consisting of a single TextRun +* made up of the entire text of the document. +* Return: +* S_OK +* E_OUTOFMEMORY +* Return value of ITextDocument::Range() +**********************************************************************/ +HRESULT CTextRunList::CreateSimpleList() +{ + _ASSERTE( !m_pHead && m_cpTextDoc ); + if ( m_pHead || !m_cpTextDoc ) + { + return E_UNEXPECTED; + } + + CComPtr cpDocRange; + HRESULT hr = m_cpTextDoc->Range( 0, 0, &cpDocRange ); + if ( SUCCEEDED( hr ) ) + { + // Keep moving the end of the range until it reaches the end of + // the document in order to get a range with the text of + // the entire document + long lDelta; + do + { + cpDocRange->MoveEnd( tomWord, 100, &lDelta ); + } while ( lDelta ); + + // Create a single CTextRun with this range + CTextRun *pTextRun = new CTextRun(); + if ( !pTextRun ) + { + return E_OUTOFMEMORY; + } + pTextRun->SetTextRange( cpDocRange ); + pTextRun->IncrementCount(); + + // Create a single node with that CTextRun + PTEXTRUNNODE pNode = new TEXTRUNNODE; + if ( !pNode ) + { + return E_OUTOFMEMORY; + } + pNode->pTextRun = pTextRun; + pNode->pNext = pNode->pPrev = NULL; + + // That node is the only node in the list + m_pHead = m_pTail = m_pCurrent = pNode; + } + return hr; +} /* CTextRunList::CreateSimpleList */ + +/********************************************************************** +* CTextRunList::Insert * +*----------------------* +* Description: +* Places pTextRun in the list wherever it should go. +* Tries to use pCurrent as a hint. +* Inserting degenerate runs is OK. +* Return: +* S_OK +* E_POINTER +* E_OUTOFMEMORY +* Return value of CTextRunList::AddHead() +* Return value of CTextRunList::MoveCurrentTo() +* Return value of CTextRunList::InsertAfter() +* Return value of CTextRunList::MergeIn() +***********************************************************************/ +HRESULT CTextRunList::Insert( CTextRun *pTextRun ) +{ + if ( !pTextRun ) + { + return E_POINTER; + } + + // Increment the refcount on the text run + pTextRun->IncrementCount(); + + // Create a new node with this CTextRun + PTEXTRUNNODE pNode = new TEXTRUNNODE; + if ( !pNode ) + { + return E_OUTOFMEMORY; + } + pNode->pTextRun = pTextRun; + + // This is the node that is going to be added + m_pNodeToInsert = pNode; + + // Insert the node into the list + HRESULT hr; + if (( !m_pHead ) || ( pNode->pTextRun->GetStart() == 0 )) + { + // There's nothing in the list already, or this run starts at zero, + // so add it as the head + hr = AddHead( pNode ); + } + else + { + // Move the m_pCurrent pointer to the node that will directly precede this run. + // Nodes will be split here if necessary + hr = MoveCurrentTo( pNode->pTextRun->GetStart() ); + + // Insert the node after where m_pCurrent now is + if ( SUCCEEDED( hr ) ) + { + hr = InsertAfter( m_pCurrent, pNode ); + } + } + if ( FAILED( hr ) ) + { + return hr; + } + + // If we replaced or deleted some entire blocks, + // then we need to delete those nodes here + PTEXTRUNNODE p = pNode->pNext; + PTEXTRUNNODE pNextNode; + PTEXTRUNNODE pPrevNode; + while ( p ) + { + pNextNode = p->pNext; + if ( p->pTextRun->IsDegenerate() || + ( p->pTextRun->GetEnd() <= pNode->pTextRun->GetEnd() )) + { + // This node has a degenerate run or a run that ends earlier than ours: + // remove it and keep going + RemoveNode( p ); + p = pNextNode; + } + else + { + // Stop at the first non-deletable run + p = NULL; + } + } + + // ... And look backwards for the same thing + p = pNode->pPrev; + while ( p ) + { + pPrevNode = p->pPrev; + if (p->pTextRun->IsDegenerate() || + ( p->pTextRun->GetStart() >= pNode->pTextRun->GetStart() )) + { + // This node has a degenerate run or a run that starts later than ours: + // remove it and keep going + RemoveNode( p ); + p = pPrevNode; + } + else + { + // Stop at the first non-deletable run + p = NULL; + } + } + + // Adjust the text ranges of the previous and next nodes + // (This is necessary because the text is actually added before this node + // makes it in, so the TOM has already adjusted the previous and next nodes' ranges to + // cover this new text) + if ( pNode->pNext ) + { + pNode->pNext->pTextRun->SetStart( pNode->pTextRun->GetEnd() ); + } + if ( pNode->pPrev ) + { + pNode->pPrev->pTextRun->SetEnd( pNode->pTextRun->GetStart() ); + } + + // Now merge this new run in with the neighbors, if possible. + // If pNode is degenerate (or becomes degenerate as a result of merging, + // it will get deleted. + bool fMadeItIn = false; + hr = MergeIn( pNode, &fMadeItIn ); + if ( SUCCEEDED( hr ) ) + { + return fMadeItIn ? S_OK : S_FALSE; + } + else + { + return hr; + } +} /* CTextRunList::Insert */ + +/****************************************************************************** +* CTextRunList::Speak * +*---------------------* +* Description: +* Starts speaking at the position *plStartSpeaking and ends at +* *plEndSpeaking, unless *plEndSpeaking is -1, in which case it +* speaks until the end of the document has been reached. +* Adjusts *plStartSpeaking and *plEndSpeaking to reflect the +* start and endpoints at which we actually will be speaking +* since they will have to be expanded if they fall in the middle +* of words or phrase elements. +* +* Return: +* S_OK +* S_FALSE if there was nothing to speak +* E_POINTER +* E_INVALIDARG if the speaking limits are not within range +* Return value of CTextRun::Speak() +******************************************************************************/ +HRESULT CTextRunList::Speak( ISpVoice &rVoice, + long *plStartSpeaking, + long *plEndSpeaking ) +{ + _ASSERTE( GetTailEnd() != 0 ); + + // Check arguments + if ( !plStartSpeaking || !plEndSpeaking ) + { + return E_POINTER; + } + if ((( *plEndSpeaking >= 0 ) && ( *plEndSpeaking < *plStartSpeaking )) || + (*plStartSpeaking < 0) ) + { + return E_INVALIDARG; + } + + if ( *plEndSpeaking == *plStartSpeaking ) + { + // nothing to speak + return S_FALSE; + } + + // Get p to the right spot for starting + PTEXTRUNNODE p; + p = Find( *plStartSpeaking ); + + // If the beginning was not found (i.e. it is at the end), then speak the entire TextRunList. + if ( !p ) + { + *plStartSpeaking = 0; + *plEndSpeaking = GetTailEnd(); + return Speak( rVoice, plStartSpeaking, plEndSpeaking ); + } + + if ( p->pTextRun->WithinRange( *plEndSpeaking ) ) + { + // This block is the only one that needs speaking, since both the start and the end + // limits for speaking are found within this run. + // CTextRun::Speak() will put the appropriate values in *plStartSpeaking and + // *plEndSpeaking. + return p->pTextRun->Speak( rVoice, plStartSpeaking, plEndSpeaking ); + } + + // Speak from *plStartSpeaking to the end of the first block + long lFirstBlockEnd = -1; + HRESULT hr = p->pTextRun->Speak( rVoice, plStartSpeaking, &lFirstBlockEnd ); + + // Spin through the list until the final node is reached or until the end of the + // TextRunList has been reached + for ( p = p->pNext; + SUCCEEDED(hr) && p && + (( *plEndSpeaking < 0 ) || ( p->pTextRun->GetEnd() < *plEndSpeaking )); + p = p->pNext ) + { + hr = p->pTextRun->Speak( rVoice ); + } + + // Stop here if something has gone wrong + if (FAILED(hr)) + { + return hr; + } + + // If we were not supposed to speak to the end of the document, + // speak from the start of the final node until the end limit. + if ( p && (*plEndSpeaking >= 0) ) + { + if ( p->pTextRun->GetStart() < *plEndSpeaking ) + { + // There is something left to speak in the final block, + // so speak from the beginning to *plEndSpeaking + long lFinalBlockStart = -1; + hr = p->pTextRun->Speak( rVoice, &lFinalBlockStart, plEndSpeaking ); + } + else + { + // There is nothing to speak in the final block: + // The end of the speak is the start of the final block + *plEndSpeaking = p->pTextRun->GetStart(); + } + } + else + { + // The end of the speak is the end of the document + *plEndSpeaking = GetTailEnd(); + } + + return hr; +} /* CTextRunList::Speak */ + +/***************************************************************************** +* CTextRunList::Serialize * +*-------------------------* +* Description: +* Serializes the information in the TextRunList and writes +* it to pStream. +* Return: +* S_OK +* E_POINTER: pStream or pRecoCtxt is NULL +* Return value of CTextRun::Serialize() +* Return value of IStream::Write() +******************************************************************************/ +HRESULT CTextRunList::Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ) +{ + if ( !pStream || !pRecoCtxt ) + { + return E_POINTER; + } + + // Walk the list, serializing each CTextRun + PTEXTRUNNODE pNode; + HRESULT hr = S_OK; + for ( pNode = m_pHead; pNode; pNode = pNode->pNext ) + { + // Serialize the node + hr = pNode->pTextRun->Serialize( pStream, pRecoCtxt ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + // Write an "end-of-list" header to the stream + RUNHEADER endHdr; + ULONG cb; + endHdr.lStart = endHdr.lEnd = -1; + hr = pStream->Write( &endHdr, sizeof( RUNHEADER ), &cb ); + + return hr; +} /* CTextRunList::Serialize */ + +/***************************************************************************** +* CTextRunList::Deserialize * +*---------------------------* +* Description: +* Uses an IStream to recreate a previously-serialized TextRunList +* Return: +* S_OK +* E_POINTER: pStream or pRecoCtxt is NULL +* E_FAIL: TextRunList was not empty to begin with or the associated +* ITextDocument is invalid or the TextRunList contains +* invalid offsets +* E_OUTOFMEMORY +* Return value of IStream::Read() +* Return value of ISpRecoContext::DeserializeResult() +* Return value of ITextDocument::Range() +* Return value of CTextRun::SetTextRange() +******************************************************************************/ +HRESULT CTextRunList::Deserialize( IStream *pStream, ISpRecoContext *pRecoCtxt ) +{ + if ( !pStream || !pRecoCtxt ) + { + return E_POINTER; + } + if ( !m_cpTextDoc ) + { + return E_FAIL; + } + + // Since we're going to be creating this CTextRunList from a stream, + // clear out any nodes that are already there + if ( m_pHead ) + { + DeleteAllNodes(); + } + + // Read in the first header; the end will be indicated by a header + // with lStart < 0 + RUNHEADER runHdr; + ULONG cbRead = 0; + HRESULT hr = pStream->Read( &runHdr, sizeof( RUNHEADER ), &cbRead ); + + // Keep reading until the end-of-stream RUNHEADER is encountered + // (that RUNHEADER will have -1 as its lStart) + long lNextPosToRead = 0; // To check consistency of serialized list + while ( SUCCEEDED( hr ) && ( cbRead > 0 ) && ( runHdr.lStart >= 0 ) ) + { + // Consistency check: Make sure this run starts where the + // last run left off + if ( lNextPosToRead == runHdr.lStart ) + { + // Good, update next position + lNextPosToRead = runHdr.lEnd; + } + else + { + hr = E_UNEXPECTED; + } + + CTextRun *pNewRun = NULL; + + if ( runHdr.bResultFollows ) + { + // This run is a serialized CDictationRun + + // Serialized CDictationRuns are preceded by a DICTHEADER + DICTHEADER dictHdr; + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Read( &dictHdr, sizeof( DICTHEADER ), &cbRead ); + } + /* + if ( FAILED( hr ) ) + { + return hr; + } + */ + + // Allocate the appropriate amount of space for the serialized + // result object + void *pv = NULL; + if ( SUCCEEDED( hr ) ) + { + pv = ::CoTaskMemAlloc( dictHdr.cbSize ); + if ( !pv ) + { + hr = E_OUTOFMEMORY; + } + } + + // Read in the serialized result object + if ( SUCCEEDED( hr ) ) + { + hr = pStream->Read( pv, dictHdr.cbSize, &cbRead ); + } + SPSERIALIZEDRESULT *pResultBlob = static_cast (pv); + CComPtr cpResult; + if ( SUCCEEDED( hr ) ) + { + hr = pRecoCtxt->DeserializeResult( pResultBlob, &cpResult ); + } + + if ( pv ) + { + ::CoTaskMemFree( pv ); + } + + /* + if ( FAILED( hr ) ) + { + return hr; + } +*/ + // Create a CDictationRun with which to associate the phrase blob + if ( SUCCEEDED( hr ) ) + { + pNewRun = new CDictationRun; + if ( !pNewRun ) + { + hr = E_OUTOFMEMORY; + } + } + + // Initialize it with the deserialized result object + if ( SUCCEEDED( hr ) ) + { + hr = ((CDictationRun *) pNewRun)->Initialize( + *cpResult, &dictHdr ); + + if ( FAILED( hr ) ) + { + // Punt and make it a TextRun + delete pNewRun; + pNewRun = new CTextRun(); + + if ( pNewRun ) + { + // Proceed with a simple CTextRun + hr = S_OK; + } + } + } + + } + else + { + // The RUNHEADER has indicated that this run is not a CDictationRun, + // so create a CTextRun + pNewRun = new CTextRun(); + } + + if ( !pNewRun ) + { + hr = E_OUTOFMEMORY; + } + else + { + pNewRun->IncrementCount(); + } + + // Create a text range for this run as specified by the RUNHEADER + CComPtr cpRange; + if ( SUCCEEDED( hr ) ) + { + hr = m_cpTextDoc->Range( runHdr.lStart, runHdr.lEnd, &cpRange ); + } + + // Set the run to use that text range + if (SUCCEEDED( hr ) ) + { + hr = pNewRun->SetTextRange( cpRange ); + } + + // Put the node on the list and continue + if ( pNewRun ) + { + // Link in the new node at the tail + PTEXTRUNNODE pNewNode = new TEXTRUNNODE; + pNewNode->pTextRun = pNewRun; + AddTail( pNewNode ); + } + + if ( SUCCEEDED( hr ) ) + { + // Read in the next header + hr = pStream->Read( &runHdr, sizeof( RUNHEADER ), &cbRead ); + } + } + + if ( FAILED( hr ) ) + { + // Roll back: Delete all of the nodes that were created + DeleteAllNodes(); + } + + // Start out with the "hint" pointer pointing to the head + m_pCurrent = m_pHead; + return hr; +} /* CTextRunList::Deserialize */ + +/***************************************************************************** +* CTextRunList::IsConsumeLeadingSpaces * +*--------------------------------------* +* Description: +* Sets *pfConsumeLeadingSpaces to true iff whatever starts at lPos +* has a display attribute to consume leading spaces +* Return: +* E_POINTER +* E_INVALIDARG if lPos is out of range +* Return value of CTextRun::IsConsumeLeadingSpaces() +******************************************************************************/ +HRESULT CTextRunList::IsConsumeLeadingSpaces( long lPos, + bool *pfConsumeLeadingSpaces ) +{ + if ( !pfConsumeLeadingSpaces ) + { + return E_POINTER; + } + + // Find the node containing this position + PTEXTRUNNODE pNode = Find( lPos ); + if ( !pNode ) + { + // we were given an out-of-range position + return E_INVALIDARG; + } + + _ASSERTE( pNode->pTextRun ); + + return pNode->pTextRun->IsConsumeLeadingSpaces( lPos, + pfConsumeLeadingSpaces ); +} /* CTextRunList::ConsumeLeadingSpaces */ + +/***************************************************************************** +* CTextRunList::HowManySpacesAfter * +*----------------------------------* +* Description: +* Returns the number of spaces that would need to precede text +* if text were to be inserted at position lPos. +* This number is in the out param puiSpaces +* Return: +* E_POINTER +* E_INVALIDARG if lPos is out of range +* Return value of CTextRun::HowManySpacesAfter() +******************************************************************************/ +HRESULT CTextRunList::HowManySpacesAfter( long lPos, UINT *puiSpaces ) +{ + if ( !puiSpaces ) + { + return E_POINTER; + } + + // Find the node containing this position + PTEXTRUNNODE pNode = Find( lPos ); + if ( !pNode ) + { + // we were given an out-of-range position + return E_INVALIDARG; + } + + _ASSERTE( pNode->pTextRun ); + + return pNode->pTextRun->HowManySpacesAfter( lPos, puiSpaces ); +} /* CTextRunList::HowManySpacesAfter */ + +/***************************************************************************** +* CTextRunList::GetTailEnd * +*--------------------------* +* Description: +* Returns the end position of the tail. This gives us the length of +* the document +******************************************************************************/ +long CTextRunList::GetTailEnd() +{ + if ( m_pTail ) + { + return m_pTail->pTextRun->GetEnd(); + } + else + { + return 0; + } +} /* CTextRunList::GetTailEnd */ + +/***************************************************************************** +* CTextRunList::Find * +*--------------------* +* Description: Returns a pointer to the node containing position lDest. +* Return: +* NULL if lDest is out of bounds +* Pointer to a node with cpMin <= lDest < cpMax +* OR a pointer to the tail if lDest is the last position in the list +******************************************************************************/ +PTEXTRUNNODE CTextRunList::Find( long lDest ) +{ + if ( !m_pHead || ( lDest < 0 ) || ( lDest > GetTailEnd() )) + { + return NULL; + } + + // Try to use m_pCurrent as a hint + if ( m_pCurrent && + ( m_pCurrent->pTextRun->GetStart() <= lDest ) && + ( lDest < m_pCurrent->pTextRun->GetEnd()) ) + { + return m_pCurrent; + } + + // Check for the start + if ( lDest == 0 ) + { + return m_pHead; + } + + // Check for the end + if ( lDest == GetTailEnd() ) + { + return m_pTail; + } + + // Find whose start is closest to lDest: the head, the tail, or m_pCurrent. + // Note that the distance from the start (head) is just lDest, since the + // start position is always 0. + long lDistFromEnd = labs( lDest - m_pTail->pTextRun->GetStart() ); + long lDistFromCurrent; + if ( m_pCurrent ) + { + lDistFromCurrent = labs( lDest - m_pCurrent->pTextRun->GetStart() ); + } + else + { + // m_pCurrent isn't pointing anywhere. + // "Sabotage" lDistFromCurrent so it will never beat searching from the start + lDistFromCurrent = lDest + 1; + } + bool bSearchForward; + PTEXTRUNNODE pStartSearch; + if (( lDistFromCurrent < lDest ) && + ( lDistFromCurrent < lDistFromEnd )) + { + // m_pCurrent is closer than both the head and the tail + // Search from m_pCurrent + pStartSearch = m_pCurrent; + } + else + { + if ( lDest < lDistFromEnd ) + { + // Head is closer than tail + pStartSearch = m_pHead; + } + else + { + pStartSearch = m_pTail; + } + } + + bSearchForward = (lDest >= pStartSearch->pTextRun->GetStart()); + + // Walk either forwards or backwards from the closest reference node + // looking for a node that meets cpMin <= lDest < cpMax + PTEXTRUNNODE p; + if ( bSearchForward ) + { + // Forward search + for ( p = pStartSearch; + p && (p->pTextRun->GetEnd() <= lDest); + p = p->pNext ) + ; + + _ASSERTE( p ); + if ( p->pTextRun->GetStart() > lDest ) + { + // lDest is in a gap preceding node p + _ASSERTE( false ); + p->pTextRun->SetStart( lDest ); + } + } + else + { + // Backwards search + for ( p = pStartSearch; + p && (p->pTextRun->GetStart() > lDest); + p = p->pPrev ) + ; + + _ASSERTE( p ); + if ( p->pTextRun->GetEnd() <= lDest ) + { + // lDest is in a gap following node p + _ASSERTE( false ); + p->pTextRun->SetEnd( lDest ); + } + } + + return p; +} /* CTextRunList::Find */ + +/***************************************************************************** +* CTextRunList::MoveCurrentTo * +*-----------------------------* +* Description: +* Moves the m_pCurrent to the TextRun node directly preceding +* the specified location (so that the next time we try to +* insert a text run, hopefully we can insert right after +* m_pCurrent. +* If lDest falls in the middle of a text run, splits that text +* run. +* First tries using its old value as a hint. +* Postcondition: The end of m_pCurrent == lDest +* Return: +* S_OK +* E_INVALIDARG if lDest is out of the range of the document +******************************************************************************/ +HRESULT CTextRunList::MoveCurrentTo( LONG lDest ) +{ + if ( m_pCurrent && (lDest == m_pCurrent->pTextRun->GetEnd()) ) + { + // All set, nothing more to do; m_pCurrent was already right + return S_OK; + } + + // If lDest is 0, then set m_pCurrent to NULL (since there is no node preceding the + // head + if ( !lDest ) + { + m_pCurrent = NULL; + return S_OK; + } + + // Find() will return pNode such that cpMin <= lDest < cpMax + PTEXTRUNNODE pNode = Find( lDest ); + + if ( !pNode ) + { + // lDest was too big, so it wasn't found + return E_INVALIDARG; + } + + // Make sure lDest is somewhere in pNode's range + _ASSERTE( pNode->pTextRun->WithinRange( lDest ) || (lDest == pNode->pTextRun->GetEnd()) ); + + HRESULT hr = S_OK; + if ( pNode->pTextRun->GetStart() == lDest ) + { + // The node we found begins exactly at lDest, so no splitting is necessary; + // we just need to have m_pCurrent point to the previous node + m_pCurrent = pNode->pPrev; + } + else + { + // lDest occurs in the middle of pNode's range, so we need to split pNode + hr = SplitNode( pNode ); + + if ( SUCCEEDED( hr ) ) + { + // pNode still starts at the same place, except now it ends at the start + // of m_pNodeToInsert (see CTextRunList::Insert()) + m_pCurrent = pNode; + } + } + return hr; +} /* CTextRunList::MoveCurrentTo */ + +/****************************************************************************** +* CTextRunList::SplitNode * +*-------------------------* +* Description: +* Called BEFORE m_pNodeToInsert is inserted into the list, in +* order to split up pNode to accommodate the new node. +* +* Splits the given node to form a node that ends at the start position +* of m_pNodeToInsert and a node that starts at the end position of +* m_pNodeToInsert. +* +* Creates a new node to bridge the gap if necessary. +* See CTextRun::Split() and CDictationRun::Split() +* Return: +* S_OK +* E_POINTER if pNode is NULL +* E_INVALIDARG if lCursorPos does not fall in the range of pNode +* E_OUTOFMEMORY +* Return value of CTextRun::Split() +* Return value of CTextRunList::InsertAfter() +******************************************************************************/ +HRESULT CTextRunList::SplitNode( PTEXTRUNNODE pNode ) +{ + if ( !pNode ) + { + return E_POINTER; + } + _ASSERTE( m_pNodeToInsert ); + if ( !m_pNodeToInsert ) + { + return E_UNEXPECTED; + } + + if ( m_pNodeToInsert->pTextRun->GetStart() == pNode->pTextRun->GetEnd() ) + { + // No need to split, since the new node is at the end of this node + return S_OK; + } + + if ( !(pNode->pTextRun->WithinRange( m_pNodeToInsert->pTextRun->GetStart() )) ) + { + // Start of m_pNodeToInsert is out of bounds + return E_INVALIDARG; + } + + CTextRun *pLatterRun = NULL; + + // Remember the start and end of m_pNodeToInsert + const long lStart = m_pNodeToInsert->pTextRun->GetStart(); + const long lEnd = m_pNodeToInsert->pTextRun->GetEnd(); + + // Call CTextRun::Split(). This might change the split locations lNewStart and lNewEnd + // and will set pLatterRun to a non-NULL value if the split actually did occur. + long lNewStart = lStart; + long lNewEnd = lEnd; + HRESULT hr = pNode->pTextRun->Split( &lNewStart, + &lNewEnd, m_cpTextDoc, &pLatterRun ); + _ASSERTE( SUCCEEDED( hr ) ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Adjust the range on m_pNodeToInsert if it has changed + if (( lStart != lNewStart ) || ( lEnd != lNewEnd )) + { + m_pNodeToInsert->pTextRun->SetStart( lNewStart ); + m_pNodeToInsert->pTextRun->SetEnd( lNewEnd ); + } + + if ( pLatterRun ) + { + // A split did occur + // Create the new node and insert it right after pNode + PTEXTRUNNODE pNewNode = new TEXTRUNNODE; + if ( !pNewNode ) + { + return E_OUTOFMEMORY; + } + pNewNode->pTextRun = pLatterRun; + pNewNode->pTextRun->IncrementCount(); + pNewNode->pNext = pNewNode->pPrev = NULL; + + hr = InsertAfter( pNode, pNewNode ); + if ( FAILED( hr ) ) + { + return hr; + } + + // InsertAfter() would have moved m_pCurrent to the latter run (the + // one associated with pNewNode). But m_pCurrent should stay at pNode. + m_pCurrent = pNode; + } + + return S_OK; +} /* CTextRunList::SplitNode */ + +/****************************************************************************** +* CTextRunList::MergeIn * +*-----------------------* +* Description: +* For new DictationRuns, passes them along to the separate merging +* method for DictationRuns below. +* handled by a separate merging method below). +* +* First tries to merge with each neighbor if it is a non-dictated +* node. +* +* Next tries to merge with dictation nodes on either side by +* temporarily including the node in the dictation node's range +* and seeing if it is a match for any of the missing phrase elements +* in that run. The neighboring dictation runs are allowed to +* appropriate whatever portion of its range that they can. +* +* Return: +* S_OK +* E_POINTER +* Return value of CTextRunList::MergeInDictRun() +******************************************************************************/ +HRESULT CTextRunList::MergeIn( PTEXTRUNNODE pNode, bool *pfNodeMadeItIn ) +{ + if ( !pfNodeMadeItIn ) + { + return E_POINTER; + } + + *pfNodeMadeItIn = false; + + if ( pNode->pTextRun->IsDict() ) + { + // Dictation runs are handled by a separate merging method. + // Assuming CTextRunList::MergeInDictRun() went off successfully, + // the run will have made it onto the list + HRESULT hr = MergeInDictRun( pNode ); + if ( SUCCEEDED( hr ) ) + { + *pfNodeMadeItIn = true; + } + return hr; + } + + // This run is not a CDictationRun + + // Do the easy merge with the neighbors if they are text nodes + // (that is, two adjacent non-dictated runs can always be merged) + MERGERESULT mr; + HRESULT hr; + if ( pNode->pPrev && !(pNode->pPrev->pTextRun->IsDict()) ) + { + mr = pNode->pTextRun->Concatenate( pNode->pPrev->pTextRun, false ); + + // Both nodes are nondictated text, so this better have worked + _ASSERTE( mr == E_FULLMERGE ); + _ASSERTE( pNode->pPrev->pTextRun->IsDegenerate() ); + if (( mr != E_FULLMERGE ) || !pNode->pPrev->pTextRun->IsDegenerate() ) + { + return E_UNEXPECTED; + } + + // Prev node can now be removed + hr = RemoveNode( pNode->pPrev ); + if ( FAILED( hr ) ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + } + if ( pNode->pNext && !(pNode->pNext->pTextRun->IsDict()) ) + { + mr = pNode->pTextRun->Concatenate( pNode->pNext->pTextRun, true ); + + // Both nodes are nondictated text, so this better have worked + _ASSERTE( mr == E_FULLMERGE ); + _ASSERTE( pNode->pNext->pTextRun->IsDegenerate() ); + if (( mr != E_FULLMERGE ) || !pNode->pNext->pTextRun->IsDegenerate() ) + { + return E_UNEXPECTED; + } + + // Next node can now be removed + hr = RemoveNode( pNode->pNext ); + if ( FAILED( hr ) ) + { + _ASSERTE( false ); + return E_UNEXPECTED; + } + } + + // pNode should be surrounded by dictation nodes now, since there should never be + // two consecutive text nodes + + // The concatenation for pNext must happen before that for pPrev. + // That is because it is a lot easier to include trailing spaces before the + // next word in a range than it is to include preceding spaces. + // Thus by concatenating onto pPrev LAST we are doing the forward Concatenate second, + // which is more effective in gobbling up pNode's range (our goal is to get + // pNode's range as small as possible. + if ( pNode->pNext ) + { + _ASSERTE( pNode->pNext->pTextRun->IsDict() ); + _ASSERTE( pNode->pNext->pTextRun->GetStart() == pNode->pTextRun->GetEnd() ); + + // This concatenation may change the end of pNode's text range or + // the start of pNext's text range + pNode->pNext->pTextRun->Concatenate( pNode->pTextRun, false ); + } + if ( pNode->pPrev ) + { + _ASSERTE( pNode->pPrev->pTextRun->IsDict() ); + _ASSERTE( pNode->pPrev->pTextRun->GetEnd() == pNode->pTextRun->GetStart() ); + + // This concatenation may change the end of pPrev's text range or + // the start of pNode's text range + pNode->pPrev->pTextRun->Concatenate( pNode->pTextRun, true ); + } + + // If pNode now has nothing left, then remove it and try to concatenate its previous and + // next neighbors together + if ( pNode->pTextRun->IsDegenerate() ) + { + // Hang on to the prev and next nodes + PTEXTRUNNODE pPrev = pNode->pPrev; + PTEXTRUNNODE pNext = pNode->pNext; + + // Remove pNode + HRESULT hr = RemoveNode( pNode ); + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + return E_UNEXPECTED; + } + + // Concatenate pPrev and pNext. If the pNext node is completely consumed, then + // remove it as well + if ( pPrev && pNext ) + { + _ASSERTE( pPrev->pTextRun->GetEnd() == pNext->pTextRun->GetStart() ); + + pPrev->pTextRun->Concatenate( pNext->pTextRun, true ); + + if ( pNext->pTextRun->IsDegenerate() ) + { + // pNext was entirely subsumed by pPrev, so remove it + hr = RemoveNode( pNext ); + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + return E_UNEXPECTED; + } + } + } + + // Do not set *pfNodeMadeItIn to true, since the node did not make it in + return S_OK; + } + else + { + // If we are here, the node made it onto the list successfully + *pfNodeMadeItIn = true; + return S_OK; + } +} /* CTextRunList::MergeIn */ + +/****************************************************************************** +* CTextRunList::MergeInDictRun * +*------------------------------* +* Description: +* Merges in a dictation run. +* Since it is a new dictation run, it is complete and its range +* will not change. If either neighbor is a dictation run, +* we need to check if the phrase elements are correct +* (since, of course, the new dictation run may be splitting up +* already-existing dictation runs). +* If not, we may need to insert text runs on either side. +* Return: +* S_OK +* E_OUTOFMEMORY +* Return value of CTextRun::CorrectPhraseEltsAndRange() +* Return value of ITextDocument::Range() +* Return value of CTextRun::SetTextRange() +* Return value of CTextRunList::InsertAfter() +* Return value of CTextRunList::MergeIn() +*******************************************************************************/ +HRESULT CTextRunList::MergeInDictRun( PTEXTRUNNODE pNode ) +{ + HRESULT hr; + PTEXTRUNNODE pNewTextRunNode = NULL; + CTextRun *pNewTextRun = NULL; + + // Make sure that the previous node still has accurate information + if ( pNode->pPrev ) + { + PTEXTRUNNODE pPrev = pNode->pPrev; + + // Ensure that the previous node's phrase elements reflect reality (it + // may be a newly-broken dictation run.) + // The range of pPrev will be adjusted so that only full phrase elements + // are included in pPrev's range + hr = pPrev->pTextRun->CorrectPhraseEltsAndRange( true ); + if ( FAILED( hr ) ) + { + return hr; + } + + if ( pPrev->pTextRun->GetEnd() < pNode->pTextRun->GetStart() ) + { + // There is a gap between the neighboring run and this run. + // The gap contains a fragment of a phrase element, which will + // now be downgraded to the status of non-dictated text. + + // A new text run must be created to cover that area + pNewTextRun = new CTextRun(); + if ( !pNewTextRun ) + { + return E_OUTOFMEMORY; + } + pNewTextRun->IncrementCount(); + + // That new run will cover the gap + CComPtr pPrevTextRange; + hr = m_cpTextDoc->Range( pPrev->pTextRun->GetEnd(), + pNode->pTextRun->GetStart(), &pPrevTextRange ); + if ( SUCCEEDED( hr ) ) + { + hr = pNewTextRun->SetTextRange( pPrevTextRange ); + } + if ( FAILED( hr ) ) + { + return hr; + } + + // Make a new TEXTRUNNODE for the list + pNewTextRunNode = new TEXTRUNNODE; + if ( !pNewTextRunNode ) + { + return E_OUTOFMEMORY; + } + pNewTextRunNode->pNext = pNewTextRunNode->pPrev = NULL; + pNewTextRunNode->pTextRun = pNewTextRun; + + // Put it right where the gap is + hr = InsertAfter( pPrev, pNewTextRunNode ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + if ( pPrev->pTextRun->IsDegenerate() ) + { + // pPrev now has no complete phrase elements, + // so get rid of it + hr = RemoveNode( pPrev ); + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + if ( pNewTextRunNode ) + { + // We are adding a CTextRun to bridge the gap between pPrev and pNode + + // Merge in the fragment of the phrase element as text + bool fMadeItIn; + hr = MergeIn( pNewTextRunNode, &fMadeItIn ); + if ( FAILED( hr ) ) + { + return hr; + } + + // Reset pNewTextRunNode NULL so this will work for processing pNext + pNewTextRunNode = NULL; + } + } + + // Make sure that the next node still has accurate information + if ( pNode->pNext ) + { + PTEXTRUNNODE pNext = pNode->pNext; + + // Ensure that the next node's phrase elements reflect reality (it + // may be a newly-broken dictation run. + // The range of pPrev will be adjusted so that only full phrase elements + // are included in pNext's range + hr = pNext->pTextRun->CorrectPhraseEltsAndRange( false ); + if ( FAILED( hr ) ) + { + return hr; + } + + if ( pNext->pTextRun->GetStart() > pNode->pTextRun->GetEnd() ) + { + // There is a gap between the neighboring run and this run. + // The gap contains a fragment of a phrase element, which will + // now be downgraded to the status of non-dictated text. + + // A new text run must be created to cover that area + pNewTextRun = new CTextRun(); + if ( !pNewTextRun ) + { + return E_OUTOFMEMORY; + } + pNewTextRun->IncrementCount(); + + // That new run will cover the gap + CComPtr pNextTextRange; + hr = m_cpTextDoc->Range( pNode->pTextRun->GetEnd(), + pNext->pTextRun->GetStart(), &pNextTextRange ); + if ( SUCCEEDED( hr ) ) + { + hr = pNewTextRun->SetTextRange( pNextTextRange ); + } + if ( FAILED( hr ) ) + { + return hr; + } + + // Make a new TEXTRUNNODE for the list + pNewTextRunNode = new TEXTRUNNODE; + if ( !pNewTextRunNode ) + { + return E_OUTOFMEMORY; + } + pNewTextRunNode->pNext = pNewTextRunNode->pPrev = NULL; + pNewTextRunNode->pTextRun = pNewTextRun; + + // Put it right where the gap is + hr = InsertAfter( pNode, pNewTextRunNode ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + if ( pNext->pTextRun->IsDegenerate() ) + { + // pNext now has no complete phrase elements, + // so get rid of it + hr = RemoveNode( pNext ); + _ASSERTE( SUCCEEDED(hr) ); + if ( FAILED( hr ) ) + { + return hr; + } + } + + if ( pNewTextRunNode ) + { + // We are adding a CTextRun to bridge the gap between pNode and pNext + + // Merge in the fragment of the phrase element as text + bool fMadeItIn; + hr = MergeIn( pNewTextRunNode, &fMadeItIn ); + if ( FAILED( hr ) ) + { + return hr; + } + } + } + + // If we got here, then no errors were encountered + return S_OK; +} /*CTextRunList::MergeInDictRun */ + +/********************************************************************** +* CTextRunList::InsertAfter * +*---------------------------* +* Description: +* Inserts pNodeToInsert in the list after pCurrent. +* If pCurrent is NULL, adds it onto the head. +* +* Return: +* E_POINTER if pNodeToInsert is NULL, otherwise S_OK. +**********************************************************************/ +HRESULT CTextRunList::InsertAfter( PTEXTRUNNODE pCurrent, + PTEXTRUNNODE pNodeToInsert ) +{ + HRESULT hr; + if( !pNodeToInsert ) + { + hr = E_POINTER; + } + else if ( !pCurrent ) + { + hr = AddHead( pNodeToInsert ); + } + else + { + // check if pCurrent is the tail of the list + if( pCurrent == m_pTail ) + { + hr = AddTail( pNodeToInsert ); + } + else + { + if( pCurrent->pNext == NULL ) + { + hr = E_UNEXPECTED; // only the tail can have a NULL pNext + } + else + { + // Link in the new node + PTEXTRUNNODE pLast = pCurrent->pNext; + pCurrent->pNext = pNodeToInsert; + pLast->pPrev = pNodeToInsert; + pNodeToInsert->pPrev = pCurrent; + pNodeToInsert->pNext = pLast; + + // Update m_pCurrent + m_pCurrent = pNodeToInsert; + + hr = S_OK; + } + } + } + return hr; +} /* CTextRunList::InsertAfter */ + +/********************************************************************** +* CTextRunList::RemoveNode * +*--------------------------* +* Description: +* Removes a node from the list. +* Decrements the text run reference counts. +* +* Return: +* E_POINTER if pNode is NULL, otherwise S_OK. +**********************************************************************/ +HRESULT CTextRunList::RemoveNode( PTEXTRUNNODE pNode ) +{ + HRESULT hr; + if( !pNode ) + { + hr = E_POINTER; + } + else + { + if( pNode == m_pHead ) + { + RemoveHead(); + } + else if( pNode == m_pTail ) + { + RemoveTail(); + } + else + { + // Link the two neighbors together + PTEXTRUNNODE pLeft = pNode->pPrev; + PTEXTRUNNODE pRight = pNode->pNext; + pLeft->pNext = pRight; + pRight->pPrev = pLeft; + + // Update current node if we're removing it + if( pNode == m_pCurrent ) + { + m_pCurrent = pLeft; + } + + // Decrement the refcount of this pNode's TextRun, then delete it + pNode->pTextRun->DecrementCount(); + delete pNode; + + } + hr = S_OK; + } + return hr; +} /* CTextRunList::RemoveNode */ + +/********************************************************************** +* CTextRunList::AddHead * +*-----------------------* +* Description: +* Adds a node to the head of the list. Sets the current +* pointer to the head. +* +* Return: +* E_POINTER if pHead is NULL, otherwise S_OK. +**********************************************************************/ +HRESULT CTextRunList::AddHead( PTEXTRUNNODE pHead ) +{ + HRESULT hr; + if( !pHead ) + { + hr = E_POINTER; + } + else + { + // Check for the first item in the list + if( !m_pHead ) + { + // This will be the only item on the list + _ASSERTE( m_pTail == NULL ); + pHead->pNext = pHead->pPrev = NULL; + m_pHead = m_pTail = m_pCurrent = pHead; + } + else + { + // Put this node ahead of the existing head + m_pHead->pPrev = pHead; + pHead->pNext = m_pHead; + pHead->pPrev = NULL; + m_pHead = pHead; + m_pCurrent = pHead; + } + hr = S_OK; + } + + return hr; +} /* CTextRunList::AddHead */ + +/********************************************************************** +* CTextRunList::AddTail * +*-----------------------* +* Description: +* Adds a node to the tail of the list. Sets the current +* pointer to the tail. +* +* Return: +* E_POINTER if pTail is NULL, otherwise S_OK. +**********************************************************************/ +HRESULT CTextRunList::AddTail( PTEXTRUNNODE pTail ) +{ + HRESULT hr; + if( !pTail ) + { + hr = E_POINTER; + } + else + { + // Check for the last item in the list + if( !m_pTail ) + { + // This will be the only item on the list + _ASSERTE( m_pHead == NULL ); + pTail->pNext = pTail->pPrev = NULL; + m_pHead = m_pTail = pTail; + } + else + { + // Put this node after of the existing tail + m_pTail->pNext = pTail; + pTail->pPrev = m_pTail; + pTail->pNext = NULL; + m_pTail = pTail; + m_pCurrent = pTail; + } + hr = S_OK; + } + + return hr; +} /* CTextRunList::AddTail */ + +/********************************************************************** +* CTextRunList::RemoveHead * +*--------------------------* +* Description: +* Removes the head node from the list and decrements the +* text run's reference count. +**********************************************************************/ +void CTextRunList::RemoveHead() +{ + _ASSERTE( m_pHead ); + if( m_pHead ) + { + if( m_pCurrent == m_pHead ) + { + // m_pCurrent would usually fall back one, but here + // we are removing the head + m_pCurrent = NULL; + } + m_pHead->pTextRun->DecrementCount(); + + // Update m_pHead + PTEXTRUNNODE pNewHead = m_pHead->pNext; + delete m_pHead; + m_pHead = pNewHead; + + // If we have deleted the only element, then make the tail NULL too + if ( !m_pHead ) + { + m_pTail = NULL; + } + else + { + // Head should have no previous node + m_pHead->pPrev = NULL; + } + } +} /* CTextRunList::RemoveHead */ + +/********************************************************************** +* CTextRunList::RemoveTail * +*--------------------------* +* Description: +* Removes the tail node from the list and decrements the +* text run's reference count. +**********************************************************************/ +void CTextRunList::RemoveTail() +{ + if( m_pTail ) + { + if( m_pCurrent == m_pTail ) + { + m_pCurrent = m_pTail->pPrev; + } + m_pTail->pTextRun->DecrementCount(); + + // Update m_pTail + PTEXTRUNNODE pNewTail = m_pTail->pPrev; + delete m_pTail; + m_pTail = pNewTail; + + // If we have deleted the last element, then make the head NULL too + if ( !m_pTail ) + { + m_pHead = NULL; + } + else + { + // Tail should have no next node + m_pTail->pNext = NULL; + } + } +} /* CTextRunList::RemoveTail */ + +/***************************************************************************** +* CTextRunList::DeleteAllNodes * +*------------------------------* +* Description: +* Deletes a doubly linked list for text run objects +* and decrements the text run reference counts. +******************************************************************************/ +void CTextRunList::DeleteAllNodes() +{ + // Spin through our list, deleting as we go + while( m_pHead ) + { + m_pCurrent = m_pHead; + + m_pHead = m_pHead->pNext; + + // Decrement a count on the TextRun associated with m_pCurrent + // This should delete the TextRun when its refcount hits 0. + m_pCurrent->pTextRun->DecrementCount(); + + delete m_pCurrent; + } + + // The list is now empty + m_pHead = m_pTail = m_pCurrent = NULL; +} /* CTextRunList::DeleteAllNodes */ + + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.h new file mode 100644 index 00000000..8e976a9f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/textrunlist.h @@ -0,0 +1,101 @@ +/****************************************************************************** +* TextRunList.h +* This module contains the definition details of CTextRunList which is +* a container class that keeps track of all of the individual text runs +* in DictPad +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "TextRun.h" +#include "DictationRun.h" + +// Nodes for the CTextRunList +typedef struct TEXTRUNNODE +{ + CTextRun *pTextRun; // Points to the actual test run information + struct TEXTRUNNODE *pPrev; // Points to the previous node in our list + struct TEXTRUNNODE *pNext; // Points to the next node in our list +} TEXTRUNNODE, *PTEXTRUNNODE; + +/****************************************************************************** +* CTextRunList +* This class keeps track of all the CTextRun objects that exist to +* represent the entire document being edited within DictPad +******************************************************************************/ +class CTextRunList +{ + public: + // Constructor/destructor + CTextRunList( ITextDocument *pTextDoc = NULL); + ~CTextRunList(); + + // Initialization methods + void SetTextDoc( ITextDocument *cpTextDoc ) { m_cpTextDoc = cpTextDoc; } + HRESULT CreateSimpleList(); // Create a one-node list consisting of a single TextRun + + // Method for new text + HRESULT Insert( CTextRun *pTextRun ); // Takes care of figuring out where the new node should go + + // Playback method + HRESULT Speak( ISpVoice &rVoice, long *plStartSpeaking, long *plEndSpeaking ); + // Speak starting and ending at specified locations + + // Serialization methods + HRESULT Serialize( IStream *pStream, ISpRecoContext *pRecoCtxt ); + // Write the contents of the TextRunList to pStream + HRESULT Deserialize( IStream *pStream, ISpRecoContext *pRecoCtxt ); + // Recreate the TextRunList from the stream + + // Display attributes methods + HRESULT IsConsumeLeadingSpaces( long lPos, bool *pfConsumeLeadingSpaces ); + HRESULT HowManySpacesAfter( long lPos, UINT *puiSpaces ); + // How many spaces would need to precede text + // that would start at lPos + + // Methods that deal with positions in the text + long GetTailEnd(); // length of the document + PTEXTRUNNODE Find( long lDest ); // Pointer to the node that contains this position + + + private: + // Methods for manipulation of adjacent CTextRuns + HRESULT MoveCurrentTo( LONG lDest ); // Move m_pCurrent to a node that ends at + // lDest, splitting nodes if necessary + HRESULT SplitNode( PTEXTRUNNODE pNode ); // Split the given node for m_pNodeToInsert + HRESULT MergeIn( PTEXTRUNNODE pNode, bool *pfNodeMadeItIn ); + // Try to merge a new node in with neighbors + HRESULT MergeInDictRun( PTEXTRUNNODE pNode ); + // Handle newly-dictated text in the list + + // List manipulation methods + HRESULT InsertAfter( PTEXTRUNNODE pCurrent, PTEXTRUNNODE pNodeToInsert ); + HRESULT RemoveNode( PTEXTRUNNODE pNode ); + HRESULT AddHead( PTEXTRUNNODE pHead ); + HRESULT AddTail( PTEXTRUNNODE pTail ); + void RemoveHead(); + void RemoveTail(); + + // Clean-up method + void DeleteAllNodes(); + + private: + // These cached nodes help us to add new nodes to our list + // somewhat optimally. + PTEXTRUNNODE m_pHead; // Starting point (necessary reguardless of strategy) + PTEXTRUNNODE m_pTail; // Last node in our list + PTEXTRUNNODE m_pCurrent; // Most recently added node. We cache this one under the + // assumption that nodes will often be added in groups; + // remembering where the last one went is a good clue + // as to where we should insert the next one. + + PTEXTRUNNODE m_pNodeToInsert; + // Node that we are about to add. This information is necessary for + // calling CTextRun::Split() + + CComPtr m_cpTextDoc; // Pointer to the ITextDocument interface to which + // we will need access for splitting nodes in order + // to retrieve ITextRange pointers. +}; /* class CTextRunList */ + diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/tom.h b/sp/src/utils/sapi51/Samples/CPP/DictPad/tom.h new file mode 100644 index 00000000..bd43fb22 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/tom.h @@ -0,0 +1,6612 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 3.01.75 */ +/* at Thu May 07 14:12:12 1998 + */ +/* Compiler settings for tom.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: none +*/ +//@@MIDL_FILE_HEADING( ) +#include "rpc.h" +#include "rpcndr.h" +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __tomtmp_h__ +#define __tomtmp_h__ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __ITextDocument_FWD_DEFINED__ +#define __ITextDocument_FWD_DEFINED__ +typedef interface ITextDocument ITextDocument; +#endif /* __ITextDocument_FWD_DEFINED__ */ + + +#ifndef __ITextRange_FWD_DEFINED__ +#define __ITextRange_FWD_DEFINED__ +typedef interface ITextRange ITextRange; +#endif /* __ITextRange_FWD_DEFINED__ */ + + +#ifndef __ITextSelection_FWD_DEFINED__ +#define __ITextSelection_FWD_DEFINED__ +typedef interface ITextSelection ITextSelection; +#endif /* __ITextSelection_FWD_DEFINED__ */ + + +#ifndef __ITextFont_FWD_DEFINED__ +#define __ITextFont_FWD_DEFINED__ +typedef interface ITextFont ITextFont; +#endif /* __ITextFont_FWD_DEFINED__ */ + + +#ifndef __ITextPara_FWD_DEFINED__ +#define __ITextPara_FWD_DEFINED__ +typedef interface ITextPara ITextPara; +#endif /* __ITextPara_FWD_DEFINED__ */ + + +#ifndef __ITextStoryRanges_FWD_DEFINED__ +#define __ITextStoryRanges_FWD_DEFINED__ +typedef interface ITextStoryRanges ITextStoryRanges; +#endif /* __ITextStoryRanges_FWD_DEFINED__ */ + + +#ifndef __ITextDocument2_FWD_DEFINED__ +#define __ITextDocument2_FWD_DEFINED__ +typedef interface ITextDocument2 ITextDocument2; +#endif /* __ITextDocument2_FWD_DEFINED__ */ + + +#ifndef __ITextMsgFilter_FWD_DEFINED__ +#define __ITextMsgFilter_FWD_DEFINED__ +typedef interface ITextMsgFilter ITextMsgFilter; +#endif /* __ITextMsgFilter_FWD_DEFINED__ */ + + +#ifndef __ITextDocument_FWD_DEFINED__ +#define __ITextDocument_FWD_DEFINED__ +typedef interface ITextDocument ITextDocument; +#endif /* __ITextDocument_FWD_DEFINED__ */ + + +#ifndef __ITextRange_FWD_DEFINED__ +#define __ITextRange_FWD_DEFINED__ +typedef interface ITextRange ITextRange; +#endif /* __ITextRange_FWD_DEFINED__ */ + + +#ifndef __ITextSelection_FWD_DEFINED__ +#define __ITextSelection_FWD_DEFINED__ +typedef interface ITextSelection ITextSelection; +#endif /* __ITextSelection_FWD_DEFINED__ */ + + +#ifndef __ITextFont_FWD_DEFINED__ +#define __ITextFont_FWD_DEFINED__ +typedef interface ITextFont ITextFont; +#endif /* __ITextFont_FWD_DEFINED__ */ + + +#ifndef __ITextPara_FWD_DEFINED__ +#define __ITextPara_FWD_DEFINED__ +typedef interface ITextPara ITextPara; +#endif /* __ITextPara_FWD_DEFINED__ */ + + +#ifndef __ITextStoryRanges_FWD_DEFINED__ +#define __ITextStoryRanges_FWD_DEFINED__ +typedef interface ITextStoryRanges ITextStoryRanges; +#endif /* __ITextStoryRanges_FWD_DEFINED__ */ + + +#ifndef __ITextDocument2_FWD_DEFINED__ +#define __ITextDocument2_FWD_DEFINED__ +typedef interface ITextDocument2 ITextDocument2; +#endif /* __ITextDocument2_FWD_DEFINED__ */ + + +#ifndef __ITextMsgFilter_FWD_DEFINED__ +#define __ITextMsgFilter_FWD_DEFINED__ +typedef interface ITextMsgFilter ITextMsgFilter; +#endif /* __ITextMsgFilter_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +/**************************************** + * Generated header for interface: __MIDL_itf_tom_0000 + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [local] */ + + + + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_tom_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_tom_0000_v0_0_s_ifspec; + + +#ifndef __tom_LIBRARY_DEFINED__ +#define __tom_LIBRARY_DEFINED__ + +/**************************************** + * Generated header for library: tom + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [version][uuid] */ + + +typedef /* [public] */ +enum __MIDL___MIDL_itf_tom_0000_0001 + { tomFalse = 0, + tomTrue = -1, + tomUndefined = -9999999, + tomToggle = -9999998, + tomAutoColor = -9999997, + tomDefault = -9999996, + tomSuspend = -9999995, + tomResume = -9999994, + tomApplyNow = 0, + tomApplyLater = 1, + tomTrackParms = 2, + tomCacheParms = 3, + tomBackward = 0xc0000001, + tomForward = 0x3fffffff, + tomMove = 0, + tomExtend = 1, + tomNoSelection = 0, + tomSelectionIP = 1, + tomSelectionNormal = 2, + tomSelectionFrame = 3, + tomSelectionColumn = 4, + tomSelectionRow = 5, + tomSelectionBlock = 6, + tomSelectionInlineShape = 7, + tomSelectionShape = 8, + tomSelStartActive = 1, + tomSelAtEOL = 2, + tomSelOvertype = 4, + tomSelActive = 8, + tomSelReplace = 16, + tomEnd = 0, + tomStart = 32, + tomCollapseEnd = 0, + tomCollapseStart = 1, + tomClientCoord = 256, + tomNone = 0, + tomSingle = 1, + tomWords = 2, + tomDouble = 3, + tomDotted = 4, + tomDash = 5, + tomDashDot = 6, + tomDashDotDot = 7, + tomWave = 8, + tomThick = 9, + tomHair = 10, + tomLineSpaceSingle = 0, + tomLineSpace1pt5 = 1, + tomLineSpaceDouble = 2, + tomLineSpaceAtLeast = 3, + tomLineSpaceExactly = 4, + tomLineSpaceMultiple = 5, + tomAlignLeft = 0, + tomAlignCenter = 1, + tomAlignRight = 2, + tomAlignJustify = 3, + tomAlignDecimal = 3, + tomAlignBar = 4, + tomAlignInterWord = 3, + tomAlignInterLetter = 4, + tomAlignScaled = 5, + tomAlignGlyphs = 6, + tomAlignSnapGrid = 7, + tomSpaces = 0, + tomDots = 1, + tomDashes = 2, + tomLines = 3, + tomThickLines = 4, + tomEquals = 5, + tomTabBack = -3, + tomTabNext = -2, + tomTabHere = -1, + tomListNone = 0, + tomListBullet = 1, + tomListNumberAsArabic = 2, + tomListNumberAsLCLetter = 3, + tomListNumberAsUCLetter = 4, + tomListNumberAsLCRoman = 5, + tomListNumberAsUCRoman = 6, + tomListNumberAsSequence = 7, + tomListParentheses = 0x10000, + tomListPeriod = 0x20000, + tomListPlain = 0x30000, + tomCharacter = 1, + tomWord = 2, + tomSentence = 3, + tomParagraph = 4, + tomLine = 5, + tomStory = 6, + tomScreen = 7, + tomSection = 8, + tomColumn = 9, + tomRow = 10, + tomWindow = 11, + tomCell = 12, + tomCharFormat = 13, + tomParaFormat = 14, + tomTable = 15, + tomObject = 16, + tomMatchWord = 2, + tomMatchCase = 4, + tomMatchPattern = 8, + tomUnknownStory = 0, + tomMainTextStory = 1, + tomFootnotesStory = 2, + tomEndnotesStory = 3, + tomCommentsStory = 4, + tomTextFrameStory = 5, + tomEvenPagesHeaderStory = 6, + tomPrimaryHeaderStory = 7, + tomEvenPagesFooterStory = 8, + tomPrimaryFooterStory = 9, + tomFirstPageHeaderStory = 10, + tomFirstPageFooterStory = 11, + tomNoAnimation = 0, + tomLasVegasLights = 1, + tomBlinkingBackground = 2, + tomSparkleText = 3, + tomMarchingBlackAnts = 4, + tomMarchingRedAnts = 5, + tomShimmer = 6, + tomWipeDown = 7, + tomWipeRight = 8, + tomAnimationMax = 8, + tomLowerCase = 0, + tomUpperCase = 1, + tomTitleCase = 2, + tomSentenceCase = 4, + tomToggleCase = 5, + tomReadOnly = 0x100, + tomShareDenyRead = 0x200, + tomShareDenyWrite = 0x400, + tomPasteFile = 0x1000, + tomCreateNew = 0x10, + tomCreateAlways = 0x20, + tomOpenExisting = 0x30, + tomOpenAlways = 0x40, + tomTruncateExisting = 0x50, + tomRTF = 0x1, + tomText = 0x2, + tomHTML = 0x3, + tomWordDocument = 0x4, + tomBold = 0x80000001, + tomItalic = 0x80000002, + tomUnderline = 0x80000004, + tomStrikeout = 0x80000008, + tomProtected = 0x80000010, + tomLink = 0x80000020, + tomSmallCaps = 0x80000040, + tomAllCaps = 0x80000080, + tomHidden = 0x80000100, + tomOutline = 0x80000200, + tomShadow = 0x80000400, + tomEmboss = 0x80000800, + tomImprint = 0x80001000, + tomDisabled = 0x80002000, + tomRevised = 0x80004000, + tomNormalCaret = 0, + tomKoreanBlockCaret = 0x1, + tomIncludeInset = 0x1, + tomIgnoreCurrentFont = 0, + tomMatchFontCharset = 0x1, + tomMatchFontSignature = 0x2, + tomCharset = 0x80000000 + } tomConstants; + + + + + + + + + + +EXTERN_C const IID LIBID_tom; + +#ifndef __ITextDocument_INTERFACE_DEFINED__ +#define __ITextDocument_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextDocument + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextDocument; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C0-A1DF-11ce-8098-00AA0047BE5D") + ITextDocument : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetName( + /* [retval][out] */ BSTR __RPC_FAR *pName) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSelection( + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryRanges( + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSaved( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSaved( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDefaultTabStop( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDefaultTabStop( + /* [in] */ float Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE New( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Open( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Save( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Freeze( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Unfreeze( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE BeginEditCollection( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndEditCollection( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Undo( + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Redo( + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Range( + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE RangeFromPoint( + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextDocumentVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextDocument __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextDocument __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextDocument __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextDocument __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextDocument __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextDocument __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextDocument __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelection )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryCount )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryRanges )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSaved )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSaved )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDefaultTabStop )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultTabStop )( + ITextDocument __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *New )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Unfreeze )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEditCollection )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndEditCollection )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Undo )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Redo )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Range )( + ITextDocument __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RangeFromPoint )( + ITextDocument __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + END_INTERFACE + } ITextDocumentVtbl; + + interface ITextDocument + { + CONST_VTBL struct ITextDocumentVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextDocument_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextDocument_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextDocument_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextDocument_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextDocument_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextDocument_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextDocument_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextDocument_GetName(This,pName) \ + (This)->lpVtbl -> GetName(This,pName) + +#define ITextDocument_GetSelection(This,ppSel) \ + (This)->lpVtbl -> GetSelection(This,ppSel) + +#define ITextDocument_GetStoryCount(This,pCount) \ + (This)->lpVtbl -> GetStoryCount(This,pCount) + +#define ITextDocument_GetStoryRanges(This,ppStories) \ + (This)->lpVtbl -> GetStoryRanges(This,ppStories) + +#define ITextDocument_GetSaved(This,pValue) \ + (This)->lpVtbl -> GetSaved(This,pValue) + +#define ITextDocument_SetSaved(This,Value) \ + (This)->lpVtbl -> SetSaved(This,Value) + +#define ITextDocument_GetDefaultTabStop(This,pValue) \ + (This)->lpVtbl -> GetDefaultTabStop(This,pValue) + +#define ITextDocument_SetDefaultTabStop(This,Value) \ + (This)->lpVtbl -> SetDefaultTabStop(This,Value) + +#define ITextDocument_New(This) \ + (This)->lpVtbl -> New(This) + +#define ITextDocument_Open(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Open(This,pVar,Flags,CodePage) + +#define ITextDocument_Save(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Save(This,pVar,Flags,CodePage) + +#define ITextDocument_Freeze(This,pCount) \ + (This)->lpVtbl -> Freeze(This,pCount) + +#define ITextDocument_Unfreeze(This,pCount) \ + (This)->lpVtbl -> Unfreeze(This,pCount) + +#define ITextDocument_BeginEditCollection(This) \ + (This)->lpVtbl -> BeginEditCollection(This) + +#define ITextDocument_EndEditCollection(This) \ + (This)->lpVtbl -> EndEditCollection(This) + +#define ITextDocument_Undo(This,Count,prop) \ + (This)->lpVtbl -> Undo(This,Count,prop) + +#define ITextDocument_Redo(This,Count,prop) \ + (This)->lpVtbl -> Redo(This,Count,prop) + +#define ITextDocument_Range(This,cp1,cp2,ppRange) \ + (This)->lpVtbl -> Range(This,cp1,cp2,ppRange) + +#define ITextDocument_RangeFromPoint(This,x,y,ppRange) \ + (This)->lpVtbl -> RangeFromPoint(This,x,y,ppRange) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetName_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + +void __RPC_STUB ITextDocument_GetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetSelection_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + +void __RPC_STUB ITextDocument_GetSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetStoryCount_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_GetStoryCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetStoryRanges_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + +void __RPC_STUB ITextDocument_GetStoryRanges_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetSaved_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextDocument_GetSaved_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_SetSaved_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextDocument_SetSaved_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetDefaultTabStop_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextDocument_GetDefaultTabStop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_SetDefaultTabStop_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextDocument_SetDefaultTabStop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_New_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_New_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Open_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + +void __RPC_STUB ITextDocument_Open_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Save_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + +void __RPC_STUB ITextDocument_Save_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Freeze_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_Freeze_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Unfreeze_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_Unfreeze_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_BeginEditCollection_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_BeginEditCollection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_EndEditCollection_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_EndEditCollection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Undo_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + +void __RPC_STUB ITextDocument_Undo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Redo_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + +void __RPC_STUB ITextDocument_Redo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Range_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextDocument_Range_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_RangeFromPoint_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextDocument_RangeFromPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextDocument_INTERFACE_DEFINED__ */ + + +#ifndef __ITextRange_INTERFACE_DEFINED__ +#define __ITextRange_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextRange + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextRange; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C2-A1DF-11ce-8098-00AA0047BE5D") + ITextRange : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetText( + /* [retval][out] */ BSTR __RPC_FAR *pbstr) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetText( + /* [in] */ BSTR bstr) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetChar( + /* [retval][out] */ long __RPC_FAR *pch) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetChar( + /* [in] */ long ch) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFormattedText( + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFormattedText( + /* [in] */ ITextRange __RPC_FAR *pRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStart( + /* [retval][out] */ long __RPC_FAR *pcpFirst) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStart( + /* [in] */ long cpFirst) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEnd( + /* [retval][out] */ long __RPC_FAR *pcpLim) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEnd( + /* [in] */ long cpLim) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFont( + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFont( + /* [in] */ ITextFont __RPC_FAR *pFont) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPara( + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPara( + /* [in] */ ITextPara __RPC_FAR *pPara) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryLength( + /* [retval][out] */ long __RPC_FAR *pcch) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryType( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Collapse( + /* [in] */ long bStart) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Expand( + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetIndex( + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetIndex( + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetRange( + /* [in] */ long cpActive, + /* [in] */ long cpOther) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE InRange( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE InStory( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Select( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE StartOf( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndOf( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Move( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStart( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEnd( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStartWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEndWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStartUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEndUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindText( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindTextStart( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindTextEnd( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Delete( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Cut( + /* [out] */ VARIANT __RPC_FAR *pVar) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Copy( + /* [out] */ VARIANT __RPC_FAR *pVar) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Paste( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanPaste( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanEdit( + /* [retval][out] */ long __RPC_FAR *pbCanEdit) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ChangeCase( + /* [in] */ long Type) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetPoint( + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetPoint( + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ScrollIntoView( + /* [in] */ long Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEmbeddedObject( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextRangeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextRange __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextRange __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextRange __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextRange __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextRange __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextRange __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextRange __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetText )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetText )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetChar )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetChar )( + ITextRange __RPC_FAR * This, + /* [in] */ long ch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFormattedText )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFormattedText )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStart )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStart )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpFirst); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnd )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpLim); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFont )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFont )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPara )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPara )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryLength )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryType )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Collapse )( + ITextRange __RPC_FAR * This, + /* [in] */ long bStart); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Expand )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIndex )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndex )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRange )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InRange )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InStory )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Select )( + ITextRange __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartOf )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndOf )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStart )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindText )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextStart )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Cut )( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Copy )( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Paste )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanPaste )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanEdit )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChangeCase )( + ITextRange __RPC_FAR * This, + /* [in] */ long Type); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPoint )( + ITextRange __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPoint )( + ITextRange __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ScrollIntoView )( + ITextRange __RPC_FAR * This, + /* [in] */ long Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmbeddedObject )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + END_INTERFACE + } ITextRangeVtbl; + + interface ITextRange + { + CONST_VTBL struct ITextRangeVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextRange_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextRange_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextRange_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextRange_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextRange_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextRange_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextRange_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextRange_GetText(This,pbstr) \ + (This)->lpVtbl -> GetText(This,pbstr) + +#define ITextRange_SetText(This,bstr) \ + (This)->lpVtbl -> SetText(This,bstr) + +#define ITextRange_GetChar(This,pch) \ + (This)->lpVtbl -> GetChar(This,pch) + +#define ITextRange_SetChar(This,ch) \ + (This)->lpVtbl -> SetChar(This,ch) + +#define ITextRange_GetDuplicate(This,ppRange) \ + (This)->lpVtbl -> GetDuplicate(This,ppRange) + +#define ITextRange_GetFormattedText(This,ppRange) \ + (This)->lpVtbl -> GetFormattedText(This,ppRange) + +#define ITextRange_SetFormattedText(This,pRange) \ + (This)->lpVtbl -> SetFormattedText(This,pRange) + +#define ITextRange_GetStart(This,pcpFirst) \ + (This)->lpVtbl -> GetStart(This,pcpFirst) + +#define ITextRange_SetStart(This,cpFirst) \ + (This)->lpVtbl -> SetStart(This,cpFirst) + +#define ITextRange_GetEnd(This,pcpLim) \ + (This)->lpVtbl -> GetEnd(This,pcpLim) + +#define ITextRange_SetEnd(This,cpLim) \ + (This)->lpVtbl -> SetEnd(This,cpLim) + +#define ITextRange_GetFont(This,pFont) \ + (This)->lpVtbl -> GetFont(This,pFont) + +#define ITextRange_SetFont(This,pFont) \ + (This)->lpVtbl -> SetFont(This,pFont) + +#define ITextRange_GetPara(This,pPara) \ + (This)->lpVtbl -> GetPara(This,pPara) + +#define ITextRange_SetPara(This,pPara) \ + (This)->lpVtbl -> SetPara(This,pPara) + +#define ITextRange_GetStoryLength(This,pcch) \ + (This)->lpVtbl -> GetStoryLength(This,pcch) + +#define ITextRange_GetStoryType(This,pValue) \ + (This)->lpVtbl -> GetStoryType(This,pValue) + +#define ITextRange_Collapse(This,bStart) \ + (This)->lpVtbl -> Collapse(This,bStart) + +#define ITextRange_Expand(This,Unit,pDelta) \ + (This)->lpVtbl -> Expand(This,Unit,pDelta) + +#define ITextRange_GetIndex(This,Unit,pIndex) \ + (This)->lpVtbl -> GetIndex(This,Unit,pIndex) + +#define ITextRange_SetIndex(This,Unit,Index,Extend) \ + (This)->lpVtbl -> SetIndex(This,Unit,Index,Extend) + +#define ITextRange_SetRange(This,cpActive,cpOther) \ + (This)->lpVtbl -> SetRange(This,cpActive,cpOther) + +#define ITextRange_InRange(This,pRange,pb) \ + (This)->lpVtbl -> InRange(This,pRange,pb) + +#define ITextRange_InStory(This,pRange,pb) \ + (This)->lpVtbl -> InStory(This,pRange,pb) + +#define ITextRange_IsEqual(This,pRange,pb) \ + (This)->lpVtbl -> IsEqual(This,pRange,pb) + +#define ITextRange_Select(This) \ + (This)->lpVtbl -> Select(This) + +#define ITextRange_StartOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> StartOf(This,Unit,Extend,pDelta) + +#define ITextRange_EndOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndOf(This,Unit,Extend,pDelta) + +#define ITextRange_Move(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Move(This,Unit,Count,pDelta) + +#define ITextRange_MoveStart(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveStart(This,Unit,Count,pDelta) + +#define ITextRange_MoveEnd(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveEnd(This,Unit,Count,pDelta) + +#define ITextRange_MoveWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveStartWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveEndWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveUntil(This,Cset,Count,pDelta) + +#define ITextRange_MoveStartUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartUntil(This,Cset,Count,pDelta) + +#define ITextRange_MoveEndUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndUntil(This,Cset,Count,pDelta) + +#define ITextRange_FindText(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindText(This,bstr,cch,Flags,pLength) + +#define ITextRange_FindTextStart(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextStart(This,bstr,cch,Flags,pLength) + +#define ITextRange_FindTextEnd(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextEnd(This,bstr,cch,Flags,pLength) + +#define ITextRange_Delete(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Delete(This,Unit,Count,pDelta) + +#define ITextRange_Cut(This,pVar) \ + (This)->lpVtbl -> Cut(This,pVar) + +#define ITextRange_Copy(This,pVar) \ + (This)->lpVtbl -> Copy(This,pVar) + +#define ITextRange_Paste(This,pVar,Format) \ + (This)->lpVtbl -> Paste(This,pVar,Format) + +#define ITextRange_CanPaste(This,pVar,Format,pb) \ + (This)->lpVtbl -> CanPaste(This,pVar,Format,pb) + +#define ITextRange_CanEdit(This,pbCanEdit) \ + (This)->lpVtbl -> CanEdit(This,pbCanEdit) + +#define ITextRange_ChangeCase(This,Type) \ + (This)->lpVtbl -> ChangeCase(This,Type) + +#define ITextRange_GetPoint(This,Type,px,py) \ + (This)->lpVtbl -> GetPoint(This,Type,px,py) + +#define ITextRange_SetPoint(This,x,y,Type,Extend) \ + (This)->lpVtbl -> SetPoint(This,x,y,Type,Extend) + +#define ITextRange_ScrollIntoView(This,Value) \ + (This)->lpVtbl -> ScrollIntoView(This,Value) + +#define ITextRange_GetEmbeddedObject(This,ppv) \ + (This)->lpVtbl -> GetEmbeddedObject(This,ppv) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetText_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + +void __RPC_STUB ITextRange_GetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextRange_SetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetChar_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + +void __RPC_STUB ITextRange_GetChar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetChar_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long ch); + + +void __RPC_STUB ITextRange_SetChar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetDuplicate_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextRange_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetFormattedText_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextRange_GetFormattedText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetFormattedText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + +void __RPC_STUB ITextRange_SetFormattedText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStart_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + +void __RPC_STUB ITextRange_GetStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpFirst); + + +void __RPC_STUB ITextRange_SetStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + +void __RPC_STUB ITextRange_GetEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpLim); + + +void __RPC_STUB ITextRange_SetEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetFont_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + +void __RPC_STUB ITextRange_GetFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetFont_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + +void __RPC_STUB ITextRange_SetFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetPara_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + +void __RPC_STUB ITextRange_GetPara_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetPara_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + +void __RPC_STUB ITextRange_SetPara_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStoryLength_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + +void __RPC_STUB ITextRange_GetStoryLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStoryType_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextRange_GetStoryType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Collapse_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long bStart); + + +void __RPC_STUB ITextRange_Collapse_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Expand_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Expand_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetIndex_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + +void __RPC_STUB ITextRange_GetIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetIndex_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + +void __RPC_STUB ITextRange_SetIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetRange_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + +void __RPC_STUB ITextRange_SetRange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_InRange_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_InRange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_InStory_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_InStory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_IsEqual_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Select_Proxy( + ITextRange __RPC_FAR * This); + + +void __RPC_STUB ITextRange_Select_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_StartOf_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_StartOf_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_EndOf_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_EndOf_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Move_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Move_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStartWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStartWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEndWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEndWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStartUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStartUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEndUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEndUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindTextStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindTextStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindTextEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindTextEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Delete_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Delete_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Cut_Proxy( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + +void __RPC_STUB ITextRange_Cut_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Copy_Proxy( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + +void __RPC_STUB ITextRange_Copy_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Paste_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + +void __RPC_STUB ITextRange_Paste_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_CanPaste_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_CanPaste_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_CanEdit_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + +void __RPC_STUB ITextRange_CanEdit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_ChangeCase_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Type); + + +void __RPC_STUB ITextRange_ChangeCase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetPoint_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + +void __RPC_STUB ITextRange_GetPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetPoint_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + +void __RPC_STUB ITextRange_SetPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_ScrollIntoView_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextRange_ScrollIntoView_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetEmbeddedObject_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + +void __RPC_STUB ITextRange_GetEmbeddedObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextRange_INTERFACE_DEFINED__ */ + + +#ifndef __ITextSelection_INTERFACE_DEFINED__ +#define __ITextSelection_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextSelection + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextSelection; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C1-A1DF-11ce-8098-00AA0047BE5D") + ITextSelection : public ITextRange + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFlags( + /* [retval][out] */ long __RPC_FAR *pFlags) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFlags( + /* [in] */ LONG Flags) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetType( + /* [retval][out] */ long __RPC_FAR *pType) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveLeft( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveRight( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveUp( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveDown( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE HomeKey( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndKey( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE TypeText( + /* [in] */ BSTR bstr) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextSelectionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextSelection __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextSelection __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextSelection __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextSelection __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextSelection __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextSelection __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextSelection __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetText )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetChar )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetChar )( + ITextSelection __RPC_FAR * This, + /* [in] */ long ch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFormattedText )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFormattedText )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStart )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpFirst); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnd )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpLim); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFont )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFont )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPara )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPara )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryLength )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryType )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Collapse )( + ITextSelection __RPC_FAR * This, + /* [in] */ long bStart); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Expand )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIndex )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndex )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRange )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InRange )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InStory )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Select )( + ITextSelection __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartOf )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndOf )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Cut )( + ITextSelection __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Copy )( + ITextSelection __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Paste )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanPaste )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanEdit )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChangeCase )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Type); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPoint )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPoint )( + ITextSelection __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ScrollIntoView )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmbeddedObject )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFlags )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pFlags); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFlags )( + ITextSelection __RPC_FAR * This, + /* [in] */ LONG Flags); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetType )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pType); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveLeft )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveRight )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUp )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveDown )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HomeKey )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndKey )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *TypeText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + END_INTERFACE + } ITextSelectionVtbl; + + interface ITextSelection + { + CONST_VTBL struct ITextSelectionVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextSelection_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextSelection_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextSelection_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextSelection_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextSelection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextSelection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextSelection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextSelection_GetText(This,pbstr) \ + (This)->lpVtbl -> GetText(This,pbstr) + +#define ITextSelection_SetText(This,bstr) \ + (This)->lpVtbl -> SetText(This,bstr) + +#define ITextSelection_GetChar(This,pch) \ + (This)->lpVtbl -> GetChar(This,pch) + +#define ITextSelection_SetChar(This,ch) \ + (This)->lpVtbl -> SetChar(This,ch) + +#define ITextSelection_GetDuplicate(This,ppRange) \ + (This)->lpVtbl -> GetDuplicate(This,ppRange) + +#define ITextSelection_GetFormattedText(This,ppRange) \ + (This)->lpVtbl -> GetFormattedText(This,ppRange) + +#define ITextSelection_SetFormattedText(This,pRange) \ + (This)->lpVtbl -> SetFormattedText(This,pRange) + +#define ITextSelection_GetStart(This,pcpFirst) \ + (This)->lpVtbl -> GetStart(This,pcpFirst) + +#define ITextSelection_SetStart(This,cpFirst) \ + (This)->lpVtbl -> SetStart(This,cpFirst) + +#define ITextSelection_GetEnd(This,pcpLim) \ + (This)->lpVtbl -> GetEnd(This,pcpLim) + +#define ITextSelection_SetEnd(This,cpLim) \ + (This)->lpVtbl -> SetEnd(This,cpLim) + +#define ITextSelection_GetFont(This,pFont) \ + (This)->lpVtbl -> GetFont(This,pFont) + +#define ITextSelection_SetFont(This,pFont) \ + (This)->lpVtbl -> SetFont(This,pFont) + +#define ITextSelection_GetPara(This,pPara) \ + (This)->lpVtbl -> GetPara(This,pPara) + +#define ITextSelection_SetPara(This,pPara) \ + (This)->lpVtbl -> SetPara(This,pPara) + +#define ITextSelection_GetStoryLength(This,pcch) \ + (This)->lpVtbl -> GetStoryLength(This,pcch) + +#define ITextSelection_GetStoryType(This,pValue) \ + (This)->lpVtbl -> GetStoryType(This,pValue) + +#define ITextSelection_Collapse(This,bStart) \ + (This)->lpVtbl -> Collapse(This,bStart) + +#define ITextSelection_Expand(This,Unit,pDelta) \ + (This)->lpVtbl -> Expand(This,Unit,pDelta) + +#define ITextSelection_GetIndex(This,Unit,pIndex) \ + (This)->lpVtbl -> GetIndex(This,Unit,pIndex) + +#define ITextSelection_SetIndex(This,Unit,Index,Extend) \ + (This)->lpVtbl -> SetIndex(This,Unit,Index,Extend) + +#define ITextSelection_SetRange(This,cpActive,cpOther) \ + (This)->lpVtbl -> SetRange(This,cpActive,cpOther) + +#define ITextSelection_InRange(This,pRange,pb) \ + (This)->lpVtbl -> InRange(This,pRange,pb) + +#define ITextSelection_InStory(This,pRange,pb) \ + (This)->lpVtbl -> InStory(This,pRange,pb) + +#define ITextSelection_IsEqual(This,pRange,pb) \ + (This)->lpVtbl -> IsEqual(This,pRange,pb) + +#define ITextSelection_Select(This) \ + (This)->lpVtbl -> Select(This) + +#define ITextSelection_StartOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> StartOf(This,Unit,Extend,pDelta) + +#define ITextSelection_EndOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndOf(This,Unit,Extend,pDelta) + +#define ITextSelection_Move(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Move(This,Unit,Count,pDelta) + +#define ITextSelection_MoveStart(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveStart(This,Unit,Count,pDelta) + +#define ITextSelection_MoveEnd(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveEnd(This,Unit,Count,pDelta) + +#define ITextSelection_MoveWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveStartWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveEndWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveUntil(This,Cset,Count,pDelta) + +#define ITextSelection_MoveStartUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartUntil(This,Cset,Count,pDelta) + +#define ITextSelection_MoveEndUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndUntil(This,Cset,Count,pDelta) + +#define ITextSelection_FindText(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindText(This,bstr,cch,Flags,pLength) + +#define ITextSelection_FindTextStart(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextStart(This,bstr,cch,Flags,pLength) + +#define ITextSelection_FindTextEnd(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextEnd(This,bstr,cch,Flags,pLength) + +#define ITextSelection_Delete(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Delete(This,Unit,Count,pDelta) + +#define ITextSelection_Cut(This,pVar) \ + (This)->lpVtbl -> Cut(This,pVar) + +#define ITextSelection_Copy(This,pVar) \ + (This)->lpVtbl -> Copy(This,pVar) + +#define ITextSelection_Paste(This,pVar,Format) \ + (This)->lpVtbl -> Paste(This,pVar,Format) + +#define ITextSelection_CanPaste(This,pVar,Format,pb) \ + (This)->lpVtbl -> CanPaste(This,pVar,Format,pb) + +#define ITextSelection_CanEdit(This,pbCanEdit) \ + (This)->lpVtbl -> CanEdit(This,pbCanEdit) + +#define ITextSelection_ChangeCase(This,Type) \ + (This)->lpVtbl -> ChangeCase(This,Type) + +#define ITextSelection_GetPoint(This,Type,px,py) \ + (This)->lpVtbl -> GetPoint(This,Type,px,py) + +#define ITextSelection_SetPoint(This,x,y,Type,Extend) \ + (This)->lpVtbl -> SetPoint(This,x,y,Type,Extend) + +#define ITextSelection_ScrollIntoView(This,Value) \ + (This)->lpVtbl -> ScrollIntoView(This,Value) + +#define ITextSelection_GetEmbeddedObject(This,ppv) \ + (This)->lpVtbl -> GetEmbeddedObject(This,ppv) + + +#define ITextSelection_GetFlags(This,pFlags) \ + (This)->lpVtbl -> GetFlags(This,pFlags) + +#define ITextSelection_SetFlags(This,Flags) \ + (This)->lpVtbl -> SetFlags(This,Flags) + +#define ITextSelection_GetType(This,pType) \ + (This)->lpVtbl -> GetType(This,pType) + +#define ITextSelection_MoveLeft(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveLeft(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveRight(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveRight(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveUp(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveUp(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveDown(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveDown(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_HomeKey(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> HomeKey(This,Unit,Extend,pDelta) + +#define ITextSelection_EndKey(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndKey(This,Unit,Extend,pDelta) + +#define ITextSelection_TypeText(This,bstr) \ + (This)->lpVtbl -> TypeText(This,bstr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_GetFlags_Proxy( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pFlags); + + +void __RPC_STUB ITextSelection_GetFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_SetFlags_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ LONG Flags); + + +void __RPC_STUB ITextSelection_SetFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_GetType_Proxy( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pType); + + +void __RPC_STUB ITextSelection_GetType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveLeft_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveLeft_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveRight_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveRight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveUp_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveUp_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveDown_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveDown_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_HomeKey_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_HomeKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_EndKey_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_EndKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_TypeText_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextSelection_TypeText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextSelection_INTERFACE_DEFINED__ */ + + +#ifndef __ITextFont_INTERFACE_DEFINED__ +#define __ITextFont_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextFont + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextFont; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C3-A1DF-11ce-8098-00AA0047BE5D") + ITextFont : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDuplicate( + /* [in] */ ITextFont __RPC_FAR *pFont) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanChange( + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStyle( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStyle( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAllCaps( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAllCaps( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAnimation( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAnimation( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetBackColor( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetBackColor( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetBold( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetBold( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEmboss( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEmboss( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetForeColor( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetForeColor( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetHidden( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetHidden( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEngrave( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEngrave( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetItalic( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetItalic( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKerning( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKerning( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLanguageID( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetLanguageID( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetName( + /* [retval][out] */ BSTR __RPC_FAR *pbstr) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetName( + /* [in] */ BSTR bstr) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetOutline( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetOutline( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPosition( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPosition( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetProtected( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetProtected( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetShadow( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetShadow( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSize( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSize( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSmallCaps( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSmallCaps( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpacing( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpacing( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStrikeThrough( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStrikeThrough( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSubscript( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSubscript( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSuperscript( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSuperscript( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetUnderline( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetUnderline( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetWeight( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetWeight( + /* [in] */ long Value) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextFontVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextFont __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextFont __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextFont __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextFont __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextFont __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextFont __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextFont __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDuplicate )( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanChange )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStyle )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStyle )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAllCaps )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAllCaps )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAnimation )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAnimation )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBackColor )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetBackColor )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBold )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetBold )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmboss )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEmboss )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetForeColor )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetForeColor )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHidden )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetHidden )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEngrave )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEngrave )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetItalic )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetItalic )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKerning )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKerning )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLanguageID )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetLanguageID )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetName )( + ITextFont __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetOutline )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetOutline )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPosition )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPosition )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProtected )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetProtected )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetShadow )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetShadow )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSize )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSize )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSmallCaps )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSmallCaps )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpacing )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpacing )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStrikeThrough )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStrikeThrough )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSubscript )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSubscript )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSuperscript )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSuperscript )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetUnderline )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetUnderline )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWeight )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWeight )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + END_INTERFACE + } ITextFontVtbl; + + interface ITextFont + { + CONST_VTBL struct ITextFontVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextFont_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextFont_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextFont_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextFont_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextFont_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextFont_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextFont_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextFont_GetDuplicate(This,ppFont) \ + (This)->lpVtbl -> GetDuplicate(This,ppFont) + +#define ITextFont_SetDuplicate(This,pFont) \ + (This)->lpVtbl -> SetDuplicate(This,pFont) + +#define ITextFont_CanChange(This,pB) \ + (This)->lpVtbl -> CanChange(This,pB) + +#define ITextFont_IsEqual(This,pFont,pB) \ + (This)->lpVtbl -> IsEqual(This,pFont,pB) + +#define ITextFont_Reset(This,Value) \ + (This)->lpVtbl -> Reset(This,Value) + +#define ITextFont_GetStyle(This,pValue) \ + (This)->lpVtbl -> GetStyle(This,pValue) + +#define ITextFont_SetStyle(This,Value) \ + (This)->lpVtbl -> SetStyle(This,Value) + +#define ITextFont_GetAllCaps(This,pValue) \ + (This)->lpVtbl -> GetAllCaps(This,pValue) + +#define ITextFont_SetAllCaps(This,Value) \ + (This)->lpVtbl -> SetAllCaps(This,Value) + +#define ITextFont_GetAnimation(This,pValue) \ + (This)->lpVtbl -> GetAnimation(This,pValue) + +#define ITextFont_SetAnimation(This,Value) \ + (This)->lpVtbl -> SetAnimation(This,Value) + +#define ITextFont_GetBackColor(This,pValue) \ + (This)->lpVtbl -> GetBackColor(This,pValue) + +#define ITextFont_SetBackColor(This,Value) \ + (This)->lpVtbl -> SetBackColor(This,Value) + +#define ITextFont_GetBold(This,pValue) \ + (This)->lpVtbl -> GetBold(This,pValue) + +#define ITextFont_SetBold(This,Value) \ + (This)->lpVtbl -> SetBold(This,Value) + +#define ITextFont_GetEmboss(This,pValue) \ + (This)->lpVtbl -> GetEmboss(This,pValue) + +#define ITextFont_SetEmboss(This,Value) \ + (This)->lpVtbl -> SetEmboss(This,Value) + +#define ITextFont_GetForeColor(This,pValue) \ + (This)->lpVtbl -> GetForeColor(This,pValue) + +#define ITextFont_SetForeColor(This,Value) \ + (This)->lpVtbl -> SetForeColor(This,Value) + +#define ITextFont_GetHidden(This,pValue) \ + (This)->lpVtbl -> GetHidden(This,pValue) + +#define ITextFont_SetHidden(This,Value) \ + (This)->lpVtbl -> SetHidden(This,Value) + +#define ITextFont_GetEngrave(This,pValue) \ + (This)->lpVtbl -> GetEngrave(This,pValue) + +#define ITextFont_SetEngrave(This,Value) \ + (This)->lpVtbl -> SetEngrave(This,Value) + +#define ITextFont_GetItalic(This,pValue) \ + (This)->lpVtbl -> GetItalic(This,pValue) + +#define ITextFont_SetItalic(This,Value) \ + (This)->lpVtbl -> SetItalic(This,Value) + +#define ITextFont_GetKerning(This,pValue) \ + (This)->lpVtbl -> GetKerning(This,pValue) + +#define ITextFont_SetKerning(This,Value) \ + (This)->lpVtbl -> SetKerning(This,Value) + +#define ITextFont_GetLanguageID(This,pValue) \ + (This)->lpVtbl -> GetLanguageID(This,pValue) + +#define ITextFont_SetLanguageID(This,Value) \ + (This)->lpVtbl -> SetLanguageID(This,Value) + +#define ITextFont_GetName(This,pbstr) \ + (This)->lpVtbl -> GetName(This,pbstr) + +#define ITextFont_SetName(This,bstr) \ + (This)->lpVtbl -> SetName(This,bstr) + +#define ITextFont_GetOutline(This,pValue) \ + (This)->lpVtbl -> GetOutline(This,pValue) + +#define ITextFont_SetOutline(This,Value) \ + (This)->lpVtbl -> SetOutline(This,Value) + +#define ITextFont_GetPosition(This,pValue) \ + (This)->lpVtbl -> GetPosition(This,pValue) + +#define ITextFont_SetPosition(This,Value) \ + (This)->lpVtbl -> SetPosition(This,Value) + +#define ITextFont_GetProtected(This,pValue) \ + (This)->lpVtbl -> GetProtected(This,pValue) + +#define ITextFont_SetProtected(This,Value) \ + (This)->lpVtbl -> SetProtected(This,Value) + +#define ITextFont_GetShadow(This,pValue) \ + (This)->lpVtbl -> GetShadow(This,pValue) + +#define ITextFont_SetShadow(This,Value) \ + (This)->lpVtbl -> SetShadow(This,Value) + +#define ITextFont_GetSize(This,pValue) \ + (This)->lpVtbl -> GetSize(This,pValue) + +#define ITextFont_SetSize(This,Value) \ + (This)->lpVtbl -> SetSize(This,Value) + +#define ITextFont_GetSmallCaps(This,pValue) \ + (This)->lpVtbl -> GetSmallCaps(This,pValue) + +#define ITextFont_SetSmallCaps(This,Value) \ + (This)->lpVtbl -> SetSmallCaps(This,Value) + +#define ITextFont_GetSpacing(This,pValue) \ + (This)->lpVtbl -> GetSpacing(This,pValue) + +#define ITextFont_SetSpacing(This,Value) \ + (This)->lpVtbl -> SetSpacing(This,Value) + +#define ITextFont_GetStrikeThrough(This,pValue) \ + (This)->lpVtbl -> GetStrikeThrough(This,pValue) + +#define ITextFont_SetStrikeThrough(This,Value) \ + (This)->lpVtbl -> SetStrikeThrough(This,Value) + +#define ITextFont_GetSubscript(This,pValue) \ + (This)->lpVtbl -> GetSubscript(This,pValue) + +#define ITextFont_SetSubscript(This,Value) \ + (This)->lpVtbl -> SetSubscript(This,Value) + +#define ITextFont_GetSuperscript(This,pValue) \ + (This)->lpVtbl -> GetSuperscript(This,pValue) + +#define ITextFont_SetSuperscript(This,Value) \ + (This)->lpVtbl -> SetSuperscript(This,Value) + +#define ITextFont_GetUnderline(This,pValue) \ + (This)->lpVtbl -> GetUnderline(This,pValue) + +#define ITextFont_SetUnderline(This,Value) \ + (This)->lpVtbl -> SetUnderline(This,Value) + +#define ITextFont_GetWeight(This,pValue) \ + (This)->lpVtbl -> GetWeight(This,pValue) + +#define ITextFont_SetWeight(This,Value) \ + (This)->lpVtbl -> SetWeight(This,Value) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetDuplicate_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont); + + +void __RPC_STUB ITextFont_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetDuplicate_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + +void __RPC_STUB ITextFont_SetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_CanChange_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextFont_CanChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_IsEqual_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextFont_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_Reset_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetStyle_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetStyle_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetAllCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetAllCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetAllCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetAllCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetAnimation_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetAnimation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetAnimation_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetAnimation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetBackColor_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetBackColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetBackColor_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetBackColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetBold_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetBold_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetBold_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetBold_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetEmboss_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetEmboss_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetEmboss_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetEmboss_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetForeColor_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetForeColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetForeColor_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetForeColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetHidden_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetHidden_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetHidden_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetHidden_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetEngrave_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetEngrave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetEngrave_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetEngrave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetItalic_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetItalic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetItalic_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetItalic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetKerning_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetKerning_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetKerning_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetKerning_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetLanguageID_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetLanguageID_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetLanguageID_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetLanguageID_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetName_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + +void __RPC_STUB ITextFont_GetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetName_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextFont_SetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetOutline_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetOutline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetOutline_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetOutline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetPosition_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetPosition_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetProtected_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetProtected_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetProtected_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetProtected_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetShadow_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetShadow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetShadow_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetShadow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSize_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSize_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSmallCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSmallCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSmallCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSmallCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSpacing_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSpacing_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetStrikeThrough_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetStrikeThrough_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetStrikeThrough_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetStrikeThrough_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSubscript_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSubscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSubscript_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSubscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSuperscript_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSuperscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSuperscript_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSuperscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetUnderline_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetUnderline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetUnderline_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetUnderline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetWeight_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetWeight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetWeight_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetWeight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextFont_INTERFACE_DEFINED__ */ + + +#ifndef __ITextPara_INTERFACE_DEFINED__ +#define __ITextPara_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextPara + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextPara; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C4-A1DF-11ce-8098-00AA0047BE5D") + ITextPara : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDuplicate( + /* [in] */ ITextPara __RPC_FAR *pPara) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanChange( + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStyle( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStyle( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAlignment( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAlignment( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetHyphenation( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetHyphenation( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFirstLineIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKeepTogether( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKeepTogether( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKeepWithNext( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKeepWithNext( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLeftIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLineSpacing( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLineSpacingRule( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListAlignment( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListAlignment( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListLevelIndex( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListLevelIndex( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListStart( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListStart( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListTab( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListTab( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListType( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListType( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetNoLineNumber( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetNoLineNumber( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPageBreakBefore( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPageBreakBefore( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetRightIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetRightIndent( + /* [in] */ float Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetIndents( + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetLineSpacing( + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpaceAfter( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpaceAfter( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpaceBefore( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpaceBefore( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetWidowControl( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetWidowControl( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetTabCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddTab( + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ClearAllTabs( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE DeleteTab( + /* [in] */ float tbPos) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetTab( + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextParaVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextPara __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextPara __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextPara __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextPara __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextPara __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextPara __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextPara __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDuplicate )( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanChange )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStyle )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStyle )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAlignment )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAlignment )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHyphenation )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetHyphenation )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFirstLineIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKeepTogether )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKeepTogether )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKeepWithNext )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKeepWithNext )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLeftIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineSpacing )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineSpacingRule )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListAlignment )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListAlignment )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListLevelIndex )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListLevelIndex )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListStart )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListStart )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListTab )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListType )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListType )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNoLineNumber )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNoLineNumber )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPageBreakBefore )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPageBreakBefore )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRightIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRightIndent )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndents )( + ITextPara __RPC_FAR * This, + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetLineSpacing )( + ITextPara __RPC_FAR * This, + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpaceAfter )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpaceAfter )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpaceBefore )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpaceBefore )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWidowControl )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWidowControl )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTabCount )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ClearAllTabs )( + ITextPara __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DeleteTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTab )( + ITextPara __RPC_FAR * This, + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader); + + END_INTERFACE + } ITextParaVtbl; + + interface ITextPara + { + CONST_VTBL struct ITextParaVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextPara_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextPara_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextPara_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextPara_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextPara_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextPara_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextPara_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextPara_GetDuplicate(This,ppPara) \ + (This)->lpVtbl -> GetDuplicate(This,ppPara) + +#define ITextPara_SetDuplicate(This,pPara) \ + (This)->lpVtbl -> SetDuplicate(This,pPara) + +#define ITextPara_CanChange(This,pB) \ + (This)->lpVtbl -> CanChange(This,pB) + +#define ITextPara_IsEqual(This,pPara,pB) \ + (This)->lpVtbl -> IsEqual(This,pPara,pB) + +#define ITextPara_Reset(This,Value) \ + (This)->lpVtbl -> Reset(This,Value) + +#define ITextPara_GetStyle(This,pValue) \ + (This)->lpVtbl -> GetStyle(This,pValue) + +#define ITextPara_SetStyle(This,Value) \ + (This)->lpVtbl -> SetStyle(This,Value) + +#define ITextPara_GetAlignment(This,pValue) \ + (This)->lpVtbl -> GetAlignment(This,pValue) + +#define ITextPara_SetAlignment(This,Value) \ + (This)->lpVtbl -> SetAlignment(This,Value) + +#define ITextPara_GetHyphenation(This,pValue) \ + (This)->lpVtbl -> GetHyphenation(This,pValue) + +#define ITextPara_SetHyphenation(This,Value) \ + (This)->lpVtbl -> SetHyphenation(This,Value) + +#define ITextPara_GetFirstLineIndent(This,pValue) \ + (This)->lpVtbl -> GetFirstLineIndent(This,pValue) + +#define ITextPara_GetKeepTogether(This,pValue) \ + (This)->lpVtbl -> GetKeepTogether(This,pValue) + +#define ITextPara_SetKeepTogether(This,Value) \ + (This)->lpVtbl -> SetKeepTogether(This,Value) + +#define ITextPara_GetKeepWithNext(This,pValue) \ + (This)->lpVtbl -> GetKeepWithNext(This,pValue) + +#define ITextPara_SetKeepWithNext(This,Value) \ + (This)->lpVtbl -> SetKeepWithNext(This,Value) + +#define ITextPara_GetLeftIndent(This,pValue) \ + (This)->lpVtbl -> GetLeftIndent(This,pValue) + +#define ITextPara_GetLineSpacing(This,pValue) \ + (This)->lpVtbl -> GetLineSpacing(This,pValue) + +#define ITextPara_GetLineSpacingRule(This,pValue) \ + (This)->lpVtbl -> GetLineSpacingRule(This,pValue) + +#define ITextPara_GetListAlignment(This,pValue) \ + (This)->lpVtbl -> GetListAlignment(This,pValue) + +#define ITextPara_SetListAlignment(This,Value) \ + (This)->lpVtbl -> SetListAlignment(This,Value) + +#define ITextPara_GetListLevelIndex(This,pValue) \ + (This)->lpVtbl -> GetListLevelIndex(This,pValue) + +#define ITextPara_SetListLevelIndex(This,Value) \ + (This)->lpVtbl -> SetListLevelIndex(This,Value) + +#define ITextPara_GetListStart(This,pValue) \ + (This)->lpVtbl -> GetListStart(This,pValue) + +#define ITextPara_SetListStart(This,Value) \ + (This)->lpVtbl -> SetListStart(This,Value) + +#define ITextPara_GetListTab(This,pValue) \ + (This)->lpVtbl -> GetListTab(This,pValue) + +#define ITextPara_SetListTab(This,Value) \ + (This)->lpVtbl -> SetListTab(This,Value) + +#define ITextPara_GetListType(This,pValue) \ + (This)->lpVtbl -> GetListType(This,pValue) + +#define ITextPara_SetListType(This,Value) \ + (This)->lpVtbl -> SetListType(This,Value) + +#define ITextPara_GetNoLineNumber(This,pValue) \ + (This)->lpVtbl -> GetNoLineNumber(This,pValue) + +#define ITextPara_SetNoLineNumber(This,Value) \ + (This)->lpVtbl -> SetNoLineNumber(This,Value) + +#define ITextPara_GetPageBreakBefore(This,pValue) \ + (This)->lpVtbl -> GetPageBreakBefore(This,pValue) + +#define ITextPara_SetPageBreakBefore(This,Value) \ + (This)->lpVtbl -> SetPageBreakBefore(This,Value) + +#define ITextPara_GetRightIndent(This,pValue) \ + (This)->lpVtbl -> GetRightIndent(This,pValue) + +#define ITextPara_SetRightIndent(This,Value) \ + (This)->lpVtbl -> SetRightIndent(This,Value) + +#define ITextPara_SetIndents(This,StartIndent,LeftIndent,RightIndent) \ + (This)->lpVtbl -> SetIndents(This,StartIndent,LeftIndent,RightIndent) + +#define ITextPara_SetLineSpacing(This,LineSpacingRule,LineSpacing) \ + (This)->lpVtbl -> SetLineSpacing(This,LineSpacingRule,LineSpacing) + +#define ITextPara_GetSpaceAfter(This,pValue) \ + (This)->lpVtbl -> GetSpaceAfter(This,pValue) + +#define ITextPara_SetSpaceAfter(This,Value) \ + (This)->lpVtbl -> SetSpaceAfter(This,Value) + +#define ITextPara_GetSpaceBefore(This,pValue) \ + (This)->lpVtbl -> GetSpaceBefore(This,pValue) + +#define ITextPara_SetSpaceBefore(This,Value) \ + (This)->lpVtbl -> SetSpaceBefore(This,Value) + +#define ITextPara_GetWidowControl(This,pValue) \ + (This)->lpVtbl -> GetWidowControl(This,pValue) + +#define ITextPara_SetWidowControl(This,Value) \ + (This)->lpVtbl -> SetWidowControl(This,Value) + +#define ITextPara_GetTabCount(This,pCount) \ + (This)->lpVtbl -> GetTabCount(This,pCount) + +#define ITextPara_AddTab(This,tbPos,tbAlign,tbLeader) \ + (This)->lpVtbl -> AddTab(This,tbPos,tbAlign,tbLeader) + +#define ITextPara_ClearAllTabs(This) \ + (This)->lpVtbl -> ClearAllTabs(This) + +#define ITextPara_DeleteTab(This,tbPos) \ + (This)->lpVtbl -> DeleteTab(This,tbPos) + +#define ITextPara_GetTab(This,iTab,ptbPos,ptbAlign,ptbLeader) \ + (This)->lpVtbl -> GetTab(This,iTab,ptbPos,ptbAlign,ptbLeader) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetDuplicate_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara); + + +void __RPC_STUB ITextPara_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetDuplicate_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + +void __RPC_STUB ITextPara_SetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_CanChange_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextPara_CanChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_IsEqual_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextPara_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_Reset_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetStyle_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetStyle_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetHyphenation_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetHyphenation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetHyphenation_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetHyphenation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetFirstLineIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetFirstLineIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetKeepTogether_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetKeepTogether_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetKeepTogether_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetKeepTogether_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetKeepWithNext_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetKeepWithNext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetKeepWithNext_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetKeepWithNext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLeftIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLeftIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLineSpacing_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLineSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLineSpacingRule_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLineSpacingRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListLevelIndex_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListLevelIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListLevelIndex_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListLevelIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListStart_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListStart_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListTab_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetListTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListType_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListType_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetNoLineNumber_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetNoLineNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetNoLineNumber_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetNoLineNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetPageBreakBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetPageBreakBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetPageBreakBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetPageBreakBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetRightIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetRightIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetRightIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetRightIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetIndents_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent); + + +void __RPC_STUB ITextPara_SetIndents_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetLineSpacing_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing); + + +void __RPC_STUB ITextPara_SetLineSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetSpaceAfter_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetSpaceAfter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetSpaceAfter_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetSpaceAfter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetSpaceBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetSpaceBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetSpaceBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetSpaceBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetWidowControl_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetWidowControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetWidowControl_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetWidowControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetTabCount_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextPara_GetTabCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_AddTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader); + + +void __RPC_STUB ITextPara_AddTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_ClearAllTabs_Proxy( + ITextPara __RPC_FAR * This); + + +void __RPC_STUB ITextPara_ClearAllTabs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_DeleteTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos); + + +void __RPC_STUB ITextPara_DeleteTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader); + + +void __RPC_STUB ITextPara_GetTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextPara_INTERFACE_DEFINED__ */ + + +#ifndef __ITextStoryRanges_INTERFACE_DEFINED__ +#define __ITextStoryRanges_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextStoryRanges + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextStoryRanges; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C5-A1DF-11ce-8098-00AA0047BE5D") + ITextStoryRanges : public IDispatch + { + public: + virtual /* [restricted][id] */ HRESULT STDMETHODCALLTYPE _NewEnum( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextStoryRangesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextStoryRanges __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextStoryRanges __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextStoryRanges __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [restricted][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *_NewEnum )( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Item )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCount )( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + END_INTERFACE + } ITextStoryRangesVtbl; + + interface ITextStoryRanges + { + CONST_VTBL struct ITextStoryRangesVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextStoryRanges_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextStoryRanges_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextStoryRanges_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextStoryRanges_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextStoryRanges_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextStoryRanges_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextStoryRanges_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextStoryRanges__NewEnum(This,ppunkEnum) \ + (This)->lpVtbl -> _NewEnum(This,ppunkEnum) + +#define ITextStoryRanges_Item(This,Index,ppRange) \ + (This)->lpVtbl -> Item(This,Index,ppRange) + +#define ITextStoryRanges_GetCount(This,pCount) \ + (This)->lpVtbl -> GetCount(This,pCount) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [restricted][id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges__NewEnum_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum); + + +void __RPC_STUB ITextStoryRanges__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges_Item_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextStoryRanges_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges_GetCount_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextStoryRanges_GetCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextStoryRanges_INTERFACE_DEFINED__ */ + + +#ifndef __ITextDocument2_INTERFACE_DEFINED__ +#define __ITextDocument2_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextDocument2 + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextDocument2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("01c25500-4268-11d1-883a-3c8b00c10000") + ITextDocument2 : public ITextDocument + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachMsgFilter( + /* [in] */ IUnknown __RPC_FAR *pFilter) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetEffectColor( + /* [in] */ long Index, + /* [in] */ COLORREF cr) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetEffectColor( + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetCaretType( + /* [retval][out] */ long __RPC_FAR *pCaretType) = 0; + + virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE SetCaretType( + /* [in] */ long CaretType) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetImmContext( + /* [retval][out] */ long __RPC_FAR *pContext) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ReleaseImmContext( + /* [in] */ long Context) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPreferredFont( + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetNotificationMode( + /* [retval][out] */ long __RPC_FAR *pMode) = 0; + + virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE SetNotificationMode( + /* [in] */ long Mode) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetClientRect( + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetSelectionEx( + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetWindow( + /* [out] */ long __RPC_FAR *phWnd) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetFEFlags( + /* [out] */ long __RPC_FAR *pFlags) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UpdateWindow( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CheckTextLimit( + long cch, + long __RPC_FAR *pcch) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IMEInProgress( + long Mode) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextDocument2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextDocument2 __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextDocument2 __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelection )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryCount )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryRanges )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSaved )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSaved )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDefaultTabStop )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultTabStop )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *New )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Unfreeze )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEditCollection )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndEditCollection )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Undo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Redo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Range )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RangeFromPoint )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachMsgFilter )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pFilter); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEffectColor )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [in] */ COLORREF cr); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEffectColor )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCaretType )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCaretType); + + /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetCaretType )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long CaretType); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetImmContext )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pContext); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ReleaseImmContext )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Context); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPreferredFont )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNotificationMode )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pMode); + + /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNotificationMode )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Mode); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetClientRect )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelectionEx )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWindow )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *phWnd); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFEFlags )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *pFlags); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UpdateWindow )( + ITextDocument2 __RPC_FAR * This); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CheckTextLimit )( + ITextDocument2 __RPC_FAR * This, + long cch, + long __RPC_FAR *pcch); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IMEInProgress )( + ITextDocument2 __RPC_FAR * This, + long Mode); + + END_INTERFACE + } ITextDocument2Vtbl; + + interface ITextDocument2 + { + CONST_VTBL struct ITextDocument2Vtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextDocument2_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextDocument2_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextDocument2_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextDocument2_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextDocument2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextDocument2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextDocument2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextDocument2_GetName(This,pName) \ + (This)->lpVtbl -> GetName(This,pName) + +#define ITextDocument2_GetSelection(This,ppSel) \ + (This)->lpVtbl -> GetSelection(This,ppSel) + +#define ITextDocument2_GetStoryCount(This,pCount) \ + (This)->lpVtbl -> GetStoryCount(This,pCount) + +#define ITextDocument2_GetStoryRanges(This,ppStories) \ + (This)->lpVtbl -> GetStoryRanges(This,ppStories) + +#define ITextDocument2_GetSaved(This,pValue) \ + (This)->lpVtbl -> GetSaved(This,pValue) + +#define ITextDocument2_SetSaved(This,Value) \ + (This)->lpVtbl -> SetSaved(This,Value) + +#define ITextDocument2_GetDefaultTabStop(This,pValue) \ + (This)->lpVtbl -> GetDefaultTabStop(This,pValue) + +#define ITextDocument2_SetDefaultTabStop(This,Value) \ + (This)->lpVtbl -> SetDefaultTabStop(This,Value) + +#define ITextDocument2_New(This) \ + (This)->lpVtbl -> New(This) + +#define ITextDocument2_Open(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Open(This,pVar,Flags,CodePage) + +#define ITextDocument2_Save(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Save(This,pVar,Flags,CodePage) + +#define ITextDocument2_Freeze(This,pCount) \ + (This)->lpVtbl -> Freeze(This,pCount) + +#define ITextDocument2_Unfreeze(This,pCount) \ + (This)->lpVtbl -> Unfreeze(This,pCount) + +#define ITextDocument2_BeginEditCollection(This) \ + (This)->lpVtbl -> BeginEditCollection(This) + +#define ITextDocument2_EndEditCollection(This) \ + (This)->lpVtbl -> EndEditCollection(This) + +#define ITextDocument2_Undo(This,Count,prop) \ + (This)->lpVtbl -> Undo(This,Count,prop) + +#define ITextDocument2_Redo(This,Count,prop) \ + (This)->lpVtbl -> Redo(This,Count,prop) + +#define ITextDocument2_Range(This,cp1,cp2,ppRange) \ + (This)->lpVtbl -> Range(This,cp1,cp2,ppRange) + +#define ITextDocument2_RangeFromPoint(This,x,y,ppRange) \ + (This)->lpVtbl -> RangeFromPoint(This,x,y,ppRange) + + +#define ITextDocument2_AttachMsgFilter(This,pFilter) \ + (This)->lpVtbl -> AttachMsgFilter(This,pFilter) + +#define ITextDocument2_SetEffectColor(This,Index,cr) \ + (This)->lpVtbl -> SetEffectColor(This,Index,cr) + +#define ITextDocument2_GetEffectColor(This,Index,pcr) \ + (This)->lpVtbl -> GetEffectColor(This,Index,pcr) + +#define ITextDocument2_GetCaretType(This,pCaretType) \ + (This)->lpVtbl -> GetCaretType(This,pCaretType) + +#define ITextDocument2_SetCaretType(This,CaretType) \ + (This)->lpVtbl -> SetCaretType(This,CaretType) + +#define ITextDocument2_GetImmContext(This,pContext) \ + (This)->lpVtbl -> GetImmContext(This,pContext) + +#define ITextDocument2_ReleaseImmContext(This,Context) \ + (This)->lpVtbl -> ReleaseImmContext(This,Context) + +#define ITextDocument2_GetPreferredFont(This,cp,CodePage,Option,pbstr,pPitchAndFamily) \ + (This)->lpVtbl -> GetPreferredFont(This,cp,CodePage,Option,pbstr,pPitchAndFamily) + +#define ITextDocument2_GetNotificationMode(This,pMode) \ + (This)->lpVtbl -> GetNotificationMode(This,pMode) + +#define ITextDocument2_SetNotificationMode(This,Mode) \ + (This)->lpVtbl -> SetNotificationMode(This,Mode) + +#define ITextDocument2_GetClientRect(This,Type,pLeft,pTop,pRight,pBottom) \ + (This)->lpVtbl -> GetClientRect(This,Type,pLeft,pTop,pRight,pBottom) + +#define ITextDocument2_GetSelectionEx(This,ppSel) \ + (This)->lpVtbl -> GetSelectionEx(This,ppSel) + +#define ITextDocument2_GetWindow(This,phWnd) \ + (This)->lpVtbl -> GetWindow(This,phWnd) + +#define ITextDocument2_GetFEFlags(This,pFlags) \ + (This)->lpVtbl -> GetFEFlags(This,pFlags) + +#define ITextDocument2_UpdateWindow(This) \ + (This)->lpVtbl -> UpdateWindow(This) + +#define ITextDocument2_CheckTextLimit(This,cch,pcch) \ + (This)->lpVtbl -> CheckTextLimit(This,cch,pcch) + +#define ITextDocument2_IMEInProgress(This,Mode) \ + (This)->lpVtbl -> IMEInProgress(This,Mode) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_AttachMsgFilter_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pFilter); + + +void __RPC_STUB ITextDocument2_AttachMsgFilter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetEffectColor_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [in] */ COLORREF cr); + + +void __RPC_STUB ITextDocument2_SetEffectColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetEffectColor_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr); + + +void __RPC_STUB ITextDocument2_GetEffectColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetCaretType_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCaretType); + + +void __RPC_STUB ITextDocument2_GetCaretType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetCaretType_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long CaretType); + + +void __RPC_STUB ITextDocument2_SetCaretType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetImmContext_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pContext); + + +void __RPC_STUB ITextDocument2_GetImmContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_ReleaseImmContext_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Context); + + +void __RPC_STUB ITextDocument2_ReleaseImmContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetPreferredFont_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily); + + +void __RPC_STUB ITextDocument2_GetPreferredFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetNotificationMode_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pMode); + + +void __RPC_STUB ITextDocument2_GetNotificationMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetNotificationMode_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Mode); + + +void __RPC_STUB ITextDocument2_SetNotificationMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetClientRect_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom); + + +void __RPC_STUB ITextDocument2_GetClientRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetSelectionEx_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + +void __RPC_STUB ITextDocument2_GetSelectionEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetWindow_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *phWnd); + + +void __RPC_STUB ITextDocument2_GetWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetFEFlags_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *pFlags); + + +void __RPC_STUB ITextDocument2_GetFEFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_UpdateWindow_Proxy( + ITextDocument2 __RPC_FAR * This); + + +void __RPC_STUB ITextDocument2_UpdateWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_CheckTextLimit_Proxy( + ITextDocument2 __RPC_FAR * This, + long cch, + long __RPC_FAR *pcch); + + +void __RPC_STUB ITextDocument2_CheckTextLimit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_IMEInProgress_Proxy( + ITextDocument2 __RPC_FAR * This, + long Mode); + + +void __RPC_STUB ITextDocument2_IMEInProgress_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextDocument2_INTERFACE_DEFINED__ */ + + +#ifndef __ITextMsgFilter_INTERFACE_DEFINED__ +#define __ITextMsgFilter_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextMsgFilter + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][version][uuid] */ + + + +EXTERN_C const IID IID_ITextMsgFilter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("a3787420-4267-11d1-883a-3c8b00c10000") + ITextMsgFilter : public IUnknown + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachDocument( + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE HandleMessage( + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachMsgFilter( + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextMsgFilterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextMsgFilter __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextMsgFilter __RPC_FAR * This); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachDocument )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HandleMessage )( + ITextMsgFilter __RPC_FAR * This, + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachMsgFilter )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter); + + END_INTERFACE + } ITextMsgFilterVtbl; + + interface ITextMsgFilter + { + CONST_VTBL struct ITextMsgFilterVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextMsgFilter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextMsgFilter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextMsgFilter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextMsgFilter_AttachDocument(This,hwnd,pTextDoc) \ + (This)->lpVtbl -> AttachDocument(This,hwnd,pTextDoc) + +#define ITextMsgFilter_HandleMessage(This,pmsg,pwparam,plparam,plres) \ + (This)->lpVtbl -> HandleMessage(This,pmsg,pwparam,plparam,plres) + +#define ITextMsgFilter_AttachMsgFilter(This,pMsgFilter) \ + (This)->lpVtbl -> AttachMsgFilter(This,pMsgFilter) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_AttachDocument_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc); + + +void __RPC_STUB ITextMsgFilter_AttachDocument_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_HandleMessage_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres); + + +void __RPC_STUB ITextMsgFilter_HandleMessage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_AttachMsgFilter_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter); + + +void __RPC_STUB ITextMsgFilter_AttachMsgFilter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextMsgFilter_INTERFACE_DEFINED__ */ + +#endif /* __tom_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * ); + +unsigned long __RPC_USER HWND_UserSize( unsigned long __RPC_FAR *, unsigned long , HWND __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER HWND_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, HWND __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER HWND_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, HWND __RPC_FAR * ); +void __RPC_USER HWND_UserFree( unsigned long __RPC_FAR *, HWND __RPC_FAR * ); + +unsigned long __RPC_USER VARIANT_UserSize( unsigned long __RPC_FAR *, unsigned long , VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +void __RPC_USER VARIANT_UserFree( unsigned long __RPC_FAR *, VARIANT __RPC_FAR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/toolbar1.bmp b/sp/src/utils/sapi51/Samples/CPP/DictPad/toolbar1.bmp new file mode 100644 index 00000000..e0c9f2fa Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/DictPad/toolbar1.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/DictPad/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/DictPad/version.rc2 new file mode 100644 index 00000000..616e5b8b --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/DictPad/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Dictation Pad Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "DICTPAD\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "dictpad.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/resource.h b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/resource.h new file mode 100644 index 00000000..65cbe51a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/resource.h @@ -0,0 +1,20 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by sreng.rc +// +#define IDS_PROJNAME 100 +#define IDR_SRENG 101 +#define IDR_SRENGUI 102 +#define IDR_SRENGEXT 103 +#define IDR_SRENGALT 104 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.cpp new file mode 100644 index 00000000..f15ba6f2 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.cpp @@ -0,0 +1,90 @@ +// srengdll.cpp : Implementation of DLL Exports. +//Copyright (c) Microsoft Corporation. All rights reserved. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, + +#include "stdafx.h" +#include "resource.h" +#include +#include "sreng.h" + +#include "sreng_i.c" +#include "sreng.h" +#include "srengobj.h" +#include "srengui.h" +#include "srengext.h" +#include "srengalt.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_SampleSREngine, CSrEngine) +OBJECT_ENTRY(CLSID_SampleSREngineUI, CSrEngineUI) +OBJECT_ENTRY(CLSID_SampleSRExtension, CSampleSRExtension) +OBJECT_ENTRY(CLSID_SampleSREngineAlternates, CSrEngineAlternates) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point +#ifdef _WIN32_WCE +extern "C" +BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_SRENGLib); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} +#else +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_SRENGLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} +#endif +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.def b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.def new file mode 100644 index 00000000..62a027fd --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.def @@ -0,0 +1,9 @@ +; sreng.def : Declares the module parameters. + +LIBRARY "sreng.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.dsp b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.dsp new file mode 100644 index 00000000..803baaab --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.dsp @@ -0,0 +1,207 @@ +# Microsoft Developer Studio Project File - Name="sreng" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=sreng - Win32 Release x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sreng.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sreng.mak" CFG="sreng - Win32 Release x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sreng - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "sreng - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "sreng - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sreng___Win32_Debug_x86" +# PROP BASE Intermediate_Dir "sreng___Win32_Debug_x86" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\sdk\include" /I "..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\sdk\include" /I "..\..\ddk\include" /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\sdk\lib\i386" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Debug_x86 +TargetPath=.\Debug_x86\sreng.dll +InputPath=.\Debug_x86\sreng.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "sreng - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "sreng___Win32_Release_x86" +# PROP BASE Intermediate_Dir "sreng___Win32_Release_x86" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\sdk\include" /I "..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\sdk\lib\i386" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Release_x86 +TargetPath=.\Release_x86\sreng.dll +InputPath=.\Release_x86\sreng.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "sreng - Win32 Debug x86" +# Name "sreng - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\sreng.cpp +# End Source File +# Begin Source File + +SOURCE=.\sreng.def +# End Source File +# Begin Source File + +SOURCE=.\sreng.idl +# ADD BASE MTL /I "..\..\sdk\idl" /tlb ".\sreng.tlb" /h "sreng.h" /iid "sreng_i.c" /Oicf +# ADD MTL /I "..\..\..\..\idl" /I "..\..\..\..\..\ddk\idl" /tlb ".\sreng.tlb" /h "sreng.h" /iid "sreng_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\sreng.rc +# End Source File +# Begin Source File + +SOURCE=.\srengalt.cpp +# End Source File +# Begin Source File + +SOURCE=.\srengext.cpp +# End Source File +# Begin Source File + +SOURCE=.\srengobj.cpp +# End Source File +# Begin Source File + +SOURCE=.\srengui.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\sreng.h +# End Source File +# Begin Source File + +SOURCE=.\srengalt.h +# End Source File +# Begin Source File + +SOURCE=.\srengext.h +# End Source File +# Begin Source File + +SOURCE=.\srengobj.h +# End Source File +# Begin Source File + +SOURCE=.\srengui.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\sreng.rgs +# End Source File +# Begin Source File + +SOURCE=.\srengalt.rgs +# End Source File +# Begin Source File + +SOURCE=.\srengext.rgs +# End Source File +# Begin Source File + +SOURCE=.\srengui.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.idl b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.idl new file mode 100644 index 00000000..38c872e1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.idl @@ -0,0 +1,64 @@ +// srengdll.idl : IDL source for sreng.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (sreng.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; +import "sapiddk.idl"; + +[ + object, + uuid(BBC18F3B-CF35-4f7c-99E8-D1F803AB4851), + helpstring("ISampleSRExtension Interface"), + pointer_default(unique) +] +interface ISampleSRExtension : IUnknown +{ + HRESULT ExamplePrivateEngineCall(void); +}; + +[ + uuid(41B89B6C-9399-11D2-9623-00C04F8EE628), + version(1.0), + helpstring("sreng 1.0 Type Library") +] +library SRENGLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(41B89B79-9399-11D2-9623-00C04F8EE628), + helpstring("Sample SR Engine Class") + ] + coclass SampleSREngine + { + [default] interface ISpSREngine; + }; + [ + uuid(B84714C0-3BFD-405D-83C5-E9C486826AD5), + helpstring("Sample SR Engine UI Class") + ] + coclass SampleSREngineUI + { + [default] interface ISpTokenUI; + }; + [ + uuid(78771A48-CE55-46a5-B78C-B813E3403F82), + helpstring("Sample SR Engine Extension Class") + ] + coclass SampleSRExtension + { + [default] interface ISampleSRExtension; + }; + [ + uuid(882CAE4A-99BA-490b-BF80-CF69A60454A7), + helpstring("Sample SR Engine Alternates Class") + ] + coclass SampleSREngineAlternates + { + [default] interface ISpSRAlternates; + }; +}; diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rc b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rc new file mode 100644 index 00000000..64c7c6de --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rc @@ -0,0 +1,90 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""sreng.tlb""\r\n" + "#include ""version.rc2""\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_SRENG REGISTRY DISCARDABLE "sreng.rgs" +IDR_SRENGUI REGISTRY DISCARDABLE "srengui.rgs" +IDR_SRENGEXT REGISTRY DISCARDABLE "srengext.rgs" +IDR_SRENGALT REGISTRY DISCARDABLE "srengalt.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "sreng" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "sreng.tlb" +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rgs b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rgs new file mode 100644 index 00000000..31a9c20f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/sreng.rgs @@ -0,0 +1,101 @@ +HKCR +{ + SampleSREngine.SampleSREngine.1 = s 'Sample SR Engine Class' + { + CLSID = s '{41B89B79-9399-11D2-9623-00C04F8EE628}' + } + SampleSREngine.SampleSREngine = s 'Sample SR Engine Class' + { + CLSID = s '{41B89B79-9399-11D2-9623-00C04F8EE628}' + CurVer = s 'SampleSREngine.SampleSREngine.1' + } + NoRemove CLSID + { + ForceRemove {41B89B79-9399-11D2-9623-00C04F8EE628} = s 'Sample SR Engine Class' + { + ProgID = s 'SampleSREngine.SampleSREngine.1' + VersionIndependentProgID = s 'SampleSREngine.SampleSREngine' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{41B89B6C-9399-11D2-9623-00C04F8EE628}' + } + } +} + +HKLM +{ + NoRemove SOFTWARE + { + NoRemove Microsoft + { + NoRemove Speech + { + NoRemove Recognizers + { + NoRemove Tokens + { + ForceRemove SAPI5SampleEngine = s 'SAPI Developer Sample Engine' + { + val CLSID = s '{41B89B79-9399-11D2-9623-00C04F8EE628}' + val RecoExtension = s '{78771A48-CE55-46A5-B78C-B813E3403F82}' + val AlternatesCLSID = s '{882CAE4A-99BA-490B-BF80-CF69A60454A7}' + val 409 = s 'SAPI Developer Sample Engine' + + ForceRemove {41B89B79-9399-11D2-9623-00C04F8EE628} + { + ForceRemove Files + { + val SampleEngDataFile = s 'C:\An_example_file_path' + } + } + ForceRemove Attributes + { + val Vendor = s 'Microsoft' + val Language = s '409;9' + val CommandAndControl = s '' + val Dictation = s '' + val Desktop = s '' + val Hypotheses = s '' + val Alternates = s 'CC;Dictation' + val DictationInCFG = s 'Anywhere;Trailing' + val WildcardInCFG = s 'Anywhere;Trailing' + val WordSequences = s '' + val SpeakingStyle = s 'Discrete;Continuous' + } + ForceRemove UI = s '' + { + ForceRemove EngineProperties = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + + ForceRemove UserTraining = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + + ForceRemove MicTraining = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + + ForceRemove AddRemoveWord = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + + ForceRemove RecoProfileProperties = s '' + { + val CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.cpp new file mode 100644 index 00000000..83ea4a4b --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.cpp @@ -0,0 +1,137 @@ +/****************************************************************************** +* srengalt.h +* This file contains the implementation of the CSrEngineAlternates class. +* This implements the interface ISpSRAlternates. +* When an app calls GetAlternates or Commit on a result, SAPI will +* look for the AlternatesCLSID field in the engine object token, and +* create this object. +* It will then call the methods here, passing the relevant results information. +* This includes any serialized data the main engine has returned with +* the results to allow alternates to be generated off-line. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "srengalt.h" + +/**************************************************************************** +* CSrEngineAlternates::GetAlternates * +*---------------------------* +* Description: +* This method generates alternate phrases when SAPI requests them. +* The method reads the extra information returned from the SR engine +* inside the results object. This gets returned +* as alternates phrases to SAPI. In addition this method can find a private interface to engine +* from the context and query the engine for additional result information. +* +* The engine must have returned info serialised within the results object +* allowing us to produce alternatives. This is the case in the sample engine. +* +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngineAlternates::GetAlternates(SPPHRASEALTREQUEST *pAltRequest, + SPPHRASEALT **ppAlts, ULONG *pcAlts) +{ + HRESULT hr = S_OK; + + // We will just produce one alternate + // This will replace the words in the original phrase on a one-to-one basis + // Real alternates may have different numbers of words to original, + // and replace only parts of the original. + *pcAlts = 1; + *ppAlts = (SPPHRASEALT *)::CoTaskMemAlloc(sizeof(SPPHRASEALT)); + (*ppAlts)[0].ulStartElementInParent = pAltRequest->ulStartElement; + (*ppAlts)[0].cElementsInParent = pAltRequest->cElements; + (*ppAlts)[0].cElementsInAlternate = pAltRequest->cElements; + (*ppAlts)[0].pvAltExtra = NULL; + (*ppAlts)[0].cbAltExtra = 0; + + // Create and fill an SPPHRASE structure + SPPHRASE phrase; + memset(&phrase, 0, sizeof(phrase)); + phrase.cbSize = sizeof(phrase); + // An alternates analyzer should really query its SR engine to find it's lang id. + // For the sample engine we will just hard-code this + phrase.LangID = 1033; + + WCHAR *pAlts = (WCHAR *) pAltRequest->pvResultExtra; + ULONG nAltChars = pAltRequest->cbResultExtra / sizeof(WCHAR); + ULONG nWord = 0; + + // Count words in alternate data + for(ULONG i = 0; i < nAltChars; i++) + { + if(iswspace(pAlts[i]) || pAlts[i] == '\0') + { + nWord++; + } + } + + // Allocate elements + SPPHRASEELEMENT* pElements = (SPPHRASEELEMENT*)_alloca(sizeof(SPPHRASEELEMENT) * nWord); + memset(pElements, 0, sizeof(SPPHRASEELEMENT)*nWord); + + // Add words in alternate to elements + ULONG cW = 0; + nWord = 0; + for(i = 0; i < nAltChars; i++) + { + if(iswspace(pAlts[i]) || pAlts[i] == '\0') + { + pElements[nWord].bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + WCHAR *pszWord = (WCHAR *)_alloca(sizeof(WCHAR) * (i- cW)); + wcsncpy(pszWord, &pAlts[cW], i - cW); + pszWord[i - cW] = '\0'; + pElements[nWord].pszDisplayText = pszWord; + + cW = i + 1; + nWord++; + } + } + + // Add elements to phrase + phrase.Rule.ulCountOfElements = nWord; + phrase.pElements = pElements; + + // Make phrase builder and add phrase info + CComPtr cpBuilder; + hr = cpBuilder.CoCreateInstance(CLSID_SpPhraseBuilder); + if(SUCCEEDED(hr)) + { + hr = cpBuilder->InitFromPhrase(&phrase); + } + if(SUCCEEDED(hr)) + { + (*ppAlts)[0].pPhrase = cpBuilder; + (*ppAlts)[0].pPhrase->AddRef(); + } + + // Alternates class can also query enginethrough private interface + CComPtr m_cpExt; + hr = pAltRequest->pRecoContext->QueryInterface(&m_cpExt); + if(SUCCEEDED(hr)) + { + hr = m_cpExt->ExamplePrivateEngineCall(); + } + return hr; +} + +/**************************************************************************** +* CSrEngineAlternates::Commit * +*---------------------------* +* Description: +* Here the engine could use the information from the application +* about which was the correct alternate in order to do supervised +* adaptation. +* In this sample we do nothing here. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngineAlternates::Commit(SPPHRASEALTREQUEST *pAltRequest, + SPPHRASEALT *pAlt, void **ppvResultExtra, ULONG *pcbResultExtra) +{ + return S_OK; +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.h b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.h new file mode 100644 index 00000000..fde94385 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.h @@ -0,0 +1,48 @@ +/****************************************************************************** +* srengalt.h +* This file contains the declaration of the CSrEngineAlternates class. +* This implements the interface ISpSRAlternates. +* When an app calls GetAlternates or Commit on a result, SAPI will +* look for the AlternatesCLSID field in the engine object token, and +* create this object. +* It will then call the methods here, passing the relevant results information. +* This includes any serialized data the main engine has returned with +* the results to allow alternates to be generated off-line. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#pragma once + +#include "stdafx.h" +#include "sreng.h" +#include "resource.h" + +class ATL_NO_VTABLE CSrEngineAlternates : + public CComObjectRootEx, + public CComCoClass, + public ISpSRAlternates +{ +public: + + DECLARE_REGISTRY_RESOURCEID(IDR_SRENGALT) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CSrEngineAlternates) + COM_INTERFACE_ENTRY(ISpSRAlternates) + END_COM_MAP() + +public: + + STDMETHODIMP GetAlternates( + SPPHRASEALTREQUEST *pAltRequest, + SPPHRASEALT **ppAlts, + ULONG *pcAlts); + + STDMETHODIMP Commit( + SPPHRASEALTREQUEST *pAltRequest, + SPPHRASEALT *pAlt, + void **ppvResultExtra, + ULONG *pcbResultExtra); +}; diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.rgs b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.rgs new file mode 100644 index 00000000..1ba6165a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengalt.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SampleSREngineAlternates.SampleSREngineAlternates.1 = s 'Sample SR Engine Alternates Class' + { + CLSID = s '{882CAE4A-99BA-490b-BF80-CF69A60454A7}' + } + SampleSREngineAlternates.SampleSREngineAlternates = s 'Sample SR Engine Alternates Class' + { + CLSID = s '{882CAE4A-99BA-490B-BF80-CF69A60454A7}' + CurVer = s 'SampleSREngineAlternates.SampleSREngineAlternates.1' + } + NoRemove CLSID + { + ForceRemove {882CAE4A-99BA-490B-BF80-CF69A60454A7} = s 'SampleSrEngineAlternates Class' + { + ProgID = s 'SampleSREngineAlternates.SampleSREngineAlternates.1' + VersionIndependentProgID = s 'SampleSREngineAlternates.SampleSREngineAlternates' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{41B89B6C-9399-11D2-9623-00C04F8EE628}' + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.cpp new file mode 100644 index 00000000..cc00bdd1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.cpp @@ -0,0 +1,31 @@ +/****************************************************************************** +* srengext.cpp +* This file contains the implementation of the CSampleSRExtension class. +* This implements the custom interface ISampleSRExtension. +* When an app QI's for this from the reco context, SAPI will +* look for the ExtensionCLSID field in the engine object token, and +* create this object and then QI for the requested interface. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "srengext.h" + +/**************************************************************************** +* CSampleSRExtension::ExamplePrivateEngineCall * +*----------------------------------------------* +* Description: +* This method shows an example of calling back to the main engine object. +* When CallEngine is called, the data supplied will get passed by SAPI +* to the ISpSREngine::PrivateCall method in CSrEngine. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSampleSRExtension::ExamplePrivateEngineCall(void) +{ + // We can use this method to pass data to and from the actual engine class, via the context + static BYTE Data[4] = { 1, 2, 3, 4 }; + return m_pEngineCall->CallEngine( (void*)Data, sp_countof(Data) ); +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.h b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.h new file mode 100644 index 00000000..1e0d4e61 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.h @@ -0,0 +1,56 @@ +/****************************************************************************** +* srengext.h +* This file contains the declaration of the CSampleSRExtension class. +* This implements the custom interface ISampleSRExtension. +* When an app QI's for this from the reco context, SAPI will +* look for the ExtensionCLSID field in the engine object token, and +* create this object and then QI for the requested interface. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#pragma once + +#include "stdafx.h" +#include "sreng.h" +#include "resource.h" + +class ATL_NO_VTABLE CSampleSRExtension : +public CComObjectRootEx, +public CComCoClass, +public ISampleSRExtension +{ +public: + +DECLARE_REGISTRY_RESOURCEID(IDR_SRENGEXT) +DECLARE_GET_CONTROLLING_UNKNOWN() +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CSampleSRExtension) + COM_INTERFACE_ENTRY(ISampleSRExtension) +END_COM_MAP() + + HRESULT FinalConstruct() + { + // We can query back to SAPI to find both the reco context, and, + // an IID__ISpPrivateEngineCall interface which can be used to call + // back to the main engine object. + HRESULT hr; + hr = OuterQueryInterface(IID__ISpPrivateEngineCall, (void **)&m_pEngineCall); + if(SUCCEEDED(hr)) + { + hr = OuterQueryInterface(IID_ISpRecoContext, (void **)&m_pRecoCtxt); + if (SUCCEEDED(hr)) + { + GetControllingUnknown()->Release(); + } + } + return hr; + } + + STDMETHODIMP ExamplePrivateEngineCall(void); // Just a test method + +private: + _ISpPrivateEngineCall *m_pEngineCall; + ISpRecoContext *m_pRecoCtxt; +}; diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.rgs b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.rgs new file mode 100644 index 00000000..cdc84c66 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengext.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SampleSrEngineExt.SampleSrEngineExt.1 = s 'Sample SR Engine Extension Class' + { + CLSID = s '{78771A48-CE55-46A5-B78C-B813E3403F82}' + } + SampleSrEngineExt.SampleSrEngineExt = s 'Sample SR Engine Extension Class' + { + CLSID = s '{78771A48-CE55-46A5-B78C-B813E3403F82}' + CurVer = s 'SampleSrEngineExt.SampleSrEngineExt.1' + } + NoRemove CLSID + { + ForceRemove {78771A48-CE55-46A5-B78C-B813E3403F82} = s 'SampleSrEngineExt Class' + { + ProgID = s 'SampleSrEngineExt.SampleSrEngineExt.1' + VersionIndependentProgID = s 'SampleSrEngineExt.SampleSrEngineExt' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{41B89B6C-9399-11D2-9623-00C04F8EE628}' + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.cpp new file mode 100644 index 00000000..2e2c374d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.cpp @@ -0,0 +1,1944 @@ +/****************************************************************************** +* srengobj.cpp +* This file contains the implementation of the CSrEngine class. +* This implements ISpSREngine and ISpObjectWithToken. +* This is the main recognition object +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sreng.h" +#include "srengobj.h" +#include "SpHelper.h" +#ifndef _WIN32_WCE +#include "shfolder.h" +#endif + +static const WCHAR DICT_WORD[] = L"Blah"; // This is the default word the sample engine uses for dictation +static const WCHAR ALT_WORD[] = L"Alt"; // This is the default word used for alternates + +/**************************************************************************** +* CSrEngine::FinalConstruct * +*---------------------------* +* Description: +* The ATL FinalConstruct method. Called after the standard C++ constructor +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::FinalConstruct() +{ + SPDBG_FUNC("Sample Engine - FINALCONSTRUCT"); + HRESULT hr = S_OK; + + // This event is used to indicate when space is available for data to be given to the recognition thread + m_hQueueHasRoom = ::CreateEvent(NULL, TRUE, TRUE, NULL); + m_FrameQueue.SetSpaceAvailEvent(m_hQueueHasRoom); + + // Create a thread control which will be used for the recognition thread + CComPtr cpTaskMgr; + hr = cpTaskMgr.CoCreateInstance(CLSID_SpResourceManager); + if (SUCCEEDED(hr)) + { + hr = cpTaskMgr->CreateThreadControl(this, this, THREAD_PRIORITY_NORMAL, &m_cpDecoderThread); + } + + if(SUCCEEDED(hr)) + { + // Create the SAPI lexicon which holds user and app pronounciations + hr = m_cpLexicon.CoCreateInstance(CLSID_SpLexicon); + } + return hr; +} + + +/**************************************************************************** +* CSrEngine::FinalRelease * +*---------------------------* +* Description: +* The ATL FinalRelease method. Clean up any resources not automatically destructed. +* Return: +* S_OK +*****************************************************************************/ +HRESULT CSrEngine::FinalRelease() +{ + SPDBG_FUNC("Sample Engine - FINALRELEASE"); + ::CloseHandle(m_hQueueHasRoom); + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetObjectToken * +*---------------------------* +* Description: +* This method is called by SAPI immediately after the engine is created. +* It can be used to get registry information specific to this engine. +* The engine can recover from the token file paths stored there during installation. +* The engine also can recover user set defaults for accuracy, rejection etc. +* Also could have different engines sharing the same code base (CLSID) but having different registry info +* e.g. if engine supports different languages +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetObjectToken(ISpObjectToken * pToken) +{ + SPDBG_FUNC("Sample Engine - SETOBJECTTOKEN"); + HRESULT hr = S_OK; + + // Helper function that copies the token reference. + hr = SpGenericSetObjectToken(pToken, m_cpEngineObjectToken); + if(FAILED(hr)) + { + return hr; + } + + // Read attribute information from the token in the registry + CComPtr cpAttribKey; + hr = pToken->OpenKey(L"Attributes", &cpAttribKey); + + if(SUCCEEDED(hr)) + { + WCHAR *psz = NULL; + hr = cpAttribKey->GetStringValue(L"Desktop", &psz); + ::CoTaskMemFree(psz); + if(SUCCEEDED(hr)) + { + // This instance of the engine is for doing desktop recognition + } + else if(hr == SPERR_NOT_FOUND) + { + hr = cpAttribKey->GetStringValue(L"Telephony", &psz); + ::CoTaskMemFree(psz); + if(SUCCEEDED(hr)) + { + // This instance of the engine is for doing telephony recognition + } + } + } + + // Read what language is set in the registry + if(SUCCEEDED(hr)) + { + WCHAR *pszLangID = NULL; + hr = cpAttribKey->GetStringValue(L"Language", &pszLangID); + if(SUCCEEDED(hr)) + { + // We could use this language id in recognition. + } + else if(hr == SPERR_NOT_FOUND) + { + pszLangID = L"409"; // Default language (US English) + hr = S_OK; + } + m_LangID = (unsigned short)wcstol(pszLangID, NULL, 16); + ::CoTaskMemFree(pszLangID); + } + + // Read data-file location + WCHAR *pszPath = NULL; + + // Looks for the file path stored in the registry + hr = pToken->GetStorageFileName(CLSID_SampleSREngine, L"SampleEngDataFile", NULL, 0, &pszPath); + // Could now load engine data-files from this given path + + ::CoTaskMemFree(pszPath); + + return hr; +} + +/**************************************************************************** +* CSrEngine::GetObjectToken * +*---------------------------* +* Description: +* This method is called if SAPI wants to find which object token this engine is using +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::GetObjectToken(ISpObjectToken ** ppToken) +{ + SPDBG_FUNC("Sample Engine - GETOBJECTTOKEN"); + // Generic helper function + return SpGenericGetObjectToken(ppToken, m_cpEngineObjectToken); +} + + +/**************************************************************************** +* CSrEngine::SetSite * +*---------------------------* +* Description: +* This is called to give the engine a reference to the ISpSREngineSite. +* The engine uses this to call back to SAPI. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetSite(ISpSREngineSite *pSite) +{ + m_cpSite = pSite; + return S_OK; +} + + +/**************************************************************************** +* CSrEngine::SetRecoProfile * +*---------------------------* +* Description: +* The RecoProfile is an object token holding information on the current +* user and enrollment session. The engine can store whatever information here +* it likes. It should store this in a key under the RecoProfile key named with the engine class id. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetRecoProfile(ISpObjectToken *pProfile) +{ + SPDBG_FUNC("Sample Engine - SETRECOPROFILE"); + + // First find if our engine already has info in this profile + HRESULT hr = S_OK; + WCHAR *pszCLSID, *pszPath = NULL; + CComPtr dataKey; + + m_cpUserObjectToken = pProfile; + + hr = ::StringFromCLSID(CLSID_SampleSREngine, &pszCLSID); + if(FAILED(hr)) + { + return hr; + } + + hr = pProfile->OpenKey(pszCLSID, &dataKey); + if(hr == SPERR_NOT_FOUND) + { + // We haven't seen this user profile before, so create a new registry key to hold info for it + hr = pProfile->CreateKey(pszCLSID, &dataKey); + + // Now we can set some default values + if(SUCCEEDED(hr)) + { + hr = dataKey->SetStringValue(L"GENDER", L"UNKNOWN"); + } + if(SUCCEEDED(hr)) + { + hr = dataKey->SetStringValue(L"AGE", L"UNKNOWN"); + } + + // Now we can create some temporary file storage (e.g. for trained models) + if(SUCCEEDED(hr)) + { + hr = pProfile->GetStorageFileName(CLSID_SampleSREngine, L"SampleEngTrainingFile", NULL, CSIDL_FLAG_CREATE | CSIDL_LOCAL_APPDATA, &pszPath); + } + + // Now we request a UI for user training (or properties - SPDUI_RecoProfileProperties) + // The engine cannot directly create UI it must request it. + hr = AddEventString(SPEI_REQUEST_UI, 0, SPDUI_UserTraining); + + } + else if(SUCCEEDED(hr)) + { + // We've already seen this profile so read values + WCHAR *pszGender = NULL, *pszAge = NULL; + hr = dataKey->GetStringValue(L"GENDER", &pszGender); + if(SUCCEEDED(hr)) + { + hr = dataKey->GetStringValue(L"AGE", &pszAge); + } + + // Now we could read training file + if(SUCCEEDED(hr)) + { + hr = pProfile->GetStorageFileName(CLSID_SampleSREngine, L"SampleEngTrainingFile", NULL, 0, &pszPath); + } + + ::CoTaskMemFree(pszGender); + ::CoTaskMemFree(pszAge); + } + + ::CoTaskMemFree(pszPath); + ::CoTaskMemFree(pszCLSID); + return hr; +} + + +/**************************************************************************** +* CSrEngine::OnCreateRecoContext * +*---------------------------* +* Description: +* This method is called each time a new reco context is created in +* an application using this engine. +* This sample engine does not strictly need info about reco contexts +* but for reference we will a keep list of them. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::OnCreateRecoContext(SPRECOCONTEXTHANDLE hSapiContext, void ** ppvDrvCtxt) +{ + SPDBG_FUNC("Sample Engine - CREATERECOCONTEXT"); + + CContext * pContext = new CContext(hSapiContext); + + // Store a reference to the CContext structure + *ppvDrvCtxt = pContext; + m_ContextList.InsertHead(pContext); + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::OnDeleteRecoContext * +*---------------------------* +* Description: +* This method is called each time a reco context is deleted. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::OnDeleteRecoContext(void * pvDrvCtxt) +{ + SPDBG_FUNC("Sample Engine - DELETERECOCONTEXT"); + + CContext * pContext = (CContext *) pvDrvCtxt; + m_ContextList.Remove(pContext); + delete pContext; + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::OnCreateGrammar * +*---------------------------* +* Description: +* This method is called each time a new reco grammar is created in +* an application using this engine. +* We keep a list of grammars - storing a pointer to the list entry in ppvEngineGrammar. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::OnCreateGrammar(void * pvEngineRecoContext, SPGRAMMARHANDLE hSapiGrammar, void ** ppvEngineGrammar) +{ + SPDBG_FUNC("Sample Engine - ONCREATEGRAMMAR"); + + // Each grammar will be associated with a context + CContext * pContext = (CContext *) pvEngineRecoContext; + SPDBG_ASSERT(m_ContextList.Find(pContext->m_hSapiContext)); + + // Keep a list of grammars + CDrvGrammar * pGrammar = new CDrvGrammar(hSapiGrammar); + // Store a reference to the CDrvGrammar structure + *ppvEngineGrammar = pGrammar; + m_GrammarList.InsertHead(pGrammar); + + return S_OK; +} + + +/**************************************************************************** +* CSrEngine::OnDeleteGrammar * +*---------------------------* +* Description: +* This method is called each time a reco grammar is deleted. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::OnDeleteGrammar(void * pvDrvGrammar) +{ + SPDBG_FUNC("Sample Engine - ONDELETEGRAMMAR"); + + CDrvGrammar * pGrammar = (CDrvGrammar *)pvDrvGrammar; + m_GrammarList.Remove(pGrammar); + delete pGrammar; + + return S_OK; +} + + +/**************************************************************************** +* CSrEngine::WordNotify * +*---------------------------* +* Description: +* This method is called by SAPI to inform the engine of the words in +* command & control (C&C) grammars. When words are added or removed (e.g. by +* the application loading or unloading grammars) this method is called. +* Here we examine the word text, see if it has an associated pronunciation, +* and see if there is a pronunciation in the lexicon. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::WordNotify(SPCFGNOTIFY Action, ULONG cWords, const SPWORDENTRY * pWords) +{ + SPDBG_FUNC("Sample Engine - WORDNOTIFY"); + HRESULT hr = S_OK; + ULONG i; + WCHAR *wordPron; + + switch(Action){ + case SPCFGN_ADD: + SPWORDENTRY WordEntry; + for(i = 0; SUCCEEDED(hr) && i < cWords; i++) + { + WordEntry = pWords[i]; + hr = m_cpSite->GetWordInfo(&WordEntry, SPWIO_WANT_TEXT); + if(SUCCEEDED(hr) && WordEntry.aPhoneId) + { + // Word entry contains a specific pronounciation from CFG + // Engine should use this in recognition + wordPron = new WCHAR[wcslen(WordEntry.aPhoneId)]; + wcscpy(wordPron, WordEntry.aPhoneId); + ::CoTaskMemFree((void*)WordEntry.aPhoneId); + } + else + { + // See if word is in lexicon + SPWORDPRONUNCIATIONLIST PronList; + PronList.pFirstWordPronunciation = 0; + PronList.pvBuffer = 0; + PronList.ulSize = 0; + hr = m_cpLexicon->GetPronunciations(WordEntry.pszLexicalForm, eLEXTYPE_APP | eLEXTYPE_USER, pWords[i].LangID, &PronList); + if(SUCCEEDED(hr)) + { + // Pronounciation(s) found in SAPI lexicon + // Engines should use these prons in recognition and also language and POS info + // For sample just copy first pron + wordPron = new WCHAR[wcslen(PronList.pFirstWordPronunciation->szPronunciation)]; + wcscpy(wordPron, PronList.pFirstWordPronunciation->szPronunciation); + ::CoTaskMemFree(PronList.pvBuffer); + } + else if(hr == SPERR_NOT_IN_LEX) + { + // No pronunciation present in SAPI lexicon. + // Engine should generate its own pronounciation or fail + // Here we generate a default NULL pronunciation + wordPron = NULL; + hr = S_OK; + } + else + { + break; // Unexpected error - break; + } + + // Associate the pronunciation information with the SAPI word handle so it can be recovered later + // An engine can store any arbitrary pointer with each word. + hr = m_cpSite->SetWordClientContext(WordEntry.hWord, wordPron); + } + + if (SUCCEEDED(hr)) + { + // When calling GetWordInfo SAPI allocates the strings which we must free + ::CoTaskMemFree((void*)WordEntry.pszDisplayText); + ::CoTaskMemFree((void*)WordEntry.pszLexicalForm); + } + } + break; + case SPCFGN_REMOVE: + for(i = 0; i < cWords; i++) + { + WordEntry = pWords[i]; + // Client context already on word entry + wordPron = (WCHAR *) WordEntry.pvClientContext; + if(wordPron) + { + delete wordPron; + } + } + break; + } + + return hr; +} + +/**************************************************************************** +* CSrEngine::RuleNotify * +*---------------------------* +* Description: +* This method is called by SAPI to inform the engine of the rules in +* command & control grammars. The order or actions of CFG grammars is of this form: +* WordNotify(SPCFGN_ADD) - add words +* RuleNotify(SPCFGN_ADD) - add rules +* RuleNotify(SPCFGN_ACTIVATE) - activate rules to indicate they are to be used for recognition +* RuleNotify(SPCFGN_INVALIDATE) - if a rule gets edited by the app then this is called +* RuleNotify(SPCFGN_DEACTIVE) - deactivate rules +* RuleNotify(SPCFGN_REMOVE) - remove rules +* WordNotify(SPCFGN_REMOVE) - remove words +* +* The engine can call GetRuleInfo to find the initial state in the rule, and +* then GetStateInfo to find the information about subsequent states and transitions in the rule. +* If a rule is edited then SPCFGN_INVALIDATE is called to indicate rule has changed so the engine +* must reparse the rule information. +* +* The engine can obtain all the information about the rule either before or during recognition. +* In this sample engine we just keep a list of rules initially and then wait +* until we want to generate a result and then find a random path through the rule. +* +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::RuleNotify(SPCFGNOTIFY Action, ULONG cRules, const SPRULEENTRY * pRules) +{ + SPDBG_FUNC("Sample Engine - RULENOTIFY"); + ULONG i; + CRuleEntry *pRuleEntry; + + switch (Action) + { + case SPCFGN_ADD: + for (i = 0; i < cRules; i++) + { + // Obtain information on the rule and store in a CRuleEntry structure + pRuleEntry = new CRuleEntry; + pRuleEntry->m_hRule = pRules[i].hRule; + pRuleEntry->m_fTopLevel = (pRules[i].Attributes & SPRAF_TopLevel); + pRuleEntry->m_fActive = (pRules[i].Attributes & SPRAF_Active); + + // Keep a list of rules + m_RuleList.InsertHead(pRuleEntry); + + // Engine can store information associated with rule handle if desired + m_cpSite->SetRuleClientContext(pRules[i].hRule, (void *)pRuleEntry); + } + break; + case SPCFGN_REMOVE: + for (i = 0; i < cRules; i++) + { + pRuleEntry = m_RuleList.Find(pRules[i].hRule); + SPDBG_ASSERT(pRuleEntry); // The rule must have been added before being removed + m_RuleList.Remove(pRuleEntry); + delete pRuleEntry; + } + break; + case SPCFGN_ACTIVATE: + for (i = 0; i < cRules; i++) + { + pRuleEntry = m_RuleList.Find(pRules[i].hRule); + // Only top-level rules can be activated + SPDBG_ASSERT(pRuleEntry && !pRuleEntry->m_fActive && pRuleEntry->m_fTopLevel); + pRuleEntry->m_fActive = TRUE; + } + break; + case SPCFGN_DEACTIVATE: + for (i = 0; i < cRules; i++) + { + pRuleEntry = m_RuleList.Find(pRules[i].hRule); + SPDBG_ASSERT(pRuleEntry && pRuleEntry->m_fActive && pRuleEntry->m_fTopLevel); + pRuleEntry->m_fActive = FALSE; + } + break; + case SPCFGN_INVALIDATE: + for (i = 0; i < cRules; i++) + { + pRuleEntry = m_RuleList.Find(pRules[i].hRule); + SPDBG_ASSERT(pRuleEntry); + pRuleEntry->m_fTopLevel = (pRules[i].Attributes & SPRAF_TopLevel); + pRuleEntry->m_fActive = (pRules[i].Attributes & SPRAF_Active); + // Don't need to do anything here as we don't start parsing the rule until recognition time + } + break; + } + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::LoadSLM * +*---------------------------* +* Description: +* Called when SAPI wants the engine to load a dictaion language model (SLM). +* For each reco gramar one dictation as well as C&C rules can be loaded. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::LoadSLM(void * pvEngineGrammar, const WCHAR * pszTopicName) +{ + SPDBG_FUNC("Sample Engine - LOADSLM"); + + if (pszTopicName) + { + // Engines should load the named language model - e.g. Spelling using + // this parameter. If NULL load the default dictation model. + // Since just a sample ignore this parameter. + } + + // pvEngineGrammar is the pointer ppvEngineGrammar we set in OnCreateGrammar + // Use this to find out on which grammar the SLM is being asked for. + CDrvGrammar * pGrammar = (CDrvGrammar *)pvEngineGrammar; + pGrammar->m_SLMLoaded = TRUE; + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::UnloadSLM * +*---------------------------* +* Description: +* Called when SAPI wants the engine to delete an SLM. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::UnloadSLM(void *pvEngineGrammar) +{ + SPDBG_FUNC("Sample Engine - UNLOADSLM"); + + CDrvGrammar * pGrammar = (CDrvGrammar *)pvEngineGrammar; + pGrammar->m_SLMLoaded = FALSE; + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetSLMState * +*---------------------------* +* Description: +* Called to activate or deactivate an SLM for recognition. +* NewState is either SPRS_ACTIVE or SPRS_INACTIVE. +* Return: +* S_OK +*****************************************************************************/ +HRESULT CSrEngine::SetSLMState(void * pvDrvGrammar, SPRULESTATE NewState) +{ + SPDBG_FUNC("Sample Engine - SETSLMSTATE"); + + // pvDrvGrammar is the pointer ppvEngineGrammar we set in OnCreateGrammar + CDrvGrammar * pGrammar = (CDrvGrammar *)pvDrvGrammar; + if (NewState != SPRS_INACTIVE) + { + pGrammar->m_SLMActive = TRUE; + } + else + { + pGrammar->m_SLMActive = FALSE; + } + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetWordSequenceData * +*---------------------------* +* Description: +* If the app submits a text buffer to SAPI this method is called. +* The text buffer supplied here can either be used in CFGs with the text buffer transition, +* or in dictation to supply information to the engine about the prior text visible on screen. +* This sample engine is just using the text buffer with the text buffer transition. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetWordSequenceData(void *pvEngineGrammar, const WCHAR *pText, ULONG cchText, const SPTEXTSELECTIONINFO *pInfo) +{ + SPDBG_FUNC("Sample Engine - SETWORDSEQUENCE"); + + //For each grammar object going to be released, SAPI would call SetWordSequenceData(NULL, 0, NULL). + + // Recover the data we have associated with this grammar. + CDrvGrammar * pGrammar = (CDrvGrammar*)pvEngineGrammar; + + // Delete previous grammar text buffer + if(pGrammar->m_pWordSequenceText) + { + delete pGrammar->m_pWordSequenceText; + } + + // Make a copy of the text data + if(cchText) + { + pGrammar->m_pWordSequenceText = new WCHAR[cchText]; + memcpy((void *)pGrammar->m_pWordSequenceText, pText, sizeof(WCHAR) * cchText); + pGrammar->m_cchText = cchText; + } + else + { + pGrammar->m_pWordSequenceText = NULL; + pGrammar->m_cchText = NULL; + } + + // Engines can use the SPTEXTSELECTIONINFO to determine which + // parts of the text buffer are visible on screen and / or selected. + // This sample engine is using the active text selection only. + SetTextSelection(pvEngineGrammar, pInfo); + + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetTextSelection * +*---------------------------* +* Description: +* This method tells engines if the SPTEXTSELECTIONINFO structure +* has been updated. This sample engine is using only fields ulStartActiveOffset and cchActiveChars of SPTEXTSELECTIONINFO. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetTextSelection(void * pvEngineGrammar, const SPTEXTSELECTIONINFO * pInfo) +{ + SPDBG_FUNC("Sample Engine - SETTEXTSELECTION"); + + // Recover the data we have associated with this grammar. + CDrvGrammar * pGrammar = (CDrvGrammar*)pvEngineGrammar; + + if (pGrammar->m_pInfo) + { + delete pGrammar->m_pInfo; + } + + if (pInfo) + { + pGrammar->m_pInfo = new SPTEXTSELECTIONINFO(*pInfo); + } + else + { + pGrammar->m_pInfo = NULL; + } + + return S_OK; +} + +/**************************************************************************** +* CSrEngine::IsPronounceable * +*---------------------------* +* Description: +* Engines should return whether it has or will be able to +* generate a pronounciation for this word. +* In this sample engine, this is always true. +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::IsPronounceable(void * pDrvGrammar, const WCHAR * pszWord, SPWORDPRONOUNCEABLE * pWordPronounceable) +{ + SPDBG_FUNC("Sample Engine - ISPRONOUNCEABLE"); + *pWordPronounceable = SPWP_KNOWN_WORD_PRONOUNCEABLE; + return S_OK; +} + +/**************************************************************************** +* CSrEngine::SetAdaptationData * +*---------------------------* +* Description: +* This method can be used by the app to give text data to the engine +* for language model adaptation etc. This method can only be called +* by the app after if has received an SPEI_ADAPTATION event. Since +* we never fire that event this method should never be called. + +* Return: +* E_UNEXPECTED +*****************************************************************************/ +STDMETHODIMP CSrEngine::SetAdaptationData(void * pvEngineCtxtCookie, const WCHAR *pAdaptationData, const ULONG cch) +{ + SPDBG_FUNC("Sample Engine - SETADAPTATIONDATA"); + + SPDBG_ASSERT(0); // This method should never be called + return E_UNEXPECTED; +} + +/**************************************************************************** +* CSrEngine::AddEvent * +*---------------------------* +* Description: +* Internal helper method to send an event to SAPI. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::AddEvent(SPEVENTENUM eEventId, ULONGLONG ullStreamPos, WPARAM wParam, LPARAM lParam) +{ + SPDBG_FUNC("Sample Engine - AddEvent"); + HRESULT hr = S_OK; + + SPEVENT Event; + Event.eEventId = eEventId; + Event.elParamType = SPET_LPARAM_IS_UNDEFINED; + Event.ulStreamNum = 0; // Always set this to zero - SAPI fills this in + Event.ullAudioStreamOffset = ullStreamPos; + Event.wParam = wParam; + Event.lParam = lParam; + + hr = m_cpSite->AddEvent(&Event, NULL); + + return hr; +} + +/**************************************************************************** +* CSrEngine::AddEventString * +*---------------------------* +* Description: +* Internal helper method to send an event with a string LParam to SAPI. +* Request UI is the only event in the sample to need this. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::AddEventString(SPEVENTENUM eEventId, ULONGLONG ullStreamPos, const WCHAR * psz, WPARAM wParam) +{ + SPDBG_FUNC("Sample Engine - AddEventString"); + HRESULT hr = S_OK; + + SPEVENT Event; + Event.eEventId = eEventId; + Event.elParamType = SPET_LPARAM_IS_STRING; + Event.ulStreamNum = 0; // Always set this to zero - SAPI fills this in + Event.ullAudioStreamOffset = ullStreamPos; + Event.wParam = wParam; + Event.lParam = (LPARAM)psz; + + hr = m_cpSite->AddEvent(&Event, NULL); + + return hr; +} + + +#define BLOCKSIZE 220 // 1/100 of a second + +/**************************************************************************** +* CSrEngine::RecognizeStream * +*---------------------------* +* Description: +* This is the method that SAPI calls for recognition to take place. +* Engines must only return from this method after they have read all the data +* and completed all the recognition they are going to do on this stream. +* Thus this method is giving a thread to the engine to do recognition on, +* and engines may create additional threads. +* +* In this sample we constantly read data using this thread, and then perform +* very basic speech detection and pass data to a recognizer thread, which +* generates hypotheses and results. +* +* Parameters: +* +* - REFGUID rguidFormatId - this is the GUID of the input audio format +* - const WAVEFORMATEX * pWaveFormatEx - this is the extended wav format information of the audio format +* - HANDLE hRequestSync - this Win32 event is used to indicate that there are pending tasks +* and the engine should call Synchronize() for SAPI to process these. +* - HANDLE hDataAvailable - this Win32 event is used to tell the engine that data is available to be read. +* The frequency this is set can be controlled by the SetBufferNotifySize method. +* - HANDLE hExit - this Win32 event indicates the engine is being closed down and should exit immediately. +* - BOOL fNewAudioStream - this indicates this is a new input stream +* e.g. the app has done a new SetInput call rather than just restarting the previous stream. +* - BOOL fRealTimeAudio - this indicates the input is from a real-time ISpAudio stream, rather than, say, a file +* - ISpObjectToken * pAudioObjectToken - this is the object token representing the audio input device +* the engine may want to query this. +* +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::RecognizeStream(REFGUID rguidFormatId, + const WAVEFORMATEX * pWaveFormatEx, + HANDLE hRequestSync, + HANDLE hDataAvailable, + HANDLE hExit, + BOOL fNewAudioStream, + BOOL fRealTimeAudio, + ISpObjectToken * pAudioObjectToken) +{ + SPDBG_FUNC("Sample Engine - RECOGNIZESTREAM"); + HRESULT hr = S_OK; + + m_hRequestSync = hRequestSync; + + // Start the recognition thread + hr = m_cpDecoderThread->StartThread(0, NULL); + + if (SUCCEEDED(hr)) + { + const HANDLE aWait[] = { hExit, m_hQueueHasRoom }; + + while (TRUE) // sit in this loop until there is no more data + { + // The Read method is used to read data. This will block until the required + // amount of data is available. If the stream has ended either a fail code + // will be returned or the amount read will be less than the amount asked for. + // To see how much data is available to be read without blocking the DataAvailable + // method can be used or hDataAvailable event. + BYTE aData[BLOCKSIZE]; + ULONG cbRead; + hr = m_cpSite->Read(aData, sizeof(aData), &cbRead); + if (hr != S_OK || cbRead < sizeof(aData)) + { + break; + } + + // Decide if the frame of data is noise or silence with a simple level detector + BOOL bNoiseDetected = FALSE; + SHORT * pBuffer = (SHORT *)aData; + for (ULONG i = 0; i < cbRead; i += 2, pBuffer++) + { + if (*pBuffer < (SHORT)-3000 || *pBuffer > (SHORT)3000) + { + bNoiseDetected = TRUE; + break; + } + } + + // If there no space on the frame queue then wait + BOOL bBlock = m_FrameQueue.IsFull(); + if(bBlock) + { + // Wait for space to appear on the queue to be passed to the recognizer. + // Real engines should not wait - the data reading should be as real-time as possible + // Also detect if the hExit event is set to indicate we should stop processing. + if (::WaitForMultipleObjects(sp_countof(aWait), aWait, FALSE, INFINITE) == WAIT_OBJECT_0) + { + break; + } + } + + // Add the frame to the queue and notify the decoder thread + m_FrameQueue.InsertTail(bNoiseDetected); + m_cpDecoderThread->Notify(); + + } + + // Once we've stopped reading data we must wait for the recognizer thread to finish + // All processing must be done before returning from the RecognizeStream method. + m_cpDecoderThread->WaitForThreadDone(TRUE, &hr, 30 * 1000); + } + + m_hRequestSync = NULL; + + SPDBG_REPORT_ON_FAIL( hr ); + return hr; +} + + +/**************************************************************************** +* CSrEngine::ThreadProc * +*-----------------------* +* Description: +* This is the main thread for the recognition process. +* This hExitThreadEvent indicates this thread should complete, +* and the hNotifyEvent indicates the RecognizeStream thread is notifying +* that data is available for processing. The m_hRequestSync indicates +* SAPI is requesting the engine should call Synchronize. +* +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::ThreadProc(void *, HANDLE hExitThreadEvent, HANDLE hNotifyEvent, HWND hwndWorker, volatile const BOOL * pfContinueProcessing) +{ + SPDBG_FUNC("Sample Engine - Recognition ThreadProc"); + HRESULT hr = S_OK; + const HANDLE aWait[] = { hExitThreadEvent, hNotifyEvent, m_hRequestSync }; + ULONG block = 0; + ULONG silenceafternoise = 0; + DWORD waitres; + + m_bSoundStarted = FALSE; + m_bPhraseStarted = FALSE; + m_cBlahBlah = 0; + + m_ullStart = 0; + m_ullEnd = 0; + while (*pfContinueProcessing) // sit in this loop until exit + { + ULONG cEvents = sp_countof(aWait); + // Respond to the request sync event only if speech not detected, + // as we don't want to allow grammar changes during recognition. + // However always respond after several seconds. + if(m_bPhraseStarted && (block - m_ullStart / BLOCKSIZE) < 5 * 100) + { + --cEvents; + } + waitres = ::WaitForMultipleObjects(cEvents, aWait, FALSE, INFINITE); + switch (waitres) + { + + case WAIT_OBJECT_0: // Exit thread + break; + + case WAIT_OBJECT_0 + 1: // Notify (data is available) + + // Engines should regularly call UpdateRecoPos to indicate how far through the + // stream they have recognized. + m_cpSite->UpdateRecoPos((ULONGLONG)block * BLOCKSIZE); + + if (m_ullStart == 0 && !m_bPhraseStarted) + { + // Engines should also call Synchronize to indicate they are ready + // to be notified about grammar changes and other tasks. Within Synchronize + // if grammars have changed WordNotify, RuleNotify etc. will be called before Synchronize returns. + // Here Synchronize is called only if processing silence, not speech + // to avoid having to deal with grammar changes during recognition. + + m_cpSite->Synchronize((ULONGLONG)block * BLOCKSIZE); + // A return code of S_FALSE from synchronize means the engine can stop recognizing + // This engine ignores this. + } + while (m_FrameQueue.HasData()) + { + BOOL bNoise = m_FrameQueue.RemoveHead(); + block++; // Update the position in stream + if (bNoise) + { + // Found some speech - update start and end positions + silenceafternoise = 0; + if (m_ullStart == 0) + { + m_ullStart = (ULONGLONG)block * BLOCKSIZE; + } + m_ullEnd = (ULONGLONG)block * BLOCKSIZE; + _CheckRecognition(); // this will generate hypotheses and events + } + else + { + // Found some silence + silenceafternoise++; + if (silenceafternoise > 50) + { + if (m_bSoundStarted) + { + // We've heard 1/2 sec of silence since the last noise, so send the + // final recognition if we had previously started a phrase + if (m_bPhraseStarted) + { + _NotifyRecognition(FALSE, m_cBlahBlah); + } + AddEvent(SPEI_SOUND_END, m_ullEnd); // send the sound end event + m_bSoundStarted = FALSE; + m_bPhraseStarted = FALSE; + } + m_ullStart = 0; + m_ullEnd = 0; + } + } + + //--- Generate random interference start at 20 seconds into the stream + // and saying it's gone at 22 seconds + if (block % (100 * 30) == 20 * 100) + { + const SPINTERFERENCE rgspi[] = + { SPINTERFERENCE_NOISE, SPINTERFERENCE_NOSIGNAL, SPINTERFERENCE_TOOLOUD, SPINTERFERENCE_TOOQUIET }; + + AddEvent(SPEI_INTERFERENCE, block*BLOCKSIZE, 0, rgspi[rand() % 4]); + } + else if (block % (100 * 30) == 22 * 100) + { + AddEvent(SPEI_INTERFERENCE, block*BLOCKSIZE, 0, SPINTERFERENCE_NONE); + } + // Ask for UI at 10 seconds into the stream + // and cancel request one second later + else if (block == 10 * 100) + { + AddEventString(SPEI_REQUEST_UI, block * BLOCKSIZE, SPDUI_UserTraining); + } + else if (block == 11 * 100) // Cancle the UI request at 11 seconds into the stream + { + AddEventString(SPEI_REQUEST_UI, block * BLOCKSIZE, NULL); + } + } + break; + + case WAIT_OBJECT_0 + 2: + // SAPI has explicitly requested we call Synchronize + hr = m_cpSite->Synchronize((ULONGLONG)block * BLOCKSIZE); + // Once synchronize is called the engine cannot fire events prior to that stream position + // so update the stored stream start position + m_ullStart = block * BLOCKSIZE; + if(m_ullEnd < m_ullStart) + { + m_ullEnd = m_ullStart; + } + break; + + default: + SPDBG_ASSERT(FALSE); + // Something strange! + break; + } + } + + // Before exiting we must make sure every phrase start has been paired with a recognition, + // and that every sound start event has a corresponding sound end. + if (m_bPhraseStarted) + { + _NotifyRecognition(FALSE, m_cBlahBlah); + } + if (m_bSoundStarted) + { + AddEvent(SPEI_SOUND_END, m_ullEnd); + } + + return S_OK; +} + + +/**************************************************************************** +* CSrEngine::_CheckRecognition * +*---------------------------* +* Description: +* This internal method decides when to fire sound start events, +* phrase start events and hypotheses. +*****************************************************************************/ +void CSrEngine::_CheckRecognition() +{ + SPDBG_FUNC("Sample Engine - _NotifyRecognition"); + ULONG duration, blahs; + + if (m_ullEnd > m_ullStart) + { + duration = (ULONG)(m_ullEnd - m_ullStart); + if (duration >= BLOCKSIZE * 100 * 1 / 8) + { + if (!m_bSoundStarted) + { + // Heard something that was longer than 1/8th second, so do sound start + AddEvent(SPEI_SOUND_START, m_ullStart); + m_bSoundStarted = TRUE; + m_cBlahBlah = 0; + } + if (duration >= BLOCKSIZE * 100 * 1 / 4) + { + // Heard something that was longer than 1/4 second, so do phrase start + // and then generate a hypothesis every 1/4 second after that. + blahs = duration / (BLOCKSIZE * 100 * 1 / 4); + if (blahs != m_cBlahBlah) + { + m_cBlahBlah = blahs; + if (!m_bPhraseStarted) + { + m_bPhraseStarted = TRUE; + AddEvent(SPEI_PHRASE_START, m_ullStart); + } + _NotifyRecognition(TRUE, blahs); + } + } + } + } +} + + +/**************************************************************************** +* CSrEngine::_NotifyRecognition * +*-------------------------------* +* Description: +* This internal method is used to generate a recognition result. The contents +* are random since we don't actually know how to recognize anything.* +****************************************************************************/ +void CSrEngine::_NotifyRecognition( BOOL fHypothesis, ULONG nWords ) +{ + SPDBG_FUNC("Sample Engine - _NotifyRecognition"); + HRESULT hr = S_OK; + + // First count the active CFG rules + ULONG cActiveCFGRules = 0; + CRuleEntry * pRule = m_RuleList.GetHead(); + for(; pRule; pRule = m_RuleList.GetNext(pRule)) + { + if( pRule->m_fActive ) + { + cActiveCFGRules++; + } + } + + // Then count all the grammars with active dictation + ULONG cActiveSLM = 0; + CDrvGrammar * pGram = m_GrammarList.GetHead(); + for(; pGram; pGram = m_GrammarList.GetNext(pGram)) + { + if(pGram->m_SLMActive) + { + cActiveSLM++; + } + } + + // If both CFG and dictation are active, randomly do one or the other + if(cActiveCFGRules && cActiveSLM) + { + if(rand() % 2) + { + cActiveSLM = 0; + } + else + { + cActiveCFGRules = 0; + } + } + + //--- Compose reco result info + SPRECORESULTINFO Result; + memset(&Result, 0, sizeof(SPRECORESULTINFO)); + Result.cbSize = sizeof(SPRECORESULTINFO); + Result.fHypothesis = fHypothesis; + Result.ullStreamPosStart = m_ullStart; + Result.ullStreamPosEnd = m_ullEnd; + + if( cActiveCFGRules ) + { + // Generate a CFG result phrase + hr = WalkCFGRule(&Result, cActiveCFGRules, fHypothesis, nWords, m_ullStart, (ULONG)(m_ullEnd - m_ullStart)); + if( SUCCEEDED(hr) ) + { + // Pass the results info to SAPI + hr = m_cpSite->Recognition(&Result); + // Cleanup any memory allocated for alternates and release phrases + for(ULONG i = 0; i < Result.ulNumAlts; i++) + { + Result.aPhraseAlts[i].pPhrase->Release(); + } + Result.pPhrase->Release(); + delete[] Result.aPhraseAlts; + } + } + else if(cActiveSLM) + { + // Generate a dictation result phrase + hr = WalkSLM(&Result, cActiveSLM, nWords, m_ullStart, (ULONG)(m_ullEnd - m_ullStart)); + if( SUCCEEDED(hr) ) + { + // Pass the results info to SAPI + hr = m_cpSite->Recognition(&Result); + // Release the result phrase + Result.pPhrase->Release(); + delete[] Result.pvEngineData; + } + } + else if(!fHypothesis) + { + // No rules were active - return a false recognition + // RecognizeStream can still be called if no rules are active + // - the engine is free to do anything it wants with the speech data. + Result.eResultType = SPRT_FALSE_RECOGNITION; + hr = m_cpSite->Recognition(&Result); + } + +} + +/**************************************************************************** +* CSrEngine::CreatePhraseFromRule * +*---------------------------------* +* Description: +* This method is used to produce the result phrase for a CFG result. +* It selects a random path through an active rule, and +* then calls ParseFromTransition to generate an ISpPhraseBuilder object. +* +* Return: +* S_OK +* FAIL(hr) +****************************************************************************/ +HRESULT CSrEngine::CreatePhraseFromRule( CRuleEntry * pRule, BOOL fHypothesis, + ULONGLONG ullAudioPos, ULONG ulAudioSize, + ISpPhraseBuilder** ppPhrase ) +{ + HRESULT hr = S_OK; + SPRULEENTRY RuleInfo; + RuleInfo.hRule = pRule->m_hRule; + hr = m_cpSite->GetRuleInfo(&RuleInfo, SPRIO_NONE); + if( SUCCEEDED(hr) ) + { + SPPATHENTRY Path[200]; // Note: Limit of 200 transitions in grammar! + ULONG cTrans; + // Recursively generate random path + hr = RecurseWalk(RuleInfo.hInitialState, Path, &cTrans); + + //Fill in the audio offset and audio size for each element in the path, while each element has equal size and silence in between + if (cTrans) + { + ULONG ulInterval = ulAudioSize/cTrans; + for (ULONG ul = 0; ul < cTrans; ul++) + { + Path[ul].elem.ulAudioStreamOffset = ul * ulInterval; + Path[ul].elem.ulAudioSizeBytes = ulInterval/2; + } + } + + if (SUCCEEDED(hr)) + { + // generate a SPPARSEINFO structure + SPPARSEINFO ParseInfo; + memset(&ParseInfo, 0, sizeof(ParseInfo)); + ParseInfo.cbSize = sizeof(SPPARSEINFO); + ParseInfo.hRule = pRule->m_hRule; + ParseInfo.ullAudioStreamPosition = ullAudioPos; + ParseInfo.ulAudioSize = ulAudioSize; + ParseInfo.cTransitions = cTrans; + ParseInfo.pPath = Path; + ParseInfo.fHypothesis = fHypothesis; + ParseInfo.SREngineID = CLSID_SampleSREngine; + ParseInfo.ulSREnginePrivateDataSize = 0; + ParseInfo.pSREnginePrivateData = NULL; + + // Generate a phrase object from the parse info. + hr = m_cpSite->ParseFromTransitions(&ParseInfo, ppPhrase ); + if(SUCCEEDED(hr)) + { + // delete any allocated memory + for(ULONG i = 0; i < cTrans; i++) + { + if(Path[i].elem.pszDisplayText) + { + delete const_cast(Path[i].elem.pszDisplayText); + } + } + } + } + } + return hr; +} + +/**************************************************************************** +* CSrEngine::FindRule * +*---------------------* +* Description: +* This method is used to locate an active rule in the rule list by index +* +****************************************************************************/ +CRuleEntry* CSrEngine::FindRule( ULONG ulRuleIndex ) +{ + CRuleEntry * pRule = m_RuleList.GetHead(); + ULONG ulRule = 0; + while( pRule ) + { + if( pRule->m_fActive && ( ulRule++ == ulRuleIndex ) ) + { + break; + } + pRule = m_RuleList.GetNext( pRule ); + } + SPDBG_ASSERT(pRule && pRule->m_fActive); + return pRule; +} + +/**************************************************************************** +* CSrEngine::NextRuleAlt * +*------------------------* +* Description: +* This method is used to locate a rule alternate in the rule list +* +****************************************************************************/ +CRuleEntry* CSrEngine::NextRuleAlt( CRuleEntry * pPriRule, CRuleEntry * pLastRule ) +{ + CRuleEntry * pRule = (pLastRule)?(pLastRule):(m_RuleList.GetHead()); + for(; pRule; pRule = m_RuleList.GetNext(pRule)) + { + if( pRule->m_fActive && + ( m_cpSite->IsAlternate( pPriRule->m_hRule, pRule->m_hRule ) == S_OK ) ) + { + break; + } + } + return pRule; +} + +/**************************************************************************** +* CSrEngine::WalkCFGRule * +*------------------------* +* Description: +* This method is used to produce the results information for a CFG result. +* It creates a result phrase and then some alternates phrases. +* Return: +* S_OK +* FAILED(hr) +****************************************************************************/ +HRESULT CSrEngine::WalkCFGRule( SPRECORESULTINFO * pResult, ULONG cRulesActive, BOOL fHypothesis, + ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize) +{ + HRESULT hr = E_FAIL; + CRuleEntry * pPriRule = NULL; + pResult->ulSizeEngineData = 0; + pResult->pvEngineData = NULL; + pResult->eResultType = SPRT_CFG; + pResult->hGrammar = NULL; + + while (hr == E_FAIL) + { + // Randomly pick a rule and locate it in the list + pPriRule = FindRule( rand() % cRulesActive ); + + // Create a phrase from the rule + hr = CreatePhraseFromRule( pPriRule, fHypothesis, ullAudioPos, + ulAudioSize, &pResult->pPhrase ); + // E_FAIL means the random path generated came to a dead end. Most likely an empty + // dynamic rule. We are not allowed to recognize through empty rules. + // Hence we choose another random toplevel rule and try again until we succeed. + } + + if (hr != S_OK) + { + SPDBG_ASSERT(FALSE); + } + + // Get the phrase info + SPPHRASE* pPriPhraseInfo = NULL; + if( SUCCEEDED( hr ) ) + { + hr = pResult->pPhrase->GetPhrase( &pPriPhraseInfo ); + } + + // Ask the site how many alternates to generate + ULONG ulNumAlts = 0; + if( SUCCEEDED( hr ) ) + { + hr = m_cpSite->GetMaxAlternates( pPriRule->m_hRule, &ulNumAlts ); + } + + // Randomly create some alternates + if( SUCCEEDED( hr ) && ulNumAlts ) + { + pResult->aPhraseAlts = new SPPHRASEALT[ulNumAlts]; + if( pResult->aPhraseAlts ) + { + memset( pResult->aPhraseAlts, 0, ulNumAlts * sizeof(SPPHRASEALT) ); + CRuleEntry * pAltRule = NULL; + + for( ULONG i = 0; SUCCEEDED( hr ) && (i < ulNumAlts); ++i ) + { + // Try to find an alternate rule + pAltRule = NextRuleAlt( pPriRule, pAltRule ); + if( !pAltRule ) + { + ulNumAlts = i; + break; + } + + // Create an alternate phrase from the rule + hr = CreatePhraseFromRule( pAltRule, fHypothesis, ullAudioPos, + ulAudioSize, &pResult->aPhraseAlts[i].pPhrase ); + + // Get the alternate phrase info + SPPHRASE* pAltPhraseInfo = NULL; + if( SUCCEEDED( hr ) ) + { + hr = pResult->aPhraseAlts[i].pPhrase->GetPhrase( &pAltPhraseInfo ); + } + + if( SUCCEEDED( hr ) ) + { + ++pResult->ulNumAlts; + + // Fill out relationship info + pResult->aPhraseAlts[i].cElementsInParent = pPriPhraseInfo->Rule.ulCountOfElements; + pResult->aPhraseAlts[i].cElementsInAlternate = pAltPhraseInfo->Rule.ulCountOfElements; + + // Point to some extra data for testing + static BYTE AltData[] = { 0xED, 0xED, 0xED, 0xED }; + pResult->aPhraseAlts[i].pvAltExtra = &AltData; + pResult->aPhraseAlts[i].cbAltExtra = sp_countof( AltData ); + } + + if( pAltPhraseInfo ) + { + ::CoTaskMemFree( pAltPhraseInfo ); + } + } + } + else + { + E_OUTOFMEMORY; + } + } + + // Cleanup main phrase information + if( pPriPhraseInfo ) + { + ::CoTaskMemFree( pPriPhraseInfo ); + } + + // Cleanup on failure + if( FAILED( hr ) ) + { + if( pResult->pPhrase ) + { + pResult->pPhrase->Release(); + pResult->pPhrase = NULL; + } + + for( ULONG i = 0; i < pResult->ulNumAlts; ++i ) + { + pResult->aPhraseAlts[i].pPhrase->Release(); + pResult->aPhraseAlts[i].pPhrase = NULL; + } + pResult->ulNumAlts = 0; + delete[] pResult->aPhraseAlts; + pResult->aPhraseAlts = NULL; + } + + return hr; +} + +/**************************************************************************** +* CSrEngine::WalkSLM * +*---------------------------* +* Description: +* This method is used to produce the results information for a dictation result. +* It creates a result phrase, and then serializes some alternates information +* that the CSrEngineAlternates object uses to generate alternates. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::WalkSLM(SPRECORESULTINFO * pResult, ULONG cSLMActive, + ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize) +{ + HRESULT hr = S_OK; + + // If several dictation grammars are active pick one at random + ULONG ulGramIndex = rand() % cSLMActive; + CDrvGrammar * pGram = m_GrammarList.GetHead(); + ULONG nGram = 0; + for(; pGram; pGram = m_GrammarList.GetNext(pGram)) + { + if(pGram->m_SLMActive) + { + if(nGram == ulGramIndex) + { + break; + } + nGram++; + } + } + SPDBG_ASSERT(pGram && pGram->m_SLMActive); + + // create and fill SPPHRASE structure + SPPHRASE phrase; + memset(&phrase, 0, sizeof(SPPHRASE)); + phrase.cbSize = sizeof(SPPHRASE); + phrase.LangID = m_LangID; + phrase.ullAudioStreamPosition = ullAudioPos; + phrase.ulAudioSizeBytes = ulAudioSize; + phrase.SREngineID = CLSID_SampleSREngine; + + // allocate elements + ULONG cb = nWords * sizeof(SPPHRASEELEMENT); + SPPHRASEELEMENT* pElements = (SPPHRASEELEMENT *)_alloca(cb); + memset(pElements, 0, cb); + + // fill in word info into elements + for (ULONG n = 0; n < nWords; n++) + { + ULONG ulInterval = ulAudioSize/nWords; + + pElements[n].bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + pElements[n].pszDisplayText = DICT_WORD; + pElements[n].ulAudioStreamOffset = n * ulInterval; + pElements[n].ulAudioSizeBytes = ulInterval/2; + + } + + // add elements to phrase + phrase.Rule.ulCountOfElements = nWords; + phrase.pElements = pElements; + + // make phrase builder and add phrase info + CComPtr cpBuilder; + hr = cpBuilder.CoCreateInstance(CLSID_SpPhraseBuilder); + if (SUCCEEDED(hr)) + { + hr = cpBuilder->InitFromPhrase(&phrase); + } + + if (SUCCEEDED(hr)) + { + // Store alternates string in extra engine data + // We just serialize an equal number of copies of ALT_WORD as DICT_WORD. + // Engines can store any information (e.g. serialized lattice) here. + pResult->ulSizeEngineData = sizeof(ALT_WORD) * nWords; + pResult->pvEngineData = new WCHAR[(sizeof(ALT_WORD) / sizeof(WCHAR )) * nWords]; + if (pResult->pvEngineData == NULL) + { + hr = E_OUTOFMEMORY; + } + } + + if (SUCCEEDED(hr)) + { + WCHAR *pC = (WCHAR *)pResult->pvEngineData; + for(ULONG i = 0; i < nWords; i++) + { + wcscpy(pC,ALT_WORD); + pC += wcslen(ALT_WORD); + *pC = L' '; + pC++; + } + *(--pC) = '\0'; + + pResult->eResultType = SPRT_SLM; + pResult->hGrammar = pGram->m_hSapiGrammar; + } + + if (SUCCEEDED(hr)) + { + pResult->pPhrase = cpBuilder.Detach(); + } + else + { + delete[] pResult->pvEngineData; + pResult->pvEngineData = NULL; + pResult->ulSizeEngineData = 0; + } + + return hr; +} + +/**************************************************************************** +* CSrEngine::WalkTextBuffer * +*---------------------------* +* Description: +* This is called when RecurseWalk hits a text-buffer transition. +* At such a transition the engine should try to recognize any sequence +* of words from the active text selection the app has supplied. +* Any word can be the start word and then recognition can continue to +* the next \0 end of sentence marker or at the end of the active text selection. +* In this sample we pick a random string of words from the buffer. +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +HRESULT CSrEngine::WalkTextBuffer(void* pvGrammarCookie, SPPATHENTRY * pPath, SPTRANSITIONID hId, ULONG * pcTrans) +{ + HRESULT hr = S_OK; + // Check if text buffer present + CDrvGrammar * pGrammar = (CDrvGrammar *) pvGrammarCookie; + SPDBG_ASSERT(pGrammar->m_pWordSequenceText && pGrammar->m_cchText >= 2); //m_cchText counts the trailing "/0/0" + + *pcTrans = 0; + + // Count sentences + ULONG nPhrase = 0; + const WCHAR *cPhrase; + + ULONG ulStartActiveOffset = 0; //The default value with text selection + ULONG cchActiveChars = pGrammar->m_cchText - 2; //The default value with text selection + ULONG ccChars = 0; + + if (pGrammar->m_pInfo) + { + ulStartActiveOffset = pGrammar->m_pInfo->ulStartActiveOffset; + cchActiveChars = pGrammar->m_pInfo->cchActiveChars; + } + + for (cPhrase = pGrammar->m_pWordSequenceText + ulStartActiveOffset; + ccChars < cchActiveChars && (*cPhrase != L'\0' || *(cPhrase + 1) != '\0'); + ccChars++, cPhrase++) + { + if(*cPhrase != L'\0' && *(cPhrase + 1) == L'\0') + { + nPhrase++; + } + } + + + SPDBG_ASSERT(nPhrase); + + // Randomly pick a sentence between the first active sentence and the last active sentence + nPhrase = rand() % nPhrase; //nPhrase would be 0 index + ULONG nP = 0; + for(cPhrase = pGrammar->m_pWordSequenceText + ulStartActiveOffset; nP != nPhrase; cPhrase++) + { + if(*cPhrase == L'\0') + { + nP++; + } + } + + // Count words in sentence + ULONG nWord = 1; + const WCHAR *cWord; + for(cWord = cPhrase; *cWord != L'\0' && ULONG(cWord - pGrammar->m_pWordSequenceText) < ulStartActiveOffset + cchActiveChars; cWord++) + { + if(iswspace(*cWord)) + { + while(*(cWord+1) && iswspace(*(cWord+1)) && ULONG(cWord - pGrammar->m_pWordSequenceText) < ulStartActiveOffset + cchActiveChars - 1) {cWord++;} + nWord++; + } + } + + // Pick entry and exit word + ULONG startWord = rand() % nWord; + ULONG countWord = rand() % (nWord - startWord) + 1; + + // Find the entry word + for(nWord = 0, cWord = cPhrase; nWord != startWord; cWord++) + { + if(iswspace(*cWord)) + { + while(*(cWord+1) && iswspace(*(cWord+1)) && ULONG(cWord - pGrammar->m_pWordSequenceText) < ulStartActiveOffset + cchActiveChars - 1) {cWord++;} + nWord++; + } + } + + // Build paths to end word + const WCHAR *cW = cWord; + for(nWord = 0; nWord != countWord; cWord++) + { + if(*cWord == L'\0' || iswspace(*cWord) || ULONG(cWord - pGrammar->m_pWordSequenceText) == ulStartActiveOffset + cchActiveChars) + { + // Build a path entry + pPath->hTransition = hId; + memset(&pPath->elem, 0, sizeof(pPath->elem)); + pPath->elem.bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + WCHAR *pszWord = new WCHAR[cWord - cW + 1]; + wcsncpy(pszWord, cW, cWord - cW); + pszWord[cWord - cW] = '\0'; + pPath->elem.pszDisplayText = pszWord; + + pPath++; + (*pcTrans)++; + + while(*(cWord+1) && iswspace(*(cWord+1)) && ULONG(cWord - pGrammar->m_pWordSequenceText) < ulStartActiveOffset + cchActiveChars - 1) {cWord++;} + cW = cWord + 1; // first char of next word + nWord++; + } + } + + return hr; +} + +/**************************************************************************** +* CSrEngine::RecurseWalk * +*----------------------* +* Description: +* This method produces a random path through an active CFG. If the path contains +* a rule reference transition RecurseWalk is recursively called to produce a path though +* sub-rules. The result is an array of SPPATHENTRY elements containing the transitions. +* +* The initial state in each rule is obtained by calling GetRuleInfo. Then for each +* state GetStateInfo can be called. This gives an array of SPTRANSITION entries +* the contain information on the type of transition, the transition id and +* the next state the transition goes to. The transition id is the main information +* included in the SPPATHENTRY. Only for word transitions are SPPATHENTRY created, +* as this is all that is required by ParseFromTransitions. +* +* Return: +* S_OK +* FAILED(hr) +****************************************************************************/ +HRESULT CSrEngine::RecurseWalk(SPSTATEHANDLE hState, SPPATHENTRY * pPath, ULONG * pcTrans) +{ + HRESULT hr = S_OK; + + CSpStateInfo StateInfo; + *pcTrans = 0; + while (SUCCEEDED(hr) && hState) + { + ULONG cTrans; + hr = m_cpSite->GetStateInfo(hState, &StateInfo); + if (SUCCEEDED(hr)) + { + // Now randomly decide which transition to take. + ULONG cTransInState = StateInfo.cEpsilons + StateInfo.cWords + StateInfo.cRules + StateInfo.cSpecialTransitions; + if (cTransInState == 0) + { + // This path is a dead-end. Most likely this is due to an empty dynamic rule. + hr = E_FAIL; + break; + } + SPTRANSITIONENTRY * pTransEntry = StateInfo.pTransitions + (rand() % cTransInState); + + switch(pTransEntry->Type) + { + case SPTRANSEPSILON: + // Epsilon transition - don't need to create a path entry + // Advance to the next state. + break; + case SPTRANSRULE: + // Rule transition - we recursively descend into the rule and add onto the path array + hr = RecurseWalk(pTransEntry->hRuleInitialState, pPath, &cTrans); + *pcTrans += cTrans; + pPath += cTrans; + break; + case SPTRANSWORD: + case SPTRANSWILDCARD: + // For a word transition we complete an SPPATHENTRY structure with the transition id. + // A wildcard transition indicates the engine should match against any speech, so we do the same thing. + pPath->hTransition = pTransEntry->ID; + memset(&pPath->elem, 0, sizeof(pPath->elem)); + pPath->elem.bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + pPath++; + (*pcTrans)++; + break; + case SPTRANSTEXTBUF: + // Text Buffer transition - produce a path from WalkTextBuffer + hr = WalkTextBuffer(pTransEntry->pvGrammarCookie, pPath, pTransEntry->ID, &cTrans); + *pcTrans += cTrans; + pPath += cTrans; + break; + case SPTRANSDICTATION: + // Dictation transition - indicating the recognizer should do dictation at + // this point in the grammar. We generate the DICT_WORD as a path entry. + // The word text is indicated by setting pszDisplayText, which otherwise can be left NULL. + pPath->hTransition = pTransEntry->ID; + memset(&pPath->elem, 0, sizeof(pPath->elem)); + pPath->elem.bDisplayAttributes = SPAF_ONE_TRAILING_SPACE; + WCHAR *pszWord = new WCHAR[wcslen(DICT_WORD) + 1]; + wcscpy(pszWord, DICT_WORD); + pPath->elem.pszDisplayText = pszWord; + pPath++; + (*pcTrans)++; + break; + } + + // Move to the next state - a transition to NULL indicates the end of the rule. + hState = pTransEntry->hNextState; + } + } + return hr; +} + + + +/**************************************************************************** +* CSrEngine::GetInputAudioFormat * +*---------------------------* +* Description: +* This method is called for SAPI to find what audio formats the engine +* can support for recognition. +* Audio formats a represented by a GUID and an optional WAVEFORMATEX +* structure for wav file formats. This method may be called +* either with pSourceFormatId and pSourceWaveFormatEx NULL, in which +* case the engine should return its most preferred format. It may also +* be called with these set, in which case the engine should return +* that format if it can support or the closest it can. +* +* If the engines returned format is incompatible with the input audio +* object format SAPI will try and create a format convertor to convert the audio +* +* Return: +* S_OK +* FAILED(hr) +*****************************************************************************/ +STDMETHODIMP CSrEngine::GetInputAudioFormat(const GUID * pSourceFormatId, const WAVEFORMATEX * pSourceWaveFormatEx, + GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWFEX) +{ + SPDBG_FUNC( "Sample Engine - GETINPUTAUDIOFORMAT" ); + + // Helper function which fills in the sample engine desired format (PCM 11kHz Mono). + return SpConvertStreamFormatEnum(SPSF_11kHz16BitMono, pDesiredFormatId, ppCoMemDesiredWFEX); +} + + +/***************************************************************************** +* CSrEngine::SetPropertyNum * +*---------------------* +* Description: +* The following methods are used for the app to send and receive +* real-time attribute information to the engine. This differs from the +* ISpObjectWithToken mechanism which is used to query static registry information. +* If the app tries to set or query an attribute the engine should return +* okay if it supports that attribute and S_FALSE if it does not. +* In this method the app is trying to set a numeric property value. +* Return: +* S_FALSE +*****************************************************************************/ +STDMETHODIMP CSrEngine:: + SetPropertyNum( SPPROPSRC eSrc, PVOID pvSrcObj, const WCHAR* pName, LONG lValue ) +{ + SPDBG_FUNC( "Sample Engine - SETPROPERTYNUM" ); + HRESULT hr = S_OK; + + hr = S_FALSE; // We don't support any properties + + return hr; +} + +/***************************************************************************** +* CSrEngine::GetPropertyNum * +*---------------------* +* Description: +* In this method the app is trying to get a numeric property value. +*****************************************************************************/ +STDMETHODIMP CSrEngine:: + GetPropertyNum( SPPROPSRC eSrc, PVOID pvSrcObj, const WCHAR* pName, LONG * plValue ) +{ + SPDBG_FUNC( "Sample Engine - GETPROPERTYNUM" ); + HRESULT hr = S_OK; + + hr = S_FALSE; + *plValue = 0; + + return hr; +} + +/***************************************************************************** +* CSrEngine::SetPropertyString * +*----------------------* +* Description: +* In this method the app is trying to set a string property value. +*****************************************************************************/ +STDMETHODIMP CSrEngine:: + SetPropertyString( SPPROPSRC eSrc, PVOID pvSrcObj, const WCHAR* pName, const WCHAR* pValue ) +{ + SPDBG_FUNC( "Sample Engine - SETPROPERTYSTRING" ); + HRESULT hr = S_OK; + + hr = S_FALSE; + + return hr; +} + +/***************************************************************************** +* CSrEngine::GetPropertyString * +*----------------------* +* Description: +* In this method the app is trying to get a string property value. +*****************************************************************************/ +STDMETHODIMP CSrEngine:: + GetPropertyString( SPPROPSRC eSrc, PVOID pvSrcObj, const WCHAR* pName, WCHAR** ppCoMemValue ) +{ + SPDBG_FUNC( "Sample Engine - GETPROPERTYSTRING" ); + HRESULT hr = S_OK; + + hr = S_FALSE; + *ppCoMemValue = NULL; + + return hr; +} + + +/**************************************************************************** +* CSrEngine::PrivateCall * +*---------------------------* +* Description: +* This method is used for a reco extension to send private, engine-specific information +* to an engine it knows about. The app QI's off the reco context for a private +* interface, and SAPI creates the engine' extension object (in this case CSampleSRExtension). +* The app can then call methods on this interface. If the extension object wants to +* communicate with the engine it calls CallEngine. The data from that call is then +* passed to this method on the engine. +* +* Similarly the alternates class and UI class can also use this mechanism to +* communicate with their main engine class. +* +* The single buffer is in/out. This call can update the buffer, and the updated buffer +* will be returned to the caller of _ISpPrivateEngineCall::CallEngine(). To return +* variable size buffers, use _ISpPrivateEngineCall::CallEngineEx() and +* ISpSREngine::PrivateCallEx(). +* +* Return: +* S_OK +*****************************************************************************/ +STDMETHODIMP CSrEngine::PrivateCall(void * pvEngineContext, void * pCallFrame, ULONG ulCallFrameSize) +{ + SPDBG_FUNC( "Sample Engine - PRIVATECALL" ); + // Just an example - do nothing here + return S_OK; +} + +/**************************************************************************** +* CSrEngine::PrivateCallEx * +*--------------------------* +* Description: +* This method is similar to PrivateCall except that the call frame is an +* input only parameter. This function should CoTaskMemAlloc a response block +* and return it in *ppvCoMemResponse. You must also return the size of the +* allocated block (in bytes) in *pcbResponse. +* +* While this is slightly more work than CallEngine/PrivateCall, it allows for +* variable size responses, which could be more efficent in some cases. +* +* Returns: +* S_OK +* +*****************************************************************************/ + +STDMETHODIMP CSrEngine::PrivateCallEx(void * pvEngineContext, const void * pInCallFrame, ULONG ulCallFrameSize, + void ** ppvCoMemResponse, ULONG * pcbResponse) +{ + SPDBG_FUNC("SampleEngine - PrivateCallEx"); + HRESULT hr = S_OK; + + *ppvCoMemResponse = NULL; + *pcbResponse = 0; + + return hr; +} + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.h b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.h new file mode 100644 index 00000000..e77c9756 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengobj.h @@ -0,0 +1,347 @@ +/****************************************************************************** +* srengobj.h +* This file contains the declaration of the CSrEngine class. +* This implements ISpSREngine and ISpObjectWithToken. +* This is the main recognition object +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#pragma once + +#include "stdafx.h" +#include "sreng.h" +#include "resource.h" + +// A list of reco contexts is stored. Each entry in the list is an instance of this class. +class CContext +{ +public: + CContext * m_pNext; + BOOL operator==(SPRECOCONTEXTHANDLE hContext) + { + return (m_hSapiContext == hContext); + } + + CContext(SPRECOCONTEXTHANDLE hSapiContext) : + m_hSapiContext(hSapiContext) + {} + + SPRECOCONTEXTHANDLE m_hSapiContext; // The reco context handle given by SAPI +}; + +// A list of reco grammars is stored. Each entry in the list is an instance of this class. +class CDrvGrammar +{ +public: + CDrvGrammar * m_pNext; + SPGRAMMARHANDLE m_hSapiGrammar; // The grammar handle given by SAPI + BOOL m_SLMLoaded; // Does the grammar have an associated SLM for dictation + BOOL m_SLMActive; // Is the dictation active + WCHAR* m_pWordSequenceText; // The text of the word sequence buffer if one is set + ULONG m_cchText; // The size of the word sequence buffer + SPTEXTSELECTIONINFO* m_pInfo; // The text selection of the word sequence buffer + + CDrvGrammar(SPGRAMMARHANDLE hSapiGrammar) : + m_hSapiGrammar(hSapiGrammar), + m_SLMLoaded(FALSE), + m_SLMActive(FALSE), + m_pWordSequenceText(NULL), + m_cchText(0), + m_pInfo(NULL) + { + } + + ~CDrvGrammar() + { + // Free up resources + //For each grammar object going to be released, SAPI would call SetWordSequenceData(NULL, 0, NULL). + //SetWordSequenceData and SetTextSelection would release the memories. + //There is no need to release memories referred by m_pWordSequenceText and m_pInfo here. + } + +#ifdef _WIN32_WCE + CDrvGrammar() + { + } + + static LONG Compare(const CDrvGrammar *, const CDrvGrammar *) + { + return 0; + } +#endif +}; + +// The RecognizeStream thread read audio data in blocks. For each block +// it decides if the data is speech or silence and adds that value to this queue. +// The decoder thread reads these and processes them. +// A critical section is used to make the queue thread-safe, and an event is used to +// show if the buffer has space or not. +// This very roughtly simulates the idea of doing features extraction on +// one thread and passes the feature stream to the decoder. +class CFrameQueue +{ +public: + BOOL m_aFrames[100]; // The queue of speech/silence values + ULONG m_cFrames; + ULONG m_ulHeadIndex; + HANDLE m_hSpaceAvailEvent; + CRITICAL_SECTION m_cs; + + CFrameQueue() + { + m_cFrames = 0; + m_ulHeadIndex = 0; + m_hSpaceAvailEvent = NULL; + InitializeCriticalSection(&m_cs); + } + ~CFrameQueue() + { + DeleteCriticalSection(&m_cs); + } + void SetSpaceAvailEvent(HANDLE h) + { + m_hSpaceAvailEvent = h; + } + void InsertTail(BOOL b) + { + EnterCriticalSection(&m_cs); + ULONG ulTailIndex = (m_ulHeadIndex + m_cFrames) % sp_countof(m_aFrames); + m_aFrames[ulTailIndex] = b; + m_cFrames++; + if (m_cFrames == sp_countof(m_aFrames)) + { + ResetEvent(m_hSpaceAvailEvent); + } + LeaveCriticalSection(&m_cs); + } + BOOL IsFull() + { + EnterCriticalSection(&m_cs); + BOOL b = (m_cFrames == sp_countof(m_aFrames)); + LeaveCriticalSection(&m_cs); + return b; + } + BOOL RemoveHead() + { + EnterCriticalSection(&m_cs); + BOOL b = m_aFrames[m_ulHeadIndex]; + m_ulHeadIndex = (m_ulHeadIndex + 1) % sp_countof(m_aFrames); + m_cFrames--; + SetEvent(m_hSpaceAvailEvent); + LeaveCriticalSection(&m_cs); + return b; + } + BOOL HasData() + { + EnterCriticalSection(&m_cs); + ULONG cFrames = m_cFrames; + LeaveCriticalSection(&m_cs); + return cFrames; + } +}; + + +// Class so we can use CSpBasicQueue to store rule information +class CRuleEntry +{ +public: + BOOL operator==(SPRULEHANDLE rh) + { + return (m_hRule == rh); + } + CRuleEntry * m_pNext; + SPRULEHANDLE m_hRule; // SAPI rule handle + BOOL m_fTopLevel; // Shows if rule can be activated + BOOL m_fActive; // Shows if rule is currectly active +}; + + + +// The main CSrEngine class + +class ATL_NO_VTABLE CSrEngine : + public CComObjectRootEx, + public CComCoClass, + public ISpSREngine, + public ISpObjectWithToken, + public ISpThreadTask +{ +public: + CSrEngine() : + m_ulNextGrammarIndex(0), + m_cActive(0), + m_bPhraseStarted(FALSE), + m_bSoundStarted(FALSE), + m_hQueueHasRoom(NULL), + m_hRequestSync(NULL), + m_LangID(0) + {} + +DECLARE_REGISTRY_RESOURCEID(IDR_SRENG) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CSrEngine) + COM_INTERFACE_ENTRY(ISpSREngine) + COM_INTERFACE_ENTRY(ISpObjectWithToken) +END_COM_MAP() + +private: + HANDLE m_hRequestSync; + CFrameQueue m_FrameQueue; + ULONG m_cBlahBlah; + CSpBasicQueue m_GrammarList; + CSpBasicQueue m_ContextList; + ULONG m_ulNextGrammarIndex; + ULONG m_cActive; + ULONGLONG m_ullStart; + ULONGLONG m_ullEnd; + BOOL m_bSoundStarted:1; + BOOL m_bPhraseStarted:1; + CComPtr m_cpSite; + CComPtr m_cpDecoderThread; + HANDLE m_hQueueHasRoom; + CSpBasicQueue m_RuleList; + CComPtr m_cpLexicon; + CComPtr m_cpEngineObjectToken; + CComPtr m_cpUserObjectToken; + LANGID m_LangID; + +public: + + HRESULT RandomlyWalkRule(SPRECORESULTINFO * pResult, ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize); + HRESULT RecurseWalk(SPSTATEHANDLE hState, SPPATHENTRY * pPath, ULONG * pcTrans); + HRESULT WalkCFGRule(SPRECORESULTINFO * pResult, ULONG cRulesActive, BOOL fHypothesis, + ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize); + HRESULT WalkSLM(SPRECORESULTINFO * pResult, ULONG cSLMActive, + ULONG nWords, ULONGLONG ullAudioPos, ULONG ulAudioSize); + HRESULT WalkTextBuffer(void* pvGrammarCookie, SPPATHENTRY * pPath, SPTRANSITIONID hId, ULONG * pcTrans); + + HRESULT AddEvent(SPEVENTENUM eEvent, ULONGLONG ullStreamPos, WPARAM wParam = 0, LPARAM lParam = 0); + HRESULT AddEventString(SPEVENTENUM eEvent, ULONGLONG ulLStreamPos, const WCHAR * psz, WPARAM = 0); + + HRESULT CreatePhraseFromRule( CRuleEntry * pRule, BOOL fHypothesis, + ULONGLONG ullAudioPos, ULONG ulAudioSize, + ISpPhraseBuilder** ppPhrase ); + + CRuleEntry* FindRule( ULONG ulRuleIndex ); + CRuleEntry* NextRuleAlt( CRuleEntry * pPriRule, CRuleEntry * pLastRule ); + + void _CheckRecognition(); + void _NotifyRecognition(BOOL fHypothesis, ULONG nWords); + + // ATL contstructor / destructor + HRESULT FinalConstruct(); + HRESULT FinalRelease(); + + // Initialization methods + STDMETHODIMP SetObjectToken(ISpObjectToken * pToken); + STDMETHODIMP GetObjectToken(ISpObjectToken ** ppToken); + + STDMETHODIMP SetRecoProfile(ISpObjectToken * pProfileToken); + STDMETHODIMP SetSite(ISpSREngineSite *pSite); + STDMETHODIMP GetInputAudioFormat(const GUID * pSrcFormatId, const WAVEFORMATEX * pSrcWFEX, + GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWFEX); + + STDMETHODIMP OnCreateRecoContext(SPRECOCONTEXTHANDLE hSAPIRecoContext, void ** ppvDrvCtxt); + STDMETHODIMP OnDeleteRecoContext(void * pvDrvCtxt); + + STDMETHODIMP OnCreateGrammar(void * pvEngineRecoContext, + SPGRAMMARHANDLE hSAPIGrammar, + void ** ppvEngineGrammar); + + STDMETHODIMP OnDeleteGrammar(void * pvEngineGrammar); + + // CFG methods + STDMETHODIMP WordNotify(SPCFGNOTIFY Action, ULONG cWords, const SPWORDENTRY * pWords); + STDMETHODIMP RuleNotify(SPCFGNOTIFY Action, ULONG cRules, const SPRULEENTRY * pRules); + + // Proprietary grammar methods + // - used to implement an engine-specific grammar format + // - this sample does not implement these + STDMETHODIMP LoadProprietaryGrammar(void * pvEngineGrammar, + REFGUID rguidParam, + const WCHAR * pszStringParam, + const void * pvDataParam, + ULONG ulDataSize, + SPLOADOPTIONS Options) + { + return E_NOTIMPL; + } + + STDMETHODIMP UnloadProprietaryGrammar(void * pvEngineGrammar) + { + return E_NOTIMPL; + } + + STDMETHODIMP SetProprietaryRuleState(void * pvEngineGrammar, + const WCHAR * pszName, + void * pvReserved, + SPRULESTATE NewState, + ULONG * pcRulesChanged) + { + return E_NOTIMPL; + } + STDMETHODIMP SetProprietaryRuleIdState(void * pvEngineGrammar, + DWORD dwRuleId, + SPRULESTATE NewState) + { + return E_NOTIMPL; + } + + // Since this engine does not support proprietary grammars, we do not need to implement + // this method other than just returning S_OK. Note to implementors: Do NOT return + // E_NOTIMPL. Just return S_OK and ignore this data if you do not need it to implement + // proprietary grammars. + STDMETHODIMP SetGrammarState(void * pvEngineGrammar, SPGRAMMARSTATE eGrammarState) + { + return S_OK; + } + STDMETHODIMP SetContextState(void * pvEngineContxt, SPCONTEXTSTATE eCtxtState) + { + return S_OK; + } + + + // Dictation methods + STDMETHODIMP LoadSLM(void * pvEngineGrammar, const WCHAR * pszTopicName); + STDMETHODIMP UnloadSLM(void * pvEngineGrammar); + STDMETHODIMP SetSLMState(void * pvEngineGrammar, SPRULESTATE NewState); + + STDMETHODIMP IsPronounceable(void *pDrvGrammar, const WCHAR *pszWord, SPWORDPRONOUNCEABLE * pWordPronounceable); + STDMETHODIMP SetWordSequenceData(void * pvEngineGrammar, const WCHAR * pText, ULONG cchText, const SPTEXTSELECTIONINFO * pInfo); + STDMETHODIMP SetTextSelection(void * pvEngineGrammar, const SPTEXTSELECTIONINFO * pInfo); + STDMETHODIMP SetAdaptationData(void * pvEngineCtxtCookie, const WCHAR * pText, const ULONG cch); + + // Property methods + STDMETHODIMP SetPropertyNum( SPPROPSRC eSrc, void* pvSrcObj, const WCHAR* pName, LONG lValue ); + STDMETHODIMP GetPropertyNum( SPPROPSRC eSrc, void* pvSrcObj, const WCHAR* pName, LONG * plValue ); + STDMETHODIMP SetPropertyString( SPPROPSRC eSrc, void* pvSrcObj, const WCHAR* pName, const WCHAR* pValue ); + STDMETHODIMP GetPropertyString( SPPROPSRC eSrc, void* pvSrcObj, const WCHAR* pName, WCHAR** ppCoMemValue ); + + + // The main recognition method + STDMETHODIMP RecognizeStream(REFGUID rguidFmtId, const WAVEFORMATEX * pWaveFormatEx, + HANDLE hRequestSync, HANDLE hDataAvailable, + HANDLE hExit, BOOL fNewAudioStream, BOOL fRealTimeAudio, + ISpObjectToken * pAudioObjectToken); + + STDMETHODIMP PrivateCall(void * pvEngineContext, void * pCallFrame, ULONG ulCallFrameSize); + STDMETHODIMP PrivateCallEx(void * pvEngineContext, const void * pInCallFrame, ULONG ulCallFrameSize, + void ** ppvCoMemResponse, ULONG * pcbResponse); + + + // ISpThreadTask methods + STDMETHODIMP InitThread( void * pvTaskData, HWND hwnd ) + { + return S_OK; + } + LRESULT STDMETHODCALLTYPE WindowMessage( void *pvTaskData, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ) + { + return E_UNEXPECTED; + } + + STDMETHODIMP ThreadProc( void *pvTaskData, HANDLE hExitThreadEvent, HANDLE hNotifyEvent, HWND hwndWorker, volatile const BOOL * pfContinueProcessing ); +}; + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.cpp new file mode 100644 index 00000000..e5a8ea86 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.cpp @@ -0,0 +1,79 @@ +/****************************************************************************** +* srengui.cpp +* This file contains the implementation of the CSrEngineUI class. +* This implements ISpTokenUI. This is used by the app to display UI. +* The methods here can either be called by the app directly from ISpObjectToken, +* or they can be called from the reco instance, in which case the methods +* are able to make a private call back to the main engine object. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sreng.h" +#include "srengui.h" + +/**************************************************************************** +* CSrEngineUI::IsUISupported * +*----------------------------* +* Description: +* Determine if the UI is supported. A reference to the main SR engine +* object (if it has been created), can be obtained from punkObject. +* If none-NULL this may be an ISpRecoContext, from which an engine +* extension interface can be obtained. +* +* Return: +* S_OK on success +* E_INVALIDARG on invalid arguments +*****************************************************************************/ +STDMETHODIMP CSrEngineUI::IsUISupported(const WCHAR * pszTypeOfUI, void * pvExtraData, ULONG cbExtraData, IUnknown * punkObject, BOOL *pfSupported) +{ + *pfSupported = FALSE; + + // We can do both engine specific properties as well as default settings (defaults when punkObject == NULL) + if (wcscmp(pszTypeOfUI, SPDUI_EngineProperties) == 0) + *pfSupported = TRUE; + + // We can only do user training if we get passed an engine + if (wcscmp(pszTypeOfUI, SPDUI_UserTraining) == 0 && punkObject != NULL) + *pfSupported = TRUE; + + // We can only do mic training if we get passed an engine + if (wcscmp(pszTypeOfUI, SPDUI_MicTraining) == 0 && punkObject != NULL) + *pfSupported = TRUE; + + return S_OK; +} + +/**************************************************************************** +* CSrEngineUI::DisplayUI * +*------------------------* +* Description: +* Display the UI requested +* +* Return: +* S_OK on success +*****************************************************************************/ +STDMETHODIMP CSrEngineUI::DisplayUI(HWND hwndParent, const WCHAR * pszTitle, const WCHAR * pszTypeOfUI, void * pvExtraData, ULONG cbExtraData, ISpObjectToken * pToken, IUnknown * punkObject) +{ + + if (wcscmp(pszTypeOfUI, SPDUI_EngineProperties) == 0) + { + if (punkObject) + { + MessageBoxW(hwndParent, L"Developer Sample Engine: Replace this with real engine properties dialog.", pszTitle, MB_OK); + } + } + + if (wcscmp(pszTypeOfUI, SPDUI_UserTraining) == 0) + { + MessageBoxW(hwndParent, L"Developer Sample Engine: Replace this with real user training wizard / dialog.", pszTitle, MB_OK); + } + + if (wcscmp(pszTypeOfUI, SPDUI_MicTraining) == 0) + { + MessageBoxW(hwndParent, L"Developer Sample Engine: Replace this with real microphone training wizard / dialog.", pszTitle, MB_OK); + } + + return S_OK; +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.h b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.h new file mode 100644 index 00000000..af2f0ea1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.h @@ -0,0 +1,47 @@ +/****************************************************************************** +* srengui.cpp +* This file contains the declaration of the CSrEngineUI class. +* This implements ISpTokenUI. This is used by the app to display UI. +* The methods here can either be called by the app directly from ISpObjectToken, +* or they can be called from the reco instance, in which case the methods +* are able to make a private call back to the main engine object. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#pragma once + +#include "resource.h" + +class ATL_NO_VTABLE CSrEngineUI : + public CComObjectRootEx, + public CComCoClass, + public ISpTokenUI +{ +public: + + DECLARE_REGISTRY_RESOURCEID(IDR_SRENGUI) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CSrEngineUI) + COM_INTERFACE_ENTRY(ISpTokenUI) + END_COM_MAP() + +public: + + STDMETHODIMP IsUISupported( + const WCHAR * pszTypeOfUI, + void * pvExtraData, + ULONG cbExtraData, + IUnknown * punkObject, + BOOL *pfSupported); + STDMETHODIMP DisplayUI( + HWND hwndParent, + const WCHAR * pszTitle, + const WCHAR * pszTypeOfUI, + void * pvExtraData, + ULONG cbExtraData, + ISpObjectToken * pToken, + IUnknown * punkObject); +}; diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.rgs b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.rgs new file mode 100644 index 00000000..5710dc07 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengui.rgs @@ -0,0 +1,26 @@ +HKCR +{ + SampleSrEngineUI.SampleSrEngineUI.1 = s 'Sample SR Engine Class' + { + CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + } + SampleSrEngineUI.SampleSrEngineUI = s 'Sample SR Engine Class' + { + CLSID = s '{B84714C0-3BFD-405D-83C5-E9C486826AD5}' + CurVer = s 'SampleSrEngineUI.SampleSrEngineUI.1' + } + NoRemove CLSID + { + ForceRemove {B84714C0-3BFD-405D-83C5-E9C486826AD5} = s 'SampleSrEngineUI Class' + { + ProgID = s 'SampleSrEngineUI.SampleSrEngineUI.1' + VersionIndependentProgID = s 'SampleSrEngineUI.SampleSrEngineUI' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{41B89B6C-9399-11D2-9623-00C04F8EE628}' + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengver.h b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengver.h new file mode 100644 index 00000000..9b1cabcf --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/srengver.h @@ -0,0 +1,78 @@ +/**************************************************************************** + * * + * VERSION.H -- Version information for internal builds * + * * + * This file is only modified by the official builder to update the * + * VERSION, VER_PRODUCTVERSION and VER_PRODUCTVERSION_STR values * + * * + * version.h is created on the fly from verhead.bat and vertail.h, * + * with the current version numbers inserted in between * + * * + ****************************************************************************/ + +#ifndef VER_H +/* ver.h defines constants needed by the VS_VERSION_INFO structure */ +//#include +#endif +#include +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "SR SAMPLE ENGINE 5" +#define VER_INTERNALNAME_STR "SRSAMPLEENG5" + +/*--------------------------------------------------------------*/ +/* the following entry should be phased out in favor of */ +/* VER_PRODUCTVERSION_STR, but is used in the shell today. */ +/*--------------------------------------------------------------*/ + + +/*--------------------------------------------------------------*/ +/* the following values should be modified by the official */ +/* builder for each build */ +/*--------------------------------------------------------------*/ + +#define VERSION "5.0" +#define VER_FILEVERSION_STR "5.0" +#define VER_FILEVERSION 5,0 +#define VER_PRODUCTVERSION_STR "5.0" +#define VER_PRODUCTVERSION 5,0 + +#define OFFICIAL 1 +#define FINAL 1 + +/*--------------------------------------------------------------*/ +/* the following section defines values used in the version */ +/* data structure for all files, and which do not change. */ +/*--------------------------------------------------------------*/ + +/* default is nodebug */ +#if _DEBUG +#define VER_DEBUG VS_FF_DEBUG +#else +#define VER_DEBUG 0 +#endif + +/* default is privatebuild */ +#ifndef OFFICIAL +#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD +#else +#define VER_PRIVATEBUILD 0 +#endif + +/* default is prerelease */ +#ifndef FINAL +#define VER_PRERELEASE VS_FF_PRERELEASE +#else +#define VER_PRERELEASE 0 +#endif + +#define VER_FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#define VER_FILEOS VOS_DOS_WINDOWS32 +#define VER_FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) + +#define VER_COMPANYNAME_STR "Microsoft Corporation\0" +#define VER_PRODUCTNAME_STR "Microsoft\256 Windows(TM) Operating System\0" +#define VER_LEGALTRADEMARKS_STR \ +"Microsoft\256 is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0" + +//#include "\sapi5\build\common.ver" diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.cpp new file mode 100644 index 00000000..5064c7ee --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.cpp @@ -0,0 +1,13 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.h new file mode 100644 index 00000000..9899f57a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/stdafx.h @@ -0,0 +1,38 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__41B89B6F_9399_11D2_9623_00C04F8EE628__INCLUDED_) +#define AFX_STDAFX_H__41B89B6F_9399_11D2_9623_00C04F8EE628__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef STRICT +#define STRICT +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module + +extern CComModule _Module; +#include + +#include + +// Platform SDK needs to be installed for this sample because it #includes shfolder.h +#ifndef MAXULONG_PTR +#error This sample application requires a newer version of the Platform SDK than you have installed. +#endif // MAXULONG_PTR + + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__41B89B6F_9399_11D2_9623_00C04F8EE628__INCLUDED) diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/SR/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/version.rc2 new file mode 100644 index 00000000..f1daef78 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/SR/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "TTS SAMPLE ENGINE 5\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TTSSAMPLEENG5\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "ttseng.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/anglais.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/anglais.wav new file mode 100644 index 00000000..4d251f75 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/anglais.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/as.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/as.wav new file mode 100644 index 00000000..52c44b6e Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/as.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/blah.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/blah.wav new file mode 100644 index 00000000..038ebad5 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/blah.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/computer_s.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/computer_s.wav new file mode 100644 index 00000000..22bbfeff Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/computer_s.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/default.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/default.wav new file mode 100644 index 00000000..460affdb Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/default.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/enter.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/enter.wav new file mode 100644 index 00000000..8dd947ae Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/enter.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/have.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/have.wav new file mode 100644 index 00000000..d63ad1ec Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/have.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/he.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/he.wav new file mode 100644 index 00000000..8928c1e7 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/he.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/here.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/here.wav new file mode 100644 index 00000000..1eb1ff05 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/here.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/je.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/je.wav new file mode 100644 index 00000000..7e061478 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/je.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.cpp new file mode 100644 index 00000000..29424b73 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.cpp @@ -0,0 +1,187 @@ +/****************************************************************************** +* mkvoice.cpp * +*-------------* +* This application assembles a simple voice font for the sample TTS engine. +*Copyright (c) Microsoft Corporation. All rights reserved. +* +******************************************************************************/ +#include "stdafx.h" +#include +#include + +int wmain(int argc, WCHAR* argv[]) +{ + USES_CONVERSION; + static const DWORD dwVersion = { 1 }; + ULONG ulNumWords = 0; + HRESULT hr = S_OK; + + //--- Check args + if( argc != 4 ) + { + printf( "%s", "Usage: > mkvoice [[in]word list file] [[out]voice file] [voice name]\n" ); + hr = E_INVALIDARG; + } + else + { + ::CoInitialize( NULL ); + + //--- Open word list file and create output voice file + //--- _wfopen is not supported on Win9x, so use fopen. + FILE* hWordList = fopen( W2A(argv[1]), "r" ); + FILE* hVoiceFile = fopen( W2A(argv[2]), "wb" ); + + if( hWordList && hVoiceFile ) + { + //--- Write file version and leave space for word count + if( !fwrite( &dwVersion, sizeof(dwVersion), 1, hVoiceFile ) || + fseek( hVoiceFile, 4, SEEK_CUR ) ) + { + hr = E_FAIL; + } + + //--- Get each entry + WCHAR WordFileName[MAX_PATH]; + while( SUCCEEDED( hr ) && fgetws( WordFileName, MAX_PATH, hWordList ) ) + { + ULONG ulTextLen = wcslen( WordFileName ); + if( WordFileName[ulTextLen-1] == '\n' ) + { + WordFileName[--ulTextLen] = NULL; + } + //--- Include NULL character when writing to the file + ulTextLen = (ulTextLen+1) * sizeof(WCHAR); + + if( fwrite( &ulTextLen, sizeof(ulTextLen), 1, hVoiceFile ) && + fwrite( WordFileName, ulTextLen, 1, hVoiceFile ) ) + { + ++ulNumWords; + //--- Open the wav data + ISpStream* pStream; + wcscat( WordFileName, L".wav" ); + hr = SPBindToFile( WordFileName, SPFM_OPEN_READONLY, &pStream ); + if( SUCCEEDED( hr ) ) + { + CSpStreamFormat Fmt; + Fmt.AssignFormat(pStream); + if( Fmt.ComputeFormatEnum() == SPSF_11kHz16BitMono ) + { + STATSTG Stat; + hr = pStream->Stat( &Stat, STATFLAG_NONAME ); + ULONG ulNumBytes = Stat.cbSize.LowPart; + + //--- Write the number of audio bytes + if( SUCCEEDED( hr ) && + fwrite( &ulNumBytes, sizeof(ulNumBytes), 1, hVoiceFile ) ) + { + BYTE* Buff = (BYTE*)alloca( ulNumBytes ); + if( SUCCEEDED( hr = pStream->Read( Buff, ulNumBytes, NULL ) ) ) + { + //--- Write the audio samples + if( !fwrite( Buff, 1, ulNumBytes, hVoiceFile ) ) + { + hr = E_FAIL; + } + } + } + else + { + hr = E_FAIL; + } + } + else + { + printf( "Input file: %s has wrong wav format.", WordFileName ); + } + pStream->Release(); + } + } + else + { + hr = E_FAIL; + } + } + } + else + { + hr = E_FAIL; + } + + //--- Write word count + if( SUCCEEDED( hr ) ) + { + if( fseek( hVoiceFile, sizeof(dwVersion), SEEK_SET ) || + !fwrite( &ulNumWords, sizeof(ulNumWords), 1, hVoiceFile ) ) + { + hr = E_FAIL; + } + } + + //--- Register the new voice file + // The section below shows how to programatically create a token for + // the new voice and set its attributes. + if( SUCCEEDED( hr ) ) + { + CComPtr cpToken; + CComPtr cpDataKeyAttribs; + hr = SpCreateNewTokenEx( + SPCAT_VOICES, + argv[3], + &CLSID_SampleTTSEngine, + L"Sample TTS Voice", + 0x409, + L"Sample TTS Voice", + &cpToken, + &cpDataKeyAttribs); + + //--- Set additional attributes for searching and the path to the + // voice data file we just created. + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Gender", L"Male"); + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Name", L"SampleTTSVoice"); + } + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Language", L"409"); + } + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Age", L"Adult"); + } + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->SetStringValue(L"Vendor", L"Microsoft"); + } + + //--- _wfullpath is not supported on Win9x, so use _fullpath. + CHAR szFullPath[MAX_PATH * 2]; + if (SUCCEEDED(hr) && _fullpath(szFullPath, W2A(argv[2]), sizeof(szFullPath)/sizeof(szFullPath[0])) == NULL) + { + hr = SPERR_NOT_FOUND; + } + + if (SUCCEEDED(hr)) + { + USES_CONVERSION; + hr = cpToken->SetStringValue(L"VoiceData", A2W(szFullPath)); + } + } + } + + //--- Cleanup + if( hWordList ) + { + fclose( hWordList ); + } + if( hVoiceFile ) + { + fclose( hVoiceFile ); + } + ::CoUninitialize(); + } + return FAILED( hr ); +} + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.dsp b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.dsp new file mode 100644 index 00000000..dad01263 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.dsp @@ -0,0 +1,125 @@ +# Microsoft Developer Studio Project File - Name="mkvoice" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=mkvoice - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "mkvoice.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "mkvoice.mak" CFG="mkvoice - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "mkvoice - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "mkvoice - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "mkvoice - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\ddk\include" /I "..\..\..\..\..\include" /I "..\..\..\..\..\..\ddk\include" /I "..\..\..\include" /I "..\\" /I "..\engines\tts" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib advapi32.lib ole32.lib uuid.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\..\lib\i386" +# Begin Special Build Tool +TargetDir=.\Release +SOURCE="$(InputPath)" +PostBuild_Desc=Build and register voice file +PostBuild_Cmds=$(TargetDir)\mkvoice.exe wordlist.txt SampleVoice.vce SampleTTSVoice +# End Special Build Tool + +!ELSEIF "$(CFG)" == "mkvoice - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\..\ddk\include" /I "..\..\..\..\..\include" /I "..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib advapi32.lib ole32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\..\lib\i386" +# Begin Special Build Tool +TargetDir=.\Debug +SOURCE="$(InputPath)" +PostBuild_Desc=Build and register voice file +PostBuild_Cmds=$(TargetDir)\mkvoice.exe wordlist.txt SampleVoice.vce SampleTTSVoice +# End Special Build Tool + +!ENDIF + +# Begin Target + +# Name "mkvoice - Win32 Release" +# Name "mkvoice - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\mkvoice.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.rc b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.rc new file mode 100644 index 00000000..a9b4f346 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/mkvoice.rc @@ -0,0 +1 @@ +#include "version.rc2" \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/parler.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/parler.wav new file mode 100644 index 00000000..527c166f Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/parler.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/peut.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/peut.wav new file mode 100644 index 00000000..02635040 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/peut.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/said.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/said.wav new file mode 100644 index 00000000..9ac5ee40 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/said.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/sample.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/sample.wav new file mode 100644 index 00000000..34fb207f Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/sample.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/selected.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/selected.wav new file mode 100644 index 00000000..b7d76cae Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/selected.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/she.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/she.wav new file mode 100644 index 00000000..bef09513 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/she.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/speak.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/speak.wav new file mode 100644 index 00000000..45076ec8 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/speak.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/spoken.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/spoken.wav new file mode 100644 index 00000000..b48a9576 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/spoken.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.cpp new file mode 100644 index 00000000..7548ef01 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// mkvoice.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.h new file mode 100644 index 00000000..19b7e8cf --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/stdafx.h @@ -0,0 +1,27 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__152AD93A_F366_47F7_B0EF_5E609435ECBB__INCLUDED_) +#define AFX_STDAFX_H__152AD93A_F366_47F7_B0EF_5E609435ECBB__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif // WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__152AD93A_F366_47F7_B0EF_5E609435ECBB__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/text.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/text.wav new file mode 100644 index 00000000..8ca94c51 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/text.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/the.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/the.wav new file mode 100644 index 00000000..92f36130 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/the.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/to.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/to.wav new file mode 100644 index 00000000..60d7c84e Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/to.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/tts.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/tts.wav new file mode 100644 index 00000000..f5aee2fc Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/tts.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/type.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/type.wav new file mode 100644 index 00000000..9f2b4ead Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/type.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/version.rc2 new file mode 100644 index 00000000..6bdb30f6 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Mkvoice Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "Mkvoice\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "Mkvoice.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/voice.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/voice.wav new file mode 100644 index 00000000..d05ae055 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/voice.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wish.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wish.wav new file mode 100644 index 00000000..c5080733 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wish.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wordlist.txt b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wordlist.txt new file mode 100644 index 00000000..43d12567 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/wordlist.txt @@ -0,0 +1,19 @@ +blah +enter +spoken +type +the +text +you +wish +to +speak +here +as +computer_s +default +have +sample +selected +TTS +voice diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/you.wav b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/you.wav new file mode 100644 index 00000000..63992467 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/MkVoice/you.wav differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/SampleVoice.vce b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/SampleVoice.vce new file mode 100644 index 00000000..c1f4b960 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/SampleVoice.vce differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/resource.h b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/resource.h new file mode 100644 index 00000000..5a2aa4c6 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by TtsEng.rc +// +#define IDS_PROJNAME 100 +#define IDR_SAMPLETTSENGINE 101 +#define IDR_SAMPLEVOICEDATAOBJ 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.cpp new file mode 100644 index 00000000..68edaff4 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.cpp @@ -0,0 +1,14 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.h new file mode 100644 index 00000000..d52a3138 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/stdafx.h @@ -0,0 +1,29 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED_) +#define AFX_STDAFX_H__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef STRICT +#define STRICT +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED) diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.cpp new file mode 100644 index 00000000..e59a0972 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.cpp @@ -0,0 +1,77 @@ +// TtsEng.cpp : Implementation of DLL Exports. +//Copyright (c) Microsoft Corporation. All rights reserved. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f msttsdrvps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "TtsEng.h" +#include "TtsEng_i.c" +#include "TtsEngObj.h" + + + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) + OBJECT_ENTRY( CLSID_SampleTTSEngine , CTTSEngObj ) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +#ifdef _WIN32_WCE +extern "C" BOOL WINAPI DllMain(HANDLE hInstance, ULONG dwReason, LPVOID) +#else +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +#endif +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_SAMPLETTSENGLib); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + + + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.def b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.def new file mode 100644 index 00000000..f15e16f5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.def @@ -0,0 +1,5 @@ +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.dsp b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.dsp new file mode 100644 index 00000000..69c01a98 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.dsp @@ -0,0 +1,168 @@ +# Microsoft Developer Studio Project File - Name="TtsEng" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=TtsEng - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ttseng.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ttseng.mak" CFG="TtsEng - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TtsEng - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "TtsEng - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TtsEng - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "TtsEng___Win32_Debug_x86" +# PROP BASE Intermediate_Dir "TtsEng___Win32_Debug_x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\sdk\include" /I "..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\..\..\ddk\include" /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD MTL /I "..\..\..\..\..\ddk\idl" /I "..\..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Debug_x86 +TargetPath=.\Debug_x86\ttseng.dll +InputPath=.\Debug_x86\ttseng.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "TtsEng - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "TtsEng___Win32_Release_x86" +# PROP BASE Intermediate_Dir "TtsEng___Win32_Release_x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\..\..\ddk\include" /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\..\..\ddk\idl" /I "..\..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /dll /map /machine:I386 /libpath:"..\..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Release_x86 +TargetPath=.\Release_x86\ttseng.dll +InputPath=.\Release_x86\ttseng.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "TtsEng - Win32 Debug x86" +# Name "TtsEng - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TtsEng.cpp +# End Source File +# Begin Source File + +SOURCE=.\TtsEng.def +# End Source File +# Begin Source File + +SOURCE=.\TtsEng.idl +# ADD BASE MTL /I "..\..\..\sdk\idl" /tlb ".\TtsEng.tlb" /h "TtsEng.h" /iid "" /Oicf +# ADD MTL /I "..\..\..\sdk\idl" /tlb ".\TtsEng.tlb" /h "TtsEng.h" /iid "TtsEng_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\TtsEng.rc +# End Source File +# Begin Source File + +SOURCE=.\TtsEngObj.cpp +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TtsEngObj.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\TtsEngObj.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.idl b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.idl new file mode 100644 index 00000000..96de3a94 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.idl @@ -0,0 +1,49 @@ +/***************************************************************************** +* TtsEng.idl * +*------------* +* Description: +* This idl file is for the sample SAPI5 Text To Speech Engine. +*----------------------------------------------------------------------------- +* Creation: 09/17/99 +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ +//--- Import base idl +import "oaidl.idl"; +import "ocidl.idl"; +import "sapiddk.idl"; + +//=== Forward References ====================================================== + +//=== Constants =============================================================== + +//=== Interface definitions =================================================== +typedef struct VOICEITEM +{ + LPCWSTR pText; + ULONG ulTextLen; + ULONG ulNumAudioBytes; + BYTE* pAudio; +} VOICEITEM; + + +//=== CoClass definitions ===================================================== +[ + uuid(7192AA2F-F759-43e9-91E7-226371EF6B2F), + version(1.0), + helpstring("Sample TTS Engine 1.0 Type Library") +] +library SAMPLETTSENGLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(A832755E-9C2A-40b4-89B2-3A92EE705852), + helpstring("SampleTTSEngine Class") + ] + coclass SampleTTSEngine + { + [default] interface ISpTTSEngine; + interface ISpObjectWithToken; + }; +}; diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.rc b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.rc new file mode 100644 index 00000000..b9173dc3 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttseng.rc @@ -0,0 +1,91 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""TtsEng.tlb""\r\n" + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_SAMPLETTSENGINE REGISTRY DISCARDABLE "TtsEngObj.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "TtsEng" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "TtsEng.tlb" +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.cpp b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.cpp new file mode 100644 index 00000000..dc4e9cef --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.cpp @@ -0,0 +1,744 @@ +/******************************************************************************* +* TtsEngObj.cpp * +*---------------* +* Description: +* This module is the main implementation file for the CTTSEngObj class. +*------------------------------------------------------------------------------- +* Creation Date: 03/24/99 +* Copyright (c) Microsoft Corporation. All rights reserved. +* All Rights Reserved +* +*******************************************************************************/ + +//--- Additional includes +#include "stdafx.h" +#include "TtsEngObj.h" + +//--- Local + +/***************************************************************************** +* CTTSEngObj::FinalConstruct * +*----------------------------* +* Description: +* Constructor +*****************************************************************************/ +HRESULT CTTSEngObj::FinalConstruct() +{ + SPDBG_FUNC( "CTTSEngObj::FinalConstruct" ); + HRESULT hr = S_OK; + + //--- Init vars + m_hVoiceData = NULL; + m_pVoiceData = NULL; + m_pWordList = NULL; + m_ulNumWords = 0; + + return hr; +} /* CTTSEngObj::FinalConstruct */ + +/***************************************************************************** +* CTTSEngObj::FinalRelease * +*--------------------------* +* Description: +* destructor +*****************************************************************************/ +void CTTSEngObj::FinalRelease() +{ + SPDBG_FUNC( "CTTSEngObj::FinalRelease" ); + + delete m_pWordList; + + if( m_pVoiceData ) + { + ::UnmapViewOfFile( (void*)m_pVoiceData ); + } + + if( m_hVoiceData ) + { + ::CloseHandle( m_hVoiceData ); + } + +} /* CTTSEngObj::FinalRelease */ + +/***************************************************************************** +* CTTSEngObj::MapFile * +*---------------------* +* Description: +* Helper function used by SetObjectToken to map file. This function +* assumes that m_cpToken has been initialized. +*****************************************************************************/ +HRESULT CTTSEngObj::MapFile( const WCHAR * pszTokenVal, // Value that contains file path + HANDLE * phMapping, // Pointer to file mapping handle + void ** ppvData ) // Pointer to the data +{ + USES_CONVERSION; + HRESULT hr = S_OK; + CSpDynamicString dstrFilePath; + hr = m_cpToken->GetStringValue( pszTokenVal, &dstrFilePath ); + if ( SUCCEEDED( hr ) ) + { + bool fWorked = false; + *phMapping = NULL; + *ppvData = NULL; + HANDLE hFile; +#ifdef _WIN32_WCE + hFile = CreateFileForMapping( dstrFilePath, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL ); +#else + hFile = CreateFile( W2T(dstrFilePath), GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL ); +#endif + if (hFile != INVALID_HANDLE_VALUE) + { + *phMapping = ::CreateFileMapping( hFile, NULL, PAGE_READONLY, 0, 0, NULL ); + if (*phMapping) + { + *ppvData = ::MapViewOfFile( *phMapping, FILE_MAP_READ, 0, 0, 0 ); + if (*ppvData) + { + fWorked = true; + } + } + ::CloseHandle( hFile ); + } + if (!fWorked) + { + hr = HRESULT_FROM_WIN32(::GetLastError()); + if (*phMapping) + { + ::CloseHandle(*phMapping); + *phMapping = NULL; + } + } + } + return hr; +} /* CTTSEngObj::MapFile */ + +// +//=== ISpObjectWithToken Implementation ====================================== +// + +/***************************************************************************** +* CTTSEngObj::SetObjectToken * +*----------------------------* +* Description: +* This function performs the majority of the initialization of the voice. +* Once the object token has been provided, the filenames are read from the +* token key and the files are mapped. +*****************************************************************************/ +STDMETHODIMP CTTSEngObj::SetObjectToken(ISpObjectToken * pToken) +{ + SPDBG_FUNC( "CTTSEngObj::SetObjectToken" ); + HRESULT hr = SpGenericSetObjectToken(pToken, m_cpToken); + + //--- Map the voice data so it will be shared among all instances + // Note: This is a good example of how to memory map and share + // your voice data across instances. + if( SUCCEEDED( hr ) ) + { + hr = MapFile( L"VoiceData", &m_hVoiceData, &m_pVoiceData ); + } + + //--- Setup word list + // Note: This is specific to our example, you probably + // don't care much about this logic. + if( SUCCEEDED( hr ) ) + { + delete m_pWordList; + + //--- Check version + UNALIGNED DWORD* pdwPtr = (UNALIGNED DWORD*)m_pVoiceData; + if( *pdwPtr++ != 1 ) + { + //--- Bad voice file version + hr = E_INVALIDARG; + SPDBG_ASSERT(0); + } + + //--- Get number of words + if( SUCCEEDED( hr ) ) + { + m_ulNumWords = *pdwPtr++; + } + + //--- Build word list + m_pWordList = new VOICEITEM[m_ulNumWords]; + if( !m_pWordList ) + { + hr = E_OUTOFMEMORY; + } + else + { + for( ULONG i = 0; i < m_ulNumWords; ++i ) + { + ULONG ulTextByteLen = *pdwPtr++; + m_pWordList[i].pText = (UNALIGNED WCHAR*)pdwPtr; + m_pWordList[i].ulTextLen = (ulTextByteLen / sizeof(WCHAR)) - 1; + pdwPtr = (UNALIGNED DWORD*)(((BYTE*)pdwPtr) + ulTextByteLen); + m_pWordList[i].ulNumAudioBytes = *pdwPtr++; + m_pWordList[i].pAudio = (BYTE*)pdwPtr; + pdwPtr = (UNALIGNED DWORD*)(((BYTE*)pdwPtr) + m_pWordList[i].ulNumAudioBytes); + } + } + } + + return hr; +} /* CTTSEngObj::SetObjectToken */ + +// +//=== ISpTTSEngine Implementation ============================================ +// + +/***************************************************************************** +* CTTSEngObj::Speak * +*-------------------* +* Description: +* This is the primary method that SAPI calls to render text. +*----------------------------------------------------------------------------- +* Input Parameters +* +* pUser +* Pointer to the current user profile object. This object contains +* information like what languages are being used and this object +* also gives access to resources like the SAPI master lexicon object. +* +* dwSpeakFlags +* This is a set of flags used to control the behavior of the +* SAPI voice object and the associated engine. +* +* VoiceFmtIndex +* Zero based index specifying the output format that should +* be used during rendering. +* +* pTextFragList +* A linked list of text fragments to be rendered. There is +* one fragement per XML state change. If the input text does +* not contain any XML markup, there will only be a single fragment. +* +* pOutputSite +* The interface back to SAPI where all output audio samples and events are written. +* +* Return Values +* S_OK - This should be returned after successful rendering or if +* rendering was interrupted because *pfContinue changed to FALSE. +* E_INVALIDARG +* E_OUTOFMEMORY +* +*****************************************************************************/ +STDMETHODIMP CTTSEngObj::Speak( DWORD dwSpeakFlags, + REFGUID rguidFormatId, + const WAVEFORMATEX * pWaveFormatEx, + const SPVTEXTFRAG* pTextFragList, + ISpTTSEngineSite* pOutputSite ) +{ + SPDBG_FUNC( "CTTSEngObj::Speak" ); + HRESULT hr = S_OK; + + //--- Check args + if( SP_IS_BAD_INTERFACE_PTR( pOutputSite ) || + SP_IS_BAD_READ_PTR( pTextFragList ) ) + { + hr = E_INVALIDARG; + } + else + { + //--- Init some vars + m_pCurrFrag = pTextFragList; + m_pNextChar = m_pCurrFrag->pTextStart; + m_pEndChar = m_pNextChar + m_pCurrFrag->ulTextLen; + m_ullAudioOff = 0; + + //--- Parse + // We've supplied a simple word/sentence breaker just to show one + // way of walking the fragment list. It obviously doesn't deal with + // things like abreviations and expansion of numbers and dates. + CItemList ItemList; + + while( SUCCEEDED( hr ) && !(pOutputSite->GetActions() & SPVES_ABORT) ) + { + //--- Do skip? + if( pOutputSite->GetActions() & SPVES_SKIP ) + { + long lSkipCnt; + SPVSKIPTYPE eType; + hr = pOutputSite->GetSkipInfo( &eType, &lSkipCnt ); + if( SUCCEEDED( hr ) ) + { + //--- Notify SAPI how many items we skipped. We're returning zero + // because this feature isn't implemented. + hr = pOutputSite->CompleteSkip( 0 ); + } + } + + //--- Build the text item list + if( SUCCEEDED( hr ) && (hr = GetNextSentence( ItemList )) != S_OK ) + { + break; + } + + //--- We aren't going to do any part of speech determination, + // prosody, or pronunciation determination. If you were, one thing + // you will need is access to the SAPI lexicon. You can get that with + // the following call. + // CComPtr cpLexicon; + // hr = pUser->GetLexicon( &cpLexicon ); + + if( !(pOutputSite->GetActions() & SPVES_ABORT) ) + { + //--- Fire begin sentence event + CSentItem& FirstItem = ItemList.GetHead(); + CSentItem& LastItem = ItemList.GetTail(); + CSpEvent Event; + Event.eEventId = SPEI_SENTENCE_BOUNDARY; + Event.elParamType = SPET_LPARAM_IS_UNDEFINED; + Event.ullAudioStreamOffset = m_ullAudioOff; + Event.lParam = (LPARAM)FirstItem.ulItemSrcOffset; + Event.wParam = (WPARAM)LastItem.ulItemSrcOffset + + LastItem.ulItemSrcLen - + FirstItem.ulItemSrcOffset; + hr = pOutputSite->AddEvents( &Event, 1 ); + + //--- Output + if( SUCCEEDED( hr ) ) + { + hr = OutputSentence( ItemList, pOutputSite ); + } + } + } + + //--- S_FALSE just says that we hit the end, return okay + if( hr == S_FALSE ) + { + hr = S_OK; + } + } + + return hr; +} /* CTTSEngObj::Speak */ + +/***************************************************************************** +* CTTSEngObj::OutputSentence * +*----------------------------* +* This method is used to output an item list. +****************************************************************************/ +HRESULT CTTSEngObj::OutputSentence( CItemList& ItemList, ISpTTSEngineSite* pOutputSite ) +{ + HRESULT hr = S_OK; + ULONG WordIndex; + + //--- Lookup words in our voice + SPLISTPOS ListPos = ItemList.GetHeadPosition(); + while( ListPos && !(pOutputSite->GetActions() & SPVES_ABORT) ) + { + CSentItem& Item = ItemList.GetNext( ListPos ); + + //--- Process sentence items + switch( Item.pXmlState->eAction ) + { + //--- Speak some text --------------------------------------- + case SPVA_Speak: + { + //--- We don't say anything for punctuation or control characters + // in this sample. + if( iswalpha( Item.pItem[0] ) || iswdigit( Item.pItem[0] ) ) + { + //--- Lookup the word, if we can't find it just use the first one + for( WordIndex = 0; WordIndex < m_ulNumWords; ++WordIndex ) + { + if( ( m_pWordList[WordIndex].ulTextLen == Item.ulItemLen ) && + ( !wcsnicmp( m_pWordList[WordIndex].pText, Item.pItem, Item.ulItemLen )) ) + { + break; + } + } + if( WordIndex == m_ulNumWords ) + { + WordIndex = 0; + } + + //--- Queue the event + CSpEvent Event; + Event.eEventId = SPEI_WORD_BOUNDARY; + Event.elParamType = SPET_LPARAM_IS_UNDEFINED; + Event.ullAudioStreamOffset = m_ullAudioOff; + Event.lParam = Item.ulItemSrcOffset; + Event.wParam = Item.ulItemSrcLen; + hr = pOutputSite->AddEvents( &Event, 1 ); + + //--- Queue the audio data + hr = pOutputSite->Write( m_pWordList[WordIndex].pAudio, + m_pWordList[WordIndex].ulNumAudioBytes, + NULL ); + + //--- Update the audio offset + m_ullAudioOff += m_pWordList[WordIndex].ulNumAudioBytes; + } + } + break; + + //--- Output some silence for a pause ----------------------- + case SPVA_Silence: + { + BYTE Buff[1000]; + memset( Buff, 0, 1000 ); + ULONG NumSilenceBytes = Item.pXmlState->SilenceMSecs * 22; + + //--- Queue the audio data in chunks so that we can get + // interrupted if necessary. + while( !(pOutputSite->GetActions() & SPVES_ABORT) ) + { + if( NumSilenceBytes > 1000 ) + { + hr = pOutputSite->Write( Buff, 1000, NULL ); + NumSilenceBytes -= 1000; + } + else + { + hr = pOutputSite->Write( Buff, NumSilenceBytes, NULL ); + break; + } + } + + //--- Update the audio offset + m_ullAudioOff += NumSilenceBytes; + } + break; + + //--- Fire a bookmark event --------------------------------- + case SPVA_Bookmark: + { + //--- The bookmark is NOT a null terminated string in the Item, but we need + //--- to convert it to one. Allocate enough space for the string. + WCHAR * pszBookmark = (WCHAR *)_alloca((Item.ulItemLen + 1) * sizeof(WCHAR)); + memcpy(pszBookmark, Item.pItem, Item.ulItemLen * sizeof(WCHAR)); + pszBookmark[Item.ulItemLen] = 0; + //--- Queue the event + SPEVENT Event; + Event.eEventId = SPEI_TTS_BOOKMARK; + Event.elParamType = SPET_LPARAM_IS_STRING; + Event.ullAudioStreamOffset = m_ullAudioOff; + Event.lParam = (LPARAM)pszBookmark; + Event.wParam = _wtol(pszBookmark); + hr = pOutputSite->AddEvents( &Event, 1 ); + } + break; + + case SPVA_Pronounce: + //--- Our sample engine doesn't handle this. If it + // did, you would use the associated pronunciation in + // the XmlState structure instead of the lexicon. + break; + + case SPVA_ParseUnknownTag: + //--- This will reference an XML tag that is unknown to SAPI + // if your engine has private tags to control state, you + // would examine these tags and see if you recognize it. This + // would also be the point that you would make the rendering + // state change. + break; + } + } + + return hr; +} /* CTTSEngObj::OutputSentence */ + +/***************************************************************************** +* CTTSEngObj::GetVoiceFormat * +*----------------------------* +* Description: +* This method returns the output data format associated with the +* specified format Index. Formats are in order of quality with the best +* starting at 0. +*****************************************************************************/ +STDMETHODIMP CTTSEngObj::GetOutputFormat( const GUID * pTargetFormatId, const WAVEFORMATEX * pTargetWaveFormatEx, + GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx ) +{ + SPDBG_FUNC( "CTTSEngObj::GetVoiceFormat" ); + HRESULT hr = S_OK; + + hr = SpConvertStreamFormatEnum(SPSF_11kHz16BitMono, pDesiredFormatId, ppCoMemDesiredWaveFormatEx); + + return hr; +} /* CTTSEngObj::GetVoiceFormat */ + +// +//=== This code is just a simplified parser ================================== +// +/***************************************************************************** +* CTTSEngObj::GetNextSentence * +*-----------------------------* +* This method is used to create a list of items to be spoken. +****************************************************************************/ +HRESULT CTTSEngObj::GetNextSentence( CItemList& ItemList ) +{ + HRESULT hr = S_OK; + + //--- Clear the destination + ItemList.RemoveAll(); + + //--- Is there any work to do + if( m_pCurrFrag == NULL ) + { + hr = S_FALSE; + } + else + { + BOOL fSentDone = false; + BOOL fGoToNextFrag = false; + + while( m_pCurrFrag && !fSentDone ) + { + if( m_pCurrFrag->State.eAction == SPVA_Speak ) + { + fSentDone = AddNextSentItem( ItemList ); + + //--- Advance fragment? + if( m_pNextChar >= m_pEndChar ) + { + fGoToNextFrag = true; + } + } + else + { + //--- Add non spoken fragments + CSentItem Item; + Item.pItem = m_pCurrFrag->pTextStart; + Item.ulItemLen = m_pCurrFrag->ulTextLen; + Item.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset; + Item.ulItemSrcLen = Item.ulItemLen; + Item.pXmlState = &m_pCurrFrag->State; + ItemList.AddTail( Item ); + fGoToNextFrag = true; + } + + if( fGoToNextFrag ) + { + fGoToNextFrag = false; + m_pCurrFrag = m_pCurrFrag->pNext; + if( m_pCurrFrag ) + { + m_pNextChar = m_pCurrFrag->pTextStart; + m_pEndChar = m_pNextChar + m_pCurrFrag->ulTextLen; + } + else + { + m_pNextChar = NULL; + m_pEndChar = NULL; + } + } + } // end while + + if( ItemList.IsEmpty() ) + { + hr = S_FALSE; + } + } + return hr; +} /* CTTSEngObj::GetNextSentence */ + +/***************************************************************************** +* IsSpace * +*---------* +* Returns true if the character is a space, tab, carriage return, or line feed. +****************************************************************************/ +static BOOL IsSpace( WCHAR wc ) +{ + return ( ( wc == 0x20 ) || ( wc == 0x9 ) || ( wc == 0xD ) || ( wc == 0xA ) ); +} + +/***************************************************************************** +* SkipWhiteSpace * +*----------------* +* Returns the position of the next non-whitespace character. +****************************************************************************/ +static const WCHAR* SkipWhiteSpace( const WCHAR* pPos ) +{ + while( IsSpace( *pPos ) ) ++pPos; + return pPos; +} + +/***************************************************************************** +* FindNextToken * +*---------------* +* Locates the next space delimited token in the stream +****************************************************************************/ +static const WCHAR* + FindNextToken( const WCHAR* pStart, const WCHAR* pEnd, const WCHAR*& pNext ) +{ + const WCHAR* pPos = SkipWhiteSpace( pStart ); + pNext = pPos; + if( pNext == pEnd ) + { + pPos = NULL; + } + else + { + while( *pNext && !IsSpace( *pNext ) ) + { + if( ++pNext == pEnd ) + { + //--- This can happen when a text fragment is + // tight up against a following xml tag. + break; + } + } + } + return pPos; +} /* FindNextToken */ + +/***************************************************************************** +* SearchSet * +*-----------* +* Finds the character in the specified array. +****************************************************************************/ +BOOL SearchSet( WCHAR wc, const WCHAR* Set, ULONG Count, ULONG* pIndex ) +{ + for( ULONG i = 0; i < Count; ++i ) + { + if( wc == Set[i] ) + { + *pIndex = i; + return true; + } + } + return false; +} + +/***************************************************************************** +* CTTSEngObj::AddNextSentItem * +*-----------------------------* +* Locates the next sentence item in the stream and adds it to the list. +* Returns true if the last item added is the end of the sentence. +****************************************************************************/ +BOOL CTTSEngObj::AddNextSentItem( CItemList& ItemList ) +{ + //--- Get the token + ULONG ulIndex; + CSentItem Item; + Item.pItem = FindNextToken( m_pNextChar, m_pEndChar, m_pNextChar ); + + //--- This case can occur when we hit the end of a text fragment. + // Returning at this point will cause advancement to the next fragment. + if( Item.pItem == NULL ) + { + return false; + } + + const WCHAR* pTrailChar = m_pNextChar-1; + ULONG TokenLen = m_pNextChar - Item.pItem; + + //--- Split off leading punction if any + static const WCHAR LeadItems[] = { L'(', L'\"', L'{', L'\'', L'[' }; + while( TokenLen > 1 ) + { + if( SearchSet( Item.pItem[0], LeadItems, sp_countof(LeadItems), &ulIndex ) ) + { + CSentItem LItem; + LItem.pItem = Item.pItem; + LItem.ulItemLen = 1; + LItem.pXmlState = &m_pCurrFrag->State; + LItem.ulItemSrcLen = LItem.ulItemLen; + LItem.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset + + ( LItem.pItem - m_pCurrFrag->pTextStart ); + ItemList.AddTail( LItem ); + ++Item.pItem; + --TokenLen; + } + else + { + break; + } + } + + //--- Get primary item insert position + SPLISTPOS ItemPos = ItemList.AddTail( Item ); + + //--- Split off trailing punction if any. + static const WCHAR EOSItems[] = { L'.', L'!', L'?' }; + static const WCHAR TrailItems[] = { L',', L'\"', L';', L':', L')', L'}', L'\'', L']' }; + SPLISTPOS NextPos = NULL; + BOOL fIsEOS = false; + while( TokenLen > 1 ) + { + BOOL fAddTrailItem = false; + if( SearchSet( *pTrailChar, EOSItems, sp_countof(EOSItems), &ulIndex ) ) + { + fIsEOS = true; + fAddTrailItem = true; + } + else if( SearchSet( *pTrailChar, TrailItems, sp_countof(TrailItems), &ulIndex ) ) + { + fAddTrailItem = true; + } + + if( fAddTrailItem ) + { + CSentItem TItem; + TItem.pItem = pTrailChar; + TItem.ulItemLen = 1; + TItem.pXmlState = &m_pCurrFrag->State; + TItem.ulItemSrcLen = TItem.ulItemLen; + TItem.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset + + ( TItem.pItem - m_pCurrFrag->pTextStart ); + NextPos = ItemList.InsertAfter( ItemPos, TItem ); + --TokenLen; + --pTrailChar; + } + else + { + break; + } + } + + //--- Abreviation or sentence end? + // If we are at the end of the buffer then EOS is implied. + if( *m_pNextChar == NULL ) + { + fIsEOS = true; + if( !SearchSet( *(m_pNextChar-1), EOSItems, sp_countof(EOSItems), &ulIndex ) ) + { + //--- Terminate with a period if we are at the end of a buffer + // and no end of sentence punction has been added. + static const WCHAR* pPeriod = L"."; + CSentItem EOSItem; + EOSItem.pItem = pPeriod; + EOSItem.ulItemLen = 1; + EOSItem.pXmlState = &m_pCurrFrag->State; + EOSItem.ulItemSrcLen = EOSItem.ulItemLen; + EOSItem.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset + + ( (m_pNextChar-1) - m_pCurrFrag->pTextStart ); + ItemList.AddTail( EOSItem ); + } + } + else if( pTrailChar[1] == L'.' ) + { + //--- Here is where you would try to prove that it's not EOS + // It might be an abreviation. That's a hard problem that + // we are not going to attempt here. + } + + //--- Substitute underscore for apostrophe + for( ULONG i = 0; i < TokenLen; ++i ) + { + if( Item.pItem[i] == L'\'' ) + { + ((WCHAR)Item.pItem[i]) = L'_'; + } + } + + //--- Add the main item + if( TokenLen > 0 ) + { + Item.ulItemLen = TokenLen; + Item.pXmlState = &m_pCurrFrag->State; + Item.ulItemSrcLen = Item.ulItemLen; + Item.ulItemSrcOffset = m_pCurrFrag->ulTextSrcOffset + + ( Item.pItem - m_pCurrFrag->pTextStart ); + ItemList.SetAt( ItemPos, Item ); + } + + return fIsEOS; +} /* CTTSEngObj::AddNextSentItem */ + diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.h b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.h new file mode 100644 index 00000000..6b28143f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.h @@ -0,0 +1,121 @@ +/****************************************************************************** +* 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 +#endif + +#ifndef SPCollec_h +#include +#endif + +#include "resource.h" + +//=== 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 CItemList; + +/*** CTTSEngObj COM object ******************************** +*/ +class ATL_NO_VTABLE CTTSEngObj : + public CComObjectRootEx, + public CComCoClass, + 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 ); + + + private: + /*--- Non interface methods ---*/ + HRESULT MapFile(const WCHAR * pszTokenValName, HANDLE * phMapping, void ** ppvData ); + HRESULT GetNextSentence( CItemList& ItemList ); + BOOL AddNextSentItem( CItemList& ItemList ); + HRESULT OutputSentence( CItemList& ItemList, ISpTTSEngineSite* pOutputSite ); + + /*=== Member Data ===*/ + private: + CComPtr 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 diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.rgs b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.rgs new file mode 100644 index 00000000..1cbef620 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengobj.rgs @@ -0,0 +1,25 @@ +HKCR +{ + TtsEng.SampleTTSEngine.1 = s 'SampleTTSEngine Class' + { + CLSID = s '{A832755E-9C2A-40B4-89B2-3A92EE705852}' + } + TtsEng.SampleTTSEngine = s 'SampleTTSEngine Class' + { + CLSID = s '{A832755E-9C2A-40B4-89B2-3A92EE705852}' + CurVer = s 'TtsEng.SampleTTSEngine.1' + } + NoRemove CLSID + { + ForceRemove {A832755E-9C2A-40B4-89B2-3A92EE705852} = s 'SampleTTSEngine Class' + { + ProgID = s 'TtsEng.SampleTTSEngine.1' + VersionIndependentProgID = s 'TtsEng.SampleTTSEngine' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + 'TypeLib' = s '{7192AA2F-F759-43E9-91E7-226371EF6B2F}' + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengver.h b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengver.h new file mode 100644 index 00000000..8868ab9c --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/ttsengver.h @@ -0,0 +1,78 @@ +/**************************************************************************** + * * + * VERSION.H -- Version information for internal builds * + * * + * This file is only modified by the official builder to update the * + * VERSION, VER_PRODUCTVERSION and VER_PRODUCTVERSION_STR values * + * * + * version.h is created on the fly from verhead.bat and vertail.h, * + * with the current version numbers inserted in between * + * * + ****************************************************************************/ + +#ifndef VER_H +/* ver.h defines constants needed by the VS_VERSION_INFO structure */ +//#include +#endif +#include +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "TTS SAMPLE ENGINE 5" +#define VER_INTERNALNAME_STR "TTSSAMPLEENG5" + +/*--------------------------------------------------------------*/ +/* the following entry should be phased out in favor of */ +/* VER_PRODUCTVERSION_STR, but is used in the shell today. */ +/*--------------------------------------------------------------*/ + + +/*--------------------------------------------------------------*/ +/* the following values should be modified by the official */ +/* builder for each build */ +/*--------------------------------------------------------------*/ + +#define VERSION "5.0" +#define VER_FILEVERSION_STR "5.0" +#define VER_FILEVERSION 5,0 +#define VER_PRODUCTVERSION_STR "5.0" +#define VER_PRODUCTVERSION 5,0 + +#define OFFICIAL 1 +#define FINAL 1 + +/*--------------------------------------------------------------*/ +/* the following section defines values used in the version */ +/* data structure for all files, and which do not change. */ +/*--------------------------------------------------------------*/ + +/* default is nodebug */ +#if _DEBUG +#define VER_DEBUG VS_FF_DEBUG +#else +#define VER_DEBUG 0 +#endif + +/* default is privatebuild */ +#ifndef OFFICIAL +#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD +#else +#define VER_PRIVATEBUILD 0 +#endif + +/* default is prerelease */ +#ifndef FINAL +#define VER_PRERELEASE VS_FF_PRERELEASE +#else +#define VER_PRERELEASE 0 +#endif + +#define VER_FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#define VER_FILEOS VOS_DOS_WINDOWS32 +#define VER_FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) + +#define VER_COMPANYNAME_STR "Microsoft Corporation\0" +#define VER_PRODUCTNAME_STR "Microsoft\256 Windows(TM) Operating System\0" +#define VER_LEGALTRADEMARKS_STR \ +"Microsoft\256 is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0" + +//#include "\sapi5\build\common.ver" diff --git a/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/version.rc2 new file mode 100644 index 00000000..bf912a5a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Engines/TTS/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 0 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees0\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees0.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/chs_reco.rc b/sp/src/utils/sapi51/Samples/CPP/Reco/chs_reco.rc new file mode 100644 index 00000000..fd89ed43 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/chs_reco.rc @@ -0,0 +1,3 @@ +LANGUAGE 0x4, SUBLANG_NEUTRAL + +IDR_SOL_CFG SRGRAMMAR DISCARDABLE "chs_sol.cfg" diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/chs_sol.xml b/sp/src/utils/sapi51/Samples/CPP/Reco/chs_sol.xml new file mode 100644 index 00000000..a002e507 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Reco/chs_sol.xml differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/itn_j.xml b/sp/src/utils/sapi51/Samples/CPP/Reco/itn_j.xml new file mode 100644 index 00000000..db4dd994 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Reco/itn_j.xml differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/jpn_reco.rc b/sp/src/utils/sapi51/Samples/CPP/Reco/jpn_reco.rc new file mode 100644 index 00000000..ae1b47ac --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/jpn_reco.rc @@ -0,0 +1,8 @@ +LANGUAGE 0x11, SUBLANG_NEUTRAL + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_SOL_CFG SRGRAMMAR DISCARDABLE "jpn_sol.cfg" diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/jpn_sol.xml b/sp/src/utils/sapi51/Samples/CPP/Reco/jpn_sol.xml new file mode 100644 index 00000000..c43fb8d6 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Reco/jpn_sol.xml differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/lmadapt.cpp b/sp/src/utils/sapi51/Samples/CPP/Reco/lmadapt.cpp new file mode 100644 index 00000000..c3abf67b --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/lmadapt.cpp @@ -0,0 +1,361 @@ +/****************************************************************************** +* LMAdapt.cpp +* Language Model adaptation routines +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include + +/**************************************************************************** +* CRecoDlgClass::GetTextFile * +*----------------------------* +* +* Description: Load the content of a text file into a buffer. The +* buffer is converted into Unicode using the default +* engine codepage if it isn't already in Unicode. +* +* Return: Buffer and character count +* HRESULT hr; +* +****************************************************************************/ + +HRESULT CRecoDlgClass::GetTextFile( + WCHAR ** ppwszCoMem, + ULONG * pcch) +{ + TCHAR pszFileName[_MAX_PATH]; + OPENFILENAME ofn; + HRESULT hr = S_OK; + HANDLE hf = INVALID_HANDLE_VALUE; + DWORD cBytes; + BOOL fUnicodeFile = FALSE; + USHORT uTemp; + WCHAR * pwszCoMem = 0; + ULONG cch = 0; + DWORD dwRead; + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + + if (SUCCEEDED(hr)) + { + pszFileName[0] = 0; + + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hDlg; + ofn.hInstance = m_hInstance; + ofn.lpstrFilter = _T("Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0"); + ofn.lpstrCustomFilter = NULL; + ofn.nMaxCustFilter = 0; + ofn.nFilterIndex = 0; + ofn.lpstrFile = pszFileName; + ofn.nMaxFile = _MAX_PATH; + ofn.nMaxFileTitle = _MAX_PATH; + ofn.lpstrFileTitle = NULL; + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = NULL; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; + ofn.lpstrDefExt = _T("txt"); + + hr = GetOpenFileName(&ofn) ? S_OK : E_FAIL; + } + + if (SUCCEEDED(hr)) + { + hf = CreateFile(pszFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + hr = (hf != INVALID_HANDLE_VALUE) ? S_OK : HRESULT_FROM_WIN32(CommDlgExtendedError()); + } + + if (SUCCEEDED(hr)) + { + cBytes = GetFileSize(hf, NULL); // 64K limit + + hr = (cBytes != -1) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + hr = ReadFile(hf, &uTemp, 2, &dwRead, NULL) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + fUnicodeFile = uTemp == 0xfeff; + + if (fUnicodeFile) + { + cBytes -= 2; + + pwszCoMem = (WCHAR *)CoTaskMemAlloc(cBytes); + + if (pwszCoMem) + { + hr = ReadFile(hf, pwszCoMem, cBytes, &dwRead, NULL) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + + cch = cBytes / sizeof(WCHAR); + } + else + { + hr = E_OUTOFMEMORY; + } + } + else + { + UINT uiCodePage = SpCodePageFromLcid(MAKELCID(m_langid, SORT_DEFAULT)); + + char * pszBuffer = (char *)malloc(cBytes); + + hr = pszBuffer ? S_OK : E_OUTOFMEMORY; + + if (SUCCEEDED(hr)) + { + SetFilePointer(hf, 0, NULL, FILE_BEGIN); // rewind + + hr = ReadFile(hf, pszBuffer, cBytes, &dwRead, NULL) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + cch = MultiByteToWideChar(uiCodePage, 0, pszBuffer, cBytes, NULL, NULL); + + if (cch) + { + pwszCoMem = (WCHAR *)CoTaskMemAlloc(sizeof(WCHAR) * cch); + } + else + { + hr = E_FAIL; + } + } + + if (SUCCEEDED(hr)) + { + MultiByteToWideChar(uiCodePage, 0, pszBuffer, cBytes, pwszCoMem, cch); + } + + if (pszBuffer) + { + free(pszBuffer); + } + } + } + + if (INVALID_HANDLE_VALUE != hf) + { + CloseHandle(hf); + } + + *ppwszCoMem = pwszCoMem; + *pcch = cch; + + return hr; +} + +/*************************************************************************************** +* CRecoDlgClass::FeedDocumentFromFile * +*-------------------------------------* +* Description: Open a text file and feed its content to the SR engine. +* Return: +* S_OK +* E_FAIL if no client window or if unsuccessful at obtaining the file name +****************************************************************************************/ + +HRESULT CRecoDlgClass::FeedDocumentFromFile() +{ + WCHAR * pwszCoMem = 0; + ULONG cch = 0; + + HRESULT hr = GetTextFile(&pwszCoMem, &cch); + + if (SUCCEEDED(hr)) + { + hr = FeedDocument(pwszCoMem, cch); + } + + return hr; +} + +/*************************************************************************************** +* CRecoDlgClass::FeedDocumentFromClipboard * +*------------------------------------------* +* Description: Take text from the clipboard and feed its content to the SR engine. +* Return: +* S_OK +* E_FAIL if neither CF_TEXT or CF_UNICODETEXT was available on the clipboard +****************************************************************************************/ + +HRESULT CRecoDlgClass::FeedDocumentFromClipboard() +{ + HRESULT hr; + UINT uFormat; + HANDLE hData; + BOOL fClipboardOpened = FALSE; + WCHAR * pwszCoMem; + ULONG cch; + + if (IsClipboardFormatAvailable(CF_UNICODETEXT)) + { + uFormat = CF_UNICODETEXT; + } + else if (IsClipboardFormatAvailable(CF_TEXT)) + { + uFormat = CF_TEXT; + } + else + { + uFormat = 0; + } + + if (uFormat) + { + hr = OpenClipboard(m_hDlg) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + else + { + hr = E_FAIL; + } + + if (SUCCEEDED(hr)) + { + fClipboardOpened = TRUE; + + hData = GetClipboardData(uFormat); + + hr = hData ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + VOID * pData = 0; + DWORD cBytes; + + if (CF_UNICODETEXT == uFormat) + { + cBytes = GlobalSize(hData); + + pwszCoMem = (WCHAR *)CoTaskMemAlloc(cBytes); + + if (pwszCoMem) + { + pData = GlobalLock(hData); + + hr = pData ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + else + { + hr = E_OUTOFMEMORY; + } + + if (SUCCEEDED(hr)) + { + memcpy(pwszCoMem, pData, cBytes); + + cch = cBytes / sizeof(WCHAR); + } + } + else + { + UINT uiCodePage = SpCodePageFromLcid(MAKELCID(m_langid, SORT_DEFAULT)); + + cBytes = GlobalSize(hData); + pData = GlobalLock(hData); + hr = pData ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + + if (SUCCEEDED(hr)) + { + cch = MultiByteToWideChar(uiCodePage, 0, (char *)pData, cBytes, NULL, NULL); + + hr = cch ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + pwszCoMem = (WCHAR *)CoTaskMemAlloc(cch * sizeof(WCHAR)); + + hr = pwszCoMem ? S_OK : E_OUTOFMEMORY; + } + + if (SUCCEEDED(hr)) + { + MultiByteToWideChar(uiCodePage, 0, (char *)pData, cBytes, pwszCoMem, cch); + } + } + + if (pData) + { + GlobalUnlock(hData); + } + } + + if (SUCCEEDED(hr)) + { + hr = FeedDocument(pwszCoMem, cch); + } + + if (fClipboardOpened) + { + CloseClipboard(); + } + + return hr; +} + +/*************************************************************************************** +* CRecoDlgClass::FeedDocument * +*-----------------------------* +* Description: Common code for FeedDocumentFromFile and FeedDocumentFromClipboard. +* Feed the text buffer to the SR engine. +* Return: +* S_OK +* E_* if error in SR engine +****************************************************************************************/ + +HRESULT CRecoDlgClass::FeedDocument(const WCHAR * pszCoMem, const ULONG cch) +{ + HRESULT hr = S_OK; + // + // NOTE: This function limits the size of the adaptation data to a maximum of 16K + // characters (32K bytes). This sample does NOT demonstrate the proper use + // of this method. Applcations that use SetAdaptationData should break the + // data into small (1K or less) blocks, call SetAdaptationData, and then wait + // for a SPEI_ADAPTATION event before sending the next small block of data. + // Note that calling SetAdapataionData with buffers larger than 32K can result + // in unpredictable results. Do NOT call this method with large buffers. + // + if (cch <= 16000) + { + hr = m_cpRecoCtxt->SetAdaptationData(pszCoMem, cch); + } + + CoTaskMemFree((void *)pszCoMem); + + return hr; +} + +/*************************************************************************************** +* CRecoDlgClass::TrainFromFile * +*------------------------------* +* Description: Load a text file, and launch the User Training wizard using this text. +* +* Return: +* S_OK +* E_* if error in SR engine +****************************************************************************************/ + +HRESULT CRecoDlgClass::TrainFromFile() +{ + WCHAR * pwszCoMem = 0; + ULONG cch = 0; + + HRESULT hr = GetTextFile(&pwszCoMem, &cch); + + if (SUCCEEDED(hr)) + { + hr = m_cpRecognizer->DisplayUI(m_hDlg, NULL, SPDUI_UserTraining, (void *)pwszCoMem, cch * sizeof(WCHAR)); + + CoTaskMemFree(pwszCoMem); + } + + return hr; +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/reco.cpp b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.cpp new file mode 100644 index 00000000..61926943 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.cpp @@ -0,0 +1,1957 @@ +/**************************************************************************** +* Reco.Cpp * +*----------* +* Description: +* This sample program is a basic speech recognition test tool. It is a +* dialog based Win32 application that uses ATL to help manage COM interface +* pointers. A basic understanding of the ATL CComPtr object will be useful +* when looking at this code. +* +* This tool allows the user to load and activate command and control +* grammars, activate a dictation grammar, turn the microphone and audio +* retention on and off, and examine the results of recognitions. +*Copyright (c) Microsoft Corporation. All rights reserved. +* +****************************************************************************/ + +#include "stdafx.h" +#define FT64(filetime) (*((LONGLONG*)&(filetime))) + +/**************************************************************************** +* WinMain * +*---------* +* Description: +* Main entry point for a Win32 application. This program simply initializes +* COM, constructs a CRecoDlg class object on the stack, and displays the dialog +* by calling DialogBoxParam. +* +* Returns: +* Always returns 0 +* +****************************************************************************/ + +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ +#ifdef _WIN32_WCE + if (SUCCEEDED(::CoInitializeEx(NULL,COINIT_MULTITHREADED))) +#else + if (SUCCEEDED(::CoInitialize(NULL))) +#endif + { + // NOTE: Extra scope provided so DlgClass is destroyed before CoUninitialize is called. + { + CRecoDlgClass DlgClass(hInstance); + ::DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_RECODLG), NULL, (DLGPROC)CRecoDlgClass::DlgProc, (LPARAM)&DlgClass); + } + ::CoUninitialize(); + } + return 0; +} + + +/**************************************************************************** +* Implementation of CRecoDlgClass +****************************************************************************/ + + +/**************************************************************************** +* CRecoDlgClass::DlgProc * +*------------------------* +* Description: +* This static member function is the message handler for the main appliation +* dialog. When the dialog is initialized via WM_INITDIALOG, the pointer to the +* CRecoDlgClass object is passed to this function in the lParam. This is stored +* in the USERDATA window long and used for subsequent message processing. +* +* Returns: +* Appropriate LRESULT for give window message +* +****************************************************************************/ + +LRESULT CALLBACK CRecoDlgClass::DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + CRecoDlgClass * pThis = (CRecoDlgClass *)::GetWindowLong(hDlg, GWL_USERDATA); + LRESULT lr = FALSE; + + switch (message) + { + case WM_INITDIALOG: + ::SetWindowLong(hDlg, GWL_USERDATA, lParam); + pThis = (CRecoDlgClass *)lParam; + lr = pThis->InitDialog(hDlg); + break; + + case WM_RECOEVENT: + pThis->RecoEvent(); + lr = TRUE; + break; + + case WM_HELP: + ::DialogBoxParam(pThis->m_hInstance, (LPCTSTR)IDD_DIALOG_BETAHELP, hDlg, (DLGPROC)BetaHelpDlgProc, NULL); + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDC_CHECK_CREATE) + { + pThis->UpdateRecoCtxtState(); + } + else if (LOWORD(wParam) == IDC_CHECK_MIC) + { + BOOL bIsChecked = (::SendDlgItemMessage( hDlg, IDC_CHECK_MIC, BM_GETCHECK, 0, 0 ) == BST_CHECKED); + if (bIsChecked) + { + pThis->m_cpRecognizer->SetRecoState( SPRST_ACTIVE ); + } + else + { + pThis->m_cpRecognizer->SetRecoState( SPRST_INACTIVE ); + } + } + else if (LOWORD(wParam) == IDM_FILE_EXIT || LOWORD(wParam) == IDCANCEL) + { + pThis->Cleanup(); + EndDialog(hDlg, 0); + lr = TRUE; + } + else if (LOWORD(wParam) == IDM_HELP) + { + ::DialogBoxParam(pThis->m_hInstance, (LPCTSTR)IDD_DIALOG_BETAHELP, hDlg, (DLGPROC)BetaHelpDlgProc, NULL); + } + else if (LOWORD(wParam) == IDM_CFG_LOAD_GRAMMAR) + { + pThis->SpecifyCAndCGrammar(); + } + else if (LOWORD(wParam) == IDM_CFG_SET_WORD_SEQUENCE_DATA) + { + pThis->SetWordSequenceData(); + } + else if (LOWORD(wParam) == IDC_EDIT_PARSETEXT) + { + BOOL bEnableSubmit = ::SendDlgItemMessage(hDlg, IDC_EDIT_PARSETEXT, WM_GETTEXTLENGTH, 0, 0); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_SUBMIT), bEnableSubmit); + } + else if (LOWORD(wParam) == IDC_BUTTON_SUBMIT) + { + TCHAR tszText[MAX_PATH]; + ::SendDlgItemMessage(hDlg, IDC_EDIT_PARSETEXT, WM_GETTEXT, sp_countof(tszText), (LPARAM)tszText); + if (tszText[0] != 0) + { + USES_CONVERSION; + pThis->EmulateRecognition(T2W(tszText)); + } + } + else if( LOWORD(wParam) == IDC_BUTTON_ALTERNATES ) + { + LONG item = ::SendDlgItemMessage(hDlg, IDC_LIST_PHRASES, LB_GETCURSEL, 0, 0); + CRecoDlgListItem * pli = NULL; + if (item != LB_ERR) + { + pli = (CRecoDlgListItem*)::SendDlgItemMessage(hDlg, IDC_LIST_PHRASES, LB_GETITEMDATA, item, 0); + } + if( pli ) + { + CAlternatesDlgClass AltDlg; + AltDlg.m_pResult = pli->GetRecoResult(); + if (AltDlg.m_pResult) + { + int RetVal = ::DialogBoxParam( pThis->m_hInstance, (LPCTSTR)IDD_ALTS_DIALOG, hDlg, + (DLGPROC)CAlternatesDlgClass::AlternatesDlgProc, + (LPARAM)&AltDlg ); + + //--- Draw the new item + if( RetVal == IDOK ) + { + CSpDynamicString dstrText; + AltDlg.m_pResult->GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, + TRUE, &dstrText, NULL ); + CRecoDlgListItem * pNewItem = + new CRecoDlgListItem( AltDlg.m_pResult, dstrText, pli->IsHypothesis() ); + int iNewPhrase = ::SendDlgItemMessage( hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pNewItem); + ::SendDlgItemMessage( hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + ::SendDlgItemMessage( hDlg, IDC_LIST_PHRASES, LB_DELETESTRING, iNewPhrase-1, 0); + pThis->UpdatePropWindow( pNewItem ); + } + } + } + lr = TRUE; + } + else if (LOWORD(wParam) == IDM_CFG_ADD_DYNAMIC_RULE && pThis->m_cpCFGGrammar) + { + CDynGrammarDlgClass DlgClass(pThis, &pThis->m_ItemList); + ::DialogBoxParam(pThis->m_hInstance, (LPCTSTR)IDD_DYNGRAMMARDLG, hDlg, (DLGPROC)CDynGrammarDlgClass::DlgProc, (LPARAM)&DlgClass); + lr = TRUE; + } + else if (LOWORD(wParam) == IDM_SLM_ADAPT_FROM_FILE) + { + lr = pThis->FeedDocumentFromFile(); + } + else if (LOWORD(wParam) == IDM_SLM_ADAPT_FROM_CLIPBOARD) + { + lr = pThis->FeedDocumentFromClipboard(); + } + else if (LOWORD(wParam) == IDM_SLM_TRAIN_FROM_FILE) + { + lr = pThis->TrainFromFile(); + } + else if (LOWORD(wParam) == IDC_RADIO_SHARED || + LOWORD(wParam) == IDC_RADIO_INPROC) + { + pThis->UpdateRecoCtxtState(); + } + else if (pThis->m_cpRecoCtxt) + { + HRESULT hr; + + if (HIWORD(wParam) == BN_CLICKED && + (LOWORD(wParam) == IDC_CHECK_CFG || + LOWORD(wParam) == IDC_CHECK_DICTATION || + LOWORD(wParam) == IDC_CHECK_DICTATION_ACTIVE || + LOWORD(wParam) == IDC_CHECK_CFG_ACTIVE || + LOWORD(wParam) == IDC_CHECK_SPELLING || + LOWORD(wParam) == IDC_CHECK_SPELLING_ACTIVE)) + { + hr = pThis->UpdateGrammarState(LOWORD(wParam)); + } + else if (LOWORD(wParam) == IDC_CHECK_RETAIN_AUDIO) + { + SPAUDIOOPTIONS Opts = SPAO_NONE; + if (::SendDlgItemMessage( hDlg, IDC_CHECK_RETAIN_AUDIO, BM_GETCHECK, 0, 0 ) == BST_CHECKED) + { + Opts = SPAO_RETAIN_AUDIO; + } + pThis->m_cpRecoCtxt->SetAudioOptions(Opts, NULL, NULL); + } + else if (LOWORD(wParam) == IDC_LIST_PHRASES) + { + WORD wNotify = HIWORD(wParam); + LONG item = ::SendDlgItemMessage(hDlg, IDC_LIST_PHRASES, LB_GETCURSEL, 0, 0); + CRecoDlgListItem * pli = NULL; + if (item != LB_ERR) + { + pli = (CRecoDlgListItem*)::SendDlgItemMessage(hDlg, IDC_LIST_PHRASES, LB_GETITEMDATA, item, 0); + } + if (wNotify == LBN_SELCHANGE) + { + pThis->UpdatePropWindow(pli); + } + else if (wNotify == LBN_DBLCLK && pli) + { + ISpRecoResult * pResult = pli->GetRecoResult(); + if (pResult) + { + if (FAILED(pli->GetRecoResult()->SpeakAudio(NULL, 0, SPF_ASYNC, NULL))) + { + CComPtr cpVoice; + pThis->m_cpRecoCtxt->GetVoice(&cpVoice); + if (cpVoice) + { + cpVoice->Speak(pli->GetText(), SPF_ASYNC, NULL); + } + } + } + } + } + } + break; + + case WM_DRAWITEM: + if (wParam == IDC_LIST_PHRASES) + { + LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam; + + const CRecoDlgListItem * pli = (const CRecoDlgListItem *)pdis->itemData; + + if (pli && pli->GetText()) + { + HGDIOBJ hfontOld = pThis->m_hfont ? SelectObject( pdis->hDC, pThis->m_hfont ) : NULL; + + CComPtr cpResult; + SPRECORESULTTIMES times; + UINT oldTextAlign = GetTextAlign(pdis->hDC); + UINT options = ETO_OPAQUE | ETO_CLIPPED; + + cpResult = pli->GetRecoResult(); + if (cpResult && cpResult->GetResultTimes(×) == S_OK) + { + FILETIME localtime; + SYSTEMTIME systime; + + if (FileTimeToLocalFileTime(×.ftStreamTime, &localtime) && + FileTimeToSystemTime(&localtime, &systime)) + { + TCHAR sztime[18]; + wsprintf(sztime, _T("[%2d:%02d:%02d.%03d] -"), + systime.wHour, systime.wMinute, systime.wSecond, systime.wMilliseconds); + SetTextAlign(pdis->hDC, TA_UPDATECP); + MoveToEx(pdis->hDC, pdis->rcItem.left, pdis->rcItem.top, NULL); + ExtTextOut(pdis->hDC, + pdis->rcItem.left, pdis->rcItem.top, + options, + &pdis->rcItem, + sztime, 16, + NULL); + options = ETO_CLIPPED; + } + } + + ExtTextOutW(pdis->hDC, + pdis->rcItem.left, pdis->rcItem.top, + options, + &pdis->rcItem, + pli->GetText(), pli->GetTextLength(), + NULL); + + if (pli->IsHypothesis()) + { + const WCHAR *pszHypothesis = L" [Hypothesis]"; + ExtTextOutW(pdis->hDC, + pdis->rcItem.left, pdis->rcItem.top, + options, + &pdis->rcItem, + pszHypothesis, wcslen(pszHypothesis), + NULL); + } + + SetTextAlign(pdis->hDC, oldTextAlign); + + if (hfontOld) + { + SelectObject(pdis->hDC, hfontOld); + } + } + } + break; + + case WM_DELETEITEM: + if (wParam == IDC_LIST_PHRASES) + { + CRecoDlgListItem * pli = (CRecoDlgListItem *)((DELETEITEMSTRUCT *)lParam)->itemData; + delete pli; + lr = TRUE; + } + break; + + } + + return lr; +} + +/**************************************************************************** +* CRecoDlgClass::ConstructRuleDisplay * +*-------------------------------------* +* Description: +* Given the SPPHRASERULE obtained from the parsed result object, +* writes the tree for the rules into dstr. +* Calls itself recursively for sub-rules. +* Returns: +* S_OK +****************************************************************************/ + +HRESULT CRecoDlgClass::ConstructRuleDisplay(const SPPHRASERULE *pRule, CSpDynamicString &dstr, ULONG ulLevel) +{ + SPDBG_FUNC("CRecoDlgClass::ConstructRuleDisplay"); + HRESULT hr = S_OK; + + USES_CONVERSION; + TCHAR szText[256]; + + // construct indent + while(SUCCEEDED(hr) && pRule) + { + wsprintf(szText, _T(" [%2d, %2d] "), pRule->ulFirstElement, pRule->ulFirstElement + pRule->ulCountOfElements); + for (ULONG i = 0; i < ulLevel; i++) + { + dstr.Append(L"\t"); + } + if (pRule->pszName) + { + if (wcslen(pRule->pszName) > 240) + { + dstr.Append(L"\"(Rule name too long)\" = \""); + } + else + { + WCHAR *pwszRuleName = wcsdup( pRule->pszName ); + if ( pwszRuleName ) + { + wsprintf(szText, _T("%s \"%s\" (%d)"), szText, W2T(pwszRuleName), pRule->ulId); + dstr.Append(T2W(szText)); + + free( pwszRuleName ); + } + else + { + hr = E_OUTOFMEMORY; + } + } + } + else + { + dstr.Append(L"\"(UNK)\" = \""); + } + dstr.Append(L"\r\n"); + if (pRule->pFirstChild && SUCCEEDED(hr)) + { + hr = ConstructRuleDisplay(pRule->pFirstChild, dstr, ulLevel + 1); + } + pRule = pRule->pNextSibling; + } + return hr; +} + +/**************************************************************************** +* CRecoDlgClass::ConstructPropertyDisplay * +*-----------------------------------------* +* Description: +* Given the SPPHRASEPROPERTY obtained from the parsed result object, +* writes the property tree into dstr. +* Calls itself recursively for sub-properties. +* Returns: +* S_OK +****************************************************************************/ + +HRESULT CRecoDlgClass::ConstructPropertyDisplay(const SPPHRASEELEMENT *pElem, const SPPHRASEPROPERTY *pProp, + CSpDynamicString & dstr, ULONG ulLevel) +{ + SPDBG_FUNC("CRecoDlgClass::ConstructPropertyDisplay"); + HRESULT hr = S_OK; + USES_CONVERSION; + TCHAR szText[256]; + + // construct indent + while(SUCCEEDED(hr) && pProp) + { + wsprintf(szText, _T(" [%2d, %2d] "), pProp->ulFirstElement, pProp->ulCountOfElements ? pProp->ulFirstElement + pProp->ulCountOfElements-1 : 0); + dstr.Append(T2W(szText)); + for (ULONG i = 0; i < ulLevel; i++) + { + dstr.Append(L"\t"); + } + if (pProp->pszName) + { + if (wcslen(pProp->pszName) > 240) + { + dstr.Append(L"\"(Rule name too long)\" = \""); + } + else + { + WCHAR *pwszPropName = wcsdup( pProp->pszName ); + if ( pwszPropName ) + { + wsprintf(szText, _T("\"%s\" = \""), W2T(pwszPropName)); + dstr.Append(T2W(szText)); + + free( pwszPropName ); + } + else + { + dstr.Append(L"Out of memory" ); + } + } + } + else + { + dstr.Append(L"\"(UNK)\" = \""); + } + if (!pProp->pszValue) + { + // construct the value from the elements! + ULONG ulEndElement = pProp->ulFirstElement + pProp->ulCountOfElements; + for (ULONG j = pProp->ulFirstElement; j < ulEndElement; j++) + { + if (j+1 < ulEndElement) + { + dstr.Append2(pElem[j].pszDisplayText, L" "); + } + else + { + dstr.Append(pElem[j].pszDisplayText); + } + } + } + else + { + dstr.Append(pProp->pszValue); + } + + if (pProp->vValue.vt != VT_EMPTY) + { + CComVariant cv = pProp->vValue; + cv.ChangeType(VT_BSTR); + wsprintf(szText, _T("\" (%d = %s)"), pProp->ulId, W2T(cv.bstrVal)); + } + else + { + wsprintf(szText, _T("\" (%d)"), pProp->ulId); + } + dstr.Append2(T2W(szText), L"\r\n"); + if (pProp->pFirstChild) + { + hr = ConstructPropertyDisplay(pElem, pProp->pFirstChild, dstr, ulLevel + 1); + } + pProp = pProp->pNextSibling; + } + return hr; +} + + +/**************************************************************************** +* CRecoDlgClass::UpdatePropWindow * +*---------------------------------* +* Description: +* Updates the contents of the property status window to contain a full +* text dump of the result list item pointed to by pli. If a NULL is passed +* to this method, the property window will be cleared. +* +* Returns: +* TRUE if property window was updated +* FALSE if it was not +* +****************************************************************************/ + +BOOL CRecoDlgClass::UpdatePropWindow(const CRecoDlgListItem * pli) +{ + BOOL fOK = FALSE; + + HWND hwndStatus = ::GetDlgItem(m_hDlg, IDC_STATUS); + ISpPhrase * pPhrase = pli ? pli->GetRecoResult() : NULL; + SPPHRASE *pElements; + + if (pli && pPhrase && SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + USES_CONVERSION; + TCHAR szText[256]; + + CSpDynamicString dstr; + + if (pElements->Rule.pszName || pElements->Rule.ulId) + { + WCHAR *pwszRuleName = NULL; + if ( pElements->Rule.pszName ) + { + pwszRuleName = wcsdup( pElements->Rule.pszName ); + } + else + { + pwszRuleName = wcsdup( L"" ); + } + + if ( pwszRuleName ) + { + wsprintf(szText, _T("RULE=\"%s\" (%05d)\r\n\r\n"), W2T(pwszRuleName), pElements->Rule.ulId); + dstr.Append(T2W(szText)); + dstr.Append(pli->GetText()); + + free( pwszRuleName ); + } + else + { + dstr.Append( L"Out of memory" ); + } + } + else + { + dstr = L"DICTATION\r\n\r\n"; + CSpDynamicString dstrText; + pPhrase->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dstrText, NULL); + dstr.Append(dstrText); + } + dstr.Append(L"\r\n"); + // Display the overall confidence. This is specified on a per-rule basis. + // However, the top rule contains everything and hence is the phrase confidence. + wsprintf(szText, _T("\r\nOverall confidence = %i.\r\n"), pElements->Rule.Confidence); + dstr.Append(T2W(szText)); + if (pElements->pProperties) + { + dstr.Append(L"\r\nPROPERTIES:\r\n"); + ConstructPropertyDisplay(pElements->pElements, pElements->pProperties, dstr, 0); + dstr.Append(L"\r\n"); + } + + dstr.Append(L"\r\nPARSE TREE:\r\n"); + ConstructRuleDisplay(&pElements->Rule, dstr, 0); + + dstr.Append(L"\r\nELEMENTS:\r\n"); + for (ULONG i = 0; i < pElements->Rule.ulCountOfElements; i++) + { + WCHAR wszIntPhone[SP_MAX_PRON_LENGTH]; + wszIntPhone[0] = L'\0'; + if ( pElements->pElements[i].pszPronunciation ) + { + m_cpPhoneConv->IdToPhone(pElements->pElements[i].pszPronunciation, wszIntPhone); + } + + WCHAR *pwszDisplayText = wcsdup( pElements->pElements[i].pszDisplayText ); + wsprintf(szText, _T(" <%u - %u> \"%s\" %c(%c) {%S}\r\n"), + pElements->pElements[i].ulAudioStreamOffset, + pElements->pElements[i].ulAudioStreamOffset + pElements->pElements[i].ulAudioSizeBytes, + pwszDisplayText ? W2T(pwszDisplayText) : _T("(out of memory)"), + ConfidenceGroupChar(pElements->pElements[i].ActualConfidence), + ConfidenceGroupChar(pElements->pElements[i].RequiredConfidence), + wszIntPhone); + if ( pwszDisplayText ) + { + free( pwszDisplayText ); + } + dstr.Append(T2W(szText)); + } + + ::CoTaskMemFree(pElements); + + SPRECORESULTTIMES times; + pli->GetRecoResult()->GetResultTimes(×); + + DWORD dwTickEnd = times.dwTickCount + (DWORD)(times.ullLength / 10000); + DWORD dwTickNow = GetTickCount(); + + wsprintf(szText, _T("GetTickCount latency = (%u - %u) = %dms\r\n"), dwTickNow, dwTickEnd, dwTickNow - dwTickEnd); + ATLTRACE(szText); + dstr.Append(T2W(szText)); + + ATLTRACE(L"\r\n"); + + ::SendMessage(hwndStatus, WM_SETTEXT, 0, (LPARAM)W2T(dstr)); + + fOK = TRUE; + } + else + { + ::SendMessage(hwndStatus, WM_SETTEXT, 0, (LPARAM)TEXT("")); + } + + return fOK; +} + + +/**************************************************************************** +* CRecoDlgClass::UpdateGrammarState * +*-----------------------------------* +* Description: +* This method is called whenever a check box state has changed to update +* the state of grammars. It will create or release m_cpCFGGrammar and +* m_cpDictationGrammar and activate or deactivate either of them. +* +* If at any point during this function, a SAPI call fails, the state of +* the application will be reset. +* +* Returns: +* S_OK, or failed HRESULT from SAPI calls made below +* +****************************************************************************/ + +HRESULT CRecoDlgClass::UpdateGrammarState(WORD wIdChanged) +{ + #ifdef _DEBUG + static BOOL fInUpdate = FALSE; + _ASSERTE(!fInUpdate); + fInUpdate = TRUE; + #endif // _DEBUG + + HRESULT hr = S_OK; + + if (m_cpRecoCtxt) // only if there is a recognition context + { + BOOL fActivateCFG = ::SendDlgItemMessage(m_hDlg, IDC_CHECK_CFG_ACTIVE, BM_GETCHECK, 0, 0); + BOOL fActivateDictation = ::SendDlgItemMessage(m_hDlg, IDC_CHECK_DICTATION_ACTIVE, BM_GETCHECK, 0, 0); + BOOL fLoadDictation = ::SendDlgItemMessage( m_hDlg, IDC_CHECK_DICTATION, BM_GETCHECK, 0, 0 ); + BOOL fLoadCFG = ::SendDlgItemMessage( m_hDlg, IDC_CHECK_CFG, BM_GETCHECK, 0, 0 ); + BOOL fActivateSpelling = ::SendDlgItemMessage(m_hDlg, IDC_CHECK_SPELLING_ACTIVE, BM_GETCHECK, 0, 0); + BOOL fLoadSpelling = ::SendDlgItemMessage( m_hDlg, IDC_CHECK_SPELLING, BM_GETCHECK, 0, 0 ); + SPSTATEHANDLE hDynRule = NULL; + + // Force the pair of checks to be in sync. If the ID is 0 then no checkbox + // has changed state, so we don't have to do anything. + WORD wIdToUpdate = 0; + WPARAM NewState; + switch (wIdChanged) + { + case IDC_CHECK_CFG: + if ((!fLoadCFG) && fActivateCFG) + { + fActivateCFG = FALSE; + wIdToUpdate = IDC_CHECK_CFG_ACTIVE; + NewState = BST_UNCHECKED; + } + break; + case IDC_CHECK_DICTATION: + if ((!fLoadDictation) && fActivateDictation) + { + fActivateDictation = FALSE; + wIdToUpdate = IDC_CHECK_DICTATION_ACTIVE; + NewState = BST_UNCHECKED; + } + break; + case IDC_CHECK_SPELLING: + if ((!fLoadSpelling) && fActivateSpelling) + { + fActivateSpelling = FALSE; + wIdToUpdate = IDC_CHECK_SPELLING_ACTIVE; + NewState = BST_UNCHECKED; + } + break; + case IDC_CHECK_CFG_ACTIVE: + if (fActivateCFG && (!fLoadCFG)) + { + fLoadCFG = TRUE; + wIdToUpdate = IDC_CHECK_CFG; + NewState = BST_CHECKED; + } + break; + case IDC_CHECK_DICTATION_ACTIVE: + if (fActivateDictation && (!fLoadDictation)) + { + fLoadDictation = TRUE; + wIdToUpdate = IDC_CHECK_DICTATION; + NewState = BST_CHECKED; + } + break; + case IDC_CHECK_SPELLING_ACTIVE: + if (fActivateSpelling && (!fLoadSpelling)) + { + fLoadSpelling = TRUE; + wIdToUpdate = IDC_CHECK_SPELLING; + NewState = BST_CHECKED; + } + break; + } + if (wIdToUpdate) + { + ::SendDlgItemMessage(m_hDlg, wIdToUpdate, BM_SETCHECK, NewState, 0); + } + + // + // Now load the appropriate grammar(s)... + // + UINT uiErrorMessageID = 0; + if (fLoadCFG) + { + if (!m_cpCFGGrammar) + { + // + // If the first char of m_szGrammarFile is 0 then load the solitaire grammar + // from our resource. Otherwise, load the grammar from the file. + // + hr = m_cpRecoCtxt->CreateGrammar(MYGRAMMARID, &m_cpCFGGrammar); + + if (*m_szGrammarFile) + { + USES_CONVERSION; + if (SUCCEEDED(hr)) + { + hr = m_cpCFGGrammar->LoadCmdFromFile(T2W(m_szGrammarFile), SPLO_DYNAMIC); + } + } + else + { + // Need a method of determining the language id of the grammar resource we + // want to load. This is dependent solely on the primary language of the engine the + // user has selected. Hence, the resources are labelled 'Primary', SUBLANG_NEUTRAL + // and we use the primary language id of the engine to do the LoadCmdFromResource. + hr = m_cpCFGGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_SOL_CFG), + L"SRGRAMMAR", MAKELANGID(PRIMARYLANGID(m_langid), SUBLANG_NEUTRAL), SPLO_DYNAMIC); + } + + // Load dynamic rules, if any. + if (SUCCEEDED(hr) && m_ItemList.GetHead()) + { + hr = m_cpCFGGrammar->GetRule(g_szDynRuleName, NULL, SPRAF_TopLevel | SPRAF_Dynamic, TRUE, &hDynRule); + if (SUCCEEDED(hr)) + { + CDynItem *pItem = m_ItemList.GetHead(); + while (pItem && SUCCEEDED(hr)) + { + hr = m_cpCFGGrammar->AddWordTransition(hDynRule, NULL, pItem->m_dstr, L" ", SPWT_LEXICAL, 1.0, NULL); + pItem = m_ItemList.GetNext(pItem); + } + + if (SUCCEEDED(hr)) + hr = m_cpCFGGrammar->Commit(0); + } + } + } + } + else + { + ::SendDlgItemMessage(m_hDlg, IDC_CHECK_CFG_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0); + m_cpCFGGrammar.Release(); + m_cpCFGVoice.Release(); + } + + if (SUCCEEDED(hr)) + { + if (fLoadDictation) + { + if (!m_cpDictationGrammar) + { + hr = m_cpRecoCtxt->CreateGrammar(MYGRAMMARID, &m_cpDictationGrammar); + + if (SUCCEEDED(hr)) + { + hr = m_cpDictationGrammar->LoadDictation(NULL, SPLO_STATIC); + } + } + } + else + { + ::SendDlgItemMessage(m_hDlg, IDC_CHECK_DICTATION_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0); + m_cpDictationGrammar.Release(); + } + } + + if (SUCCEEDED(hr)) + { + if (fLoadSpelling) + { + if (!m_cpSpellingGrammar) + { + hr = m_cpRecoCtxt->CreateGrammar(MYGRAMMARID, &m_cpSpellingGrammar); + if (SUCCEEDED(hr)) + { + hr = m_cpSpellingGrammar->LoadDictation(SPTOPIC_SPELLING, SPLO_STATIC); + if (FAILED(hr)) + { + m_cpSpellingGrammar.Release(); + } + } + } + } + else + { + ::SendDlgItemMessage(m_hDlg, IDC_CHECK_SPELLING_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0); + m_cpSpellingGrammar.Release(); + } + } + + // If we've failed by now, it's a grammar load failure + if ( FAILED( hr ) ) + { + uiErrorMessageID = IDS_GRAMMAR_LOAD_FAIL; + } + + if (SUCCEEDED(hr) && m_cpCFGGrammar) + { + hr = m_cpCFGGrammar->SetRuleState(NULL, NULL, fActivateCFG ? SPRS_ACTIVE : SPRS_INACTIVE); + + if (SUCCEEDED(hr) && hDynRule) + { + hr = m_cpCFGGrammar->SetRuleState(g_szDynRuleName, NULL, fActivateCFG ? SPRS_ACTIVE : SPRS_INACTIVE); + } + } + + if (SUCCEEDED(hr) && m_cpDictationGrammar) + { + hr = m_cpDictationGrammar->SetDictationState(fActivateDictation ? SPRS_ACTIVE : SPRS_INACTIVE); + } + + if (SUCCEEDED(hr) && m_cpSpellingGrammar) + { + hr = m_cpSpellingGrammar->SetDictationState(fActivateSpelling ? SPRS_ACTIVE : SPRS_INACTIVE); + } + + // If we have failed here, but the grammar load succeeded, then it's a + // SetRuleState/SetDictationState failure + if ( FAILED( hr ) && (0 == uiErrorMessageID) ) + { + if ( SPERR_DEVICE_BUSY == hr ) + { + uiErrorMessageID = IDS_DEVICE_BUSY; + } + else + { + uiErrorMessageID = IDS_RULESTATE_FAIL; + } + } + + if (SUCCEEDED(hr)) + { + HMENU hMenu = ::GetMenu(m_hDlg); + ::EnableMenuItem(hMenu, IDM_CFG_LOAD_GRAMMAR, fLoadCFG ? MF_GRAYED : MF_ENABLED); + ::EnableMenuItem(hMenu, IDM_CFG_ADD_DYNAMIC_RULE, fLoadCFG ? MF_ENABLED : MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_CFG_SET_WORD_SEQUENCE_DATA, fLoadCFG ? MF_ENABLED : MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_TRAIN_FROM_FILE, m_cpRecognizer ? MF_ENABLED : MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_ADAPT_FROM_FILE, m_cpDictationGrammar ? MF_ENABLED : MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_ADAPT_FROM_CLIPBOARD, m_cpDictationGrammar ? MF_ENABLED : MF_GRAYED); + } + else + { + MessageBoxFromResource( uiErrorMessageID ); + Reset(); + } + } + + #ifdef _DEBUG + fInUpdate = FALSE; + #endif // _DEBUG + + return hr; +} + + +/**************************************************************************** +* CRecoDlgClass::UpdateRecoCtxtState * +*------------------------------------* +* Description: +* Creates or releases the m_cpRecoContext member based on the state of the +* ICD_CHECK_CREATE checkbox. This method also enables or disables various controls +* based on weather or not there is a m_cpRecoContext object. If for any reason +* one of the SAPI calls fails, the application state will be reset. +* +* Returns: +* S_OK +* Return value of CRecoDlgClass::CreateRecoCtxt() +* Return value of CRecoDlgClass::UpdateGrammarState() +* +****************************************************************************/ + +HRESULT CRecoDlgClass::UpdateRecoCtxtState() +{ + HRESULT hr = S_OK; + BOOL bCreateChecked = (::SendDlgItemMessage(m_hDlg, IDC_CHECK_CREATE, BM_GETCHECK, 0, 0 ) == BST_CHECKED); + if (bCreateChecked) + { + if (!m_cpRecoCtxt) + { + BOOL bShared = (::SendDlgItemMessage(m_hDlg, IDC_RADIO_SHARED, BM_GETCHECK, 0, 0) == BST_CHECKED); + if (bShared) + { + hr = CreateRecoCtxt(0); + } + else + { + HWND hwndList = ::GetDlgItem(m_hDlg, IDC_COMBO_ENGINES); + LONG i = ::SendMessage(hwndList, CB_GETCURSEL, 0, 0); + hr = CreateRecoCtxt(::SendMessage(hwndList, CB_GETITEMDATA, i, 0)); + } + } + + if( SUCCEEDED(hr) ) + { + hr = UpdateGrammarState(0); + if (FAILED(hr)) + { + Reset(); + } + } + } + else + { + Reset(); + } + BOOL bEnable = (m_cpRecoCtxt != NULL); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_LIST_PHRASES), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_CFG), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_CFG_ACTIVE), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_MIC), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_DICTATION), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_DICTATION_ACTIVE), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_SPELLING), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_SPELLING_ACTIVE), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_RETAIN_AUDIO), bEnable); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_RADIO_SHARED), m_cpRecoCtxt == NULL); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_RADIO_INPROC), m_cpRecoCtxt == NULL); + BOOL bEnableCombo = (m_cpRecoCtxt == NULL); + if (bEnableCombo) + { + bEnableCombo = (::SendDlgItemMessage(m_hDlg, IDC_RADIO_INPROC, BM_GETCHECK, 0, 0) == BST_CHECKED); + } + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_COMBO_ENGINES), bEnableCombo); + if (!bEnable) + { + UpdatePropWindow(NULL); + } + return hr; +} + +/**************************************************************************** +* CRecoDlgClass::InitDialog * +*---------------------------* +* Description: +* Enumerates the available SR engines and populates the combo box. +* Initializes the application to the default starting state. +* +* Returns: +* TRUE if successful, else FALSE +* +****************************************************************************/ + +BOOL CRecoDlgClass::InitDialog(HWND hDlg) +{ + HRESULT hr = S_OK; + m_hDlg = hDlg; + + // + // Initialize the list of engines. The shared context will be indicated by a NULL + // GUID pointer (a 0 item data). The default inproc engine will be GUID_NULL, and all + // other engines will have a GUID allocated for them. + // + CComPtr cpEnum; + if (SUCCEEDED(hr)) + { + hr = SpEnumTokens(SPCAT_RECOGNIZERS, NULL, NULL, &cpEnum); + } + if (FAILED(hr)) + { + return FALSE; + } + + CComPtr cpDefaultRecoToken; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOGNIZERS, &cpDefaultRecoToken); + + if (SUCCEEDED(hr)) + { + CSpDynamicString dstrDefaultName; + if (SUCCEEDED(SpGetDescription(cpDefaultRecoToken, &dstrDefaultName))) + { + CSpDynamicString dstrDesc(L"Shar&ed: "); + dstrDesc.Append(dstrDefaultName); + USES_CONVERSION; + ::SendDlgItemMessage(hDlg, IDC_RADIO_SHARED, WM_SETTEXT, 0, (LPARAM)W2T(dstrDesc)); + } + } + + // + // Now set up the list. + // + HWND hwndList = ::GetDlgItem(hDlg, IDC_COMBO_ENGINES); + + ISpObjectToken * pEngineToken; + + while (cpEnum->Next(1, &pEngineToken, NULL) == S_OK) + { + CSpDynamicString dstrName; + if (SUCCEEDED(SpGetDescription(pEngineToken, &dstrName))) + { + USES_CONVERSION; + LRESULT NewItem = ::SendMessage(hwndList, CB_ADDSTRING, 0, (LPARAM)W2T(dstrName)); + ::SendMessage(hwndList, CB_SETITEMDATA, NewItem, (LPARAM)pEngineToken); + } + else + { + pEngineToken->Release(); + } + } + + ::SendMessage(hwndList, CB_SETCURSEL, 0, 0); + ::SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)::LoadIconA(m_hInstance, MAKEINTRESOURCEA(IDI_RECO))); + + ::SendDlgItemMessage( m_hDlg, IDC_CHECK_MIC, BM_SETCHECK, BST_CHECKED, 0 ); + ::SendDlgItemMessage( m_hDlg, IDC_RADIO_SHARED, BM_SETCHECK, BST_CHECKED, 0 ); + + UpdateRecoCtxtState(); + UpdateGrammarStatusWindow(); + + // + // Phrase window is owner draw, in order to prevent dataloss in thunking + // We keep the Unicode string in the CRecoDlgListItem and call ExtTextOutW. + // + + HWND hwndPhrase = GetDlgItem(hDlg, IDC_LIST_PHRASES); + LONG l = GetWindowLong(hwndPhrase, GWL_STYLE); + SetWindowLong(hwndPhrase, GWL_STYLE, l & ~LBS_HASSTRINGS); + + return TRUE; +} + + +/**************************************************************************** +* CRecoDlgClass::Cleanup * +*------------------------* +* Description: +* Called when the application is shutting down. +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::Cleanup() +{ + // + // Release all the engine tokens in the combo box + // + HWND hwndList = ::GetDlgItem(m_hDlg, IDC_COMBO_ENGINES); + LONG NumEntries = ::SendMessage(hwndList, CB_GETCOUNT, 0, 0); + for (LONG i = 0; i < NumEntries; i++) + { + LRESULT ItemData = ::SendMessage(hwndList, CB_GETITEMDATA, i, 0); + if (ItemData) + { + ((IUnknown *)ItemData)->Release(); + } + } + + Reset(); + + if (m_hfont) + { + ::DeleteObject(m_hfont); + } +} + + +/**************************************************************************** +* CRecoDlgClass::CreateRecoCtxt * +*-------------------------------* +* Description: +* This method is only called from UpdateRecoCtxtState. It is passed the +* item data from selected item in the IDC_COMBO_ENGINES combo box. If the item +* data is NULL then the "Shared default engine" is selected. If it is non-NULL +* then the item data points to an SpObjectToken for the selected engine to +* load inproc. +* +* Returns: +* S_OK, or failed HRESULT of SAPI initialization calls made below +* +****************************************************************************/ + +HRESULT CRecoDlgClass::CreateRecoCtxt(LRESULT ItemData) +{ + HRESULT hr = S_OK; + + // + // ItemData is NULL, for shared case. In the inproc case, we are REQUIRED to set the + // input so we create the default audio object. + // + if (ItemData) + { + hr = m_cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + if (SUCCEEDED(hr)) + { + hr = m_cpRecognizer->SetRecognizer((ISpObjectToken *)ItemData); + } + if (SUCCEEDED(hr)) + { + CComPtr cpAudioToken; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_AUDIOIN, &cpAudioToken); + if (SUCCEEDED(hr)) + { + hr = m_cpRecognizer->SetInput(cpAudioToken, TRUE); + } + } + } + else + { + hr = m_cpRecognizer.CoCreateInstance(CLSID_SpSharedRecognizer); + } + if (SUCCEEDED(hr)) + { + hr = m_cpRecognizer->CreateRecoContext(&m_cpRecoCtxt); + } + if (SUCCEEDED(hr)) + { + hr = m_cpRecoCtxt->SetNotifyWindowMessage(m_hDlg, WM_RECOEVENT, 0, 0); + } + if (SUCCEEDED(hr)) + { + const ULONGLONG ullInterest = SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | + SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | + SPFEI(SPEI_FALSE_RECOGNITION) | SPFEI(SPEI_HYPOTHESIS) | + SPFEI(SPEI_INTERFERENCE) | SPFEI(SPEI_RECO_OTHER_CONTEXT) | + SPFEI(SPEI_REQUEST_UI) | SPFEI(SPEI_RECO_STATE_CHANGE) | + SPFEI(SPEI_PROPERTY_NUM_CHANGE) | SPFEI(SPEI_PROPERTY_STRING_CHANGE); + hr = m_cpRecoCtxt->SetInterest(ullInterest, ullInterest); + } + + if( SUCCEEDED(hr) ) + { + //--- Set the max number of desired alternates + hr = m_cpRecoCtxt->SetMaxAlternates( 3 ); + } + + SPRECOGNIZERSTATUS stat; + + // Get locale/font settings + if (SUCCEEDED(hr)) + { + ZeroMemory(&stat, sizeof(stat)); + hr = m_cpRecognizer->GetStatus(&stat); + } + + if (SUCCEEDED(hr)) + { + m_langid = stat.aLangID[0]; + + // Pick an appropriate font. On Windows 2000, let the system fontlink. + + DWORD dwVersion = GetVersion(); + + if ( dwVersion >= 0x80000000 + || LOBYTE(LOWORD(dwVersion)) < 5 + || m_langid != MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)) + { + TCHAR achCodePage[6]; + UINT uiCodePage; + + if (0 != GetLocaleInfo(MAKELCID(m_langid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, achCodePage, 6)) + { + uiCodePage = _ttoi(achCodePage); + } + else + { + uiCodePage = GetACP(); + } + + CComPtr cpMultiLanguage; + MIMECPINFO MimeCpInfo; + + if ( SUCCEEDED(cpMultiLanguage.CoCreateInstance(CLSID_CMultiLanguage)) + && SUCCEEDED(cpMultiLanguage->GetCodePageInfo(uiCodePage, &MimeCpInfo))) + { + USES_CONVERSION; + + if (m_hfont) + { + DeleteObject(m_hfont); + } + + m_hfont = CreateFont(0, 0, 0, 0, FW_NORMAL, 0, 0, 0, + MimeCpInfo.bGDICharset, + OUT_DEFAULT_PRECIS, + CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, + DEFAULT_PITCH, + W2T(MimeCpInfo.wszProportionalFont)); + + } + } + } + + if (SUCCEEDED(hr)) + { + m_cpPhoneConv.Release(); + hr = SpCreatePhoneConverter(m_langid, NULL, NULL, &m_cpPhoneConv); + } + + if (FAILED(hr)) + { + MessageBoxFromResource( IDS_RECOCONTEXT_FAIL ); + Reset(); + } + return hr; +} + +/**************************************************************************** +* CRecoDlgClass::UpdateGrammarStatusWindow * +*------------------------------------------* +* Description: +* Called whenever the grammar file has changed to set the text of the +* grammar status control (a line in the dialog box below the property window). +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::UpdateGrammarStatusWindow() +{ + const static TCHAR szPrefixText[] = _T("Current C&&C Grammar: "); + TCHAR szDesc[sp_countof(m_szGrammarFileTitle) + sp_countof(szPrefixText)]; + _tcscpy(szDesc, szPrefixText); + _tcscat(szDesc, *m_szGrammarFile ? m_szGrammarFileTitle : _T("Solitaire (built-in demo grammar)")); + ::SendDlgItemMessage(m_hDlg, IDC_GRAMMAR_STATUS, WM_SETTEXT, 0, (LPARAM)szDesc); +} + + +/**************************************************************************** +* CRecoDlgClass::Reset * +*----------------------* +* Description: +* Shutdown and release all of the objects associated with an active +* recognition context and reset UI elements to their initial state. +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::Reset() +{ + UpdatePropWindow(NULL); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_CFG_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_CFG, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_DICTATION_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_DICTATION, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_SPELLING_ACTIVE, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_SPELLING, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_CREATE, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_RETAIN_AUDIO, BM_SETCHECK, BST_UNCHECKED, 0 ); + ::SendDlgItemMessage (m_hDlg, IDC_CHECK_MIC, BM_SETCHECK, BST_CHECKED, 0 ); + ::EnableWindow(::GetDlgItem(m_hDlg, IDC_CHECK_MIC), 0); + + HMENU hMenu = ::GetMenu(m_hDlg); + ::EnableMenuItem(hMenu, IDM_CFG_LOAD_GRAMMAR, MF_ENABLED); + ::EnableMenuItem(hMenu, IDM_CFG_ADD_DYNAMIC_RULE, MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_CFG_SET_WORD_SEQUENCE_DATA, MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_TRAIN_FROM_FILE, MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_ADAPT_FROM_FILE, MF_GRAYED); + ::EnableMenuItem(hMenu, IDM_SLM_ADAPT_FROM_CLIPBOARD, MF_GRAYED); + + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_RESETCONTENT, 0, 0); + + m_cpCFGGrammar.Release(); + m_cpCFGVoice.Release(); + m_cpRecoCtxt.Release(); + m_cpDictationGrammar.Release(); + m_cpSpellingGrammar.Release(); + m_cpRecognizer.Release(); + + m_bInSound = FALSE; + m_bGotReco = FALSE; +} + +/**************************************************************************** +* CRecoDlgClass::RecoEvent * +*--------------------------* +* Description: +* Whenever a notification is sent from the m_cpRecoCtxt object, this +* method is called. When a recognition event occurs, it adds an item to +* the listbox. If a sound start / sound end occurs without a recogntion +* then it inserts a "" string in the listbox. +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::RecoEvent() +{ + USES_CONVERSION; + CSpEvent event; + long iNewPhrase; + + if (m_cpRecoCtxt) + { + while (event.GetFrom(m_cpRecoCtxt) == S_OK) + { + switch (event.eEventId) + { + case SPEI_REQUEST_UI: + if (event.RequestTypeOfUI() != NULL) + { + #ifdef _DEBUG + SPRECOCONTEXTSTATUS recostatus; + m_cpRecoCtxt->GetStatus(&recostatus); + _ASSERTE(wcscmp(recostatus.szRequestTypeOfUI, event.RequestTypeOfUI()) == 0); + #endif // _DEBUG + + m_cpRecognizer->DisplayUI(m_hDlg, L"Basic Speech Recognition", event.RequestTypeOfUI() , NULL, 0); + } + else + { + #ifdef _DEBUG + SPRECOCONTEXTSTATUS recostatus; + m_cpRecoCtxt->GetStatus(&recostatus); + _ASSERTE(recostatus.szRequestTypeOfUI[0] == '\0'); + #endif // _DEBUG + } + break; + + case SPEI_INTERFERENCE: + { + USES_CONVERSION; + CSpDynamicString dstr; + switch(event.Interference()) + { + case SPINTERFERENCE_NONE: + dstr = L"Interference - None"; + break; + case SPINTERFERENCE_NOISE: + dstr = L"Interference - Noise"; + break; + case SPINTERFERENCE_NOSIGNAL: + dstr = L"Interference - No signal"; + break; + case SPINTERFERENCE_TOOLOUD: + dstr = L"Interference - Too loud"; + break; + case SPINTERFERENCE_TOOQUIET: + dstr = L"Interference - Too quiet"; + break; + case SPINTERFERENCE_TOOFAST: + dstr = L"Dictation mode: Interference - Too fast"; + break; + case SPINTERFERENCE_TOOSLOW: + dstr = L"Dictation mode: Interference - Too slow"; + break; + default: + dstr = L"Unrecognized Interference Event"; + } + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, dstr, FALSE); + if (pli) + { + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + } + break; + + case SPEI_PROPERTY_NUM_CHANGE: + { + USES_CONVERSION; + TCHAR sz[MAX_PATH * 2]; + WCHAR *pwszPropertyName = NULL; + if ( event.PropertyName() ) + { + pwszPropertyName = wcsdup( event.PropertyName() ); + } + else + { + pwszPropertyName = wcsdup( L"" ); + } + wsprintf(sz, _T("Attrib change: %s=%d"), + pwszPropertyName ? W2T(pwszPropertyName) : _T("(out of memory)"), + event.PropertyNumValue()); + if ( pwszPropertyName ) + { + free( pwszPropertyName ); + } + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, T2W(sz), FALSE); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + break; + + case SPEI_PROPERTY_STRING_CHANGE: + { + USES_CONVERSION; + TCHAR sz[MAX_PATH * 2]; + WCHAR *pwszPropertyName = NULL; + if ( event.PropertyName() ) + { + pwszPropertyName = wcsdup( event.PropertyName() ); + } + else + { + pwszPropertyName = wcsdup( L"" ); + } + + WCHAR *pwszPropertyStringValue = NULL; + if ( event.PropertyStringValue() ) + { + pwszPropertyStringValue = wcsdup( event.PropertyStringValue() ); + } + else + { + pwszPropertyStringValue = wcsdup( L"" ); + } + wsprintf(sz, _T("Attrib change: %s=%s"), + pwszPropertyName ? W2T(pwszPropertyName) : _T("(out of memory)"), + pwszPropertyStringValue ? W2T(pwszPropertyStringValue): _T("(out of memory)") ); + if ( pwszPropertyName ) + { + free( pwszPropertyName ); + } + if ( pwszPropertyStringValue ) + { + free( pwszPropertyStringValue ); + } + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, T2W(sz), FALSE); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + break; + + case SPEI_RECO_STATE_CHANGE: + ::SendDlgItemMessage( m_hDlg, IDC_CHECK_MIC, BM_SETCHECK, + (event.RecoState() == SPRST_INACTIVE) ? BST_UNCHECKED : BST_CHECKED, 0 ); + break; + + + + case SPEI_SOUND_START: + m_bInSound = TRUE; + break; + + case SPEI_SOUND_END: + if (m_bInSound) + { + m_bInSound = FALSE; + if (!m_bGotReco) + { + const WCHAR wszNoise[] = L"(Noise without speech)"; + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, wszNoise, FALSE); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + m_bGotReco = FALSE; + } + break; + + case SPEI_RECO_OTHER_CONTEXT: + { + m_bGotReco = TRUE; + CRecoDlgListItem * pli = new CRecoDlgListItem(NULL, L"(Recognition for other client)", FALSE); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + } + break; + + + case SPEI_FALSE_RECOGNITION: + case SPEI_HYPOTHESIS: + case SPEI_RECOGNITION: + { + CComPtr cpResult; + cpResult = event.RecoResult(); + + m_bGotReco = TRUE; + + CRecoDlgListItem * pli; + + CSpDynamicString dstrText; + if (event.eEventId == SPEI_FALSE_RECOGNITION) + { + dstrText = L"(Unrecognized)"; + } + else + { + cpResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dstrText, NULL); + } + + pli = new CRecoDlgListItem(cpResult, dstrText, event.eEventId == SPEI_HYPOTHESIS); + iNewPhrase = ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_ADDSTRING, 0, (LPARAM)pli); + ::SendDlgItemMessage(m_hDlg, IDC_LIST_PHRASES, LB_SETCURSEL, iNewPhrase, 0); + UpdatePropWindow(pli); + + cpResult.Release(); + } + break; + } + } + } +} + +/**************************************************************************** +* CRecoDlgClass::EmulateRecognition * +*-----------------------------------* +* Description: +* Calls ISpRecognizer::EmulateRecognition to parse the phrase +* built out of the text in pszText +* Returns: +* void +****************************************************************************/ + +void CRecoDlgClass::EmulateRecognition(WCHAR *pszText) +{ + SPDBG_FUNC("CRecoDlgClass::EmulateRecognition"); + HRESULT hr = S_OK; + + CComPtr cpPhrase; + if (SUCCEEDED(CreatePhraseFromText(pszText, &cpPhrase, m_langid, m_cpPhoneConv)) && m_cpRecognizer) + { + hr = m_cpRecognizer->EmulateRecognition(cpPhrase); + } +} + + + +/**************************************************************************** +* CRecoDlgClass::SpecifyCAndCGrammar * +*------------------------------------* +* Description: +* This method is called when the "C&C Grammar" button is pressed on the +* main application dialog. It opens the standard file dialog so that the user +* can specify a command and control grammar to be used by the application. If +* the user cancels out of the dialog, then this method resets the m_szGrammarFile +* member so that the built-in grammar will be used. +* +* Returns: +* void +* +****************************************************************************/ + +void CRecoDlgClass::SpecifyCAndCGrammar() +{ + OPENFILENAME OpenFileName; + const static TCHAR szFilter[] = _T("Grammar files\0*.cfg;*.xml\0All files\0*.*\0"); + size_t ofnsize = (BYTE*)&OpenFileName.lpTemplateName + sizeof(OpenFileName.lpTemplateName) - (BYTE*)&OpenFileName; + + // Fill in the OPENFILENAME structure to support a template and hook. + OpenFileName.lStructSize = ofnsize; + OpenFileName.hwndOwner = m_hDlg; + OpenFileName.hInstance = m_hInstance; + OpenFileName.lpstrFilter = szFilter; + OpenFileName.lpstrCustomFilter = NULL; + OpenFileName.nMaxCustFilter = 0; + OpenFileName.nFilterIndex = 0; + OpenFileName.lpstrFile = m_szGrammarFile; + OpenFileName.nMaxFile = sp_countof(m_szGrammarFile); + OpenFileName.lpstrFileTitle = m_szGrammarFileTitle; + OpenFileName.nMaxFileTitle = sp_countof(m_szGrammarFileTitle); + OpenFileName.lpstrInitialDir = NULL; + OpenFileName.lpstrTitle = _T("Select a grammar file"); + OpenFileName.nFileOffset = 0; + OpenFileName.nFileExtension = 0; + OpenFileName.lpstrDefExt = _T("cfg"); + OpenFileName.lCustData = 0; + OpenFileName.lpfnHook = NULL; + OpenFileName.lpTemplateName = NULL; + OpenFileName.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + + // Call the common dialog function. + if (!GetOpenFileName(&OpenFileName)) + { + // If for any reason, GetOpenFileName returns false, revert to our internal grammar + m_szGrammarFile[0] = 0; + } + UpdateGrammarStatusWindow(); +} + +/**************************************************************************** +* CRecoDlgClass::MessageBoxFromResource * +*---------------------------------------* +* Description: +* Display a MessageBox whose text is the requested string resource ID +* +* Returns: +* void +* +****************************************************************************/ +int CRecoDlgClass::MessageBoxFromResource( UINT uiResource ) +{ + TCHAR szMessage[ MAX_LOADSTRING ]; + ::LoadString( m_hInstance, uiResource, szMessage, sizeof( szMessage ) ); + return ::MessageBox( m_hDlg, szMessage, NULL, MB_ICONEXCLAMATION ); +} + +/**************************************************************************** +* CRecoDlgClass::SetWordSequenceData * +*------------------------------------* +* Description: +* This method is called when the "Set Word Sequence Data" menu item is selected from the +* C&C menu. It opens the standard file dialog so that the user +* can specify a document to be used by the application. +* +****************************************************************************/ + +void CRecoDlgClass::SetWordSequenceData() +{ + WCHAR * pwszCoMem = 0; + WCHAR * pwszCoMem2 = 0; + ULONG cch = 0; + + HRESULT hr = GetTextFile(&pwszCoMem, &cch); + + if (SUCCEEDED(hr)) + { + SPTEXTSELECTIONINFO tsi; + + tsi.ulStartActiveOffset = 0; + tsi.cchActiveChars = cch; + tsi.ulStartSelection = 0; + tsi.cchSelection = cch; + + pwszCoMem2 = (WCHAR *)CoTaskMemAlloc(sizeof(WCHAR) * (cch + 2)); + + if (SUCCEEDED(hr)) + { + // SetWordSequenceData requires double NULL terminator. + memcpy(pwszCoMem2, pwszCoMem, sizeof(WCHAR) * cch); + pwszCoMem2[cch] = L'\0'; + pwszCoMem2[cch+1] = L'\0'; + + hr = m_cpCFGGrammar->SetWordSequenceData(pwszCoMem2, cch + 2, &tsi); + + CoTaskMemFree(pwszCoMem2); + } + CoTaskMemFree(pwszCoMem); + } +} + + +/**************************************************************************** +* Implementation of CDynGrammarDlgClass +****************************************************************************/ + +/**************************************************************************** +* CDynGrammarDlgClass::DlgProc * +*------------------------------* +* Description: +* This static member function is the message handler for the dynamic rule +* dialog. When the dialog is initialized via WM_INITDIALOG, the pointer to the +* CDynGrammarDlgClass object is passed to this function in the lParam. This is stored +* in the USERDATA window long and used for subsequent message processing. +* +* Returns: +* Appropriate LRESULT for give window message +* +****************************************************************************/ + +LRESULT CALLBACK CDynGrammarDlgClass::DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + CDynGrammarDlgClass * pThis = (CDynGrammarDlgClass *)::GetWindowLong(hDlg, GWL_USERDATA); + switch (message) + { + case WM_INITDIALOG: + ::SetWindowLong(hDlg, GWL_USERDATA, lParam); + pThis = (CDynGrammarDlgClass *)lParam; + return pThis->InitDialog(hDlg, pThis->m_pItemList); + + case WM_HELP: + ::DialogBoxParam(pThis->m_pParent->m_hInstance, (LPCTSTR)IDD_DIALOG_BETAHELP, hDlg, (DLGPROC)BetaHelpDlgProc, NULL); + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + pThis->Cleanup(); + EndDialog(hDlg, 0); + return TRUE; + } + else if (LOWORD(wParam) == IDC_BUTTON_ADDITEM) + { + pThis->AddItem(); + } + else if (LOWORD(wParam) == IDC_BUTTON_CLEARALL) + { + pThis->ClearAll(); + } + else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_EDIT_NEWITEM) + { + // + // Only enable the "Add" button if there is some text in the edit control + // + BOOL fEnable = ::SendMessage((HWND)lParam, WM_GETTEXTLENGTH, 0, 0); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_ADDITEM), fEnable); + } + + break; + + } + return FALSE; +} + + +/**************************************************************************** +* CDynGrammarDlgClass::InitDialog * +*---------------------------------* +* Description: +* This method is called from the WM_INITDIALOG message. It initialzes +* the m_hDlg member and populates the listbox with any items that have already +* been added to the "DynRule". +* +* Returns: +* TRUE if successful, else FALSE +* +****************************************************************************/ + +BOOL CDynGrammarDlgClass::InitDialog(HWND hDlg, CSpBasicQueue *pItemList) +{ + USES_CONVERSION; + HRESULT hr = S_OK; + m_hDlg = hDlg; + + m_pItemList = pItemList; + ISpRecoGrammar * pGram = m_pParent->m_cpCFGGrammar; + + hr = pGram->GetRule(g_szDynRuleName, NULL, SPRAF_TopLevel | SPRAF_Dynamic | SPRAF_Active, TRUE, &m_hDynRule); + if (SUCCEEDED(hr)) + { + HWND hwndList = ::GetDlgItem(hDlg, IDC_LIST_ITEMS); + CDynItem *pItem = m_pItemList->GetHead(); + while (pItem) + { + LRESULT Index = ::SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)W2T(pItem->m_dstr)); + ::SendMessage(hwndList, LB_SETITEMDATA, Index, (LPARAM)W2T(pItem->m_dstr)); + pItem = m_pItemList->GetNext(pItem); + } + } + return TRUE; +} + +/**************************************************************************** +* CDynGrammarDlgClass::AddItem * +*------------------------------* +* Description: +* Called when the "Add" button is pressed. It calls AddItem to add the +* text in the edit control to the "DynRule" in the CFG grammar. +* +* Returns: +* void +* +****************************************************************************/ + +void CDynGrammarDlgClass::AddItem() +{ + HRESULT hr = S_OK; + WCHAR wszItem[MAX_PATH]; + GETTEXTEX gtex = { sp_countof(wszItem), GT_DEFAULT, 1200, NULL, NULL }; + + ::SendDlgItemMessage(m_hDlg, IDC_EDIT_NEWITEM, EM_GETTEXTEX, (WPARAM)>ex, (LPARAM)wszItem); + + hr = m_pParent->m_cpCFGGrammar->AddWordTransition(m_hDynRule, NULL, wszItem, L" ", SPWT_LEXICAL, 1.0, NULL); + if (SUCCEEDED(hr)) + { + CDynItem *pItem = new CDynItem(wszItem); + if (pItem) + { + m_pItemList->InsertTail(pItem); + USES_CONVERSION; + LRESULT Index = ::SendDlgItemMessage(m_hDlg, IDC_LIST_ITEMS, LB_ADDSTRING, 0, (LPARAM)W2T(wszItem)); + } + ::SendDlgItemMessage(m_hDlg, IDC_EDIT_NEWITEM, WM_SETTEXT, 0, (LPARAM)_T("")); + ::SetFocus(::GetDlgItem(m_hDlg, IDC_EDIT_NEWITEM)); + } +} + + +/**************************************************************************** +* CDynGrammarDlgClass::ClearAll * +*-------------------------------* +* Description: +* Called when the "Clear" button is pressed. Clears the contents of the +* listbox and clears the "DynRule" in the CFG grammar. +* +* Returns: +* void +* +****************************************************************************/ + +void CDynGrammarDlgClass::ClearAll() +{ + ::SendDlgItemMessage(m_hDlg, IDC_LIST_ITEMS, LB_RESETCONTENT, 0, 0); + m_pParent->m_cpCFGGrammar->ClearRule(m_hDynRule); + m_pItemList->Purge(); +} + + +/**************************************************************************** +* CDynGrammarDlgClass::Cleanup * +*------------------------------* +* Description: +* Called when the dialog is being closed. Commits the changes to the +* "DynRule" and sets the activation state of the DynRule to the same state +* as the current setting of the checkbox in the main dialog. +* +* Returns: +* void +* +****************************************************************************/ + +void CDynGrammarDlgClass::Cleanup() +{ + m_pParent->m_cpCFGGrammar->Commit(0); + BOOL fActive = ::SendDlgItemMessage(m_pParent->m_hDlg, IDC_CHECK_CFG_ACTIVE, BM_GETCHECK, 0, 0); + m_pParent->m_cpCFGGrammar->SetRuleState(g_szDynRuleName, NULL, fActive ? SPRS_ACTIVE : SPRS_INACTIVE); +} + +/**************************************************************************** +* Implemenation of temporary help dialog for pre-release tool +****************************************************************************/ + +const TCHAR g_szBetaHelpText[] = +_T("INTRODUCTION:\r\n") +_T("This tool can be used by engine vendors and CFG grammar developers to perform basic functionality ") +_T("testing for recognition. The tool can select a specific engine, load a specified command and control grammar, add items to ") +_T("a dynamic rule, enable a dictation grammar, and turn the microphone state on and off.\r\n\r\n") +_T("BASIC USE:\r\n") +_T("Select the speech recognition engine you want to use and then check Create Recognition Context. ") +_T("Once the engine has loaded, you can enable a dictation grammar by checking Activate Dictation. ") +_T("For debugging purposes, the operations of loading and then activating a specific grammar have been separated so that ") +_T("engine developers can debug the process of loading a grammar prior to the grammar activation.\r\n\r\n") +_T("COMMAND AND CONTROL GRAMMARS\r\n") +_T("Recognition has a built-in grammar containing the basic commands for solitaire. Try saying \"Play the King of Diamonds\" or ") +_T("\"Put the Jack of Clubs on the Queen please.\" If you want to load your own grammar, click Load C&&C. Use GramComp.Exe ") +_T("to compile the grammar for use with this program. If you wish to test dynamic lists, author a grammar with a rule named \"DynRule\" ") +_T("and then reference that rule from a top-level rule in your grammar. When you add items to the grammar, click Dynamic Rules. ") +_T("The items will be added to the dynamic rule in your grammar. If the grammar does not contain a rule named \"DynRule\", then the ") +_T("items added in the Dynamic Rules dialog will become top-level rules.\r\n\r\n") +_T("OTHER FEATURES:\r\n") +_T("When a command is recognized, the text is displayed in the list box at the top of the dialog box, and a dump of the full result is displayed ") +_T("in the status window towards the bottom of the dialog. To examine the result of a particular utterance, simply click it in the list box, and ") +_T("the result status window will be updated. To play back the audio from an utterance, double click the item. Note that if you have not ") +_T("checked Retain Reco Audio, the text will be played back using synthesized speech. If you have enabled audio retention, the ") +_T("original utterance will be played back. To emulate recognition, you can type a phrase you want parsed into the edit box ") +_T("at the bottom of the dialog and click \"Submit\""); + +LRESULT CALLBACK BetaHelpDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: + ::SendDlgItemMessage(hDlg, IDC_BETA_HELP, WM_SETTEXT, 0, (LPARAM)g_szBetaHelpText); + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, 0); + return TRUE; + } + + } + return FALSE; +} + +/**************************************************************************** +* AlternatesDlgProc * +*-------------------* +* Description: +* Dlgproc for the alternates dialog, which displays the +* alternates for the current phrase and allows the user to +* choose (commit) one of them. +****************************************************************************/ +LRESULT CALLBACK CAlternatesDlgClass:: + AlternatesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + USES_CONVERSION; + HRESULT hr = S_OK; + CAlternatesDlgClass* pThis = (CAlternatesDlgClass *)::GetWindowLong(hDlg, GWL_USERDATA); + + switch( message ) + { + case WM_INITDIALOG: + { + ::SetWindowLong(hDlg, GWL_USERDATA, lParam); + pThis = (CAlternatesDlgClass *)lParam; + + //--- Ask for up to 5 alts + hr = pThis->m_pResult->GetAlternates( 0, SPRR_ALL_ELEMENTS, NUM_ALTS, + pThis->m_Alts, &pThis->m_ulNumAltsReturned ); + //--- Show user choices + if( SUCCEEDED( hr ) && pThis->m_ulNumAltsReturned ) + { + for( ULONG i = 0; i < pThis->m_ulNumAltsReturned; ++i ) + { + WCHAR* pComemText = NULL; + BYTE Attrs; + hr = pThis->m_Alts[i]->GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, true, + &pComemText, &Attrs ); + if( SUCCEEDED( hr ) ) + { + int Err = ::SendDlgItemMessage( hDlg, IDC_ALTS_LIST, LB_ADDSTRING, 0, (LPARAM)W2T(pComemText) ); + ::CoTaskMemFree( pComemText ); + } + } + + //--- Pick the first alternate by default + ::SendDlgItemMessage( hDlg, IDC_ALTS_LIST, LB_SETCURSEL, 0, 0 ); + } + break; + } + + case WM_COMMAND: + { + if( LOWORD(wParam) == IDOK ) + { + ULONG Index = ::SendDlgItemMessage( hDlg, IDC_ALTS_LIST, LB_GETCURSEL, 0, 0 ); + if( Index <= pThis->m_ulNumAltsReturned ) + { + pThis->m_Alts[Index]->Commit(); + } + } + + if( ( LOWORD(wParam) == IDOK ) || LOWORD(wParam) == IDCANCEL ) + { + EndDialog(hDlg, LOWORD(wParam) ); + return TRUE; + } + break; + } + } + return FALSE; +} + diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/reco.dsp b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.dsp new file mode 100644 index 00000000..847d9efa --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.dsp @@ -0,0 +1,255 @@ +# Microsoft Developer Studio Project File - Name="Reco" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=Reco - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "reco.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "reco.mak" CFG="Reco - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Reco - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "Reco - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "reco" +# PROP Scc_LocalPath "Desktop" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Reco - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Reco___Win32_Debug_x86" +# PROP BASE Intermediate_Dir "Reco___Win32_Debug_x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\ddk\include" /I "..\..\..\..\test\engext" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "Reco - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Reco___Win32_Release_x86" +# PROP BASE Intermediate_Dir "Reco___Win32_Release_x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\ddk\include" /I "..\..\..\..\test\engext" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "Reco - Win32 Debug x86" +# Name "Reco - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\lmadapt.cpp +# End Source File +# Begin Source File + +SOURCE=.\Reco.cpp +# End Source File +# Begin Source File + +SOURCE=.\Reco.rc +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Reco.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\Reco.ico +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# Begin Source File + +SOURCE=.\tv.cfg +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "*.xml" +# Begin Source File + +SOURCE=.\chs_sol.xml + +!IF "$(CFG)" == "Reco - Win32 Debug x86" + +USERDEP__CHS_S="..\..\..\idl\sapi.idl" +# Begin Custom Build +ProjDir=. +InputPath=.\chs_sol.xml + +"$(ProjDir)\chs_sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Reco - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\chs_sol.xml + +"$(ProjDir)\chs_sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\jpn_sol.xml + +!IF "$(CFG)" == "Reco - Win32 Debug x86" + +USERDEP__JPN_S="..\..\..\idl\sapi.idl" +# Begin Custom Build +ProjDir=. +InputPath=.\jpn_sol.xml + +"$(ProjDir)\jpn_sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Reco - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\jpn_sol.xml + +"$(ProjDir)\jpn_sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\sol.xml + +!IF "$(CFG)" == "Reco - Win32 Debug x86" + +USERDEP__SOL_X="..\..\..\idl\sapi.idl" +# Begin Custom Build +ProjDir=. +InputPath=.\sol.xml +InputName=sol + +"$(ProjDir)\sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputName) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Reco - Win32 Release x86" + +USERDEP__SOL_X="..\..\..\idl\sapi.idl" +# Begin Custom Build +ProjDir=. +InputPath=.\sol.xml +InputName=sol + +"$(ProjDir)\sol.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputName) + +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\jpn_reco.rc +# PROP Exclude_From_Build 1 +# End Source File +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# Begin Source File + +SOURCE=.\sol.cfg +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/reco.h b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.h new file mode 100644 index 00000000..e94703bd --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.h @@ -0,0 +1,272 @@ +/**************************************************************************** +* Reco.H * +*--------* +* Description: +* Header file for Reco tool. This file declares the various dialog classes. +* +****************************************************************************/ + +#if !defined(AFX_RECO_H__BD16E9D0_597E_11D2_960E_00C04F8EE628__INCLUDED_) +#define AFX_RECO_H__BD16E9D0_597E_11D2_960E_00C04F8EE628__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +// +// Defines +// +#define MYGRAMMARID 101 +#define ITNGRAMMARID 102 +#define WM_RECOEVENT WM_APP // Window message used for recognition events + +#define MAX_LOADSTRING 250 + +// +// Constant strings +// +const WCHAR g_szDynRuleName[] = L"DynRule"; + +// +// Forward class declarations +// + +class CRecoDlgListItem; +class CRecoDlgClass; +class CDynGrammarDlgClass; + +// +// Helper class for CSpBasicQueue +// +class CDynItem +{ +public: + CDynItem(WCHAR *psz) : m_dstr(psz) {} ; +public: + CSpDynamicString m_dstr; + CDynItem * m_pNext; +}; + +/**************************************************************************** +* CRecoDlgListItem * +*------------------* +* +* This class stores the recognition result as well as a text string associated +* with the recognition. Note that the string will sometimes be and +* the pResult will be NULL. In other cases the string will be +* and pResult will be valid. +* +****************************************************************************/ + +class CRecoDlgListItem +{ +public: + CRecoDlgListItem(ISpRecoResult * pResult, const WCHAR * pwsz, BOOL fHypothesis) : + m_cpRecoResult(pResult), + m_dstr(pwsz), + m_fHypothesis(fHypothesis) + {} + + ISpRecoResult * GetRecoResult() const { return m_cpRecoResult; } + int GetTextLength() const { return m_dstr.Length(); } + const WCHAR * GetText() const { return m_dstr; } + BOOL IsHypothesis() const { return m_fHypothesis; } + +private: + CComPtr m_cpRecoResult; + CSpDynamicString m_dstr; + BOOL m_fHypothesis; +}; + + +/**************************************************************************** +* CRecoDlgClass * +*---------------* +* +* This class manages the main application dialog. +* +****************************************************************************/ + +class CRecoDlgClass +{ + friend CDynGrammarDlgClass; +// +// Public methods +// +public: + CRecoDlgClass(HINSTANCE hInstance) : + m_hInstance(hInstance), + m_bInSound(FALSE), + m_bGotReco(FALSE), + m_hfont(NULL) + { + m_szGrammarFile[0] = 0; + } + + static LRESULT CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +// +// Private methods +// +private: + HRESULT Create(BOOL bCreateChecked); + BOOL InitDialog(HWND hDlg); + HRESULT CreateRecoCtxt(LRESULT ItemData); + HRESULT UpdateRecoCtxtState(); + void Cleanup(); + void Reset(); + void RecoEvent(); + void SpecifyCAndCGrammar(); + void SetWordSequenceData(); + void EmulateRecognition(WCHAR *pszText); + void UpdateGrammarStatusWindow(); + HRESULT ConstructRuleDisplay(const SPPHRASERULE *pRule, CSpDynamicString & dstr, ULONG ulLevel); + HRESULT ConstructPropertyDisplay(const SPPHRASEELEMENT *pElem, const SPPHRASEPROPERTY *pProp, + CSpDynamicString & dstr, ULONG ulLevel); + BOOL UpdatePropWindow(const CRecoDlgListItem * pli); + HRESULT UpdateGrammarState(WORD wIdOfChangedControl); + + HRESULT GetTextFile(WCHAR ** ppwszCoMem, ULONG * pcch); + + HRESULT FeedDocumentFromFile(); + HRESULT FeedDocumentFromClipboard(); + HRESULT FeedDocument(const WCHAR * pwszCoMem, ULONG cch); + + HRESULT TrainFromFile(); + + int MessageBoxFromResource( UINT uiResource ); + +// +// Member data +// +private: + const HINSTANCE m_hInstance; // Instance handle of process + HWND m_hDlg; // Window handle of dialog + CComPtr m_cpCFGGrammar; // Loaded CFG grammar + CComPtr m_cpCFGVoice; + CComPtr m_cpITNGrammar; // Loaded ITN cfg grammar + CComPtr m_cpDictationGrammar; // Loaded dictation grammar + CComPtr m_cpSpellingGrammar; // Loaded spelling grammar + CComPtr m_cpRecoCtxt; // Recognition context + CComPtr m_cpRecognizer; // Recognition instance + CComPtr m_cpPhoneConv; // Phone converter + BOOL m_bInSound; + BOOL m_bGotReco; + TCHAR m_szGrammarFile[MAX_PATH]; // Fully qualified file path + TCHAR m_szGrammarFileTitle[MAX_PATH]; // Name of the file (no path) + LANGID m_langid; + HFONT m_hfont; + CSpBasicQueue m_ItemList; +}; + +/**************************************************************************** +* CDynGrammarDlgClass * +*---------------------* +* +* This class manages the dynamic rule dialog. +* +****************************************************************************/ + +class CDynGrammarDlgClass +{ +// +// Public methods +// +public: + CDynGrammarDlgClass(CRecoDlgClass * pParent, CSpBasicQueue *pItemList) : + m_pParent(pParent) + { + m_hinstRichEdit = LoadLibrary(_T("riched20.dll")); + m_hDynRule = NULL; + m_pItemList = pItemList; + } + + ~CDynGrammarDlgClass() + { + FreeLibrary(m_hinstRichEdit); + } + + static LRESULT CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +// +// Private methods +// +private: + BOOL InitDialog(HWND hDlg, CSpBasicQueue *pItemList); + void AddItem(); + void Cleanup(); + void ClearAll(); + +// +// Member data +// +private: + const CRecoDlgClass * m_pParent; + HWND m_hDlg; + SPSTATEHANDLE m_hDynRule; + HINSTANCE m_hinstRichEdit; + CSpBasicQueue * m_pItemList; +}; + +//=== This is for the alternates pop window +/**************************************************************************** +* CAlternatesDlgClass * +*---------------------* +* +****************************************************************************/ +#define NUM_ALTS 5 + +class CAlternatesDlgClass +{ + public: + CAlternatesDlgClass() + { + m_ulNumAltsReturned = 0; + memset( m_Alts, 0, NUM_ALTS * sizeof(ISpPhraseAlt*) ); + } + + ~CAlternatesDlgClass() + { + for( ULONG i = 0; i < m_ulNumAltsReturned; ++i ) + { + m_Alts[i]->Release(); + } + } + + static LRESULT CALLBACK AlternatesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + + //--- Member data + ISpRecoResult* m_pResult; + ISpPhraseAlt* m_Alts[NUM_ALTS]; + ULONG m_ulNumAltsReturned; +}; + +// +// This dialog function is only defined for the preview release of this tool. +// +LRESULT CALLBACK BetaHelpDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +// +// Helper function +// +inline char ConfidenceGroupChar(char Confidence) +{ + switch (Confidence) + { + case SP_LOW_CONFIDENCE: + return '-'; + + case SP_NORMAL_CONFIDENCE: + return ' '; + + case SP_HIGH_CONFIDENCE: + return '+'; + + default: + _ASSERTE(false); + return '?'; + } +} + + + +#endif // !defined(AFX_RECO_H__BD16E9D0_597E_11D2_960E_00C04F8EE628__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/reco.ico b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.ico new file mode 100644 index 00000000..38688352 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/reco.rc b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.rc new file mode 100644 index 00000000..2714efa5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/reco.rc @@ -0,0 +1,273 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) (unknown sub-lang: 0x0) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, 0x0 +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_SOL_CFG SRGRAMMAR DISCARDABLE "sol.cfg" +#endif // English (U.S.) (unknown sub-lang: 0x0) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_RECO ICON DISCARDABLE "RECO.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""jpn_reco.rc""\r\n" + "#include ""version.rc2""\r\n" + "\r\n" + "\0" +END + +4 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""chs_reco.rc""\r\n" + "\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_RECODLG DIALOG DISCARDABLE 0, 0, 274, 285 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Basic Speech Recognition" +MENU IDR_RECOMENU +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "Create &Recognition Context",IDC_CHECK_CREATE,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,10,10,104,12 + CONTROL "Retain Reco A&udio",IDC_CHECK_RETAIN_AUDIO,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,24,76,12 + CONTROL "Load &Dictation",IDC_CHECK_DICTATION,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,123,10,59,12 + CONTROL "&Activate Dictation",IDC_CHECK_DICTATION_ACTIVE,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,187,10,70,12 + CONTROL "&Load C&&C",IDC_CHECK_CFG,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,123,24,58,12 + CONTROL "Acti&vate C&&C",IDC_CHECK_CFG_ACTIVE,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,187,24,58,12 + CONTROL "Activate &Microphone",IDC_CHECK_MIC,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,38,104,12 + CONTROL "Load &Spelling",IDC_CHECK_SPELLING,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,123,39,59,12 + CONTROL "Activate S&pelling",IDC_CHECK_SPELLING_ACTIVE,"Button", + BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,187,39,70,12 + CONTROL "Shar&ed recognizer",IDC_RADIO_SHARED,"Button", + BS_AUTORADIOBUTTON,10,56,248,12 + CONTROL "I&nproc:",IDC_RADIO_INPROC,"Button",BS_AUTORADIOBUTTON, + 10,71,40,12 + COMBOBOX IDC_COMBO_ENGINES,52,71,207,60,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_LIST_PHRASES,7,92,251,70,LBS_OWNERDRAWFIXED | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL + EDITTEXT IDC_STATUS,7,166,251,79,ES_MULTILINE | ES_AUTOHSCROLL | + ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP + EDITTEXT IDC_EDIT_PARSETEXT,8,264,191,16,ES_AUTOHSCROLL + DEFPUSHBUTTON "Su&bmit",IDC_BUTTON_SUBMIT,207,264,50,14,WS_DISABLED + GROUPBOX "Grammars",IDC_STATIC,115,3,143,51 + LTEXT "Static",IDC_GRAMMAR_STATUS,7,250,193,9 + PUSHBUTTON "Al&ternates",IDC_BUTTON_ALTERNATES,207,248,49,14 +END + +IDD_DYNGRAMMARDLG DIALOG DISCARDABLE 0, 0, 217, 226 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dynamic Rules" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "",IDC_EDIT_NEWITEM,"RICHEDIT20A",WS_BORDER | WS_TABSTOP | + 0x80,7,7,203,14 + DEFPUSHBUTTON "&Add Item",IDC_BUTTON_ADDITEM,7,204,55,15,WS_DISABLED + LISTBOX IDC_LIST_ITEMS,5,25,205,170,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Clear all",IDC_BUTTON_CLEARALL,86,205,50,14 + PUSHBUTTON "OK",IDOK,160,205,50,14 +END + +IDD_DIALOG_BETAHELP DIALOG DISCARDABLE 0, 0, 427, 301 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Help for the Reco Tool" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,188,280,50,14 + LTEXT "",IDC_BETA_HELP,11,10,405,260 +END + +IDD_ALTS_DIALOG DIALOG DISCARDABLE 200, 150, 186, 109 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Alternates" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,38,88,50,14 + PUSHBUTTON "Cancel",IDCANCEL,93,88,50,14 + LISTBOX IDC_ALTS_LIST,7,7,172,79,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_RECODLG, DIALOG + BEGIN + BOTTOMMARGIN, 281 + END + + IDD_DYNGRAMMARDLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 210 + TOPMARGIN, 7 + BOTTOMMARGIN, 219 + END + + IDD_DIALOG_BETAHELP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 420 + TOPMARGIN, 7 + BOTTOMMARGIN, 294 + END + + IDD_ALTS_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 102 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_RECOMENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_FILE_EXIT + END + POPUP "&C&&C" + BEGIN + MENUITEM "&Load Grammar...", IDM_CFG_LOAD_GRAMMAR + MENUITEM "&Add Dynamic Rule", IDM_CFG_ADD_DYNAMIC_RULE + MENUITEM "Set Word &Sequence Data...", IDM_CFG_SET_WORD_SEQUENCE_DATA + + END + POPUP "D&ictation" + BEGIN + MENUITEM "&Train from File...", IDM_SLM_TRAIN_FROM_FILE + MENUITEM "&Adapt LM From File...", IDM_SLM_ADAPT_FROM_FILE + MENUITEM "A&dapt LM From Clipboard", IDM_SLM_ADAPT_FROM_CLIPBOARD + END + MENUITEM "&Help!", IDM_HELP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_GRAMMAR_LOAD_FAIL "An error occurred loading the requested grammar." + IDS_RECOCONTEXT_FAIL "An error occurred creating or initializing the recognition context, so speech recognition will not work." + IDS_RULESTATE_FAIL "An error occurred activating the requested grammar. This may indicate an error with your default Speech audio device." + IDS_DEVICE_BUSY "The grammar could not be activated, since your audio device is in already in use by another application. Please shut down all other speech applications and try again. " +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "jpn_reco.rc" +#include "chs_reco.rc" +#include "version.rc2" + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/resource.h b/sp/src/utils/sapi51/Samples/CPP/Reco/resource.h new file mode 100644 index 00000000..b0272593 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/resource.h @@ -0,0 +1,71 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by reco.rc +// +#define IDS_GRAMMAR_LOAD_FAIL 1 +#define IDS_RECOCONTEXT_FAIL 2 +#define IDS_RULESTATE_FAIL 3 +#define IDS_DEVICE_BUSY 4 +#define IDD_RECODLG 100 +#define IDI_RECO 107 +#define IDR_SOL_CFG 134 +#define IDD_DYNGRAMMARDLG 135 +#define IDD_DIALOG_BETAHELP 136 +#define IDR_RECOMENU 137 +#define IDD_ALTS_DIALOG 138 +#define IDC_BUTTON_EXIT 1006 +#define IDC_BUTTON_LOADGRAMMAR 1007 +#define IDC_LIST_PHRASES 1008 +#define IDC_BUTTON_ADD 1009 +#define IDC_BUTTON_DYNRULES 1010 +#define IDC_COMBO_ENGINES 1011 +#define IDC_CHECK_CREATE 1012 +#define IDC_RETAINALL 1013 +#define IDC_CHECK_RETAIN_AUDIO 1014 +#define IDC_CHECK_CFG 1015 +#define IDC_EDIT_PROPS 1016 +#define IDC_CHECK_CFG_ACTIVE 1017 +#define IDC_CHECK_DICTATION 1018 +#define IDC_BUTTON_CLEAR 1019 +#define IDC_CHECK_SPELLING 1019 +#define IDC_EDIT_NEWITEM 1020 +#define IDC_CHECK_DICTATION_ACTIVE 1021 +#define IDC_BUTTON_ADDITEM 1022 +#define IDC_CHECK_SPELLING_ACTIVE 1022 +#define IDC_LIST_ITEMS 1023 +#define IDC_CHECK_MIC 1024 +#define IDC_STATUS 1025 +#define IDC_GRAMMAR_STATUS 1026 +#define IDC_CHECK_ITN 1027 +#define IDC_BUTTON_CLEARALL 1028 +#define IDC_BUTTON_HELP 1031 +#define IDC_ALPHAHELPTEXT 1032 +#define IDC_BUTTON_SUBMIT 1032 +#define IDC_ALPHA_HELP 1034 +#define IDC_BETA_HELP 1034 +#define IDC_STATIC_ENGINE 1036 +#define IDC_EDIT_PARSETEXT 1037 +#define IDC_RADIO_SHARED 1039 +#define IDC_RADIO_INPROC 1040 +#define IDC_BUTTON_ALTERNATES 1041 +#define IDC_ALTS_LIST 1042 +#define IDM_FILE_EXIT 32771 +#define IDM_CFG_LOAD_GRAMMAR 32772 +#define IDM_CFG_ADD_DYNAMIC_RULE 32773 +#define IDM_SLM_ADAPT_FROM_FILE 32774 +#define IDM_SLM_ADAPT_FROM_CLIPBOARD 32775 +#define IDM_SLM_TRAIN_FROM_FILE 32776 +#define IDM_HELP 32777 +#define IDM_CFG_SET_WORD_SEQUENCE_DATA 32778 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 139 +#define _APS_NEXT_COMMAND_VALUE 32778 +#define _APS_NEXT_CONTROL_VALUE 1043 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/small.ico b/sp/src/utils/sapi51/Samples/CPP/Reco/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Reco/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/sol.xml b/sp/src/utils/sapi51/Samples/CPP/Reco/sol.xml new file mode 100644 index 00000000..ec65f76a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/sol.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + +

new +game

-please +
+ + please +

play the

+ ... + + please +
+ + please +

+ +

move

+

put

+ +

the

+

+ + + +

on

+

to

+
+

the

+ +
+ please +
+ + +

+ + red + black + + +

+

+ + +

of

+ + clubs + hearts + diamonds + spades + + +

+ + club + heart + diamond + spade + +
+
+ + + ace + two + three + four + five + six + seven + eight + nine + ten + jack + queen + king + lady + emperor + + +
diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Reco/stdafx.cpp new file mode 100644 index 00000000..a3f9e50c --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/stdafx.cpp @@ -0,0 +1,7 @@ +// stdafx.cpp : source file that includes just the standard includes +// Reco.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Reco/stdafx.h new file mode 100644 index 00000000..a31f0d3c --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/stdafx.h @@ -0,0 +1,51 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include +#include + +// C RunTime Header Files +#include +#include +#include +#include + +// ATL Header Files +#include + +// Multi-Language Header File +#include + +// RichEdit 2.0 +#include + +#ifdef _WIN32_WCE +#include +#define ICON_BIG 1 +#endif + +// SAPI Header Files +#include +#include + +// Local Header Files +#include "reco.h" +#include "resource.h" + + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Reco/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Reco/version.rc2 new file mode 100644 index 00000000..aed1ca9f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Reco/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Reco Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "RECO\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "reco.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.cpp b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.cpp new file mode 100644 index 00000000..818ecccf --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.cpp @@ -0,0 +1,1402 @@ +// SpAudioPlug.cpp : Implementation of CSimpleaudioApp and DLL registration. + +#include "stdafx.h" +#include "simpleaudio.h" +#include "SpAudioPlug.h" + +///////////////////////////////////////////////////////////////////////////// +// + + +template +void CBasicQueueByArray::_Clear() +{ + m_ulQueueSize = 0; + m_ulHeader = 0; + m_ulTail = 0; + m_ullTotalOut = 0; + m_ullTotalIn = 0; + m_ulSpaceNotifySize = 1; + m_ulDataNotifySize = 1; + if (m_pCoMemAlloc) + { + ::CoTaskMemFree(m_pCoMemAlloc); + m_pCoMemAlloc = NULL; + } +} + + + + +template +ULONG CBasicQueueByArray::_SpaceSize() +{ + return (m_ulHeader >= m_ulTail) ? (m_ulQueueSize - (m_ulHeader - m_ulTail) - 1) : (m_ulTail - m_ulHeader - 1); +} + +template +ULONG CBasicQueueByArray::_DataSize() +{ + return (m_ulHeader >= m_ulTail) ? (m_ulHeader - m_ulTail) : (m_ulQueueSize - (m_ulTail - m_ulHeader)); +} + + +template +CBasicQueueByArray::CBasicQueueByArray() : +m_pCoMemAlloc(NULL), +m_ulQueueSize(0), +m_ulHeader(0), +m_ulTail(0), +m_hSpaceAvailable(0), +m_hDataAvailable(0), +m_ullTotalOut(0), +m_ullTotalIn(0), +m_ulSpaceNotifySize(1), +m_ulDataNotifySize(1) +{ + InitializeCriticalSection(&m_CriticalSection); +} + +template +CBasicQueueByArray::CBasicQueueByArray(ULONG ulQueueSize, HRESULT *phr) : +m_pCoMemAlloc(NULL), +m_ulQueueSize(0), +m_ulHeader(0), +m_ulTail(0), +m_hSpaceAvailable(0), +m_hDataAvailable(0), +m_ullTotalOut(0), +m_ullTotalIn(0), +m_ulSpaceNotifySize(1), +m_ulDataNotifySize(1) +{ + InitializeCriticalSection(&m_CriticalSection); + *phr = Init(ulQueueSize); +} + + + +template +HRESULT CBasicQueueByArray::Resize(ULONG ulNewQueueSize) +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + HRESULT hr = S_OK; + if (ulNewQueueSize > m_ulQueueSize-1) + { + T* p = (T*)::CoTaskMemRealloc(m_pCoMemAlloc, sizeof(T)*(ulNewQueueSize+1)); + if (p == NULL) + { + hr = E_OUTOFMEMORY; + } + else + { + m_pCoMemAlloc = p; + if (m_ulHeader >= m_ulTail) + { + //We don't need to do anything. + } + else + { + //data are rounded from end of the queue to the beginning of the queue, we need to move the data to the end of the queue + memmove(m_pCoMemAlloc + ulNewQueueSize + 1 - (m_ulQueueSize - m_ulTail), m_pCoMemAlloc + m_ulTail, (m_ulQueueSize - m_ulTail)*sizeof(T)); + m_ulTail += ulNewQueueSize + 1 - m_ulQueueSize; + } + m_ulQueueSize = ulNewQueueSize + 1; + } + } + else if (ulNewQueueSize < m_ulQueueSize-1) + { + if (m_ulQueueSize-1-ulNewQueueSize > _SpaceSize()) + { + //This could cause loss of data + hr = E_INVALIDARG; + } + else + { + T* p = (T*)::CoTaskMemAlloc(sizeof(T) * (ulNewQueueSize+1)); + if (!p) + { + hr = E_OUTOFMEMORY; + } + else + { + if (m_ulHeader > m_ulTail) + { + //continous memory + memcpy(p, m_pCoMemAlloc + m_ulTail, (m_ulHeader-m_ulTail)*sizeof(T)); + } + else if (m_ulHeader < m_ulTail) + { + //copy the memory from m_ulTail to the end of the memory block + memcpy(p, m_pCoMemAlloc + m_ulTail, (m_ulQueueSize - m_ulTail)*sizeof(T)); + if (m_ulHeader) + { + memcpy(p + (m_ulQueueSize - m_ulTail), m_pCoMemAlloc, m_ulHeader*sizeof(T)); + } + } + m_ulHeader = _DataSize(); + m_ulTail = 0; + + ::CoTaskMemFree(m_pCoMemAlloc); + m_pCoMemAlloc = p; + m_ulQueueSize = ulNewQueueSize + 1; + } + } + } + + return hr; +} + + +template +HRESULT CBasicQueueByArray::Init(ULONG ulQueueSize, HANDLE hSpaceAvailable, HANDLE hDataAvailable, ULONG ulSpaceNotifySize, ULONG ulDataNotifySize) +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + HRESULT hr = S_OK; + if (ulSpaceNotifySize + ulDataNotifySize >= ulQueueSize) + { + //This could cause deadlock between client thread and SAPI read/write thread + return E_INVALIDARG; + } + _Clear(); + if (ulQueueSize) + { + //We allocated additional dummy space is to deal with the case that m_ulHeader catches up from behind to m_ulTail. + //We shouldn't use the dummy space to store any value + m_pCoMemAlloc = (T*)::CoTaskMemAlloc(sizeof(T)*(ulQueueSize + 1)); + if (m_pCoMemAlloc) + { + m_ulQueueSize = ulQueueSize + 1; + } + else + { + hr = E_OUTOFMEMORY; + } + } + + m_hSpaceAvailable = hSpaceAvailable; + m_hDataAvailable = hDataAvailable; + + m_ulSpaceNotifySize = ulSpaceNotifySize; + m_ulDataNotifySize = ulDataNotifySize; + + return hr; +} + + + +template +ULONG CBasicQueueByArray::QueueSize() +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + return m_ulQueueSize ? m_ulQueueSize -1 : 0; +} + + +template +void CBasicQueueByArray::InsertHead(T* pElements, ULONG ulCount, ULONG * pulReturnCount) +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + ULONG ulDataBeforeInsert= _DataSize(); //get the available data before we do the update + + ULONG ulEmpty = _SpaceSize(); + ULONG ulPushCount = (ulEmpty >= ulCount) ? ulCount : ulEmpty; + + if (ulPushCount <= (m_ulQueueSize - m_ulHeader)) + { + memcpy(m_pCoMemAlloc + m_ulHeader, pElements, sizeof(T)*ulPushCount); + } + else + { + memcpy(m_pCoMemAlloc + m_ulHeader, pElements, sizeof(T)*(m_ulQueueSize - m_ulHeader)); + memcpy(m_pCoMemAlloc, pElements + m_ulQueueSize - m_ulHeader, sizeof(T)*(ulPushCount - m_ulQueueSize + m_ulHeader)); + } + + m_ulHeader = (m_ulHeader + ulPushCount) % m_ulQueueSize; + if (pulReturnCount) + { + *pulReturnCount = ulPushCount; + } + + m_ullTotalIn += ulPushCount; + + if (ulDataBeforeInsert < m_ulDataNotifySize && m_ulDataNotifySize <= _DataSize()) + { + ::SetEvent(m_hDataAvailable); + } +} + + + +//When ulCount == 0, the caller wants to get the remaining +template +void CBasicQueueByArray::RemoveTail(T* pElements, ULONG ulCount, ULONG * pulReturnCount) +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + ULONG ulSpaceBeforeRemove = _SpaceSize(); //get the available space before we do the update + + ULONG ulOccupied = _DataSize(); + ULONG ulPopCount = (ulOccupied >= ulCount && ulCount) ? ulCount : ulOccupied; + + if (ulPopCount <= (m_ulQueueSize - m_ulTail)) + { + memcpy(pElements, m_pCoMemAlloc + m_ulTail, sizeof(T)*ulPopCount); + } + else + { + memcpy(pElements, m_pCoMemAlloc + m_ulTail, sizeof(T)*(m_ulQueueSize - m_ulTail)); + memcpy(pElements + m_ulQueueSize - m_ulTail, m_pCoMemAlloc, sizeof(T)*(ulPopCount - m_ulQueueSize + m_ulTail)); + } + + m_ulTail = (m_ulTail + ulPopCount) % m_ulQueueSize; + if (pulReturnCount) + { + *pulReturnCount = ulPopCount; + } + + m_ullTotalOut += ulPopCount; + + if (ulSpaceBeforeRemove < m_ulSpaceNotifySize && m_ulSpaceNotifySize <= _SpaceSize()) + { + ::SetEvent(m_hSpaceAvailable); + } +} + + + +template +void CBasicQueueByArray::ResetPos() +{ + CRITICAL_SECTION_AUTO_LOCK csl(this); + m_ulHeader = 0; + m_ulTail = 0; + m_ullTotalOut = 0; + m_ullTotalIn = 0; +} + + +/**************************************************************************** +* SpAudioPlug::Init * +*------------------------------* +* Description: +****************************************************************************/ +HRESULT SpAudioPlug::Init(VARIANT_BOOL fWrite, SpeechAudioFormatType FormatType) +{ + SPAUTO_OBJ_LOCK; + + HRESULT hr = S_OK; + if (fWrite == VARIANT_TRUE) + { + m_fWrite = TRUE; + } + else + { + m_fWrite = FALSE; + } + + SPSTREAMFORMAT eFormat = (SPSTREAMFORMAT)FormatType; + + if (eFormat == SPSF_Text) + { + return E_INVALIDARG; + } + + if (!m_autohAPIEvent) + { + m_autohAPIEvent = CreateEvent(NULL, TRUE, m_fWrite, NULL); + } + + if (m_State != SPAS_CLOSED) + { + hr = SPERR_DEVICE_BUSY; + } + else + { + if (eFormat != SPSF_NoAssignedFormat && m_Format.ComputeFormatEnum() != eFormat) + { + hr = m_Format.AssignFormat(eFormat); + if (SUCCEEDED(hr)) + { + static const SPAUDIOBUFFERINFO BuffInfo = {50, 500, 0}; + hr = SetBufferInfo(&BuffInfo); + } + } + + m_fautohAPIEventSet = m_fWrite; + } + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetData * +*------------------------------* +* Description: +****************************************************************************/ +HRESULT SpAudioPlug::SetData(VARIANT vData, long * pWritten) +{ + HRESULT hr = S_OK; + + //The method can only be called when the audio object is set to be input device. + if (m_fWrite || m_State != SPAS_RUN) + { + return STG_E_ACCESSDENIED; + } + else + { + bool fByRef = false; + switch (vData.vt) + { + case (VT_ARRAY | VT_BYREF | VT_UI1): + fByRef = true; + break; + case (VT_ARRAY | VT_UI1): + break; + default: + return E_INVALIDARG; + } + + BYTE *pArray = NULL; + ULONG ulDataSize = 0; + + hr = SafeArrayAccessData( fByRef ? *vData.pparray : vData.parray, + (void **)&pArray ); + if( SUCCEEDED( hr ) ) + { + ulDataSize = fByRef ? + (*vData.pparray)->rgsabound[0].cElements : + vData.parray->rgsabound[0].cElements; + } + + ULONG cbRemaining = ulDataSize; + ULONG ulWrite = 0; + BYTE * pHeader = pArray; + + if (pWritten) + { + *pWritten = 0; + } + + while(cbRemaining) + { + m_Queue.InsertHead(pHeader, cbRemaining, &ulWrite); + _ProcessEvent(); + + cbRemaining -= ulWrite; + pHeader += ulWrite; + if (pWritten) + { + *pWritten += ulWrite; + } + + if (ulWrite == 0) + { + DWORD dwReturn = ::WaitForSingleObject(m_hQueueHasSpaceEvent, INFINITE); + if (dwReturn == WAIT_OBJECT_0) + { + //It could be signalled by SetState thread, or Read thread + if (m_State == SPAS_CLOSED) + { + //Signalled by SetState thread + break; + } + else + { + //Signalled by Read thread + } + } + } + } + + SafeArrayUnaccessData( fByRef ? *vData.pparray : vData.parray); + + } + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::GetData * +*------------------------------* +* Description: +****************************************************************************/ +HRESULT SpAudioPlug::GetData(VARIANT* pData) +{ + HRESULT hr = S_OK; + + //The method can only be called when the audio object is set to be output device. + if (!m_fWrite) + { + return STG_E_ACCESSDENIED; + } + + //We can lock the queue several times on the same thread without blocking the client thread, this is character of critical section + //The reason we want to lock the queue explicitly is the possible inconsistent state between + m_Queue.Lock(); + ULONG ulDataAvailable = m_Queue.DataSize(); + if (ulDataAvailable) + { + BYTE *pArray = NULL; + SAFEARRAY* psa = SafeArrayCreateVector( VT_UI1, 0, ulDataAvailable); + if( psa ) + { + if( SUCCEEDED( hr = SafeArrayAccessData( psa, (void **)&pArray) ) ) + { + m_Queue.RemoveTail(pArray, ulDataAvailable, NULL); + SafeArrayUnaccessData( psa ); + VariantClear( pData ); + pData->vt = VT_ARRAY | VT_UI1; + pData->parray = psa; + } + else + { + // Free our memory if we failed. + hr = SafeArrayDestroy(psa); + VariantClear( pData ); + } + + } + else + { + hr = E_OUTOFMEMORY; + } + } + else + { + VariantClear( pData ); + hr = S_FALSE; + } + + + _ProcessEvent(); + + m_Queue.Unlock(); + + return hr; +} + + + +/**************************************************************************** +* SpAudioPlug::SpAudioPlug * +*------------------------------* +* Description: +* ctor +*********************************************************************/ +SpAudioPlug::SpAudioPlug() : +m_State(SPAS_CLOSED), +m_fWrite(TRUE), +m_SpEventSource(this), +m_cbEventBias(0), +m_ulBufferNotifySize(0), +m_hQueueHasDataEvent(NULL), +m_hQueueHasSpaceEvent(NULL), +m_autohAPIEvent(NULL) +{ + InitializeCriticalSection(&m_CriticalSection); +} + +/**************************************************************************** +* SpAudioPlug::FinalConstruct * +*-----------------------------* +* Description: +* Called by ATL when our object is constructed. +************************************************************************/ +HRESULT SpAudioPlug::FinalConstruct() +{ + HRESULT hr = S_OK; + + hr = m_Format.AssignFormat(SPSF_22kHz16BitMono); + + if (SUCCEEDED(hr)) + { + m_hQueueHasDataEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + } + + if (SUCCEEDED(hr)) + { + m_hQueueHasSpaceEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + } + + + + static const SPAUDIOBUFFERINFO BuffInfo = {50, 500, 0}; + hr = SetBufferInfo(&BuffInfo); + + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::FinalRelease * +*-----------------------------* +* Description: +* Called by ATL when our object is going away. +*********************************************************************/ +void SpAudioPlug::FinalRelease() +{ + if (m_hQueueHasDataEvent) + { + ::CloseHandle(m_hQueueHasDataEvent); + } + + if (m_hQueueHasSpaceEvent) + { + ::CloseHandle(m_hQueueHasSpaceEvent); + } + + if (m_autohAPIEvent) + { + CloseHandle(m_autohAPIEvent); + } + + DeleteCriticalSection(&m_CriticalSection); + + +} + + + +/**************************************************************************** +* SpAudioPlug::AddEvents * +*-----------------------* +* Description: +* ISpEventSink::AddEvents implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::AddEvents(const SPEVENT* pEventArray, ULONG ulCount) +{ + HRESULT hr = S_OK; + SPAUTO_OBJ_LOCK; + + if( SPIsBadReadPtr(pEventArray, sizeof(SPEVENT ) * ulCount)) + { + hr = E_INVALIDARG; + } + else + { + ULONGLONG ullDevicePosition = m_fWrite ? m_Queue.GetTotalOut() : m_Queue.GetTotalIn(); + hr = m_SpEventSource._AddEvents(pEventArray, ulCount); + m_SpEventSource._CompleteEvents(ullDevicePosition + m_cbEventBias); + } + return hr; +} + + + +/**************************************************************************** +* SpAudioPlug::GetEventInterest * +*------------------------------* +* Description: +* ISpEventSink::GetEventInterest implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetEventInterest(ULONGLONG * pullEventInterest) +{ + HRESULT hr = S_OK; + SPAUTO_OBJ_LOCK; + + if (SP_IS_BAD_WRITE_PTR(pullEventInterest)) + { + hr = E_POINTER; + } + else + { + *pullEventInterest = m_SpEventSource.m_ullEventInterest; + } + + return hr; +} + + + +/**************************************************************************** +* SpAudioPlug::_ProcessEvent * +*---------------------* +* Description: +* +* Return: +*********************************************************************/ +void SpAudioPlug::_ProcessEvent() +{ + BOOL fSetEvent; + if (m_fWrite) + { + if (m_Queue.DataSize() < m_ulBufferNotifySize) + { + fSetEvent = TRUE; + } + else + { + fSetEvent = FALSE; + } + } + else + { + if (m_Queue.DataSize() >= m_ulBufferNotifySize) + { + fSetEvent = TRUE; + } + else + { + fSetEvent = FALSE; + } + } + if (fSetEvent != m_fautohAPIEventSet) + { + if (fSetEvent) + { + SetEvent(m_autohAPIEvent); + } + else + { + ResetEvent(m_autohAPIEvent); + } + m_fautohAPIEventSet = fSetEvent; + } + + ULONGLONG ullDevicePosition = m_fWrite ? m_Queue.GetTotalOut() : m_Queue.GetTotalIn(); + m_SpEventSource._CompleteEvents(ullDevicePosition + m_cbEventBias); + +} + + +/**************************************************************************** +* SpAudioPlug::Read * +*---------------------* +* Description: +* ISequentialStream::Read implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Read(void * pv, ULONG cb, ULONG *pcbRead) +{ + SPDBG_FUNC("SpAudioPlug::Read"); + HRESULT hr = S_OK; + + if (SPIsBadWritePtr(pv, cb) || + SP_IS_BAD_OPTIONAL_WRITE_PTR(pcbRead)) + { + return E_POINTER; + } + + if (m_fWrite) + { + return STG_E_ACCESSDENIED; + } + + if (pcbRead) + { + *pcbRead = 0; + } + + ULONG cbRemaining = cb; + BYTE *pTail = (BYTE*)pv; + ULONG ulRead = 0; + + while(cbRemaining) + { + + m_Queue.RemoveTail(pTail, cbRemaining, &ulRead); + _ProcessEvent(); + + + + if (ulRead) + { + cbRemaining -= ulRead; + pTail += ulRead; + + if (pcbRead) + { + *pcbRead += ulRead; + } + } + else + { + if (m_State == SPAS_RUN) + { + DWORD dwReturn = ::WaitForSingleObject(m_hQueueHasDataEvent, 1000); + + if (dwReturn == WAIT_OBJECT_0) + { + //Signalled by SetData thread + } + else if (dwReturn == WAIT_TIMEOUT) + { + hr = SPERR_AUDIO_BUFFER_UNDERFLOW; + break; + } + + } + else + { + break; + } + } + + } + + + SPDBG_REPORT_ON_FAIL(hr); + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::Write * +*----------------------* +* Description: +* ISequentialStream::Write implementation. +* +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Write(const void * pv, ULONG cb, ULONG *pcb) +{ + SPDBG_FUNC("SpAudioPlug::Write"); + HRESULT hr = S_OK; + + if (!m_fWrite) + { + return STG_E_ACCESSDENIED; + } + else if (m_State != SPAS_RUN && m_State != SPAS_PAUSE) + { + return SPERR_AUDIO_STOPPED; + } + else + { + ULONG cbRemaining = cb; + ULONG ulWrite = 0; + BYTE * pHeader = (BYTE*)pv; + while(cbRemaining) + { + m_Queue.InsertHead(pHeader, cbRemaining, &ulWrite); + _ProcessEvent(); + + + cbRemaining -= ulWrite; + pHeader += ulWrite; + if (pcb) + { + *pcb += ulWrite; + } + + if (ulWrite == 0) + { + DWORD dwReturn = ::WaitForSingleObject(m_hQueueHasSpaceEvent, INFINITE); + if (dwReturn == WAIT_OBJECT_0) + { + //It could be signalled by SetState thread, or GetData thread + if (m_State == SPAS_CLOSED) + { + //Signalled by SetState thread + break; + } + else + { + //Signalled by GetData thread + } + } + } + } + + } + + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::Seek * +*---------------------* +* Description: +* IStream::Seek implementation. It can only be used to retrieve the current seek position +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER * plibNewPosition) +{ + SPDBG_FUNC("SpAudioPlug::Seek"); + SPAUTO_OBJ_LOCK; + + HRESULT hr = S_OK; + + if (dwOrigin != STREAM_SEEK_CUR || dlibMove.QuadPart) + { + hr = E_INVALIDARG; + } + else + { + if (SPIsBadWritePtr(plibNewPosition, sizeof(*plibNewPosition))) + { + hr = E_POINTER; + } + else + { + ULONGLONG ullSeekPosition = m_fWrite ? m_Queue.GetTotalIn() : m_Queue.GetTotalOut(); + plibNewPosition->QuadPart = ullSeekPosition; + } + } + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetSize * +*------------------------* +* Description: +* IStream::SetSize implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetSize(ULARGE_INTEGER libNewSize) +{ + SPDBG_FUNC("SpAudioPlug::SetSize"); + SPAUTO_OBJ_LOCK; + + return m_Queue.Resize(libNewSize.LowPart); +} + +/**************************************************************************** +* SpAudioPlug::CopyTo * +*-----------------------* +* Description: +* IStream::CopyTo implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) +{ + SPDBG_FUNC("SpAudioPlug::CopyTo"); + SPAUTO_OBJ_LOCK; + if (m_fWrite) + { + return STG_E_ACCESSDENIED; + } + else + { + return E_NOTIMPL; + } +} + +/**************************************************************************** +* SpAudioPlug::Commit * +*-----------------------* +* Description: +* IStream::Commit implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Commit(DWORD grfCommitFlags) +{ + SPDBG_FUNC("SpAudioPlug::Commit"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + if (m_fWrite && m_State == SPAS_RUN) + { + _ProcessEvent(); // Call this to clear the event if we're writing + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::Revert * +*-----------------------* +* Description: +* IStream::Revert implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Revert(void) +{ + SPDBG_FUNC("SpAudioPlug::Revert"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::LockRegion * +*---------------------------* +* Description: +* IStream::LockRegion implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +{ + SPDBG_FUNC("SpAudioPlug::LockRegion"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::UnlockRegion * +*-----------------------------* +* Description: +* IStream::UnlockRegion implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) +{ + SPDBG_FUNC("SpAudioPlug::UnlockRegion"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::Stat * +*---------------------* +* Description: +* IStream::Stat implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Stat(STATSTG *pstatstg, DWORD grfStatFlag) +{ + SPDBG_FUNC("SpAudioPlug::Stat"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::Clone * +*----------------------* +* Description: +* IStream::Clone implementation. Delegate to the actual audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::Clone(IStream **ppstm) +{ + SPDBG_FUNC("SpAudioPlug::Clone"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL; +} + +/**************************************************************************** +* SpAudioPlug::GetFormat * +*--------------------------* +* Description: +* ISpStreamFormat::GetFormat implementation. +* GetFormat is called for input device +* +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetFormat(GUID * pguidFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + SPDBG_FUNC("SpAudioPlug::GetFormat"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + if (SP_IS_BAD_WRITE_PTR(pguidFormatId) || + SP_IS_BAD_WRITE_PTR(ppCoMemWaveFormatEx)) + { + return E_POINTER; + } + + //m_guidFormatId and m_pCoMemWaveFormatEx need to be initialized by ISpAudioPlug::Init + if (m_Format.FormatId() == GUID_NULL || m_Format.WaveFormatExPtr() == NULL) + { + hr = SPERR_UNINITIALIZED; + } + else + { + hr = m_Format.CopyTo(pguidFormatId, ppCoMemWaveFormatEx); + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetState * +*-------------------------* +* Description: +* ISpAudio::SetState implementation. +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetState(SPAUDIOSTATE NewState, ULONGLONG ullReserved ) +{ + SPDBG_FUNC("SpAudioPlug::SetState"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + if (m_State != NewState) + { + m_State = NewState; + + if (NewState != SPAS_RUN) + { + if (NewState == SPAS_STOP || NewState == SPAS_CLOSED) + { + m_Queue.ResetPos(); + } + SetEvent(m_hQueueHasDataEvent); //Signal the read/getdata thread it exit + SetEvent(m_hQueueHasSpaceEvent); //Signal the write/setdata thread it exit + } + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetFormat * +*--------------------------* +* Description: +* ISpAudio::SetFormat implementation. We don't allow setting the format +* to anything other than the input format. +* We'll let the format converter do the right thing for us for +* the SR engine. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetFormat(REFGUID rguidFmtId, const WAVEFORMATEX * pWaveFormatEx) +{ + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + if (!m_Format.IsEqual(rguidFmtId, pWaveFormatEx)) + { + hr = SPERR_UNSUPPORTED_FORMAT; + } + + return hr; +} + +/**************************************************************************** +* SpAudioPlug::GetStatus * +*--------------------------* +* Description: +* ISpAudio::GetStatus implementation. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetStatus(SPAUDIOSTATUS *pStatus) +{ + SPDBG_FUNC("SpAudioPlug::GetStatus"); + SPAUTO_OBJ_LOCK; + HRESULT hr = S_OK; + if (SP_IS_BAD_WRITE_PTR(pStatus)) + { + hr = E_POINTER; + } + else + { + //Because there are more than one operation on m_Queue, we need to lock the queue explicitly + m_Queue.Lock(); + + if (m_State == SPAS_RUN) + { + long lDataInQueue = (long)(m_Queue.DataSize()); + pStatus->cbFreeBuffSpace = ((long)m_Queue.QueueSize()) - lDataInQueue; + + if (m_fWrite) + { + pStatus->cbNonBlockingIO = pStatus->cbFreeBuffSpace; + } + else + { + pStatus->cbNonBlockingIO = lDataInQueue; + } + } + else + { + pStatus->cbFreeBuffSpace = 0; + pStatus->cbNonBlockingIO = 0; + } + pStatus->CurSeekPos = m_fWrite ? m_Queue.GetTotalIn() : m_Queue.GetTotalOut(); + pStatus->State = m_State; + pStatus->CurDevicePos = m_fWrite ? m_Queue.GetTotalOut() : m_Queue.GetTotalIn();; + pStatus->dwReserved1 = 0; + pStatus->dwReserved2 = 0; + + m_Queue.Unlock(); + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetBufferInfo * +*------------------------------* +* Description: +* ISpAudio::SetBufferInfo implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetBufferInfo(const SPAUDIOBUFFERINFO * pInfo) +{ + SPDBG_FUNC("SpAudioPlug::SetBufferInfo"); + SPAUTO_OBJ_LOCK; + + HRESULT hr = S_OK; + + + if (m_State != SPAS_CLOSED) + { + hr = SPERR_DEVICE_BUSY; + } + else + { + m_BufferInfo = *pInfo; + if (m_fWrite) + { + m_Queue.Init(m_Format.WaveFormatExPtr()->nAvgBytesPerSec * pInfo->ulMsBufferSize / 1000, + m_hQueueHasSpaceEvent, + m_hQueueHasDataEvent, + m_Format.WaveFormatExPtr()->nAvgBytesPerSec *pInfo->ulMsMinNotification / 1000, + 1); + } + else + { + m_Queue.Init(m_Format.WaveFormatExPtr()->nAvgBytesPerSec * pInfo->ulMsBufferSize / 1000, + m_hQueueHasSpaceEvent, + m_hQueueHasDataEvent, + 1, + 1); + } + + m_cbEventBias = (m_Format.WaveFormatExPtr()->nAvgBytesPerSec * pInfo->ulMsEventBias) / 1000; + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::GetBufferInfo * +*------------------------------* +* Description: +* ISpAudio::GetBufferInfo implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetBufferInfo(SPAUDIOBUFFERINFO * pInfo) +{ + SPDBG_FUNC("SpAudioPlug::GetBufferInfo"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + *pInfo = m_BufferInfo; + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::GetDefaultFormat * +*---------------------------------* +* Description: +* ISpAudio::GetDefaultFormat implementation. +* GetDefaultFormat is called for output device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetDefaultFormat(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + SPDBG_FUNC("SpAudioPlug::GetDefaultFormat"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + if (SP_IS_BAD_WRITE_PTR(pFormatId) || + SP_IS_BAD_WRITE_PTR(ppCoMemWaveFormatEx)) + { + return E_POINTER; + } + + //m_guidFormatId and m_pCoMemWaveFormatEx need to be initialized by ISpAudioPlug::Init + if (m_Format.FormatId() == GUID_NULL || m_Format.WaveFormatExPtr() == NULL) + { + hr = SPERR_UNINITIALIZED; + } + else + { + hr = m_Format.CopyTo(pFormatId, ppCoMemWaveFormatEx); + } + + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::EventHandle * +*----------------------------* +* Description: +* ISpAudio::EventHandle implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP_(HANDLE) SpAudioPlug::EventHandle() +{ + SPDBG_FUNC("SpAudioPlug::EventHandle"); + + SPAUTO_OBJ_LOCK; + + return m_autohAPIEvent; +} + +/**************************************************************************** +* SpAudioPlug::GetVolumeLevel * +*-------------------------------* +* Description: +* ISpAudio:GetVolumeLevel implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetVolumeLevel(ULONG *pLevel) +{ + SPDBG_FUNC("SpAudioPlug::GetVolumeLevel"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL ; +} + +/**************************************************************************** +* SpAudioPlug::SetVolumeLevel * +*-------------------------------* +* Description: +* ISpAudio::SetVolumeLevel implementation. Delegate to the actual audio +* device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetVolumeLevel(ULONG Level) +{ + SPDBG_FUNC("SpAudioPlug::SetVolumeLevel"); + + SPAUTO_OBJ_LOCK; + + return E_NOTIMPL ; +} + +/**************************************************************************** +* SpAudioPlug::GetBufferNotifySize * +*------------------------------------* +* Description: +* ISpAudio::GetBufferNotifySize implementation. Delegate to the actual +* audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::GetBufferNotifySize(ULONG *pcbSize) +{ + SPDBG_FUNC("SpAudioPlug::GetBufferNotifySize"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + *pcbSize = m_ulBufferNotifySize; + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} + +/**************************************************************************** +* SpAudioPlug::SetBufferNotifySize * +*------------------------------------* +* Description: +* ISpAudio::SetBufferNotifySize implementation. Delegate to the actual +* audio device. +* +* Return: +* S_OK on success +* FAILED(hr) otherwise +*********************************************************************/ +STDMETHODIMP SpAudioPlug::SetBufferNotifySize(ULONG cbSize) +{ + SPDBG_FUNC("SpAudioPlug::SetBufferNotifySize"); + HRESULT hr = S_OK; + + SPAUTO_OBJ_LOCK; + + m_ulBufferNotifySize = cbSize; + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.h b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.h new file mode 100644 index 00000000..83d504ad --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.h @@ -0,0 +1,246 @@ +// SpAudioPlug.h: Definition of the SpAudioPlug class +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_SPAUDIOPLUG_H__AD57CF29_3B4A_40A9_BB01_9BE69043E1DF__INCLUDED_) +#define AFX_SPAUDIOPLUG_H__AD57CF29_3B4A_40A9_BB01_9BE69043E1DF__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" // main symbols + + +//The queue object itself is thread safe. Different threads could call the different methods on the same object. +//The queue object uses contiguous memory block for queue operation. + +template +class CCriticalSectionLock +{ +private: +T* m_pObject; + +public: + CCriticalSectionLock(T* pObject) + { + m_pObject = pObject; + m_pObject->Lock(); + } + ~CCriticalSectionLock() + { + m_pObject->Unlock(); + } +}; + + +template +class CBasicQueueByArray +{ + private: + typedef CCriticalSectionLock< CBasicQueueByArray > CRITICAL_SECTION_AUTO_LOCK; + + T* m_pCoMemAlloc; + ULONG m_ulQueueSize; //In terms of the number of element of T in the queue, not the total bytes + ULONG m_ulHeader; //In terms of the number of element offset from the beginning of memory, range from 0 to m_ulQueueSize - 1 + ULONG m_ulTail; //In terms of the number of element offset from the beginning of memory, range from 0 to m_ulQueueSize - 1 + ULONGLONG m_ullTotalOut; //the total bytes read out of the queue by RemoveTail + ULONGLONG m_ullTotalIn; //the total bytes put into the queue by InsertHead + + CRITICAL_SECTION m_CriticalSection; + HANDLE m_hSpaceAvailable; //signalled when the queue has space + HANDLE m_hDataAvailable; //signalled when the the queue has m_ulNotifySize or more data + ULONG m_ulSpaceNotifySize; //when the available space is equal or more than this amount, we need to signal m_hSpaceAvailable + ULONG m_ulDataNotifySize; //when the available data is equal or more than this amount, we need to signal m_hDataAvailable + + void _Clear(); + + ULONG _SpaceSize(); + ULONG _DataSize(); + + + public: + CBasicQueueByArray(); + CBasicQueueByArray(ULONG ulQueueSize, HRESULT *phr); + ~CBasicQueueByArray() + { + DeleteCriticalSection(&m_CriticalSection); + if (m_pCoMemAlloc) + { + ::CoTaskMemFree(m_pCoMemAlloc); + } + } + + void Lock() + { + EnterCriticalSection(&m_CriticalSection); + } + + void Unlock() + { + LeaveCriticalSection(&m_CriticalSection); + } + + + HRESULT Resize(ULONG ulNewQueueSize); + + HRESULT Init + (ULONG ulQueueSize, HANDLE hSpaceAvailable, HANDLE hDataAvailable, ULONG ulSpaceNotifySize, ULONG ulDataNotifySize); + ULONG QueueSize(); + + void InsertHead(T* pElements, ULONG ulCount, ULONG * pulReturnCount); + void RemoveTail(T* pElements, ULONG ulCount, ULONG * pulReturnCount); + void ResetPos(); + ULONGLONG GetTotalOut() + { + CRITICAL_SECTION_AUTO_LOCK csl(this); + return m_ullTotalOut; + } + ULONGLONG GetTotalIn() + { + CRITICAL_SECTION_AUTO_LOCK csl(this); + return m_ullTotalIn; + } + ULONG DataSize() + { + CRITICAL_SECTION_AUTO_LOCK csl(this); + return _DataSize(); + } + + +}; + +///////////////////////////////////////////////////////////////////////////// +// SpAudioPlug + +class SpAudioPlug : + public ISpAudio, + public ISpEventSource, + public ISpEventSink, + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl, + public IDispatchImpl + +{ +public: + SpAudioPlug(); + HRESULT FinalConstruct(); + void FinalRelease(); + +BEGIN_COM_MAP(SpAudioPlug) + COM_INTERFACE_ENTRY(ISpAudioPlug) + COM_INTERFACE_ENTRY(ISequentialStream) + COM_INTERFACE_ENTRY(IStream) + COM_INTERFACE_ENTRY(ISpStreamFormat) + COM_INTERFACE_ENTRY(ISpAudio) + COM_INTERFACE_ENTRY(ISpNotifySource) + COM_INTERFACE_ENTRY(ISpEventSource) + COM_INTERFACE_ENTRY(ISpEventSink) + COM_INTERFACE_ENTRY2(IDispatch, ISpeechAudio) + COM_INTERFACE_ENTRY(ISpeechAudio) + COM_INTERFACE_ENTRY(ISpeechBaseStream) +END_COM_MAP() +//DECLARE_NOT_AGGREGATABLE(SpAudioPlug) +// Remove the comment from the line above if you don't want your object to +// support aggregation. + +DECLARE_REGISTRY_RESOURCEID(IDR_SpAudioPlug) + +// ISpAudioPlug + STDMETHODIMP Init(VARIANT_BOOL fWrite, SpeechAudioFormatType FormatType); + STDMETHODIMP SetData(VARIANT vData, long * pWritten); + STDMETHODIMP GetData(VARIANT* vData); + + + //--- ISequentialStream --- + STDMETHODIMP Read(void * pv, ULONG cb, ULONG *pcbRead); + STDMETHODIMP Write(const void * pv, ULONG cb, ULONG *pcbWritten); + + //--- IStream --- + STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition); + STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize); + STDMETHODIMP CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten); + STDMETHODIMP Commit(DWORD grfCommitFlags); + STDMETHODIMP Revert(void); + STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); + STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); + STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag); + STDMETHODIMP Clone(IStream **ppstm); + + //--- ISpStreamFormat --- + STDMETHODIMP GetFormat(GUID * pguidFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); + + //--- ISpAudio --- + STDMETHODIMP SetState(SPAUDIOSTATE NewState, ULONGLONG ullReserved ); + STDMETHODIMP SetFormat(REFGUID rguidFmtId, const WAVEFORMATEX * pWaveFormatEx); + STDMETHODIMP GetStatus(SPAUDIOSTATUS *pStatus); + STDMETHODIMP SetBufferInfo(const SPAUDIOBUFFERINFO * pInfo); + STDMETHODIMP GetBufferInfo(SPAUDIOBUFFERINFO * pInfo); + STDMETHODIMP GetDefaultFormat(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); + STDMETHODIMP_(HANDLE) EventHandle(); + STDMETHODIMP GetVolumeLevel(ULONG *pLevel); + STDMETHODIMP SetVolumeLevel(ULONG Level); + STDMETHODIMP GetBufferNotifySize(ULONG *pcbSize); + STDMETHODIMP SetBufferNotifySize(ULONG cbSize); + + //--- ISpNotifySource --- + //--- ISpEventSource --- + CSpEventSource m_SpEventSource; + DECLARE_SPEVENTSOURCE_METHODS(m_SpEventSource) + + //--- ISpEventSink --- + STDMETHODIMP AddEvents(const SPEVENT* pEventArray, ULONG ulCount); + STDMETHODIMP GetEventInterest(ULONGLONG * pullEventInterest); + + //--- ISpeechBaseStream ---------------------------------------- + STDMETHODIMP get_Format(ISpeechAudioFormat** ppStreamFormat) { return E_NOTIMPL; }; + STDMETHODIMP putref_Format(ISpeechAudioFormat* pFormat) { return E_NOTIMPL; }; + STDMETHODIMP Read(VARIANT* pvtBuffer, long NumBytes, long* pRead) { return E_NOTIMPL;} + STDMETHODIMP Write(VARIANT vtBuffer, long* pWritten) { return E_NOTIMPL;} + STDMETHODIMP Seek(VARIANT Pos, SpeechStreamSeekPositionType Origin, VARIANT* pNewPosition) { return E_NOTIMPL; }; + + //--- ISpeechAudio ---------------------------------- + STDMETHODIMP SetState( SpeechAudioState State ) { return E_NOTIMPL; }; + STDMETHODIMP get_Status( ISpeechAudioStatus** ppStatus ) { return E_NOTIMPL; }; + STDMETHODIMP get_BufferInfo(ISpeechAudioBufferInfo** ppBufferInfo) { return E_NOTIMPL; }; + STDMETHODIMP get_DefaultFormat(ISpeechAudioFormat** ppStreamFormat) { return E_NOTIMPL; }; + STDMETHODIMP get_Volume(long* pVolume) { return E_NOTIMPL; }; + STDMETHODIMP put_Volume(long Volume) { return E_NOTIMPL; }; + STDMETHODIMP get_BufferNotifySize(long* pBufferNotifySize) { return E_NOTIMPL; }; + STDMETHODIMP put_BufferNotifySize(long BufferNotifySize) { return E_NOTIMPL; }; + STDMETHODIMP get_EventHandle(long* pEventHandle) { return E_NOTIMPL; }; + + void Lock() + { + EnterCriticalSection(&m_CriticalSection); + } + + void Unlock() + { + LeaveCriticalSection(&m_CriticalSection); + } + + +private: + SPAUDIOSTATE m_State; + CSpStreamFormat m_Format; + CBasicQueueByArray m_Queue; + SPAUDIOBUFFERINFO m_BufferInfo; + ULONG m_cbEventBias; + BOOL m_fWrite; + HANDLE m_hQueueHasDataEvent; //The event is signaled by SetData/GetData thread or SAPI SetState thread. Read/Write thread waits for this event. + HANDLE m_hQueueHasSpaceEvent; //The event is signaled by Read/Write thread or SAPI SetState thread , SetData/GetData thread waits for this event. + + ULONG m_ulBufferNotifySize; + HANDLE m_autohAPIEvent; //When there are m_ulBufferNotifySize data available + BOOL m_fautohAPIEventSet; + CRITICAL_SECTION m_CriticalSection; + + void _ProcessEvent(); + +}; + +#define SPAUTO_OBJ_LOCK CCriticalSectionLock< SpAudioPlug > lck(this) + +#endif // !defined(AFX_SPAUDIOPLUG_H__AD57CF29_3B4A_40A9_BB01_9BE69043E1DF__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.rgs b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.rgs new file mode 100644 index 00000000..b13bb4d3 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/SpAudioPlug.rgs @@ -0,0 +1,23 @@ +HKCR +{ + Simpleaudio.SpAudioPlug.1 = s 'SpAudioPlug Class' + { + CLSID = s '{F0CB433F-9453-466A-A35E-95909872E2A8}' + } + Simpleaudio.SpAudioPlug = s 'SpAudioPlug Class' + { + CLSID = s '{F0CB433F-9453-466A-A35E-95909872E2A8}' + } + NoRemove CLSID + { + ForceRemove {F0CB433F-9453-466A-A35E-95909872E2A8} = s 'SpAudioPlug Class' + { + ProgID = s 'Simpleaudio.SpAudioPlug.1' + VersionIndependentProgID = s 'Simpleaudio.SpAudioPlug' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'both' + } + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.cpp b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.cpp new file mode 100644 index 00000000..a5eea178 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.cpp @@ -0,0 +1,12 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.h b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.h new file mode 100644 index 00000000..a047f50f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/StdAfx.h @@ -0,0 +1,33 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__C748285E_9F4E_4F76_A1CD_B963593A52DD__INCLUDED_) +#define AFX_STDAFX_H__C748285E_9F4E_4F76_A1CD_B963593A52DD__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef STRICT +#define STRICT +#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include +#include "sapi.h" +#include "sphelper.h" +#include "spddkhlp.h" +#include "speventq.h" + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__C748285E_9F4E_4F76_A1CD_B963593A52DD__INCLUDED) diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/resource.h b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/resource.h new file mode 100644 index 00000000..eeec4a4d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by simpleaudio.rc +// +#define IDS_PROJNAME 100 +#define IDS_SPAUDIOPLUG_DESC 101 +#define IDR_SpAudioPlug 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.cpp b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.cpp new file mode 100644 index 00000000..58ea3bc5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.cpp @@ -0,0 +1,72 @@ +// simpleaudio.cpp : Implementation of DLL Exports. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f simpleaudiops.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "simpleaudio.h" + +#include "simpleaudio_i.c" +#include "SpAudioPlug.h" + + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_SpAudioPlug, SpAudioPlug) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_SIMPLEAUDIOLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.def b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.def new file mode 100644 index 00000000..38f5c0f7 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.def @@ -0,0 +1,9 @@ +; simpleaudio.def : Declares the module parameters. + +LIBRARY "simpleaudio.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.dsp b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.dsp new file mode 100644 index 00000000..ea69409a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.dsp @@ -0,0 +1,336 @@ +# Microsoft Developer Studio Project File - Name="simpleaudio" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=simpleaudio - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "simpleaudio.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "simpleaudio.mak" CFG="simpleaudio - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "simpleaudio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "simpleaudio - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "simpleaudio - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=.\Debug\simpleaudio.dll +InputPath=.\Debug\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\DebugU +TargetPath=.\DebugU\simpleaudio.dll +InputPath=.\DebugU\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=.\ReleaseMinSize\simpleaudio.dll +InputPath=.\ReleaseMinSize\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=.\ReleaseMinDependency\simpleaudio.dll +InputPath=.\ReleaseMinDependency\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=.\ReleaseUMinSize\simpleaudio.dll +InputPath=.\ReleaseUMinSize\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "simpleaudio - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD MTL /I "..\..\..\idl" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 sapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\simpleaudio.dll +InputPath=.\ReleaseUMinDependency\simpleaudio.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "simpleaudio - Win32 Debug" +# Name "simpleaudio - Win32 Unicode Debug" +# Name "simpleaudio - Win32 Release MinSize" +# Name "simpleaudio - Win32 Release MinDependency" +# Name "simpleaudio - Win32 Unicode Release MinSize" +# Name "simpleaudio - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\simpleaudio.cpp +# End Source File +# Begin Source File + +SOURCE=.\simpleaudio.def +# End Source File +# Begin Source File + +SOURCE=.\simpleaudio.idl +# ADD MTL /tlb ".\simpleaudio.tlb" /h "simpleaudio.h" /iid "simpleaudio_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\simpleaudio.rc +# End Source File +# Begin Source File + +SOURCE=.\SpAudioPlug.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\SpAudioPlug.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\SpAudioPlug.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.idl b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.idl new file mode 100644 index 00000000..185773b1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.idl @@ -0,0 +1,59 @@ +// simpleaudio.idl : IDL source for simpleaudio.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (simpleaudio.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; +import "sapi.idl"; + + +typedef [hidden] enum DISPID_SpAudioPlug +{ + DISPID_SAPInit = 1000, + DISPID_SAPSetData, + DISPID_SAPGetData +} DISPID_SpAudioPlug; + + + +[ + object, + uuid(1CE52E86-6B75-4749-BBAC-3D23626DA468), + dual, + helpstring("ISpAudioPlug Interface"), + pointer_default(unique) +] +interface ISpAudioPlug : IDispatch +{ + + [helpstring("Init"), id(DISPID_SAPInit)] + HRESULT Init([in] VARIANT_BOOL fWrite, [in] SpeechAudioFormatType FormatType); + + [helpstring("SetData"), id(DISPID_SAPSetData)] + HRESULT SetData([in] VARIANT vData, [out, retval] long * pWritten); + + [helpstring("GetData"), id(DISPID_SAPGetData)] + HRESULT GetData([out, retval] VARIANT* vData); +}; + +[ + uuid(17709AA0-2512-4FFE-BB24-1F6C535DEBCA), + version(1.0), + helpstring("simpleaudio 1.0 Type Library") +] +library SIMPLEAUDIOLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(F0CB433F-9453-466A-A35E-95909872E2A8), + helpstring("SpAudioPlug Class") + ] + coclass SpAudioPlug + { + [default] interface ISpAudioPlug; + }; +}; diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.rc b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.rc new file mode 100644 index 00000000..51bae98e --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/simpleaudio.rc @@ -0,0 +1,93 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""simpleaudio.tlb""\r\n" + "#include ""version.rc2""\r\n""\0" +END + + + +#endif // APSTUDIO_INVOKED + + + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_SpAudioPlug REGISTRY DISCARDABLE "SpAudioPlug.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "simpleaudio" + IDS_SPAUDIOPLUG_DESC "SpAudioPlug Class" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "simpleaudio.tlb" +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/version.rc2 new file mode 100644 index 00000000..9bf18fa9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleAudioDll/version.rc2 @@ -0,0 +1,45 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "\0" + VALUE "FileDescription", "simpleaudio Module\0" + VALUE "FileVersion", "1, 0, 0, 0\0" + VALUE "InternalName", "simpleaudio\0" + VALUE "LegalCopyright", "Copyright 2001\0" + VALUE "LegalTrademarks", "\0" + VALUE "OLESelfRegister", "\0" + VALUE "OriginalFilename", "simpleaudio.DLL\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "simpleaudio Module\0" + VALUE "ProductVersion", "1, 0, 0, 0\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/resource.h b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/resource.h new file mode 100644 index 00000000..ffe470be --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/resource.h @@ -0,0 +1,40 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by simpledict.rc +// +#define IDC_BUTTON_DELETEITEM 2 +#define IDC_BUTTON_CLEARALL 3 +#define IDD_RECODLG 100 +#define IDD_SIMPLEDICTDLG 100 +#define IDI_RECO 107 +#define IDR_SOL_CFG 134 +#define IDD_DYNGRAMMARDLG 135 +#define IDI_SIMPLEDICT 137 +#define IDC_BUTTON_EXIT 1006 +#define IDC_LIST_PHRASES 1008 +#define IDC_BUTTON_ADD 1009 +#define IDC_BUTTON_DYNRULES 1009 +#define IDC_COMBO_ENGINES 1010 +#define IDC_CHECK_CREATE 1011 +#define IDC_RETAINALL 1012 +#define IDC_RETAINRECO 1013 +#define IDC_CHECK_CFG 1014 +#define IDC_EDIT_PROPS 1015 +#define IDC_CHECK_DICTATION 1016 +#define IDC_BUTTON_CLEAR 1017 +#define IDC_EDIT_NEWITEM 1017 +#define IDC_BUTTON_ADDITEM 1018 +#define IDC_LIST_ITEMS 1019 +#define IDC_EDIT_DICT 1021 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 138 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1024 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.cpp b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.cpp new file mode 100644 index 00000000..7fbb5aa8 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.cpp @@ -0,0 +1,226 @@ +/**************************************************************************** +* SimpleDict.cpp +* A very simple dictation app. The user speaks, and whatever the +* engine recognizes appears in an edit box. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include +#include "simpledict.h" + +// Foward declarations of functions included in this code module: +LRESULT CALLBACK SimpleDictDlgProc( HWND, UINT, WPARAM, LPARAM ); + +// Entry point +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ +#ifdef _WIN32_WCE + if (SUCCEEDED(::CoInitializeEx(NULL,COINIT_MULTITHREADED))) +#else + if (SUCCEEDED(::CoInitialize(NULL))) +#endif + { + // NOTE: Extra scope provided so DlgInfo is destroyed before CoUninitialize is called. + { + CSimpleDict SimpleDictClass( hInstance ); + ::DialogBoxParam( hInstance, MAKEINTRESOURCE( IDD_SIMPLEDICTDLG ), NULL, + (DLGPROC) CSimpleDict::SimpleDictDlgProc, (LPARAM) &SimpleDictClass ); + } + ::CoUninitialize(); + } + return 0; +} + + + +/********************************************************************************************* +* CSimpleDict::SimpleDictDlgProc() +* Main message handler for SimpleDict dialog box. +* At initialization time, LPARAM is the CSimpleDict object, to which the +* window long is set. +**********************************************************************************************/ +LRESULT CALLBACK CSimpleDict::SimpleDictDlgProc(HWND hDlg, + UINT message, + WPARAM wParam, + LPARAM lParam) +{ + CSimpleDict *pThis = (CSimpleDict *) ::GetWindowLong( hDlg, GWL_USERDATA ); + switch( message ) + { + case WM_INITDIALOG: + ::SetWindowLong( hDlg, GWL_USERDATA, lParam ); + pThis = (CSimpleDict *) lParam; + if ( !pThis->InitDialog( hDlg ) ) + { + ::DestroyWindow( hDlg ); + } + break; + + case WM_RECOEVENT: + // All recognition events send this message, because that is how we + // specified we should be notified + pThis->RecoEvent(); + return TRUE; + break; + + case WM_COMMAND: + if ( LOWORD( wParam ) == IDC_BUTTON_EXIT ) + { + ::EndDialog( hDlg, TRUE ); + } + break; + + case WM_CLOSE: + ::EndDialog( hDlg, TRUE ); + break; + + case WM_DESTROY: + // Release the recognition context and the dictation grammar + pThis->m_cpRecoCtxt.Release(); + pThis->m_cpDictationGrammar.Release(); + + break; + + default: + return FALSE; + break; + } + + return TRUE; +} + +/********************************************************************************************* +* CSimpleDict::InitDialog() +* Creates the recognition context and activates the grammar. +* Returns TRUE iff successful. +**********************************************************************************************/ +bool CSimpleDict::InitDialog( HWND hDlg ) +{ + m_hDlg = hDlg; + + HRESULT hr = S_OK; + CComPtr cpRecoEngine; + hr = cpRecoEngine.CoCreateInstance(CLSID_SpInprocRecognizer); + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoEngine->CreateRecoContext( &m_cpRecoCtxt ); + } + + + // Set recognition notification for dictation + if (SUCCEEDED(hr)) + { + hr = m_cpRecoCtxt->SetNotifyWindowMessage( hDlg, WM_RECOEVENT, 0, 0 ); + } + + + if (SUCCEEDED(hr)) + { + // This specifies which of the recognition events are going to trigger notifications. + // Here, all we are interested in is the beginning and ends of sounds, as well as + // when the engine has recognized something + const ULONGLONG ullInterest = SPFEI(SPEI_RECOGNITION); + hr = m_cpRecoCtxt->SetInterest(ullInterest, ullInterest); + } + + // create default audio object + CComPtr cpAudio; + hr = SpCreateDefaultObjectFromCategoryId(SPCAT_AUDIOIN, &cpAudio); + + // set the input for the engine + hr = cpRecoEngine->SetInput(cpAudio, TRUE); + hr = cpRecoEngine->SetRecoState( SPRST_ACTIVE ); + + + + + + if (SUCCEEDED(hr)) + { + // Specifies that the grammar we want is a dictation grammar. + // Initializes the grammar (m_cpDictationGrammar) + hr = m_cpRecoCtxt->CreateGrammar( GID_DICTATION, &m_cpDictationGrammar ); + } + if (SUCCEEDED(hr)) + { + hr = m_cpDictationGrammar->LoadDictation(NULL, SPLO_STATIC); + } + if (SUCCEEDED(hr)) + { + hr = m_cpDictationGrammar->SetDictationState( SPRS_ACTIVE ); + } + if (FAILED(hr)) + { + m_cpDictationGrammar.Release(); + } + + return (hr == S_OK); +} + +/***************************************************************************************** +* CSimpleDict::RecoEvent() +* Called whenever the dialog process is notified of a recognition event. +* Inserts whatever is recognized into the edit box. +******************************************************************************************/ +void CSimpleDict::RecoEvent() +{ + USES_CONVERSION; + CSpEvent event; + + // Process all of the recognition events + while (event.GetFrom(m_cpRecoCtxt) == S_OK) + { + switch (event.eEventId) + { + case SPEI_SOUND_START: + m_bInSound = TRUE; + break; + + case SPEI_SOUND_END: + if (m_bInSound) + { + m_bInSound = FALSE; + if (!m_bGotReco) + { + // The sound has started and ended, + // but the engine has not succeeded in recognizing anything + const TCHAR szNoise[] = _T(""); + ::SendDlgItemMessage( m_hDlg, IDC_EDIT_DICT, + EM_REPLACESEL, TRUE, (LPARAM) szNoise ); + } + m_bGotReco = FALSE; + } + break; + + case SPEI_RECOGNITION: + // There may be multiple recognition results, so get all of them + { + m_bGotReco = TRUE; + static const WCHAR wszUnrecognized[] = L""; + + CSpDynamicString dstrText; + if (FAILED(event.RecoResult()->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, NULL))) + { + dstrText = wszUnrecognized; + } + + // Concatenate a space onto the end of the recognized word + dstrText.Append(L" "); + + ::SendDlgItemMessage( m_hDlg, IDC_EDIT_DICT, EM_REPLACESEL, TRUE, (LPARAM) W2T(dstrText) ); + + } + break; + + } + } +} + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.dsp b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.dsp new file mode 100644 index 00000000..655d0e80 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.dsp @@ -0,0 +1,134 @@ +# Microsoft Developer Studio Project File - Name="simpledict" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=simpledict - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "simpledict.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "simpledict.mak" CFG="simpledict - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "simpledict - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "simpledict - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "simpledict - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "simpledict - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "simpledict - Win32 Release" +# Name "simpledict - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\simpledict.cpp +# End Source File +# Begin Source File + +SOURCE=.\simpledict.rc +# End Source File +# Begin Source File + +SOURCE=.\stdafx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\simpledict.h +# End Source File +# Begin Source File + +SOURCE=.\stdafx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\reco.ico +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# End Group +# Begin Source File + +SOURCE=.\sol.cfg +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.h b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.h new file mode 100644 index 00000000..b5a0aeef --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.h @@ -0,0 +1,40 @@ +/**************************************************************************** +* SimpleDict.h +* Definition of the CSimpleDict class +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "resource.h" +#define MAX_EDIT_TEXT 1000 +#define GID_DICTATION 0 // Dictation grammar has grammar ID 0 + +#define WM_RECOEVENT WM_APP // Window message used for recognition events + +class CSimpleDict +{ +public: + CSimpleDict( HINSTANCE hInstance ) : + m_hInstance( hInstance ), + m_bGotReco( FALSE ), + m_bInSound( FALSE ) + {} + + static LRESULT CALLBACK CSimpleDict::SimpleDictDlgProc( HWND, UINT, WPARAM, LPARAM ); + // Message handler + bool InitDialog( HWND hDlg ); // Starts up SR + void RecoEvent(); // Called whenever dialog process is notified of recognition + + HINSTANCE m_hInstance; + HWND m_hDlg; + BOOL m_bInSound; + BOOL m_bGotReco; + LCID m_lcid; + CComPtr m_cpRecoCtxt; + CComPtr m_cpDictationGrammar; +}; + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.ico b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.ico new file mode 100644 index 00000000..43f13171 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.rc b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.rc new file mode 100644 index 00000000..97734611 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/simpledict.rc @@ -0,0 +1,113 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SIMPLEDICT ICON DISCARDABLE "simpledict.ico" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_SIMPLEDICTDLG DIALOG DISCARDABLE 30, 30, 274, 225 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "Simple dictation application" +FONT 8, "MS Shell Dlg" +BEGIN + EDITTEXT IDC_EDIT_DICT,10,34,251,142,ES_MULTILINE | + ES_AUTOVSCROLL + PUSHBUTTON "E&xit",IDC_BUTTON_EXIT,201,194,60,18 + LTEXT "Dictate text here:",IDC_STATIC,10,8,251,16 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_SIMPLEDICTDLG, DIALOG + BEGIN + BOTTOMMARGIN, 213 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/small.ico b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/small.ico new file mode 100644 index 00000000..43f13171 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.cpp new file mode 100644 index 00000000..ef5c4607 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// Reco.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.h new file mode 100644 index 00000000..c9574613 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/stdafx.h @@ -0,0 +1,41 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif // WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +#ifdef _WIN32_WCE +#include +#define ICON_BIG 1 +#endif + + +// Local Header Files + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleDict/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/version.rc2 new file mode 100644 index 00000000..ab3fadac --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleDict/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Simple Dictation Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SimpleDict\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "SimpleDict.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.cpp b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.cpp new file mode 100644 index 00000000..10dc14d9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.cpp @@ -0,0 +1,62 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + callnot.cpp + +Abstract: + + Implementation of the ITTAPIEventNotification interface. + + This is an outgoing interface that is defined by TAPI 3.0. This + is basically a callback function that TAPI 3.0 calls to inform + the application of events related to calls (on a specific address) + + Please refer to COM documentation for information on outgoing + interfaces. + + An application must implement and register this interface in order + to receive calls and events related to calls + +--*/ + +#include +#include "callnot.h" + +/////////////////////////////////////////////////////////////////// +// CallEventNotification +// +// The only method in the ITCallEventNotification interface. This gets +// called by TAPI 3.0 when there is a call event to report. This just +// posts the message to our UI thread, so that we do as little as +// possible on TAPI's callback thread. +// +/////////////////////////////////////////////////////////////////// + +HRESULT +STDMETHODCALLTYPE +CTAPIEventNotification::Event( + TAPI_EVENT TapiEvent, + IDispatch * pEvent + ) +{ + // + // Addref the event so it doesn't go away. + // + + pEvent->AddRef(); + + // + // Post a message to our own UI thread. + // + + PostMessage( m_hWnd, + WM_PRIVATETAPIEVENT, + (WPARAM) TapiEvent, + (LPARAM) pEvent + ); + + return S_OK; +} + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.h b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.h new file mode 100644 index 00000000..a2d94428 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/callnot.h @@ -0,0 +1,113 @@ +/*++ + +Copyright (c) Microsoft Corporation. All rights reserved. + +Module Name: + callnot.h + +Abstract: + + Declaration of the CTAPIEventNotification object + +--*/ + +#ifndef __TAPIEventNotification_H__ +#define __TAPIEventNotification_H__ + +#define WM_PRIVATETAPIEVENT WM_USER+101 + +///////////////////////////////////////////////////////////////////////////// +// CTAPIEventNotification +class CTAPIEventNotification : public ITTAPIEventNotification +{ +private: + // Refcount for COM + LONG m_dwRefCount; + + // Member data + HWND m_hWnd; + +public: + + // CTAPIEventNotification implements ITTAPIEventNotification + // Declare ITTAPIEventNotification methods here + HRESULT STDMETHODCALLTYPE Event( + TAPI_EVENT TapiEvent, + IDispatch * pEvent + ); + + +// other COM stuff: +public: + + // constructor + CTAPIEventNotification() {} + // destructor + ~CTAPIEventNotification(){} + + // initialization function + // this stuff could also be done in the + // constructor + HRESULT Initialize( ) + { + m_dwRefCount = 1; + return S_OK; + } + + void Shutdown() + { + } + + void SetHWND( HWND hWnd ) + { + m_hWnd = hWnd; + } + + // IUnknown implementation + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) + { + if (iid == IID_ITTAPIEventNotification) + { + AddRef(); + *ppvObject = (void *)this; + return S_OK; + } + + if (iid == IID_IUnknown) + { + AddRef(); + *ppvObject = (void *)this; + return S_OK; + } + + return E_NOINTERFACE; + } + + // + // reference counting needs to be thread safe + // + + ULONG STDMETHODCALLTYPE AddRef() + { + ULONG l = InterlockedIncrement(&m_dwRefCount); + return l; + } + + ULONG STDMETHODCALLTYPE Release() + { + ULONG l = InterlockedDecrement(&m_dwRefCount); + + if ( 0 == l) + { + delete this; + } + + return l; + } + + +}; + +#endif //__TAPIEventNotification_H__ + + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.cpp b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.cpp new file mode 100644 index 00000000..659cf536 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.cpp @@ -0,0 +1,1312 @@ +////////////////////////////////////////////////////////// +// SIMPLETELEPHONY.EXE +// +// Sample application that handles incoming TAPI calls +// and does some speech recognition and text-to-speech. +// +// In order to receive incoming calls, the application must +// implement and register the outgoing ITCallNotification +// interface. +// +// This application will register to receive calls on +// all addresses that support at least the audio media type. +// +// NOTE: This application is limited to working with one +// call at at time, and will not work correctly if multiple +// calls are present at the same time. +// +// NOTE: The call-handling sequence in this application is +// short, so it is fine to make it all the way through to +// the end of the call even if the caller hung up in the +// middle. If your telephony app involves a lengthy +// call-handling sequence, you need a separate thread to +// listen for TAPI's CS_DISCONNECT message; otherwise your +// app will have no way of being notified of the hang-up, +// and your app will appear to have hung. +////////////////////////////////////////////////////////// + +/**************************************************************************** +* Operator.cpp +* Implementation of the COperator class for the simpletelephony +* project. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include // In general, you need to have the + // Microsoft Platform SDK installed + // in order to have this file +#include "operator.h" +#include "resource.h" + +#define CALLER_TIMEOUT 8000 // Wait 8 seconds before giving up on a caller + +/********************************************************** +* WinMain * +*---------* +* Description: +* Main entry point for the application +***********************************************************/ +int WINAPI WinMain( + HINSTANCE hInst, + HINSTANCE hPrevInst, + LPSTR lpCmdLine, + int nCmdShow + ) +{ + // Initialize COM. + if (FAILED(::CoInitialize( NULL ))) + { + return 0; + } + + // Create an instance of our main call-handling class + COperator *pOperator = new COperator( hInst ); + if ( !pOperator ) + { + return 0; + } + + // Does initialization of SAPI and TAPI objects + HRESULT hr = pOperator->Initialize(); + if ( FAILED( hr ) ) + { + return 0; + } + + // everything is initialized, so + // start the main dialog box + ::DialogBoxParam( hInst, + MAKEINTRESOURCE(IDD_MAINDLG), + NULL, + MainDialogProc, + (LPARAM) pOperator + ); + + // This does the cleanup of SAPI and TAPI objects + delete pOperator; + + ::CoUninitialize(); + + return 1; +} + +/********************************************************** +* COperator::~COperator * +*-----------------------* +* Description: +* Destructor for the COperator class. +* Cleans up SAPI and TAPI objects. +***********************************************************/ +COperator::~COperator() +{ + ShutdownSapi(); + ShutdownTapi(); +} /* COperator::~COperator */ + +/********************************************************** +* COperator::Initialize * +*-----------------------* +* Description: +* Initializes SAPI and TAPI +* Return: +* S_OK if both SAPI and TAPI initialized successfully +***********************************************************/ +HRESULT COperator::Initialize() +{ + HRESULT hr = InitializeSapi(); + if ( SUCCEEDED( hr ) ) + { + hr = InitializeTapi(); + } + return hr; +} /* COperator::Initialize */ + +/********************************************************** +* COperator::InitializeSapi * +*---------------------------* +* Description: +* Various SAPI initializations. +* Return: +* S_OK if SAPI initialized successfully +* Return values of failed SAPI initialization +* functions +***********************************************************/ +HRESULT COperator::InitializeSapi() +{ + // Create a voice for speaking on this machine + HRESULT hr = m_cpLocalVoice.CoCreateInstance( CLSID_SpVoice ); + if ( FAILED( hr ) ) + { + DoMessage( L"Could not create a TTS voice on the local machine" ); + return hr; + } + + // Create a reco engine for recognizing speech over the phone + // This is an inproc recognizer since it will likely be + // using a format other than the default + hr = m_cpIncomingRecognizer.CoCreateInstance( CLSID_SpInprocRecognizer ); + if ( FAILED(hr) ) + { + DoMessage(L"CoCreateInstance on inproc reco engine failed"); + return hr; + } + + // Create a reco context for this engine + hr = m_cpIncomingRecognizer->CreateRecoContext( &m_cpIncomingRecoCtxt ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not create recognition context"); + return hr; + } + + // Set interest only in PHRASE_START, RECOGNITION, FALSE_RECOGNITION + const ULONGLONG ullInterest = SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | + SPFEI(SPEI_FALSE_RECOGNITION); + hr = m_cpIncomingRecoCtxt->SetInterest( ullInterest, ullInterest ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not set interest in SAPI events"); + return hr; + } + + // Retain recognized audio + hr = m_cpIncomingRecoCtxt->SetAudioOptions( SPAO_RETAIN_AUDIO, NULL, NULL ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not set audio options to retain recognized audio"); + return hr; + } + + // Create a dictation grammar and load it + hr = m_cpIncomingRecoCtxt->CreateGrammar( 0, &m_cpDictGrammar ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not create dictation grammar"); + return hr; + } + + hr = m_cpDictGrammar->LoadDictation( NULL, SPLO_STATIC ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not load dictation"); + return hr; + } + + // Create a voice for talking on the phone. + hr = m_cpIncomingRecoCtxt->GetVoice( &m_cpOutgoingVoice ); + if ( FAILED(hr) ) + { + DoMessage(L"Could not create a TTS voice for speaking over the phone"); + return hr; + } + + return S_OK; +} /* COperator::InitializeSapi */ + + +/********************************************************** +* COperator::InitializeTapi * +*---------------------------* +* Description: +* Various TAPI initializations +* Return: +* S_OK iff TAPI initialized successfully +* Return values of failed TAPI initialization +* functions +***********************************************************/ +HRESULT COperator::InitializeTapi() +{ + // Cocreate the TAPI object + HRESULT hr = CoCreateInstance( + CLSID_TAPI, + NULL, + CLSCTX_INPROC_SERVER, + IID_ITTAPI, + (LPVOID *)&m_pTapi + ); + + if ( FAILED(hr) ) + { + DoMessage(L"CoCreateInstance on TAPI failed"); + return hr; + } + + // call ITTAPI::Initialize(). this must be called before + // any other tapi functions are called. + hr = m_pTapi->Initialize(); + + if ( FAILED(hr) ) + { + DoMessage(L"TAPI failed to initialize"); + m_pTapi->Release(); + m_pTapi = NULL; + return hr; + } + + // Create our own event notification object and register it + // See callnot.h and callnot.cpp + m_pTAPIEventNotification = new CTAPIEventNotification; + if ( NULL == m_pTAPIEventNotification ) + { + return E_OUTOFMEMORY; + } + hr = m_pTAPIEventNotification->Initialize(); + + if ( SUCCEEDED( hr ) ) + { + hr = RegisterTapiEventInterface(); + } + + // Set the Event filter to only give us only the events we process + if ( SUCCEEDED( hr ) ) + { + hr = m_pTapi->put_EventFilter(TE_CALLNOTIFICATION | TE_CALLSTATE); + } + + if ( FAILED( hr ) ) + { + DoMessage( L"Could not set up TAPI event notifications" ); + return hr; + } + + + // Find all address objects that we will use to listen for calls on + hr = ListenOnAddresses(); + + if ( FAILED(hr) ) + { + DoMessage(L"Could not find any addresses to listen on"); + + m_pTapi->Release(); + m_pTapi = NULL; + + return hr; + } + + return S_OK; +} /* COperator::InitializeTapi */ + +/********************************************************** +* COperator::ShutdownSapi * +*-------------------------* +* Description: +* Releases all SAPI objects +***********************************************************/ +void COperator::ShutdownSapi() +{ + m_cpMMSysAudioIn.Release(); + m_cpMMSysAudioOut.Release(); + m_cpDictGrammar.Release(); + m_cpIncomingRecoCtxt.Release(); + m_cpIncomingRecognizer.Release(); + m_cpLocalVoice.Release(); + m_cpOutgoingVoice.Release(); +} /* COperator::ShutdownSapi */ + +/********************************************************** +* COperator::ShutdownTapi * +*-------------------------* +* Description: +* Releases all TAPI objects +***********************************************************/ +void COperator::ShutdownTapi() +{ + // if there is still a call, release it + if (NULL != m_pCall) + { + m_pCall->Release(); + m_pCall = NULL; + } + + // release main object. + if (NULL != m_pTapi) + { + m_pTapi->Shutdown(); + m_pTapi->Release(); + } +} /* COperator::ShutdownTapi */ + + +/********************************************************** +* MainDialogProc * +*----------------* +* Description: +* Main dialog proc for this sample +***********************************************************/ +BOOL CALLBACK MainDialogProc( + HWND hDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam + ) +{ + // This is set to be the window long in WM_INITDIALOG + COperator *pThis = (COperator *) ::GetWindowLong( hDlg, GWL_USERDATA ); + + switch (uMsg) + { + case WM_INITDIALOG: + { + // Get the pointer to the COperator object from the lParam. + // Store it in the window long as user data + pThis = (COperator *) lParam; + ::SetWindowLong( hDlg, GWL_USERDATA, (LPARAM) pThis ); + + // Hand the window handle to the event notification object + // so that this window will get window messages about incoming calls + pThis->m_pTAPIEventNotification->SetHWND( hDlg ); + + // Get the window handle + pThis->m_hDlg = hDlg; + + // Wait for a call + ::EnableWindow( ::GetDlgItem( hDlg, IDC_ANSWER ), FALSE ); + pThis->SetStatusMessage( L"Waiting for a call..." ); + + return 0; + } + + case WM_PRIVATETAPIEVENT: + { + // This message is received whenever a TAPI event occurs + pThis->OnTapiEvent( (TAPI_EVENT) wParam, + (IDispatch *) lParam ); + + return 0; + } + + case WM_COMMAND: + { + if ( LOWORD(wParam) == IDCANCEL ) + { + // Quit + EndDialog( hDlg, 0 ); + + return 1; + } + + switch ( LOWORD(wParam) ) + { + case IDC_AUTOANSWER: + { + // Auto answer check box state was changed + pThis->m_fAutoAnswer = !pThis->m_fAutoAnswer; + return 1; + } + + case IDC_ANSWER: + { + // Answer the call + + pThis->SetStatusMessage(L"Answering..."); + + if ( S_OK == pThis->AnswerTheCall() ) + { + pThis->SetStatusMessage(L"Connected"); + + ::EnableWindow( ::GetDlgItem( hDlg, IDC_ANSWER ), FALSE ); + + // Connected: Talk to the caller + + // PLEASE NOTE: This is a single-threaded app, so if the caller + // hangs up after the call-handling sequence has started, the + // app will not be notified until after the entire call sequence + // has finished. + // If you want to be able to cut the call-handling short because + // the caller hung up, you need to have a separate thread listening + // for TAPI's CS_DISCONNECT notification. + HRESULT hrHandleCall = pThis->HandleCall(); + if ( FAILED( hrHandleCall ) ) + { + if ( TAPI_E_DROPPED == hrHandleCall ) + { + pThis->SetStatusMessage( L"Caller hung up prematurely" ); + } + else + { + pThis->DoMessage( L"Error encountered handling the call" ); + } + } + + // Hang up if we still need to + if ( NULL != pThis->m_pCall ) + { + // The caller is still around; hang up on him + pThis->SetStatusMessage(L"Disconnecting..."); + if (S_OK != pThis->DisconnectTheCall()) + { + pThis->DoMessage(L"Disconnect failed"); + } + } + } + else + { + ::EnableWindow( ::GetDlgItem( hDlg, IDC_ANSWER ), FALSE ); + pThis->DoMessage(L"Answer failed"); + } + + // Waiting for the next call... + pThis->SetStatusMessage(L"Waiting for a call..."); + + return 1; + } + + case IDC_DISCONNECTED: + { + // This message is sent from OnTapiEvent() + // Disconnected notification -- release the call + pThis->ReleaseTheCall(); + + ::EnableWindow( ::GetDlgItem( hDlg, IDC_ANSWER ), FALSE ); + + pThis->SetStatusMessage(L"Waiting for a call..."); + + return 1; + } + default: + + return 0; + } + } + default: + + return 0; + } +} /* MainDialogProc */ + +/////////////////////////////////////////////////////////// +// TAPI actions +/////////////////////////////////////////////////////////// + +/********************************************************** +* COperator::RegisterTapiEventInterface * +*---------------------------------------* +* Description: +* Get a unique identifier (m_ulAdvice) for +* this connection point. +* Return: +* S_OK +* Failed HRESULTs from QI(), +* IConnectionPointContainer::FindConnectionPoint(), +* or IConnectionPoint::Advise() +***********************************************************/ +HRESULT COperator::RegisterTapiEventInterface() +{ + HRESULT hr = S_OK; + IConnectionPointContainer * pCPC; + IConnectionPoint * pCP; + + + hr = m_pTapi->QueryInterface( IID_IConnectionPointContainer, + (void **)&pCPC ); + + if ( SUCCEEDED( hr ) ) + { + hr = pCPC->FindConnectionPoint( IID_ITTAPIEventNotification, + &pCP ); + pCPC->Release(); + } + + if ( SUCCEEDED( hr ) ) + { + hr = pCP->Advise( m_pTAPIEventNotification, + &m_ulAdvise ); + + pCP->Release(); + } + return hr; +} /* COperator::RegisterTapiEventInterface */ + +/********************************************************** +* COperator::ListenOnAddresses * +*------------------------------* +* Description: +* Find all addresses that support audio in and audio +* out. Call ListenOnThisAddress to start listening +* Return: +* S_OK +* S_FALSE if there are no addresses to listen on +* Failed HRESULT ITTAPI::EnumberateAddresses() +* or IEnumAddress::Next() +************************************************************/ +HRESULT COperator::ListenOnAddresses() +{ + // enumerate the addresses + IEnumAddress * pEnumAddress; + HRESULT hr = m_pTapi->EnumerateAddresses( &pEnumAddress ); + + if ( FAILED(hr) ) + { + return hr; + } + + ITAddress * pAddress; + bool fAddressExists = false; + while ( true ) + { + // get the next address + hr = pEnumAddress->Next( 1, &pAddress, NULL ); + if (S_OK != hr) + { + // Done dealing with all the addresses + break; + } + + // Does the address support audio? + if ( AddressSupportsMediaType(pAddress, TAPIMEDIATYPE_AUDIO) ) + { + // If it does then we'll listen. + HRESULT hrListen = ListenOnThisAddress( pAddress ); + + if ( S_OK == hrListen ) + { + fAddressExists = true; + } + } + pAddress->Release(); + + } + pEnumAddress->Release(); + + if ( !fAddressExists ) + { + DoMessage( L"Could not find any addresses to listen on" ); + } + + if ( FAILED( hr ) ) + { + return hr; + } + else + { + return fAddressExists ? S_OK : S_FALSE; + } +} /* COperator::ListenOnAddress */ + +/********************************************************** +* COperator::ListenOnThisAddress * +*--------------------------------* +* Description: +* Call RegisterCallNotifications() to inform TAPI +* that we want notifications of calls on this +* address. We already registered our notification +* interface with TAPI, so now we are just telling +* TAPI that we want calls from this address to +* trigger our existing notification interface. +* Return: +* Return value of ITTAPI::RegisterCallNotifications() +************************************************************/ +HRESULT COperator::ListenOnThisAddress( ITAddress * pAddress ) +{ + // RegisterCallNotifications takes a media type set of flags indicating + // the set of media types we are interested in. We know the + // address supports audio (see COperator::ListenOnAddress()) + long lMediaTypes = TAPIMEDIATYPE_AUDIO; + + long lRegister; + return m_pTapi->RegisterCallNotifications( + pAddress, + VARIANT_TRUE, + VARIANT_TRUE, + lMediaTypes, + m_ulAdvise, + &lRegister ); +} /* COperator::ListenOnAddress */ + + +/********************************************************** +* COperator::AnswerTheCall * +*--------------------------* +* Description: +* Called whenever notification is received of an +* incoming call and the app wants to answer it. +* Answers and handles the call. +* Return: +* S_OK +* Failed retval of QI(), ITCallInfo::get_Address(), +* COperator::SetAudioOutForCall(), +************************************************************/ +HRESULT COperator::AnswerTheCall() +{ + + if (NULL == m_pCall) + { + return E_UNEXPECTED; + } + + // Get the LegacyCallMediaControl interface so that we can + // get a device ID to reroute the audio + ITLegacyCallMediaControl *pLegacyCallMediaControl; + HRESULT hr = m_pCall->QueryInterface( IID_ITLegacyCallMediaControl, + (void**)&pLegacyCallMediaControl ); + + + // Set the audio for the SAPI objects so that the call + // can be handled + if ( SUCCEEDED( hr ) ) + { + hr = SetAudioOutForCall( pLegacyCallMediaControl ); + if ( FAILED( hr ) ) + { + DoMessage( L"Could not set up audio out for text-to-speech" ); + } + } + if ( SUCCEEDED( hr ) ) + { + hr = SetAudioInForCall( pLegacyCallMediaControl ); + if ( FAILED( hr ) ) + { + DoMessage( L"Could not set up audio in for speech recognition" ); + } + } + pLegacyCallMediaControl->Release(); + if ( FAILED(hr) ) + { + return hr; + } + + // Now we can actually answer the call + hr = m_pCall->Answer(); + + return hr; +} /* COperator::AnswerTheCall */ + +/********************************************************** +* COperator::DisconnectTheCall * +*------------------------------* +* Description: +* Disconnects the call +* Return: +* S_OK +* S_FALSE if there was no call +* Failed return value of ITCall::Disconnect() +************************************************************/ +HRESULT COperator::DisconnectTheCall() +{ + HRESULT hr = S_OK; + if (NULL != m_pCall) + { + // Hang up + return m_pCall->Disconnect( DC_NORMAL ); + + // Do not release the call yet, as that would prevent + // us from receiving the disconnected notification. + } + else + { + return S_FALSE; + } +} /* COperator::DisconnectTheCall */ + +/********************************************************** +* COperator::ReleaseTheCall * +*---------------------------* +* Description: +* Releases the call +************************************************************/ +void COperator::ReleaseTheCall() +{ + if (NULL != m_pCall) + { + m_pCall->Release(); + m_pCall = NULL; + } + + // Let go of the SAPI audio in and audio out objects + if ( m_cpMMSysAudioOut ) + { + m_cpMMSysAudioOut->SetState( SPAS_STOP, 0 ); + } + if ( m_cpMMSysAudioIn ) + { + m_cpMMSysAudioIn->SetState( SPAS_STOP, 0 ); + } + + m_cpMMSysAudioOut.Release(); + m_cpMMSysAudioIn.Release(); +} /* COperator::ReleaseTheCall */ + +/********************************************************** +* COperator::OnTapiEvent * +*------------------------* +* Description: +* This is the real TAPI event handler, called on our +* UI thread upon receipt of the WM_PRIVATETAPIEVENT +* message. +* Return: +* S_OK +************************************************************/ +HRESULT COperator::OnTapiEvent( TAPI_EVENT TapiEvent, + IDispatch * pEvent ) +{ + HRESULT hr; + switch ( TapiEvent ) + { + case TE_CALLNOTIFICATION: + { + // TE_CALLNOTIFICATION means that the application is being notified + // of a new call. + // + // Note that we don't answer to call at this point. The application + // should wait for a CS_OFFERING CallState message before answering + // the call. + // + ITCallNotificationEvent * pNotify; + hr = pEvent->QueryInterface( IID_ITCallNotificationEvent, (void **)&pNotify ); + if (S_OK != hr) + { + DoMessage( L"Incoming call, but failed to get the interface"); + } + else + { + CALL_PRIVILEGE cp; + ITCallInfo * pCall; + + // Get the call + hr = pNotify->get_Call( &pCall ); + pNotify->Release(); + if ( SUCCEEDED(hr) ) + { + // Check to see if we own the call + hr = pCall->get_Privilege( &cp ); + if ( FAILED(hr) || (CP_OWNER != cp) ) + { + // Just ignore it if we don't own it + pCall->Release(); + pEvent->Release(); // We addrefed it CTAPIEventNotification::Event() + return S_OK; + } + + // Get the ITBasicCallControl interface and save it in our + // member variable. + hr = pCall->QueryInterface( IID_ITBasicCallControl, + (void**)&m_pCall ); + pCall->Release(); + + if ( SUCCEEDED(hr) ) + { + // Update UI + ::EnableWindow( ::GetDlgItem( m_hDlg, IDC_ANSWER ), TRUE ); + SetStatusMessage(L"Incoming Owner Call"); + } + } + } + + break; + } + + case TE_CALLSTATE: + { + // TE_CALLSTATE is a call state event. pEvent is + // an ITCallStateEvent + + // Get the interface + ITCallStateEvent * pCallStateEvent; + hr = pEvent->QueryInterface( IID_ITCallStateEvent, (void **)&pCallStateEvent ); + if ( FAILED(hr) ) + { + break; + } + + // Get the CallState that we are being notified of. + CALL_STATE cs; + hr = pCallStateEvent->get_State( &cs ); + pCallStateEvent->Release(); + if ( FAILED(hr) ) + { + break; + } + + // If it's offering to be answered, update our UI + if (CS_OFFERING == cs) + { + if (m_fAutoAnswer) + { + ::PostMessage(m_hDlg, WM_COMMAND, IDC_ANSWER, 0); + } + else + { + SetStatusMessage(L"Click the Answer button"); + } + } + else if (CS_DISCONNECTED == cs) + { + ::PostMessage(m_hDlg, WM_COMMAND, IDC_DISCONNECTED, 0); + } + else if (CS_CONNECTED == cs) + { + // Nothing to do -- we handle connection synchronously + } + break; + } + default: + break; + } + + pEvent->Release(); // We addrefed it CTAPIEventNotification::Event() + + return S_OK; +} + +/////////////////////////////////////////////////////////// +// SAPI actions +/////////////////////////////////////////////////////////// + +/********************************************************** +* COperator::SetAudioOutForCall * +*-------------------------------* +* Description: +* Uses the legacy call media control in TAPI to +* get the device IDs for audio out. +* Uses these device IDs to set up the audio +* for text-to-speech +* Return: +* S_OK +* E_INVALIDARG if the pLegacyCallMediaControl is NULL +* E_OUTOFMEMORY +* SPERR_DEVICE_NOT_SUPPORTED if no supported +* formats could be found +* Failed return value of QI(), +* ITLegacyCallMediaControl::GetID(), +* CoCreateInstance(), +* ISpMMSysAudio::SetDeviceID(), +* ISpMMSysAudio::SetFormat(), +* ISpVoice::SetOutput() +************************************************************/ +HRESULT COperator::SetAudioOutForCall( ITLegacyCallMediaControl *pLegacyCallMediaControl ) +{ + if (NULL == m_pCall) + { + return E_UNEXPECTED; + } + + if ( NULL == pLegacyCallMediaControl ) + { + return E_INVALIDARG; + } + + // Get the device ID from ITLegacyCallMediaControl::GetID() + UINT *puDeviceID; + BSTR bstrWavOut = ::SysAllocString( L"wave/out" ); + if ( !bstrWavOut ) + { + return E_OUTOFMEMORY; + } + DWORD dwSize = sizeof( puDeviceID ); + HRESULT hr = pLegacyCallMediaControl->GetID( bstrWavOut, &dwSize, (BYTE**) &puDeviceID ); + ::SysFreeString( bstrWavOut ); + + // Find out what, if any, formats are supported + GUID guidWave = SPDFID_WaveFormatEx; + WAVEFORMATEX *pWaveFormatEx = NULL; + if ( SUCCEEDED(hr) ) + { + // Loop through all of the SAPI audio formats and query the wave/out device + // about whether it supports each one. + // We will take the first one that we find + SPSTREAMFORMAT enumFmtId; + MMRESULT mmr = MMSYSERR_ALLOCATED; + for ( DWORD dw = 0; (MMSYSERR_NOERROR != mmr) && (dw < SPSF_NUM_FORMATS); dw++ ) + { + if ( pWaveFormatEx && ( MMSYSERR_NOERROR != mmr ) ) + { + // No dice: The audio device does not support this format + + // Free up the WAVEFORMATEX pointer + ::CoTaskMemFree( pWaveFormatEx ); + pWaveFormatEx = NULL; + } + + // Get the next format from SAPI and convert it into a WAVEFORMATEX + enumFmtId = (SPSTREAMFORMAT) (SPSF_8kHz8BitMono + dw); + HRESULT hrConvert = SpConvertStreamFormatEnum( + enumFmtId, &guidWave, &pWaveFormatEx ); + + if ( SUCCEEDED( hrConvert ) ) + { + // This call to waveOutOpen() does not actually open the device; + // it just queries the device whether it supports the given format + mmr = ::waveOutOpen( NULL, *puDeviceID, pWaveFormatEx, 0, 0, WAVE_FORMAT_QUERY ); + } + } + + // If we made it all the way through the loop without breaking, that + // means we found no supported formats + if ( enumFmtId == SPSF_NUM_FORMATS ) + { + return SPERR_DEVICE_NOT_SUPPORTED; + } + } + + // Cocreate a SAPI audio out object + if ( SUCCEEDED( hr ) ) + { + hr = m_cpMMSysAudioOut.CoCreateInstance( CLSID_SpMMAudioOut ); + } + + // Give the audio out object the device ID + if ( SUCCEEDED(hr) ) + { + hr = m_cpMMSysAudioOut->SetDeviceId( *puDeviceID ); + } + + // Use the format that we found works + if ( SUCCEEDED( hr ) ) + { + _ASSERTE( pWaveFormatEx ); + hr = m_cpMMSysAudioOut->SetFormat( guidWave, pWaveFormatEx ); + } + + // We are now done with the wave format pointer + if ( pWaveFormatEx ) + { + ::CoTaskMemFree( pWaveFormatEx ); + } + + // Set the appropriate output to the outgoing voice + if ( SUCCEEDED( hr ) ) + { + _ASSERTE( m_cpOutgoingVoice ); + hr = m_cpOutgoingVoice->SetOutput( m_cpMMSysAudioOut, FALSE ); + } + + return hr; +} /* COperator::SetAudioOutForCall */ + +/********************************************************** +* COperator::SetAudioInForCall * +*------------------------------* +* Description: +* Uses the legacy call media control in TAPI to +* get the device IDs for audio input. +* Uses these device IDs to set up the audio +* for speech recognition +* Return: +* S_OK +* E_INVALIDARG if pLegacyCallMediaControl is NULL +* E_OUTOFMEMORY +* SPERR_DEVICE_NOT_SUPPORTED if no supported +* formats could be found +* Failed return value of QI(), +* ITLegacyCallMediaControl::GetID(), +* CoCreateInstance(), +* ISpMMSysAudio::SetDeviceID(), +* ISpMMSysAudio::SetFormat() +************************************************************/ +HRESULT COperator::SetAudioInForCall( ITLegacyCallMediaControl *pLegacyCallMediaControl ) +{ + if ( NULL == m_pCall ) + { + return E_UNEXPECTED; + } + + if ( NULL == pLegacyCallMediaControl ) + { + return E_INVALIDARG; + } + + // Get the device ID + UINT *puDeviceID; + BSTR bstrWavIn = ::SysAllocString( L"wave/in" ); + if ( !bstrWavIn ) + { + return E_OUTOFMEMORY; + } + DWORD dwSize = sizeof( puDeviceID ); + HRESULT hr = pLegacyCallMediaControl->GetID( bstrWavIn, &dwSize, (BYTE**) &puDeviceID ); + ::SysFreeString( bstrWavIn ); + + // Find out what, if any, formats are supported + GUID guidWave = SPDFID_WaveFormatEx; + WAVEFORMATEX *pWaveFormatEx = NULL; + if ( SUCCEEDED(hr) ) + { + // Loop through all of the SAPI audio formats and query the wave/out device + // about each one. + // We will take the first one that we find + SPSTREAMFORMAT enumFmtId; + MMRESULT mmr = MMSYSERR_ALLOCATED; + for ( DWORD dw = 0; (MMSYSERR_NOERROR != mmr) && (dw < SPSF_NUM_FORMATS); dw++ ) + { + if ( pWaveFormatEx && ( MMSYSERR_NOERROR != mmr ) ) + { + // Free up the WAVEFORMATEX pointer + ::CoTaskMemFree( pWaveFormatEx ); + pWaveFormatEx = NULL; + } + + // Get the next format from SAPI and convert it into a WAVEFORMATEX + enumFmtId = (SPSTREAMFORMAT) (SPSF_8kHz8BitMono + dw); + HRESULT hrConvert = SpConvertStreamFormatEnum( + enumFmtId, &guidWave, &pWaveFormatEx ); + if ( SUCCEEDED( hrConvert ) ) + { + // This call to waveOutOpen() does not actually open the device; + // it just queries the device whether it supports the given format + mmr = ::waveInOpen( NULL, *puDeviceID, pWaveFormatEx, 0, 0, WAVE_FORMAT_QUERY ); + } + } + + // If we made it all the way through the loop without breaking, that + // means we found no supported formats + if ( SPSF_NUM_FORMATS == dw ) + { + return SPERR_DEVICE_NOT_SUPPORTED; + } + } + + // Cocreate a SAPI audio in object + if ( SUCCEEDED( hr ) ) + { + hr = m_cpMMSysAudioIn.CoCreateInstance( CLSID_SpMMAudioIn ); + } + + // Give the audio in object the device ID + if ( SUCCEEDED(hr) ) + { + hr = m_cpMMSysAudioIn->SetDeviceId( *puDeviceID ); + } + + // Use the format that we found works + if ( SUCCEEDED( hr ) ) + { + _ASSERTE( pWaveFormatEx ); + hr = m_cpMMSysAudioIn->SetFormat( guidWave, pWaveFormatEx ); + } + + // We are now done with the wave format pointer + if ( pWaveFormatEx ) + { + ::CoTaskMemFree( pWaveFormatEx ); + } + + // Set this as input to the reco context + if ( SUCCEEDED( hr ) ) + { + hr = m_cpIncomingRecognizer->SetInput( m_cpMMSysAudioIn, FALSE ); + } + + return hr; +} /* COperator::SetAudioInForCall */ + + +/********************************************************** +* COperator::HandleCall * +*-----------------------* +* Description: +* Deals with the call +* Return: +* S_OK +* Failed return value of ISpMMSysAudio::SetState(), +* ISpVoice::Speak() +************************************************************/ +HRESULT COperator::HandleCall() +{ + // PLEASE NOTE: This is a single-threaded app, so if the caller + // hangs up after the call-handling sequence has started, the + // app will not be notified until after the entire call sequence + // has finished. + // If you want to be able to cut the call-handling short because + // the caller hung up, you need to have a separate thread listening + // for TAPI's CS_DISCONNECT notification. + + _ASSERTE( m_cpMMSysAudioOut ); + HRESULT hr = S_OK; + + // Now that the call is connected, we can start up the audio output + hr = m_cpOutgoingVoice->Speak( L"Hello, please say something to me", 0, NULL ); + + // Start listening + if ( SUCCEEDED( hr ) ) + { + hr = m_cpDictGrammar->SetDictationState( SPRS_ACTIVE ); + } + + // We are expecting a PHRASESTART followed by either a RECOGNITION or a + // FALSERECOGNITION + + // Wait for the PHRASE_START + CSpEvent event; + WORD eLastEventID = SPEI_FALSE_RECOGNITION; + hr = m_cpIncomingRecoCtxt->WaitForNotifyEvent(CALLER_TIMEOUT); + if ( SUCCEEDED( hr ) ) + { + hr = event.GetFrom( m_cpIncomingRecoCtxt ); + } + + // Enter this block only if we have not timed out (the user started speaking) + if ( ( S_OK == hr ) && ( SPEI_PHRASE_START == event.eEventId ) ) + { + // Caller has started to speak, block "forever" until the + // result (or lack thereof) comes back. + // This is all right, since every PHRASE_START is guaranteed + // to be followed up by a RECOGNITION or FALSE_RECOGNITION + hr = m_cpIncomingRecoCtxt->WaitForNotifyEvent(INFINITE); + + if ( S_OK == hr ) + { + // Get the RECOGNITION or FALSE_RECOGNITION + hr = event.GetFrom( m_cpIncomingRecoCtxt ); + eLastEventID = event.eEventId; + + // This had better be either a RECOGNITION or FALSERECOGNITION! + _ASSERTE( (SPEI_RECOGNITION == event.eEventId) || + (SPEI_FALSE_RECOGNITION == event.eEventId) ); + } + } + + + // Make sure a recognition result was actually received (as opposed to a false recognition + // or timeout on the caller) + WCHAR *pwszCoMemText = NULL; + ISpRecoResult *pResult = NULL; + if ( SUCCEEDED( hr ) && ( SPEI_RECOGNITION == event.eEventId ) ) + { + // Get the text of the result + pResult = event.RecoResult(); + + BYTE bDisplayAttr; + hr = pResult->GetText( SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, &pwszCoMemText, &bDisplayAttr ); + } + if ( SUCCEEDED( hr ) && pResult ) + { + // Speak the result back locally + m_cpLocalVoice->Speak( L"I think the person on the phone said", SPF_ASYNC, 0 ); + m_cpLocalVoice->Speak( pwszCoMemText, SPF_ASYNC, 0 ); + m_cpLocalVoice->Speak( L"when he said", SPF_ASYNC, 0 ); + + // Get the audio so that the local voice can speak it back + CComPtr cpStreamFormat; + HRESULT hrAudio = pResult->GetAudio( 0, 0, &cpStreamFormat ); + if ( SUCCEEDED( hrAudio ) ) + { + m_cpLocalVoice->SpeakStream( cpStreamFormat, SPF_ASYNC, 0 ); + } + else + { + m_cpLocalVoice->Speak( L"no audio was available", SPF_ASYNC, 0 ); + } + } + + // Stop listening + if ( SUCCEEDED( hr ) ) + { + hr = m_cpDictGrammar->SetDictationState( SPRS_INACTIVE ); + } + + // Close the audio input so that we can open the audio output + // (half-duplex device) + if ( SUCCEEDED( hr ) ) + { + hr = m_cpMMSysAudioIn->SetState( SPAS_CLOSED, 0 ); + } + + // The caller may have hung up on us, in which case we don't want to do + // the following + if ( m_pCall ) + { + if ( pResult ) + { + // There's a result to playback + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( L"I think I heard you say", 0, 0 ); + } + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( pwszCoMemText, 0, 0 ); + } + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( L"when you said", 0, 0 ); + } + if ( SUCCEEDED( hr ) ) + { + hr = pResult->SpeakAudio( NULL, 0, NULL, NULL ); + } + } + else + { + // Caller didn't say anything + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( L"I don't believe you said anything!", 0, 0 ); + } + } + + if ( SUCCEEDED( hr ) ) + { + hr = m_cpOutgoingVoice->Speak( L"OK bye now", 0, 0 ); + } + } + else + { + m_cpLocalVoice->Speak( L"Prematurely terminated call", 0, 0 ); + } + + if ( pwszCoMemText ) + { + ::CoTaskMemFree( pwszCoMemText ); + } + + return m_pCall ? hr : TAPI_E_DROPPED; +} /* COperator::HandleCall */ + +/////////////////////////////////////////////////////////// +// Miscellany +/////////////////////////////////////////////////////////// + +/********************************************************** +* COperator::DoMessage * +*----------------------* +* Description: +* Displays a MessageBox +************************************************************/ +void COperator::DoMessage( LPWSTR pszMessage ) +{ + USES_CONVERSION; + ::MessageBox( m_hDlg, W2T(pszMessage), W2T((WCHAR *) gszTelephonySample), MB_OK ); +} /* COperator::DoMessage */ + + +/********************************************************** +* COperator::SetStatusMessage * +*-----------------------------* +* Description: +* Displays a status message +************************************************************/ +void COperator::SetStatusMessage( LPWSTR pszMessage ) +{ + USES_CONVERSION; + ::SetDlgItemText( m_hDlg, IDC_STATUS, W2T(pszMessage) ); +} /* COperator::SetStatusMessage */ + +/************************************************************* +* AddressSupportsMediaType * +*--------------------------* +* Return: +* TRUE iff the given address supports the given media +**************************************************************/ +BOOL AddressSupportsMediaType( ITAddress * pAddress, + long lMediaType ) +{ + VARIANT_BOOL bSupport = VARIANT_FALSE; + ITMediaSupport * pMediaSupport; + + if ( SUCCEEDED( pAddress->QueryInterface( IID_ITMediaSupport, + (void **)&pMediaSupport ) ) ) + { + // does it support this media type? + pMediaSupport->QueryMediaType( lMediaType, + &bSupport ); + + pMediaSupport->Release(); + } + return (bSupport == VARIANT_TRUE); +} /* AddressSupportsMediaType */ diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.h b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.h new file mode 100644 index 00000000..ae80d8cd --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/operator.h @@ -0,0 +1,116 @@ +/**************************************************************************** +* Operator.h +* Definition of the COperator class +* +* Copyright (c) Microsoft Corporation. All rights reserved. +*****************************************************************************/ + +#ifndef MAXULONG_PTR +#error This sample application requires a newer version of the Platform SDK than you have installed. +#endif // MAXULONG_PTR + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include +#include "callnot.h" + +// Global data +const WCHAR gszTelephonySample[] = L"SAPI 5.0 Telephony sample"; + +class COperator +{ +public: + COperator::COperator( HINSTANCE hInst ) : + m_hDlg( NULL ), + m_pTapi( NULL ), + m_pCall( NULL ), + m_fAutoAnswer( FALSE ), + m_pTAPIEventNotification( NULL ) + {}; + COperator::~COperator(); + + HRESULT Initialize(); + +private: + // Setup and shutdown + + HRESULT InitializeSapi(); + + HRESULT InitializeTapi(); + + void ShutdownSapi(); + + void ShutdownTapi(); + + // Main dialog proc is a friend function + + friend BOOL CALLBACK MainDialogProc( HWND hDlg, + UINT uMsg, + WPARAM wParam, + LPARAM lParam ); + + // TAPI actions + + HRESULT RegisterTapiEventInterface(); + + HRESULT ListenOnAddresses(); + + HRESULT ListenOnThisAddress( ITAddress * pAddress ); + + HRESULT AnswerTheCall(); + + HRESULT DisconnectTheCall(); + + void ReleaseTheCall(); + + HRESULT OnTapiEvent( + TAPI_EVENT TapiEvent, + IDispatch * pEvent ); + + // SAPI actions + + HRESULT SetAudioOutForCall( ITLegacyCallMediaControl *pLegacyCallMediaControl ); + HRESULT SetAudioInForCall( ITLegacyCallMediaControl *pLegacyCallMediaControl ); + + HRESULT HandleCall(); + + // Miscellany + + void DoMessage( LPWSTR pszMessage ); + + void SetStatusMessage( LPWSTR pszMessage ); + + +private: + // Win32 data + HWND m_hDlg; + BOOL m_fAutoAnswer; + + // TAPI data + ITTAPI * m_pTapi; + ITBasicCallControl * m_pCall; + CTAPIEventNotification * m_pTAPIEventNotification; + ULONG m_ulAdvise; + + // SAPI data + + // Audio + CComPtr m_cpMMSysAudioOut; + CComPtr m_cpMMSysAudioIn; + + // Text to speech + CComPtr m_cpLocalVoice; + CComPtr m_cpOutgoingVoice; + + // Speech Recognition + CComPtr m_cpIncomingRecognizer; + CComPtr m_cpIncomingRecoCtxt; + CComPtr m_cpDictGrammar; +}; + +// Helper function +BOOL AddressSupportsMediaType( ITAddress * pAddress, + long lMediaType ); + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/resource.h b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/resource.h new file mode 100644 index 00000000..8c7332fe --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/resource.h @@ -0,0 +1,22 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by simpletelephony.rc +// +#define IDD_MAINDLG 101 +#define IDC_STATUS 1000 +#define IDC_ANSWER 1001 +#define IDC_DISCONNECT 1002 +#define IDC_DISCONNECTED 1003 +#define IDC_AUTOANSWER 1004 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.dsp b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.dsp new file mode 100644 index 00000000..3be1d986 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.dsp @@ -0,0 +1,131 @@ +# Microsoft Developer Studio Project File - Name="simpletelephony" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=simpletelephony - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "simpletelephony.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "simpletelephony.mak" CFG="simpletelephony - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "simpletelephony - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "simpletelephony - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "simpletelephony - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib t3iid.lib strmiids.lib winmm.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "simpletelephony - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib t3iid.lib strmiids.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" /libpath:"..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "simpletelephony - Win32 Release" +# Name "simpletelephony - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Callnot.Cpp +# End Source File +# Begin Source File + +SOURCE=.\operator.cpp +# End Source File +# Begin Source File + +SOURCE=.\simpletelephony.rc +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Callnot.h +# End Source File +# Begin Source File + +SOURCE=.\operator.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.ico b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.ico new file mode 100644 index 00000000..43f13171 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.rc b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.rc new file mode 100644 index 00000000..9f2aed7e --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/simpletelephony.rc @@ -0,0 +1,121 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MAINDLG DIALOG DISCARDABLE 0, 0, 280, 50 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "SAPI 5.0 Telephony Sample" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Answer",IDC_ANSWER,220,6,50,14 + PUSHBUTTON "Exit",IDCANCEL,220,27,50,14 + EDITTEXT IDC_STATUS,37,11,173,14,ES_AUTOHSCROLL | ES_READONLY + LTEXT "Status",IDC_STATIC,7,11,28,8 + CONTROL "Auto Answer",IDC_AUTOANSWER,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,37,31,56,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +SIMPLETELEPHONY ICON DISCARDABLE "simpletelephony.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// SMALLICON +// + +SIMPLETELEPHONY SMALLICON MOVEABLE PURE "simpletelephony.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_MAINDLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 270 + TOPMARGIN, 6 + BOTTOMMARGIN, 40 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/version.rc2 new file mode 100644 index 00000000..a8072b0b --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/SimpleTelephony/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Simple Telephony Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SimpleTelephony\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "SimpleTelephony.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/appicon.ico b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/appicon.ico new file mode 100644 index 00000000..91f966f2 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/appicon.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic eyes closed.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic eyes closed.bmp new file mode 100644 index 00000000..2c557fb2 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic eyes closed.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic.bmp new file mode 100644 index 00000000..fa27d542 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_eyes_narrow.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_eyes_narrow.bmp new file mode 100644 index 00000000..bf32c74a Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_eyes_narrow.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_10.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_10.bmp new file mode 100644 index 00000000..21be2766 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_10.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_11.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_11.bmp new file mode 100644 index 00000000..46426010 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_11.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_12.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_12.bmp new file mode 100644 index 00000000..28123d5f Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_12.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_13.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_13.bmp new file mode 100644 index 00000000..76ad8c8d Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_13.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_2.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_2.bmp new file mode 100644 index 00000000..97352cab Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_2.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_3.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_3.bmp new file mode 100644 index 00000000..7e5adfb7 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_3.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_4.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_4.bmp new file mode 100644 index 00000000..d8fed73c Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_4.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_5.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_5.bmp new file mode 100644 index 00000000..1f8b8279 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_5.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_6.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_6.bmp new file mode 100644 index 00000000..a41a2e20 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_6.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_7.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_7.bmp new file mode 100644 index 00000000..92620857 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_7.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_8.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_8.bmp new file mode 100644 index 00000000..2702594a Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_8.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_9.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_9.bmp new file mode 100644 index 00000000..fce5f6b8 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mic_mouth_9.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthclo.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthclo.bmp new file mode 100644 index 00000000..630e5f3f Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthclo.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthmed.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthmed.bmp new file mode 100644 index 00000000..87fca9c3 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthmed.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthnar.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthnar.bmp new file mode 100644 index 00000000..3f00d5c1 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthnar.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop1.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop1.bmp new file mode 100644 index 00000000..315edf83 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop1.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop2.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop2.bmp new file mode 100644 index 00000000..eabfea9c Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop2.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop3.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop3.bmp new file mode 100644 index 00000000..a520cbb5 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop3.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop4.bmp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop4.bmp new file mode 100644 index 00000000..9c4d1d15 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/TTSApp/Res/mouthop4.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/childwin.cpp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/childwin.cpp new file mode 100644 index 00000000..9ec8f4ce --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/childwin.cpp @@ -0,0 +1,100 @@ +///////////////////////////////////////////////////////////////////////// +// ChidWin.CPP +// +// This module handles all actions that take place in the child window. +// The child window is used for displaying the mouth bitmaps. +// +// Revision History: +// 07/18/99 Created +//Copyright (c) Microsoft Corporation. All rights reserved. +// +///////////////////////////////////////////////////////////////////////// + +#include "globals.h" + + +// --------------------------------------------------------------------------- +// ChildWndProc +// --------------------------------------------------------------------------- +// Description: Main window procedure. +// Arguments: +// HWND [in] Window handle. +// UINT [in] Message identifier. +// WPARAM [in] Depends on message. +// LPARAM [in] Depends on message. +// Returns: +// LPARAM Depends on message. +LPARAM CALLBACK ChildWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + HDC hdc=NULL, hmemDC=NULL; + PAINTSTRUCT ps; + HBRUSH hbrBkGnd=NULL; + RECT rect; + + // Call the appropriate message handler + switch(uMsg) + { + case WM_PAINT: + { + // Get the Display Context so we have someplace to blit. + hdc = BeginPaint( hWnd, &ps ); + + // Create a compatible DC. + hmemDC = CreateCompatibleDC( hdc ); + + GetClientRect( hWnd, &rect ); + // Create a bitmap big enough for our client rectangle. + HBITMAP hmemBMP = CreateCompatibleBitmap( hdc, + rect.right - rect.left, + rect.bottom - rect.top ); + + // Select the bitmap into the off-screen DC. + HGDIOBJ hobjOld = SelectObject( hmemDC, hmemBMP ); + + // Erase the background. + hbrBkGnd = CreateSolidBrush( GetSysColor(COLOR_3DFACE) ); + FillRect( hmemDC, &rect, hbrBkGnd ); + DeleteObject( hbrBkGnd ); + + // Draw into memory DC + ImageList_Draw( g_hListBmp, 0, hmemDC, 0, 0, INDEXTOOVERLAYMASK(g_iBmp) ); + if( g_iBmp%6 == 2 ) + { + ImageList_Draw( g_hListBmp, WEYESNAR, hmemDC, 0, 0, 0 ); + } + if( g_iBmp%6 == 5 ) + { + ImageList_Draw( g_hListBmp, WEYESCLO, hmemDC, 0, 0, 0 ); + } + + + // Blit to window DC + StretchBlt( hdc, 0, 0, rect.right, rect.bottom, + hmemDC, 0, 0, rect.right, rect.bottom, SRCCOPY ); + + // Replace the previous GDI object to the DC + SelectObject( hmemDC, hobjOld ); + + // Done with off-screen bitmap and DC. + DeleteObject( hmemBMP ); + + DeleteDC( hmemDC ); + + DeleteDC( hdc ); + + // Clean up and get outta here + EndPaint( hWnd, &ps ); + } + break; + + case WM_DESTROY: + // Delete Mouth Bitmaps + ImageList_Destroy( g_hListBmp ); + break; + + + } + + // Call the default message handler + return DefWindowProc(hWnd, uMsg, wParam, lParam); +} diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/dlgmain.cpp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/dlgmain.cpp new file mode 100644 index 00000000..9b0f6fe7 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/dlgmain.cpp @@ -0,0 +1,1275 @@ +///////////////////////////////////////////////////////////////////////// +// DlgMain.CPP +// +// This module handles the main dialog box, and it's controls. +// +// The main dialog is actually the application's main window class, there +// is no conventional "Window class", only this dialog class which is +// registered in WinMain. +// +// Revision History: +// 06/06/99 Created +//Copyright (c) Microsoft Corporation. All rights reserved. +// +///////////////////////////////////////////////////////////////////////// + +#include "globals.h" + +// +// Other local functions +// +inline void TTSAppStatusMessage( HWND hWnd, TCHAR* szMessage ); + +// --------------------------------------------------------------------------- +// CTTSApp::DlgProcMain +// --------------------------------------------------------------------------- +// Description: Main window procedure. +// Arguments: +// HWND [in] Window handle. +// UINT [in] Message identifier. +// WPARAM [in] Depends on message. +// LPARAM [in] Depends on message. +// Returns: +// LPARAM Depends on message. +LRESULT CALLBACK CTTSApp::DlgProcMain(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + CTTSApp* pThis = (CTTSApp *)::GetWindowLong( hwnd, GWL_USERDATA ); + + // Call the appropriate function to handle the messages + switch(uMsg) + { + case WM_INITDIALOG: + ::SetWindowLong( hwnd, GWL_USERDATA, lParam ); + pThis = (CTTSApp *)lParam; + return pThis->OnInitDialog( hwnd ); + + case WM_TTSAPPCUSTOMEVENT: + pThis->MainHandleSynthEvent(); + return TRUE; + + case WM_HSCROLL: + pThis->HandleScroll( (HWND) lParam ); + return TRUE; + + case WM_COMMAND: + if( pThis ) + { + pThis->MainHandleCommand( (int)(LOWORD(wParam)), (HWND)lParam, + (UINT)HIWORD(wParam) ); + } + return TRUE; + + case WM_CLOSE: + pThis->MainHandleClose(); + return TRUE; + } + + return FALSE; +} + +///////////////////////////////////////////////////////////////// +HRESULT CTTSApp::InitSapi() +///////////////////////////////////////////////////////////////// +{ + HRESULT hr; + + hr = m_cpVoice.CoCreateInstance( CLSID_SpVoice ); + + return hr; +} + +///////////////////////////////////////////////////////////////// +HIMAGELIST CTTSApp::InitImageList() +///////////////////////////////////////////////////////////////// +{ + HIMAGELIST hListBmp; + HBITMAP hBmp; + + hListBmp = ImageList_Create( CHARACTER_WIDTH, CHARACTER_HEIGHT, ILC_COLOR32 | ILC_MASK, 1, 0 ); + if (hListBmp) + { + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICFULL ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH2 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH3 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH4 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH5 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH6 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH7 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH8 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH9 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH10 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH11 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH12 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICMOUTH13 ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICEYESNAR ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + hBmp = LoadBitmap( m_hInst, MAKEINTRESOURCE( IDB_MICEYESCLO ) ); + ImageList_AddMasked( hListBmp, hBmp, 0xff00ff ); + DeleteObject( hBmp ); + + ImageList_SetOverlayImage( hListBmp, 1, 1 ); + ImageList_SetOverlayImage( hListBmp, 2, 2 ); + ImageList_SetOverlayImage( hListBmp, 3, 3 ); + ImageList_SetOverlayImage( hListBmp, 4, 4 ); + ImageList_SetOverlayImage( hListBmp, 5, 5 ); + ImageList_SetOverlayImage( hListBmp, 6, 6 ); + ImageList_SetOverlayImage( hListBmp, 7, 7 ); + ImageList_SetOverlayImage( hListBmp, 8, 8 ); + ImageList_SetOverlayImage( hListBmp, 9, 9 ); + ImageList_SetOverlayImage( hListBmp, 10, 10 ); + ImageList_SetOverlayImage( hListBmp, 11, 11 ); + ImageList_SetOverlayImage( hListBmp, 12, 12 ); + ImageList_SetOverlayImage( hListBmp, 13, 13 ); + ImageList_SetOverlayImage( hListBmp, 14, WEYESNAR ); + ImageList_SetOverlayImage( hListBmp, 15, WEYESCLO ); + } + return hListBmp; +} + +///////////////////////////////////////////////////////////////// +BOOL CTTSApp::OnInitDialog( HWND hWnd ) +///////////////////////////////////////////////////////////////// +{ + HRESULT hr = S_OK; + + // Store this as the "Main Dialog" + m_hWnd = hWnd; + + // Add some default text to the main edit control + SetDlgItemText( hWnd, IDE_EDITBOX, _T("Enter text you wish spoken here.") ); + + // Set the event mask in the rich edit control so that it notifies us when text is + // changed in the control + SendMessage( GetDlgItem( hWnd, IDE_EDITBOX ), EM_SETEVENTMASK, 0, ENM_CHANGE ); + + // Initialize the Output Format combo box + for( int i=0; i cpStream; + HRESULT hrOutputStream = m_cpVoice->GetOutputStream(&cpStream); + + if (hrOutputStream == S_OK) + { + CSpStreamFormat Fmt; + hr = Fmt.AssignFormat(cpStream); + if (SUCCEEDED(hr)) + { + SPSTREAMFORMAT eFmt = Fmt.ComputeFormatEnum(); + for( i=0; iSetNotifyWindowMessage( hWnd, WM_TTSAPPCUSTOMEVENT, 0, 0 ); + } + + // We're interested in all TTS events + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->SetInterest( SPFEI_ALL_TTS_EVENTS, SPFEI_ALL_TTS_EVENTS ); + } + + // Get default rate and volume + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->GetRate( &m_DefaultRate ); + // initialize sliders and edit boxes with default rate + if ( SUCCEEDED( hr ) ) + { + SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETRANGE, TRUE, MAKELONG( SPMIN_RATE, SPMAX_RATE ) ); + SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETPOS, TRUE, m_DefaultRate ); + SendDlgItemMessage( hWnd, IDC_RATE_SLIDER, TBM_SETPAGESIZE, TRUE, 5 ); + } + } + + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->GetVolume( &m_DefaultVolume ); + // initialize sliders and edit boxes with default volume + if ( SUCCEEDED( hr ) ) + { + SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETRANGE, TRUE, MAKELONG( SPMIN_VOLUME, SPMAX_VOLUME ) ); + SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETPOS, TRUE, m_DefaultVolume ); + SendDlgItemMessage( hWnd, IDC_VOLUME_SLIDER, TBM_SETPAGESIZE, TRUE, 10 ); + } + } + + // If any SAPI initialization failed, shut down! + if( FAILED( hr ) ) + { + MessageBox( NULL, _T("Error initializing speech objects. Shutting down."), _T("Error"), MB_OK ); + SendMessage( hWnd, WM_CLOSE, 0, 0 ); + return(FALSE); + + } + else + { + // + // Create the child windows to which we'll blit our result + // + HWND hCharWnd = GetDlgItem(hWnd, IDC_CHARACTER); + RECT rc; + + GetClientRect(hCharWnd, &rc); + rc.left = (rc.right - CHARACTER_WIDTH) / 2; + rc.top = (rc.bottom - CHARACTER_HEIGHT) / 2; + m_hChildWnd = CreateWindow( CHILD_CLASS, NULL, + WS_CHILDWINDOW | WS_VISIBLE, + rc.left, rc.top, + rc.left + CHARACTER_WIDTH, rc.top + CHARACTER_HEIGHT, + hCharWnd, NULL, m_hInst, NULL ); + + if ( !m_hChildWnd ) + { + MessageBox( hWnd, _T("Error initializing speech objects. Shutting down."), _T("Error"), MB_OK ); + SendMessage( hWnd, WM_CLOSE, 0, 0 ); + return(FALSE); + + } + else + { + // Load Mouth Bitmaps and use and ImageList since we'll blit the mouth + // and eye positions over top of the full image + g_hListBmp = InitImageList(); + } + } + return(TRUE); + +} + +///////////////////////////////////////////////////////////////// +void CTTSApp::Stop() +///////////////////////////////////////////////////////////////// +// +// Resets global audio state to stopped, updates the Pause/Resume button +// and repaints the mouth in a closed position +// +{ + // Stop current rendering with a PURGEBEFORESPEAK... + HRESULT hr = m_cpVoice->Speak( NULL, SPF_PURGEBEFORESPEAK, 0 ); + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Stop error\r\n") ); + } + + SetWindowText( GetDlgItem( m_hWnd, IDB_PAUSE ), _T("Pause") ); + m_bPause = FALSE; + m_bStop = TRUE; + // Mouth closed + g_iBmp = 0; + SendMessage( m_hChildWnd, WM_PAINT, 0, 0 ); + InvalidateRect( m_hChildWnd, NULL, FALSE ); +} + +///////////////////////////////////////////////////////////////// +void CTTSApp::MainHandleCommand( int id, HWND hWndControl, UINT codeNotify ) +///////////////////////////////////////////////////////////////// +// +// Handle each of the WM_COMMAND messages that come in, and deal with +// them appropriately +// +{ + UINT cNumChar = 0; + HRESULT hr = S_OK; + TCHAR szAFileName[NORM_SIZE] = _T(""); + static BOOL bIsUnicode = FALSE; + BOOL bWavFileOpened = FALSE; + int iFormat; + CComPtr cpWavStream; + CComPtr cpOldStream; + HWND hwndEdit; + BOOL bFileOpened = FALSE; + + // Get handle to the main edit box + hwndEdit = GetDlgItem( m_hWnd, IDE_EDITBOX ); + + switch(id) + { + // About Box display + case IDC_ABOUT: + ::DialogBox( m_hInst, (LPCTSTR)IDD_ABOUT, m_hWnd, (DLGPROC)About ); + break; + + // Any change to voices is sent to VoiceChange() function + case IDC_COMBO_VOICES: + if( codeNotify == CBN_SELCHANGE ) + { + hr = VoiceChange(); + } + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Error changing voices\r\n") ); + } + + break; + + // If user wants to speak a file pop the standard windows open file + // dialog box and load the text into a global buffer (m_pszwFileText) + // which will be used when the user hits speak. + case IDB_OPEN: + bFileOpened = CallOpenFileDialog( szAFileName, + _T("TXT (*.txt)\0*.txt\0XML (*.xml)\0*.xml\0All Files (*.*)\0*.*\0") ); + if( bFileOpened ) + { + DWORD dwFileSize = 0; + + USES_CONVERSION; + wcscpy( m_szWFileName, T2W( szAFileName ) ); + ReadTheFile( szAFileName, &bIsUnicode, &m_pszwFileText ); + + if( bIsUnicode ) + { + // Unicode source + UpdateEditCtlW( m_pszwFileText ); + } + else + { + // MBCS source +#ifdef _UNICODE + TCHAR *pszFileText = _tcsdup( m_pszwFileText ); +#else + // We're compiling ANSI, so we need to convert the string to MBCS + // Note that a W2T may not be good here, since this string might + // be very big + TCHAR *pszFileText = NULL; + int iNeeded = ::WideCharToMultiByte( CP_ACP, 0, m_pszwFileText, -1, NULL, 0, NULL, NULL ); + pszFileText = (TCHAR *) ::malloc( sizeof( TCHAR ) * ( iNeeded + 1 ) ); + ::WideCharToMultiByte( CP_ACP, 0, m_pszwFileText, -1, pszFileText, iNeeded + 1, NULL, NULL ); +#endif + if ( pszFileText ) + { + SetDlgItemText( m_hWnd, IDE_EDITBOX, pszFileText ); + free( pszFileText ); + } + + } + } + else + { + wcscpy( m_szWFileName, L"" ); + } + // Always SetFocus back to main edit window so text highlighting will work + SetFocus( hwndEdit ); + break; + + // Handle speak + case IDB_SPEAK: + HandleSpeak(); + break; + + case IDB_PAUSE: + if( !m_bStop ) + { + if( !m_bPause ) + { + SetWindowText( GetDlgItem( m_hWnd, IDB_PAUSE ), _T("Resume") ); + // Pause the voice... + m_cpVoice->Pause(); + m_bPause = TRUE; + TTSAppStatusMessage( m_hWnd, _T("Pause\r\n") ); + } + else + { + SetWindowText( GetDlgItem( m_hWnd, IDB_PAUSE ), _T("Pause") ); + m_cpVoice->Resume(); + m_bPause = FALSE; + } + } + SetFocus( hwndEdit ); + break; + + case IDB_STOP: + TTSAppStatusMessage( m_hWnd, _T("Stop\r\n") ); + // Set the global audio state to stop + Stop(); + SetFocus( hwndEdit ); + break; + + case IDB_SKIP: + { + SetFocus( hwndEdit ); + int fSuccess = false; + int SkipNum = GetDlgItemInt( m_hWnd, IDC_SKIP_EDIT, &fSuccess, true ); + ULONG ulGarbage = 0; + WCHAR szGarbage[] = L"Sentence"; + if ( fSuccess ) + { + TTSAppStatusMessage( m_hWnd, _T("Skip\r\n") ); + hr = m_cpVoice->Skip( szGarbage, SkipNum, &ulGarbage ); + } + else + { + TTSAppStatusMessage( m_hWnd, _T("Skip failed\r\n") ); + } + break; + } + + case IDE_EDITBOX: + // Set the global audio state to stop if user has changed contents of edit control + if( codeNotify == EN_CHANGE ) + { + Stop(); + } + break; + + case IDB_SPEAKWAV: + bWavFileOpened = CallOpenFileDialog( szAFileName, + _T("WAV (*.wav)\0*.wav\0All Files (*.*)\0*.*\0") ); + // Speak the wav file using SpeakStream + if( bWavFileOpened ) + { + CComPtr cpWavStream; + WCHAR szwWavFileName[NORM_SIZE] = L"";; + + USES_CONVERSION; + wcscpy( szwWavFileName, T2W( szAFileName ) ); + + // User helper function found in sphelper.h to open the wav file and + // get back an IStream pointer to pass to SpeakStream + hr = SPBindToFile( szwWavFileName, SPFM_OPEN_READONLY, &cpWavStream ); + + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->SpeakStream( cpWavStream, SPF_ASYNC, NULL ); + } + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Speak error\r\n") ); + } + } + break; + + // Reset all values to defaults + case IDB_RESET: + TTSAppStatusMessage( m_hWnd, _T("Reset\r\n") ); + SendDlgItemMessage( m_hWnd, IDC_VOLUME_SLIDER, TBM_SETPOS, TRUE, m_DefaultVolume ); + SendDlgItemMessage( m_hWnd, IDC_RATE_SLIDER, TBM_SETPOS, TRUE, m_DefaultRate ); + SendDlgItemMessage( m_hWnd, IDC_SAVETOWAV, BM_SETCHECK, BST_UNCHECKED, 0 ); + SendDlgItemMessage( m_hWnd, IDC_EVENTS, BM_SETCHECK, BST_UNCHECKED, 0 ); + SetDlgItemText( m_hWnd, IDE_EDITBOX, _T("Enter text you wish spoken here.") ); + + // reset output format + SendDlgItemMessage( m_hWnd, IDC_COMBO_OUTPUT, CB_SETCURSEL, m_DefaultFormatIndex, 0 ); + SendMessage( m_hWnd, WM_COMMAND, MAKEWPARAM(IDC_COMBO_OUTPUT, CBN_SELCHANGE), 0 ); + + // Change the volume and the rate to reflect what the UI says + HandleScroll( ::GetDlgItem( m_hWnd, IDC_VOLUME_SLIDER ) ); + HandleScroll( ::GetDlgItem( m_hWnd, IDC_RATE_SLIDER ) ); + + SetFocus( hwndEdit ); + break; + + case IDC_COMBO_OUTPUT: + if( codeNotify == CBN_SELCHANGE ) + { + // Get the audio output format and set it's GUID + iFormat = SendDlgItemMessage( m_hWnd, IDC_COMBO_OUTPUT, CB_GETCURSEL, 0, 0 ); + SPSTREAMFORMAT eFmt = (SPSTREAMFORMAT)SendDlgItemMessage( m_hWnd, IDC_COMBO_OUTPUT, + CB_GETITEMDATA, iFormat, 0 ); + CSpStreamFormat Fmt; + Fmt.AssignFormat(eFmt); + if ( m_cpOutAudio ) + { + hr = m_cpOutAudio->SetFormat( Fmt.FormatId(), Fmt.WaveFormatExPtr() ); + } + else + { + hr = E_FAIL; + } + + if( SUCCEEDED( hr ) ) + { + hr = m_cpVoice->SetOutput( m_cpOutAudio, FALSE ); + } + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Format rejected\r\n") ); + } + + EnableSpeakButtons( SUCCEEDED( hr ) ); + } + break; + + case IDC_SAVETOWAV: + { + USES_CONVERSION; + + TCHAR szFileName[256]; + _tcscpy(szFileName, _T("\0")); + + BOOL bFileOpened = CallSaveFileDialog( szFileName, + _T("WAV (*.wav)\0*.wav\0All Files (*.*)\0*.*\0") ); + + if (bFileOpened == FALSE) break; + + wcscpy( m_szWFileName, T2W(szFileName) ); + + CSpStreamFormat OriginalFmt; + hr = m_cpVoice->GetOutputStream( &cpOldStream ); + if (hr == S_OK) + { + hr = OriginalFmt.AssignFormat(cpOldStream); + } + else + { + hr = E_FAIL; + } + // User SAPI helper function in sphelper.h to create a wav file + if (SUCCEEDED(hr)) + { + hr = SPBindToFile( m_szWFileName, SPFM_CREATE_ALWAYS, &cpWavStream, &OriginalFmt.FormatId(), OriginalFmt.WaveFormatExPtr() ); + } + if( SUCCEEDED( hr ) ) + { + // Set the voice's output to the wav file instead of the speakers + hr = m_cpVoice->SetOutput(cpWavStream, TRUE); + } + + if ( SUCCEEDED( hr ) ) + { + // Do the Speak + HandleSpeak(); + } + + // Set output back to original stream + // Wait until the speak is finished if saving to a wav file so that + // the smart pointer cpWavStream doesn't get released before its + // finished writing to the wav. + m_cpVoice->WaitUntilDone( INFINITE ); + cpWavStream.Release(); + + // Reset output + m_cpVoice->SetOutput( cpOldStream, FALSE ); + + TCHAR szTitle[MAX_PATH]; + TCHAR szConfString[MAX_PATH]; + if ( SUCCEEDED( hr ) ) + { + LoadString( m_hInst, IDS_SAVE_NOTIFY, szConfString, MAX_PATH ); + LoadString( m_hInst, IDS_NOTIFY_TITLE, szTitle, MAX_PATH ); + MessageBox( m_hWnd, szConfString, szTitle, MB_OK | MB_ICONINFORMATION ); + } + else + { + LoadString( m_hInst, IDS_SAVE_ERROR, szConfString, MAX_PATH ); + MessageBox( m_hWnd, szConfString, NULL, MB_ICONEXCLAMATION ); + } + + break; + } + } + + return; +} + +///////////////////////////////////////////////////////////////////////////////////////////// +void CTTSApp::HandleSpeak() +///////////////////////////////////////////////////////////////////////////////////////////// +{ + HWND hwndEdit; + HRESULT hr = S_OK; + WCHAR *szWTextString = NULL; + + // Get handle to the main edit box + hwndEdit = GetDlgItem( m_hWnd, IDE_EDITBOX ); + + TTSAppStatusMessage( m_hWnd, _T("Speak\r\n") ); + SetFocus( hwndEdit ); + m_bStop = FALSE; + + // only get the string if we're not paused + if( !m_bPause ) + { + // Find the length of the string in the buffer + GETTEXTLENGTHEX gtlx; + gtlx.codepage = 1200; + gtlx.flags = GTL_DEFAULT; + LONG lTextLen = SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_GETTEXTLENGTHEX, (WPARAM) >lx, 0 ); + szWTextString = new WCHAR[ lTextLen + 1 ]; + + GETTEXTEX GetText; + + GetText.cb = (lTextLen + 1) * sizeof( WCHAR ); + GetText.codepage = 1200; + GetText.flags = GT_DEFAULT; + GetText.lpDefaultChar = NULL; + GetText.lpUsedDefChar = NULL; + + // Get the string in a unicode buffer + SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_GETTEXTEX, (WPARAM)&GetText, (LPARAM)szWTextString ); + + // do we speak or interpret the XML + hr = m_cpVoice->Speak( szWTextString, SPF_ASYNC | ((IsDlgButtonChecked( m_hWnd, IDC_SPEAKXML )) ? SPF_IS_XML : SPF_IS_NOT_XML), 0 ); + + delete[] szWTextString; + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Speak error\r\n") ); + } + } + m_bPause = FALSE; + SetWindowText( GetDlgItem( m_hWnd, IDB_PAUSE ), _T("Pause") ); + SetFocus( hwndEdit ); + // Set state to run + hr = m_cpVoice->Resume(); + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Speak error\r\n") ); + } +} + +///////////////////////////////////////////////////////////////// +void CTTSApp::MainHandleSynthEvent() +///////////////////////////////////////////////////////////////// +// +// Handles the WM_TTSAPPCUSTOMEVENT application defined message and all +// of it's appropriate SAPI5 events. +// +{ + + CSpEvent event; // helper class in sphelper.h for events that releases any + // allocated memory in it's destructor - SAFER than SPEVENT + SPVOICESTATUS Stat; + WPARAM nStart; + LPARAM nEnd; + int i = 0; + HRESULT hr = S_OK; + + while( event.GetFrom(m_cpVoice) == S_OK ) + { + switch( event.eEventId ) + { + case SPEI_START_INPUT_STREAM: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("StartStream event\r\n") ); + } + break; + + case SPEI_END_INPUT_STREAM: + // Set global boolean stop to TRUE when finished speaking + m_bStop = TRUE; + // Highlight entire text + nStart = 0; + nEnd = SendDlgItemMessage( m_hWnd, IDE_EDITBOX, WM_GETTEXTLENGTH, 0, 0 ); + SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_SETSEL, nStart, nEnd ); + // Mouth closed + g_iBmp = 0; + InvalidateRect( m_hChildWnd, NULL, FALSE ); + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("EndStream event\r\n") ); + } + break; + + case SPEI_VOICE_CHANGE: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Voicechange event\r\n") ); + } + break; + + case SPEI_TTS_BOOKMARK: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + // Get the string associated with the bookmark + // and add the null terminator. + USES_CONVERSION; + TCHAR szBuff2[MAX_PATH] = _T("Bookmark event: "); + + WCHAR *pwszEventString = new WCHAR[ wcslen( event.String() ) + 1]; + if ( pwszEventString ) + { + wcscpy( pwszEventString, event.String() ); + _tcscat( szBuff2, W2T(pwszEventString) ); + free( pwszEventString ); + } + + _tcscat( szBuff2, _T("\r\n") ); + TTSAppStatusMessage( m_hWnd, szBuff2 ); + } + break; + + case SPEI_WORD_BOUNDARY: + hr = m_cpVoice->GetStatus( &Stat, NULL ); + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Voice GetStatus error\r\n") ); + } + + // Highlight word + nStart = (LPARAM)( Stat.ulInputWordPos / sizeof(char) ); + nEnd = nStart + Stat.ulInputWordLen; + SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_SETSEL, nStart, nEnd ); + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + + TTSAppStatusMessage( m_hWnd, _T("Wordboundary event\r\n") ); + } + break; + + case SPEI_PHONEME: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Phoneme event\r\n") ); + } + break; + + case SPEI_VISEME: + // Get the current mouth viseme position and map it to one of the + // 7 mouth bitmaps. + g_iBmp = g_aMapVisemeToImage[event.Viseme()]; // current viseme + + InvalidateRect( m_hChildWnd, NULL, FALSE ); + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Viseme event\r\n") ); + } + break; + + case SPEI_SENTENCE_BOUNDARY: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Sentence event\r\n") ); + } + break; + + case SPEI_TTS_AUDIO_LEVEL: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + USES_CONVERSION; + WCHAR wszBuff[MAX_PATH]; + swprintf(wszBuff, L"Audio level: %d\r\n", (ULONG)event.wParam); + TTSAppStatusMessage( m_hWnd, W2T(wszBuff) ); + } + break; + + case SPEI_TTS_PRIVATE: + if( IsDlgButtonChecked( m_hWnd, IDC_EVENTS ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Private engine event\r\n") ); + } + break; + + default: + TTSAppStatusMessage( m_hWnd, _T("Unknown message\r\n") ); + break; + } + } +} + +///////////////////////////////////////////////////////////////////////// +void CTTSApp::HandleScroll( HWND hCtl ) +///////////////////////////////////////////////////////////////////////// +{ + static long hpos = 1; + HWND hVolume, hRate; + HRESULT hr = S_OK; + + // Get the current position of the slider + hpos = SendMessage( hCtl, TBM_GETPOS, 0, 0 ); + + // Get the Handle for the scroll bar so it can be associated with an edit box + hVolume = GetDlgItem( m_hWnd, IDC_VOLUME_SLIDER ); + hRate = GetDlgItem( m_hWnd, IDC_RATE_SLIDER ); + + if( hCtl == hVolume ) + { + hr = m_cpVoice->SetVolume((USHORT)hpos); + } + else if( hCtl == hRate ) + { + hr = m_cpVoice->SetRate(hpos); + } + + if( FAILED( hr ) ) + { + TTSAppStatusMessage( m_hWnd, _T("Error setting volume / rate\r\n") ); + } + + return; +} + +///////////////////////////////////////////////////////////////// +void CTTSApp::MainHandleClose() +///////////////////////////////////////////////////////////////// +{ + // Call helper functions from sphelper.h to destroy combo boxes + // created with SpInitTokenComboBox + SpDestroyTokenComboBox( GetDlgItem( m_hWnd, IDC_COMBO_VOICES ) ); + + // Terminate the app + PostQuitMessage(0); + + // Return success + return; +} + +///////////////////////////////////////////////////////////////// +HRESULT CTTSApp::VoiceChange() +///////////////////////////////////////////////////////////////// +// +// This function is called during initialization and whenever the +// selection for the voice combo box changes. +// It gets the token pointer associated with the voice. +// If the new voice is different from the one that's currently +// selected, it first stops any synthesis that is going on and +// sets the new voice on the global voice object. +// +{ + HRESULT hr = S_OK; + GUID* pguidAudioFormat = NULL; + int iFormat = 0; + + // Get the token associated with the selected voice + ISpObjectToken* pToken = SpGetCurSelComboBoxToken( GetDlgItem( m_hWnd, IDC_COMBO_VOICES ) ); + + //Determine if it is the current voice + CComPtr pOldToken; + hr = m_cpVoice->GetVoice( &pOldToken ); + + if (SUCCEEDED(hr)) + { + if (pOldToken != pToken) + { + // Stop speaking. This is not necesary, for the next call to work, + // but just to show that we are changing voices. + hr = m_cpVoice->Speak( NULL, SPF_PURGEBEFORESPEAK, 0); + // And set the new voice on the global voice object + if (SUCCEEDED (hr) ) + { + hr = m_cpVoice->SetVoice( pToken ); + } + } + } + + EnableSpeakButtons( SUCCEEDED( hr ) ); + + return hr; +} + +///////////////////////////////////////////////////////////////// +BOOL CTTSApp::CallOpenFileDialog( TCHAR* szFileName, TCHAR* szFilter ) +///////////////////////////////////////////////////////////////// +// +// Display the open dialog box to retrieve the user-selected +// .txt or .xml file for synthisizing +{ + OPENFILENAME ofn; + BOOL bRetVal = TRUE; + LONG lRetVal; + HKEY hkResult; + TCHAR szPath[256] = _T(""); + DWORD size = 256; + + // Open the last directory used by this app (stored in registry) + lRetVal = RegCreateKeyEx( HKEY_CURRENT_USER, + _T("SOFTWARE\\Microsoft\\Speech\\AppData\\TTSApp"), 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkResult, NULL ); + + if( lRetVal == ERROR_SUCCESS ) + { + RegQueryValueEx( hkResult, _T("TTSFiles"), NULL, NULL, (PBYTE)szPath, &size ); + } + + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + ZeroMemory( &ofn, ofnsize); + + + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hWnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrCustomFilter = NULL; + ofn.nFilterIndex = 1; + ofn.lpstrInitialDir = szPath; + ofn.lpstrFile = szFileName; + ofn.nMaxFile = 256; + ofn.lpstrTitle = NULL; + ofn.lpstrFileTitle = NULL; + ofn.lpstrDefExt = NULL; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_READONLY | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY; + + // Pop the dialog + bRetVal = GetOpenFileName( &ofn ); + + // Write the directory path you're in to the registry + TCHAR pathstr[256] = _T(""); + _tcscpy( pathstr, szFileName ); + + int i=0; + while( pathstr[i] != NULL ) + { + i++; + } + while( pathstr[i] != '\\' ) + { + i --; + } + pathstr[i] = NULL; + + // Now write the string to the registry + RegSetValueEx( hkResult, _T("TTSFiles"), NULL, REG_EXPAND_SZ, (PBYTE)pathstr, _tcslen(pathstr)+1 ); + + RegCloseKey( hkResult ); + + return bRetVal; +} + +///////////////////////////////////////////////////////////////// +BOOL CTTSApp::CallSaveFileDialog( TCHAR* szFileName, TCHAR* szFilter ) +///////////////////////////////////////////////////////////////// +// +// Display the save dialog box to save the wav file +{ + OPENFILENAME ofn; + BOOL bRetVal = TRUE; + LONG lRetVal; + HKEY hkResult; + TCHAR szPath[256] = _T(""); + DWORD size = 256; + + // Open the last directory used by this app (stored in registry) + lRetVal = RegCreateKeyEx( HKEY_CLASSES_ROOT, _T("PathTTSDataFiles"), 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkResult, NULL ); + + if( lRetVal == ERROR_SUCCESS ) + { + RegQueryValueEx( hkResult, _T("TTSFiles"), NULL, NULL, (PBYTE)szPath, &size ); + + RegCloseKey( hkResult ); + } + + size_t ofnsize = (BYTE*)&ofn.lpTemplateName + sizeof(ofn.lpTemplateName) - (BYTE*)&ofn; + ZeroMemory( &ofn, ofnsize); + + ofn.lStructSize = ofnsize; + ofn.hwndOwner = m_hWnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrCustomFilter = NULL; + ofn.nFilterIndex = 1; + ofn.lpstrInitialDir = szPath; + ofn.lpstrFile = szFileName; + ofn.nMaxFile = 256; + ofn.lpstrTitle = NULL; + ofn.lpstrFileTitle = NULL; + ofn.lpstrDefExt = _T("wav"); + ofn.Flags = OFN_OVERWRITEPROMPT; + + // Pop the dialog + bRetVal = GetSaveFileName( &ofn ); + + if ( ofn.Flags & OFN_EXTENSIONDIFFERENT ) + { + _tcscat( szFileName, _T(".wav") ); + } + + // Write the directory path you're in to the registry + TCHAR pathstr[256] = _T(""); + _tcscpy( pathstr, szFileName ); + + int i=0; + while( pathstr[i] != NULL ) + { + i++; + } + while( pathstr[i] != '\\' ) + { + i --; + } + pathstr[i] = NULL; + + // Now write the string to the registry + lRetVal = RegCreateKeyEx( HKEY_CLASSES_ROOT, _T("PathTTSDataFiles"), 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkResult, NULL ); + + if( lRetVal == ERROR_SUCCESS ) + { + RegSetValueEx( hkResult, _T("TTSFiles"), NULL, REG_EXPAND_SZ, (PBYTE)pathstr, _tcslen(pathstr)+1 ); + + RegCloseKey( hkResult ); + } + + return bRetVal; +} + +///////////////////////////////////////////////////// +HRESULT CTTSApp::ReadTheFile( TCHAR* szFileName, BOOL* bIsUnicode, WCHAR** ppszwBuff ) +///////////////////////////////////////////////////// +// +// This file opens and reads the contents of a file. It +// returns a pointer to the string. +// Warning, this function allocates memory for the string on +// the heap so the caller must free it with 'delete'. +// +{ + // Open up the file and copy it's contents into a buffer to return + HRESULT hr = 0; + HANDLE hFile; + DWORD dwSize = 0; + DWORD dwBytesRead = 0; + + // First delete any memory previously allocated by this function + if( m_pszwFileText ) + { + delete m_pszwFileText; + } + + hFile = CreateFile( szFileName, GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY, NULL ); + if( hFile == INVALID_HANDLE_VALUE ) + { + *ppszwBuff = NULL; + hr = E_FAIL; + } + + if( SUCCEEDED( hr ) ) + { + dwSize = GetFileSize( hFile, NULL ); + if( dwSize == 0xffffffff ) + { + *ppszwBuff = NULL; + hr = E_FAIL; + } + } + + if( SUCCEEDED( hr ) ) + { + // Read the file contents into a wide buffer and then determine + // if it's a unicode or ascii file + WCHAR Signature = 0; + + ReadFile( hFile, &Signature, 2, &dwBytesRead, NULL ); + + // Check to see if its a unicode file by looking at the signature of the first character. + if( 0xFEFF == Signature ) + { + *ppszwBuff = new WCHAR [dwSize/2]; + + *bIsUnicode = TRUE; + ReadFile( hFile, *ppszwBuff, dwSize-2, &dwBytesRead, NULL ); + (*ppszwBuff)[dwSize/2-1] = NULL; + + CloseHandle( hFile ); + } + else // MBCS source + { + char* pszABuff = new char [dwSize+1]; + *ppszwBuff = new WCHAR [dwSize+1]; + + *bIsUnicode = FALSE; + SetFilePointer( hFile, NULL, NULL, FILE_BEGIN ); + ReadFile( hFile, pszABuff, dwSize, &dwBytesRead, NULL ); + pszABuff[dwSize] = NULL; + ::MultiByteToWideChar( CP_ACP, 0, pszABuff, -1, *ppszwBuff, dwSize + 1 ); + + delete( pszABuff ); + CloseHandle( hFile ); + } + } + + return hr; +} + +///////////////////////////////////////////////////////////////////////// +void CTTSApp::UpdateEditCtlW( WCHAR* pszwText ) +///////////////////////////////////////////////////////////////////////// +{ + CComPtr cpRichEdit; + CComPtr cpTextDocument; + ITextServices* pTextServices=NULL; + HRESULT hr = S_OK; + + // Use rich edit control interface pointers to update text + if( SendDlgItemMessage( m_hWnd, IDE_EDITBOX, EM_GETOLEINTERFACE, 0, (LPARAM)(LPVOID FAR *)&cpRichEdit ) ) + { + hr = cpRichEdit.QueryInterface( &cpTextDocument ); + + if( SUCCEEDED( hr ) ) + { + hr = cpTextDocument->QueryInterface( IID_ITextServices, (void**)&pTextServices ); + } + + if (SUCCEEDED(hr)) + { + BSTR bstr = SysAllocString( pszwText ); + + hr = pTextServices->TxSetText( bstr ); + + pTextServices->Release(); + + SysFreeString( bstr ); + } + } + + // Add text the old fashon way by converting it to ansi. Note information + // loss will occur because of the WC2MB conversion. + if( !cpRichEdit || FAILED( hr ) ) + { + USES_CONVERSION; + TCHAR *pszFileText = _tcsdup( W2T(pszwText) ); + SetDlgItemText( m_hWnd, IDE_EDITBOX, pszFileText ); + free( pszFileText ); + } +} + +///////////////////////////////////////////////////////////////////////// +void CTTSApp::EnableSpeakButtons( BOOL fEnable ) +///////////////////////////////////////////////////////////////////////// +{ + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_SPEAK ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_PAUSE ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_STOP ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_SKIP ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDB_SPEAKWAV ), fEnable ); + ::EnableWindow( ::GetDlgItem( m_hWnd, IDC_SAVETOWAV ), fEnable ); +} + +///////////////////////////////////////////////////// +inline void TTSAppStatusMessage( HWND hWnd, TCHAR* szMessage ) +///////////////////////////////////////////////////// +// +// This function prints debugging messages to the debug edit control +// +{ + static TCHAR szDebugText[MAX_SIZE]=_T(""); + static int i = 0; + + // Clear out the buffer after 100 lines of text have been written + // to the debug window since it can only hold 4096 characters. + if( i == 100 ) + { + _tcscpy( szDebugText, _T("") ); + i = 0; + } + // Attach the new message to the ongoing list of messages + _tcscat( szDebugText, szMessage ); + SetDlgItemText( hWnd, IDC_DEBUG, szDebugText ); + + SendDlgItemMessage( hWnd, IDC_DEBUG, EM_LINESCROLL, 0, i ); + + i++; + + return; +} + +/***************************************************************************************** +* About() * +*---------* +* Description: +* Message handler for the "About" box. +******************************************************************************************/ +LRESULT CALLBACK About( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch( message ) + { + case WM_COMMAND: + { + WORD wId = LOWORD(wParam); + WORD wEvent = HIWORD(wParam); + + switch( wId ) + { + case IDOK: + case IDCANCEL: + EndDialog( hDlg, LOWORD(wParam) ); + return TRUE; + } + } + } + return FALSE; +} /* About */ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/globals.cpp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/globals.cpp new file mode 100644 index 00000000..447ee6e1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/globals.cpp @@ -0,0 +1,110 @@ +#include "globals.h" +//Copyright (c) Microsoft Corporation. All rights reserved. + +// Other global variables +int g_iBmp = 0; // current bmp +HIMAGELIST g_hListBmp = 0; // image list +const int g_aMapVisemeToImage[22] = { 0, // SP_VISEME_0 = 0, // Silence + 11, // SP_VISEME_1, // AE, AX, AH + 11, // SP_VISEME_2, // AA + 11, // SP_VISEME_3, // AO + 10, // SP_VISEME_4, // EY, EH, UH + 11, // SP_VISEME_5, // ER + 9, // SP_VISEME_6, // y, IY, IH, IX + 2, // SP_VISEME_7, // w, UW + 13, // SP_VISEME_8, // OW + 9, // SP_VISEME_9, // AW + 12, // SP_VISEME_10, // OY + 11, // SP_VISEME_11, // AY + 9, // SP_VISEME_12, // h + 3, // SP_VISEME_13, // r + 6, // SP_VISEME_14, // l + 7, // SP_VISEME_15, // s, z + 8, // SP_VISEME_16, // SH, CH, JH, ZH + 5, // SP_VISEME_17, // TH, DH + 4, // SP_VISEME_18, // f, v + 7, // SP_VISEME_19, // d, t, n + 9, // SP_VISEME_20, // k, g, NG + 1 };// SP_VISEME_21, // p, b, m + + +// Output formats +const SPSTREAMFORMAT g_aOutputFormat[NUM_OUTPUTFORMATS] = {SPSF_8kHz8BitMono, + SPSF_8kHz8BitStereo, + SPSF_8kHz16BitMono, + SPSF_8kHz16BitStereo, + SPSF_11kHz8BitMono, + SPSF_11kHz8BitStereo, + SPSF_11kHz16BitMono, + SPSF_11kHz16BitStereo, + SPSF_12kHz8BitMono, + SPSF_12kHz8BitStereo, + SPSF_12kHz16BitMono, + SPSF_12kHz16BitStereo, + SPSF_16kHz8BitMono, + SPSF_16kHz8BitStereo, + SPSF_16kHz16BitMono, + SPSF_16kHz16BitStereo, + SPSF_22kHz8BitMono, + SPSF_22kHz8BitStereo, + SPSF_22kHz16BitMono, + SPSF_22kHz16BitStereo, + SPSF_24kHz8BitMono, + SPSF_24kHz8BitStereo, + SPSF_24kHz16BitMono, + SPSF_24kHz16BitStereo, + SPSF_32kHz8BitMono, + SPSF_32kHz8BitStereo, + SPSF_32kHz16BitMono, + SPSF_32kHz16BitStereo, + SPSF_44kHz8BitMono, + SPSF_44kHz8BitStereo, + SPSF_44kHz16BitMono, + SPSF_44kHz16BitStereo, + SPSF_48kHz8BitMono, + SPSF_48kHz8BitStereo, + SPSF_48kHz16BitMono, + SPSF_48kHz16BitStereo}; + +TCHAR* g_aszOutputFormat[NUM_OUTPUTFORMATS] = {_T("8kHz 8 Bit Mono"), + _T("8kHz 8 Bit Stereo"), + _T("8kHz 16 Bit Mono"), + _T("8kHz 16 Bit Stereo"), + _T("11kHz 8 Bit Mono"), + _T("11kHz 8 Bit Stereo"), + _T("11kHz 16 Bit Mono"), + _T("11kHz 16 Bit Stereo"), + _T("12kHz 8 Bit Mono"), + _T("12kHz 8 Bit Stereo"), + _T("12kHz 16 Bit Mono"), + _T("12kHz 16 Bit Stereo"), + _T("16kHz 8 Bit Mono"), + _T("16kHz 8 Bit Stereo"), + _T("16kHz 16 Bit Mono"), + _T("16kHz 16 Bit Stereo"), + _T("22kHz 8 Bit Mono"), + _T("22kHz 8 Bit Stereo"), + _T("22kHz 16 Bit Mono"), + _T("22kHz 16 Bit Stereo"), + _T("24kHz 8 Bit Mono"), + _T("24kHz 8 Bit Stereo"), + _T("24kHz 16 Bit Mono"), + _T("24kHz 16 Bit Stereo"), + _T("32kHz 8 Bit Mono"), + _T("32kHz 8 Bit Stereo"), + _T("32kHz 16 Bit Mono"), + _T("32kHz 16 Bit Stereo"), + _T("44kHz 8 Bit Mono"), + _T("44kHz 8 Bit Stereo"), + _T("44kHz 16 Bit Mono"), + _T("44kHz 16 Bit Stereo"), + _T("48kHz 8 Bit Mono"), + _T("48kHz 8 Bit Stereo"), + _T("48kHz 16 Bit Mono"), + _T("48kHz 16 Bit Stereo")}; + +// ITextServices interface guid +const IID IID_ITextServices = {0X8D33F740,0XCF58,0x11ce,{0XA8,0X9D,0X00,0XAA,0X00,0X6C,0XAD,0XC5}}; + +// ITextDocument interface guid +const IID IID_ITextDocument = {0x8CC497C0,0xA1DF,0x11ce,{0x80,0x98,0x00,0xAA,0x00,0x47,0xBE,0x5D}}; diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/globals.h b/sp/src/utils/sapi51/Samples/CPP/TTSApp/globals.h new file mode 100644 index 00000000..4a584a73 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/globals.h @@ -0,0 +1,18 @@ + #ifndef __TTSAPP_GLOBALS_H__ +#define __TTSAPP_GLOBALS_H__ + +// App includes +#include "TTSApp.h" + + +// Other global variables +extern int g_iBmp; +extern HIMAGELIST g_hListBmp; +extern const int g_aMapVisemeToImage[22]; + +// Output formats +extern const SPSTREAMFORMAT g_aOutputFormat[NUM_OUTPUTFORMATS]; +extern TCHAR* g_aszOutputFormat[NUM_OUTPUTFORMATS]; + + +#endif // __TTSAPP_GLOBALS_H__ diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/resource.h b/sp/src/utils/sapi51/Samples/CPP/TTSApp/resource.h new file mode 100644 index 00000000..3d53da69 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/resource.h @@ -0,0 +1,61 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ttsapp.rc +// +#define IDS_SAVE_NOTIFY 1 +#define IDS_NOTIFY_TITLE 2 +#define IDS_SAVE_ERROR 3 +#define IDS_AUDIOOUT_ERROR 4 +#define IDS_VOICE_INIT_ERROR 4 +#define IDS_UNSUPPORTED_FORMAT 5 +#define IDI_APPICON 101 +#define IDD_MAIN 101 +#define IDB_MICFULL 127 +#define IDB_MICEYESCLO 128 +#define IDB_MICEYESNAR 129 +#define IDB_MICMOUTH10 148 +#define IDB_MICMOUTH11 149 +#define IDB_MICMOUTH12 150 +#define IDB_MICMOUTH13 151 +#define IDB_MICMOUTH2 152 +#define IDB_MICMOUTH3 153 +#define IDB_MICMOUTH4 154 +#define IDB_MICMOUTH5 155 +#define IDB_MICMOUTH6 156 +#define IDB_MICMOUTH7 157 +#define IDB_MICMOUTH8 158 +#define IDB_MICMOUTH9 159 +#define IDD_ABOUT 161 +#define IDE_EDITBOX 1000 +#define IDC_ABOUT_TTSAPP_VERSION 1000 +#define IDC_MOUTHPOS 1001 +#define IDB_SPEAK 1002 +#define IDB_PAUSE 1003 +#define IDB_STOP 1004 +#define IDC_EVENTS 1006 +#define IDC_DEBUG 1007 +#define IDC_SPEAKXML 1008 +#define IDB_OPEN 1009 +#define IDC_COMBO_VOICES 1011 +#define IDB_RESET 1012 +#define IDC_RATE_SLIDER 1014 +#define IDC_VOLUME_SLIDER 1015 +#define IDC_COMBO_OUTPUT 1018 +#define IDC_SAVETOWAV 1020 +#define IDB_SPEAKWAV 1021 +#define IDC_CHARACTER 1023 +#define IDB_SKIP 1026 +#define IDC_SKIP_EDIT 1031 +#define IDC_SKIP_SPIN 1032 +#define IDC_ABOUT 1033 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 165 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1036 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/textserv.h b/sp/src/utils/sapi51/Samples/CPP/TTSApp/textserv.h new file mode 100644 index 00000000..fc945847 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/textserv.h @@ -0,0 +1,420 @@ +/* @doc EXTERNAL + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * + * @module TEXTSRV.H Text Service Interface | + * + * Define interfaces between the Text Services component and the host + * + * Original Author: + * Christian Fortini + * + * History: + * 8/1/95 ricksa Revised interface definition + */ + +#ifndef _TEXTSERV_H +#define _TEXTSERV_H + +#if _MSC_VER > 1000 +#pragma once +#endif + +EXTERN_C const IID IID_ITextServices; +EXTERN_C const IID IID_ITextHost; + +// Note: error code is first outside of range reserved for OLE. +#define S_MSG_KEY_IGNORED \ + MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_ITF, 0x201) + +// Enums used by property methods + +/* + * TXTBACKSTYLE + * + * @enum Defines different background styles control + */ +enum TXTBACKSTYLE { + TXTBACK_TRANSPARENT = 0, //@emem background should show through + TXTBACK_OPAQUE, //@emem erase background +}; + + +/* + * TXTHITRESULT + * + * @enum Defines different hitresults + */ +enum TXTHITRESULT { + TXTHITRESULT_NOHIT = 0, //@emem no hit + TXTHITRESULT_TRANSPARENT = 1, //@emem point is within the text's rectangle, but + //in a transparent region + TXTHITRESULT_CLOSE = 2, //@emem point is close to the text + TXTHITRESULT_HIT = 3 //@emem dead-on hit +}; + +/* + * TXTNATURALSIZE + * + * @enum useful values for TxGetNaturalSize. + * + * @xref + */ +enum TXTNATURALSIZE { + TXTNS_FITTOCONTENT = 1, //@emem Get a size that fits the content + TXTNS_ROUNDTOLINE = 2 //@emem Round to the nearest whole line. +}; + +/* + * TXTVIEW + * + * @enum useful values for TxDraw lViewId parameter + * + * @xref + */ +enum TXTVIEW { + TXTVIEW_ACTIVE = 0, + TXTVIEW_INACTIVE = -1 +}; + + +/* + * CHANGETYPE + * + * @enum used for CHANGENOTIFY.dwChangeType; indicates what happened + * for a particular change. + */ +enum CHANGETYPE +{ + CN_GENERIC = 0, //@emem Nothing special happened + CN_TEXTCHANGED = 1, //@emem the text changed + CN_NEWUNDO = 2, //@emem A new undo action was added + CN_NEWREDO = 4 //@emem A new redo action was added +}; + +/* + * @struct CHANGENOTIFY | + * + * passed during an EN_CHANGE notification; contains information about + * what actually happened for a change. + */ +struct CHANGENOTIFY { + DWORD dwChangeType; //@field TEXT changed, etc + void * pvCookieData; //@field cookie for the undo action + // associated with the change. +}; + +// The TxGetPropertyBits and OnTxPropertyBitsChange methods can pass the following bits: + +// NB!!! Do NOT rely on the ordering of these bits yet; the are subject +// to change. +#define TXTBIT_RICHTEXT 1 // rich-text control +#define TXTBIT_MULTILINE 2 // single vs multi-line control +#define TXTBIT_READONLY 4 // read only text +#define TXTBIT_SHOWACCELERATOR 8 // underline accelerator character +#define TXTBIT_USEPASSWORD 0x10 // use password char to display text +#define TXTBIT_HIDESELECTION 0x20 // show selection when inactive +#define TXTBIT_SAVESELECTION 0x40 // remember selection when inactive +#define TXTBIT_AUTOWORDSEL 0x80 // auto-word selection +#define TXTBIT_VERTICAL 0x100 // vertical +#define TXTBIT_SELBARCHANGE 0x200 // notification that the selection bar width + // has changed. + // FUTURE: move this bit to the end to + // maintain the division between + // properties and notifications. +#define TXTBIT_WORDWRAP 0x400 // if set, then multi-line controls + // should wrap words to fit the available + // display +#define TXTBIT_ALLOWBEEP 0x800 // enable/disable beeping +#define TXTBIT_DISABLEDRAG 0x1000 // disable/enable dragging +#define TXTBIT_VIEWINSETCHANGE 0x2000 // the inset changed +#define TXTBIT_BACKSTYLECHANGE 0x4000 +#define TXTBIT_MAXLENGTHCHANGE 0x8000 +#define TXTBIT_SCROLLBARCHANGE 0x10000 +#define TXTBIT_CHARFORMATCHANGE 0x20000 +#define TXTBIT_PARAFORMATCHANGE 0x40000 +#define TXTBIT_EXTENTCHANGE 0x80000 +#define TXTBIT_CLIENTRECTCHANGE 0x100000 // the client rectangle changed +#define TXTBIT_USECURRENTBKG 0x200000 // tells the renderer to use the current background + // color rather than the system default for an entire line + + +/* + * ITextServices + * + * @class An interface extending Microsoft's Text Object Model to provide + * extra functionality for windowless operation. In conjunction + * with ITextHost, ITextServices provides the means by which the + * the RichEdit control can be used *without* creating a window. + * + * @base public | IUnknown + */ +class ITextServices : public IUnknown +{ +public: + + //@cmember Generic Send Message interface + virtual HRESULT TxSendMessage( + UINT msg, + WPARAM wparam, + LPARAM lparam, + LRESULT *plresult) = 0; + + //@cmember Rendering + virtual HRESULT TxDraw( + DWORD dwDrawAspect, + LONG lindex, + void * pvAspect, + DVTARGETDEVICE * ptd, + HDC hdcDraw, + HDC hicTargetDev, + LPCRECTL lprcBounds, + LPCRECTL lprcWBounds, + LPRECT lprcUpdate, + BOOL (CALLBACK * pfnContinue) (DWORD), + DWORD dwContinue, + LONG lViewId) = 0; + + //@cmember Horizontal scrollbar support + virtual HRESULT TxGetHScroll( + LONG *plMin, + LONG *plMax, + LONG *plPos, + LONG *plPage, + BOOL * pfEnabled ) = 0; + + //@cmember Horizontal scrollbar support + virtual HRESULT TxGetVScroll( + LONG *plMin, + LONG *plMax, + LONG *plPos, + LONG *plPage, + BOOL * pfEnabled ) = 0; + + //@cmember Setcursor + virtual HRESULT OnTxSetCursor( + DWORD dwDrawAspect, + LONG lindex, + void * pvAspect, + DVTARGETDEVICE * ptd, + HDC hdcDraw, + HDC hicTargetDev, + LPCRECT lprcClient, + INT x, + INT y) = 0; + + //@cmember Hit-test + virtual HRESULT TxQueryHitPoint( + DWORD dwDrawAspect, + LONG lindex, + void * pvAspect, + DVTARGETDEVICE * ptd, + HDC hdcDraw, + HDC hicTargetDev, + LPCRECT lprcClient, + INT x, + INT y, + DWORD * pHitResult) = 0; + + //@cmember Inplace activate notification + virtual HRESULT OnTxInPlaceActivate(LPCRECT prcClient) = 0; + + //@cmember Inplace deactivate notification + virtual HRESULT OnTxInPlaceDeactivate() = 0; + + //@cmember UI activate notification + virtual HRESULT OnTxUIActivate() = 0; + + //@cmember UI deactivate notification + virtual HRESULT OnTxUIDeactivate() = 0; + + //@cmember Get text in control + virtual HRESULT TxGetText(BSTR *pbstrText) = 0; + + //@cmember Set text in control + virtual HRESULT TxSetText(LPCWSTR pszText) = 0; + + //@cmember Get x position of + virtual HRESULT TxGetCurTargetX(LONG *) = 0; + //@cmember Get baseline position + virtual HRESULT TxGetBaseLinePos(LONG *) = 0; + + //@cmember Get Size to fit / Natural size + virtual HRESULT TxGetNaturalSize( + DWORD dwAspect, + HDC hdcDraw, + HDC hicTargetDev, + DVTARGETDEVICE *ptd, + DWORD dwMode, + const SIZEL *psizelExtent, + LONG *pwidth, + LONG *pheight) = 0; + + //@cmember Drag & drop + virtual HRESULT TxGetDropTarget( IDropTarget **ppDropTarget ) = 0; + + //@cmember Bulk bit property change notifications + virtual HRESULT OnTxPropertyBitsChange(DWORD dwMask, DWORD dwBits) = 0; + + //@cmember Fetch the cached drawing size + virtual HRESULT TxGetCachedSize(DWORD *pdwWidth, DWORD *pdwHeight)=0; +}; + + +/* + * ITextHost + * + * @class Interface to be used by text services to obtain text host services + * + * @base public | IUnknown + */ +class ITextHost : public IUnknown +{ +public: + + //@cmember Get the DC for the host + virtual HDC TxGetDC() = 0; + + //@cmember Release the DC gotten from the host + virtual INT TxReleaseDC(HDC hdc) = 0; + + //@cmember Show the scroll bar + virtual BOOL TxShowScrollBar(INT fnBar, BOOL fShow) = 0; + + //@cmember Enable the scroll bar + virtual BOOL TxEnableScrollBar (INT fuSBFlags, INT fuArrowflags) = 0; + + //@cmember Set the scroll range + virtual BOOL TxSetScrollRange( + INT fnBar, + LONG nMinPos, + INT nMaxPos, + BOOL fRedraw) = 0; + + //@cmember Set the scroll position + virtual BOOL TxSetScrollPos (INT fnBar, INT nPos, BOOL fRedraw) = 0; + + //@cmember InvalidateRect + virtual void TxInvalidateRect(LPCRECT prc, BOOL fMode) = 0; + + //@cmember Send a WM_PAINT to the window + virtual void TxViewChange(BOOL fUpdate) = 0; + + //@cmember Create the caret + virtual BOOL TxCreateCaret(HBITMAP hbmp, INT xWidth, INT yHeight) = 0; + + //@cmember Show the caret + virtual BOOL TxShowCaret(BOOL fShow) = 0; + + //@cmember Set the caret position + virtual BOOL TxSetCaretPos(INT x, INT y) = 0; + + //@cmember Create a timer with the specified timeout + virtual BOOL TxSetTimer(UINT idTimer, UINT uTimeout) = 0; + + //@cmember Destroy a timer + virtual void TxKillTimer(UINT idTimer) = 0; + + //@cmember Scroll the content of the specified window's client area + virtual void TxScrollWindowEx ( + INT dx, + INT dy, + LPCRECT lprcScroll, + LPCRECT lprcClip, + HRGN hrgnUpdate, + LPRECT lprcUpdate, + UINT fuScroll) = 0; + + //@cmember Get mouse capture + virtual void TxSetCapture(BOOL fCapture) = 0; + + //@cmember Set the focus to the text window + virtual void TxSetFocus() = 0; + + //@cmember Establish a new cursor shape + virtual void TxSetCursor(HCURSOR hcur, BOOL fText) = 0; + + //@cmember Converts screen coordinates of a specified point to the client coordinates + virtual BOOL TxScreenToClient (LPPOINT lppt) = 0; + + //@cmember Converts the client coordinates of a specified point to screen coordinates + virtual BOOL TxClientToScreen (LPPOINT lppt) = 0; + + //@cmember Request host to activate text services + virtual HRESULT TxActivate( LONG * plOldState ) = 0; + + //@cmember Request host to deactivate text services + virtual HRESULT TxDeactivate( LONG lNewState ) = 0; + + //@cmember Retrieves the coordinates of a window's client area + virtual HRESULT TxGetClientRect(LPRECT prc) = 0; + + //@cmember Get the view rectangle relative to the inset + virtual HRESULT TxGetViewInset(LPRECT prc) = 0; + + //@cmember Get the default character format for the text + virtual HRESULT TxGetCharFormat(const CHARFORMATW **ppCF ) = 0; + + //@cmember Get the default paragraph format for the text + virtual HRESULT TxGetParaFormat(const PARAFORMAT **ppPF) = 0; + + //@cmember Get the background color for the window + virtual COLORREF TxGetSysColor(int nIndex) = 0; + + //@cmember Get the background (either opaque or transparent) + virtual HRESULT TxGetBackStyle(TXTBACKSTYLE *pstyle) = 0; + + //@cmember Get the maximum length for the text + virtual HRESULT TxGetMaxLength(DWORD *plength) = 0; + + //@cmember Get the bits representing requested scroll bars for the window + virtual HRESULT TxGetScrollBars(DWORD *pdwScrollBar) = 0; + + //@cmember Get the character to display for password input + virtual HRESULT TxGetPasswordChar(TCHAR *pch) = 0; + + //@cmember Get the accelerator character + virtual HRESULT TxGetAcceleratorPos(LONG *pcp) = 0; + + //@cmember Get the native size + virtual HRESULT TxGetExtent(LPSIZEL lpExtent) = 0; + + //@cmember Notify host that default character format has changed + virtual HRESULT OnTxCharFormatChange (const CHARFORMATW * pcf) = 0; + + //@cmember Notify host that default paragraph format has changed + virtual HRESULT OnTxParaFormatChange (const PARAFORMAT * ppf) = 0; + + //@cmember Bulk access to bit properties + virtual HRESULT TxGetPropertyBits(DWORD dwMask, DWORD *pdwBits) = 0; + + //@cmember Notify host of events + virtual HRESULT TxNotify(DWORD iNotify, void *pv) = 0; + + // Far East Methods for getting the Input Context +//#ifdef WIN95_IME + virtual HIMC TxImmGetContext() = 0; + virtual void TxImmReleaseContext( HIMC himc ) = 0; +//#endif + + //@cmember Returns HIMETRIC size of the control bar. + virtual HRESULT TxGetSelectionBarWidth (LONG *lSelBarWidth) = 0; + +}; + +//+----------------------------------------------------------------------- +// Factories +//------------------------------------------------------------------------ + +// Text Services factory +STDAPI CreateTextServices( + IUnknown *punkOuter, + ITextHost *pITextHost, + IUnknown **ppUnk); + +typedef HRESULT (STDAPICALLTYPE * PCreateTextServices)( + IUnknown *punkOuter, + ITextHost *pITextHost, + IUnknown **ppUnk); + +#endif // _TEXTSERV_H diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/tom.h b/sp/src/utils/sapi51/Samples/CPP/TTSApp/tom.h new file mode 100644 index 00000000..bd43fb22 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/tom.h @@ -0,0 +1,6612 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 3.01.75 */ +/* at Thu May 07 14:12:12 1998 + */ +/* Compiler settings for tom.idl: + Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext + error checks: none +*/ +//@@MIDL_FILE_HEADING( ) +#include "rpc.h" +#include "rpcndr.h" +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __tomtmp_h__ +#define __tomtmp_h__ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +#ifndef __ITextDocument_FWD_DEFINED__ +#define __ITextDocument_FWD_DEFINED__ +typedef interface ITextDocument ITextDocument; +#endif /* __ITextDocument_FWD_DEFINED__ */ + + +#ifndef __ITextRange_FWD_DEFINED__ +#define __ITextRange_FWD_DEFINED__ +typedef interface ITextRange ITextRange; +#endif /* __ITextRange_FWD_DEFINED__ */ + + +#ifndef __ITextSelection_FWD_DEFINED__ +#define __ITextSelection_FWD_DEFINED__ +typedef interface ITextSelection ITextSelection; +#endif /* __ITextSelection_FWD_DEFINED__ */ + + +#ifndef __ITextFont_FWD_DEFINED__ +#define __ITextFont_FWD_DEFINED__ +typedef interface ITextFont ITextFont; +#endif /* __ITextFont_FWD_DEFINED__ */ + + +#ifndef __ITextPara_FWD_DEFINED__ +#define __ITextPara_FWD_DEFINED__ +typedef interface ITextPara ITextPara; +#endif /* __ITextPara_FWD_DEFINED__ */ + + +#ifndef __ITextStoryRanges_FWD_DEFINED__ +#define __ITextStoryRanges_FWD_DEFINED__ +typedef interface ITextStoryRanges ITextStoryRanges; +#endif /* __ITextStoryRanges_FWD_DEFINED__ */ + + +#ifndef __ITextDocument2_FWD_DEFINED__ +#define __ITextDocument2_FWD_DEFINED__ +typedef interface ITextDocument2 ITextDocument2; +#endif /* __ITextDocument2_FWD_DEFINED__ */ + + +#ifndef __ITextMsgFilter_FWD_DEFINED__ +#define __ITextMsgFilter_FWD_DEFINED__ +typedef interface ITextMsgFilter ITextMsgFilter; +#endif /* __ITextMsgFilter_FWD_DEFINED__ */ + + +#ifndef __ITextDocument_FWD_DEFINED__ +#define __ITextDocument_FWD_DEFINED__ +typedef interface ITextDocument ITextDocument; +#endif /* __ITextDocument_FWD_DEFINED__ */ + + +#ifndef __ITextRange_FWD_DEFINED__ +#define __ITextRange_FWD_DEFINED__ +typedef interface ITextRange ITextRange; +#endif /* __ITextRange_FWD_DEFINED__ */ + + +#ifndef __ITextSelection_FWD_DEFINED__ +#define __ITextSelection_FWD_DEFINED__ +typedef interface ITextSelection ITextSelection; +#endif /* __ITextSelection_FWD_DEFINED__ */ + + +#ifndef __ITextFont_FWD_DEFINED__ +#define __ITextFont_FWD_DEFINED__ +typedef interface ITextFont ITextFont; +#endif /* __ITextFont_FWD_DEFINED__ */ + + +#ifndef __ITextPara_FWD_DEFINED__ +#define __ITextPara_FWD_DEFINED__ +typedef interface ITextPara ITextPara; +#endif /* __ITextPara_FWD_DEFINED__ */ + + +#ifndef __ITextStoryRanges_FWD_DEFINED__ +#define __ITextStoryRanges_FWD_DEFINED__ +typedef interface ITextStoryRanges ITextStoryRanges; +#endif /* __ITextStoryRanges_FWD_DEFINED__ */ + + +#ifndef __ITextDocument2_FWD_DEFINED__ +#define __ITextDocument2_FWD_DEFINED__ +typedef interface ITextDocument2 ITextDocument2; +#endif /* __ITextDocument2_FWD_DEFINED__ */ + + +#ifndef __ITextMsgFilter_FWD_DEFINED__ +#define __ITextMsgFilter_FWD_DEFINED__ +typedef interface ITextMsgFilter ITextMsgFilter; +#endif /* __ITextMsgFilter_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +/**************************************** + * Generated header for interface: __MIDL_itf_tom_0000 + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [local] */ + + + + + + + + + + + +extern RPC_IF_HANDLE __MIDL_itf_tom_0000_v0_0_c_ifspec; +extern RPC_IF_HANDLE __MIDL_itf_tom_0000_v0_0_s_ifspec; + + +#ifndef __tom_LIBRARY_DEFINED__ +#define __tom_LIBRARY_DEFINED__ + +/**************************************** + * Generated header for library: tom + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [version][uuid] */ + + +typedef /* [public] */ +enum __MIDL___MIDL_itf_tom_0000_0001 + { tomFalse = 0, + tomTrue = -1, + tomUndefined = -9999999, + tomToggle = -9999998, + tomAutoColor = -9999997, + tomDefault = -9999996, + tomSuspend = -9999995, + tomResume = -9999994, + tomApplyNow = 0, + tomApplyLater = 1, + tomTrackParms = 2, + tomCacheParms = 3, + tomBackward = 0xc0000001, + tomForward = 0x3fffffff, + tomMove = 0, + tomExtend = 1, + tomNoSelection = 0, + tomSelectionIP = 1, + tomSelectionNormal = 2, + tomSelectionFrame = 3, + tomSelectionColumn = 4, + tomSelectionRow = 5, + tomSelectionBlock = 6, + tomSelectionInlineShape = 7, + tomSelectionShape = 8, + tomSelStartActive = 1, + tomSelAtEOL = 2, + tomSelOvertype = 4, + tomSelActive = 8, + tomSelReplace = 16, + tomEnd = 0, + tomStart = 32, + tomCollapseEnd = 0, + tomCollapseStart = 1, + tomClientCoord = 256, + tomNone = 0, + tomSingle = 1, + tomWords = 2, + tomDouble = 3, + tomDotted = 4, + tomDash = 5, + tomDashDot = 6, + tomDashDotDot = 7, + tomWave = 8, + tomThick = 9, + tomHair = 10, + tomLineSpaceSingle = 0, + tomLineSpace1pt5 = 1, + tomLineSpaceDouble = 2, + tomLineSpaceAtLeast = 3, + tomLineSpaceExactly = 4, + tomLineSpaceMultiple = 5, + tomAlignLeft = 0, + tomAlignCenter = 1, + tomAlignRight = 2, + tomAlignJustify = 3, + tomAlignDecimal = 3, + tomAlignBar = 4, + tomAlignInterWord = 3, + tomAlignInterLetter = 4, + tomAlignScaled = 5, + tomAlignGlyphs = 6, + tomAlignSnapGrid = 7, + tomSpaces = 0, + tomDots = 1, + tomDashes = 2, + tomLines = 3, + tomThickLines = 4, + tomEquals = 5, + tomTabBack = -3, + tomTabNext = -2, + tomTabHere = -1, + tomListNone = 0, + tomListBullet = 1, + tomListNumberAsArabic = 2, + tomListNumberAsLCLetter = 3, + tomListNumberAsUCLetter = 4, + tomListNumberAsLCRoman = 5, + tomListNumberAsUCRoman = 6, + tomListNumberAsSequence = 7, + tomListParentheses = 0x10000, + tomListPeriod = 0x20000, + tomListPlain = 0x30000, + tomCharacter = 1, + tomWord = 2, + tomSentence = 3, + tomParagraph = 4, + tomLine = 5, + tomStory = 6, + tomScreen = 7, + tomSection = 8, + tomColumn = 9, + tomRow = 10, + tomWindow = 11, + tomCell = 12, + tomCharFormat = 13, + tomParaFormat = 14, + tomTable = 15, + tomObject = 16, + tomMatchWord = 2, + tomMatchCase = 4, + tomMatchPattern = 8, + tomUnknownStory = 0, + tomMainTextStory = 1, + tomFootnotesStory = 2, + tomEndnotesStory = 3, + tomCommentsStory = 4, + tomTextFrameStory = 5, + tomEvenPagesHeaderStory = 6, + tomPrimaryHeaderStory = 7, + tomEvenPagesFooterStory = 8, + tomPrimaryFooterStory = 9, + tomFirstPageHeaderStory = 10, + tomFirstPageFooterStory = 11, + tomNoAnimation = 0, + tomLasVegasLights = 1, + tomBlinkingBackground = 2, + tomSparkleText = 3, + tomMarchingBlackAnts = 4, + tomMarchingRedAnts = 5, + tomShimmer = 6, + tomWipeDown = 7, + tomWipeRight = 8, + tomAnimationMax = 8, + tomLowerCase = 0, + tomUpperCase = 1, + tomTitleCase = 2, + tomSentenceCase = 4, + tomToggleCase = 5, + tomReadOnly = 0x100, + tomShareDenyRead = 0x200, + tomShareDenyWrite = 0x400, + tomPasteFile = 0x1000, + tomCreateNew = 0x10, + tomCreateAlways = 0x20, + tomOpenExisting = 0x30, + tomOpenAlways = 0x40, + tomTruncateExisting = 0x50, + tomRTF = 0x1, + tomText = 0x2, + tomHTML = 0x3, + tomWordDocument = 0x4, + tomBold = 0x80000001, + tomItalic = 0x80000002, + tomUnderline = 0x80000004, + tomStrikeout = 0x80000008, + tomProtected = 0x80000010, + tomLink = 0x80000020, + tomSmallCaps = 0x80000040, + tomAllCaps = 0x80000080, + tomHidden = 0x80000100, + tomOutline = 0x80000200, + tomShadow = 0x80000400, + tomEmboss = 0x80000800, + tomImprint = 0x80001000, + tomDisabled = 0x80002000, + tomRevised = 0x80004000, + tomNormalCaret = 0, + tomKoreanBlockCaret = 0x1, + tomIncludeInset = 0x1, + tomIgnoreCurrentFont = 0, + tomMatchFontCharset = 0x1, + tomMatchFontSignature = 0x2, + tomCharset = 0x80000000 + } tomConstants; + + + + + + + + + + +EXTERN_C const IID LIBID_tom; + +#ifndef __ITextDocument_INTERFACE_DEFINED__ +#define __ITextDocument_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextDocument + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextDocument; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C0-A1DF-11ce-8098-00AA0047BE5D") + ITextDocument : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetName( + /* [retval][out] */ BSTR __RPC_FAR *pName) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSelection( + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryRanges( + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSaved( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSaved( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDefaultTabStop( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDefaultTabStop( + /* [in] */ float Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE New( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Open( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Save( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Freeze( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Unfreeze( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE BeginEditCollection( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndEditCollection( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Undo( + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Redo( + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Range( + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE RangeFromPoint( + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextDocumentVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextDocument __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextDocument __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextDocument __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextDocument __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextDocument __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextDocument __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextDocument __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelection )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryCount )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryRanges )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSaved )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSaved )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDefaultTabStop )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultTabStop )( + ITextDocument __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *New )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Unfreeze )( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEditCollection )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndEditCollection )( + ITextDocument __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Undo )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Redo )( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Range )( + ITextDocument __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RangeFromPoint )( + ITextDocument __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + END_INTERFACE + } ITextDocumentVtbl; + + interface ITextDocument + { + CONST_VTBL struct ITextDocumentVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextDocument_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextDocument_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextDocument_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextDocument_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextDocument_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextDocument_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextDocument_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextDocument_GetName(This,pName) \ + (This)->lpVtbl -> GetName(This,pName) + +#define ITextDocument_GetSelection(This,ppSel) \ + (This)->lpVtbl -> GetSelection(This,ppSel) + +#define ITextDocument_GetStoryCount(This,pCount) \ + (This)->lpVtbl -> GetStoryCount(This,pCount) + +#define ITextDocument_GetStoryRanges(This,ppStories) \ + (This)->lpVtbl -> GetStoryRanges(This,ppStories) + +#define ITextDocument_GetSaved(This,pValue) \ + (This)->lpVtbl -> GetSaved(This,pValue) + +#define ITextDocument_SetSaved(This,Value) \ + (This)->lpVtbl -> SetSaved(This,Value) + +#define ITextDocument_GetDefaultTabStop(This,pValue) \ + (This)->lpVtbl -> GetDefaultTabStop(This,pValue) + +#define ITextDocument_SetDefaultTabStop(This,Value) \ + (This)->lpVtbl -> SetDefaultTabStop(This,Value) + +#define ITextDocument_New(This) \ + (This)->lpVtbl -> New(This) + +#define ITextDocument_Open(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Open(This,pVar,Flags,CodePage) + +#define ITextDocument_Save(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Save(This,pVar,Flags,CodePage) + +#define ITextDocument_Freeze(This,pCount) \ + (This)->lpVtbl -> Freeze(This,pCount) + +#define ITextDocument_Unfreeze(This,pCount) \ + (This)->lpVtbl -> Unfreeze(This,pCount) + +#define ITextDocument_BeginEditCollection(This) \ + (This)->lpVtbl -> BeginEditCollection(This) + +#define ITextDocument_EndEditCollection(This) \ + (This)->lpVtbl -> EndEditCollection(This) + +#define ITextDocument_Undo(This,Count,prop) \ + (This)->lpVtbl -> Undo(This,Count,prop) + +#define ITextDocument_Redo(This,Count,prop) \ + (This)->lpVtbl -> Redo(This,Count,prop) + +#define ITextDocument_Range(This,cp1,cp2,ppRange) \ + (This)->lpVtbl -> Range(This,cp1,cp2,ppRange) + +#define ITextDocument_RangeFromPoint(This,x,y,ppRange) \ + (This)->lpVtbl -> RangeFromPoint(This,x,y,ppRange) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetName_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + +void __RPC_STUB ITextDocument_GetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetSelection_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + +void __RPC_STUB ITextDocument_GetSelection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetStoryCount_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_GetStoryCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetStoryRanges_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + +void __RPC_STUB ITextDocument_GetStoryRanges_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetSaved_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextDocument_GetSaved_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_SetSaved_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextDocument_SetSaved_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_GetDefaultTabStop_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextDocument_GetDefaultTabStop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument_SetDefaultTabStop_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextDocument_SetDefaultTabStop_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_New_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_New_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Open_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + +void __RPC_STUB ITextDocument_Open_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Save_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + +void __RPC_STUB ITextDocument_Save_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Freeze_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_Freeze_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Unfreeze_Proxy( + ITextDocument __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextDocument_Unfreeze_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_BeginEditCollection_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_BeginEditCollection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_EndEditCollection_Proxy( + ITextDocument __RPC_FAR * This); + + +void __RPC_STUB ITextDocument_EndEditCollection_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Undo_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + +void __RPC_STUB ITextDocument_Undo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Redo_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + +void __RPC_STUB ITextDocument_Redo_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_Range_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextDocument_Range_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextDocument_RangeFromPoint_Proxy( + ITextDocument __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextDocument_RangeFromPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextDocument_INTERFACE_DEFINED__ */ + + +#ifndef __ITextRange_INTERFACE_DEFINED__ +#define __ITextRange_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextRange + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextRange; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C2-A1DF-11ce-8098-00AA0047BE5D") + ITextRange : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetText( + /* [retval][out] */ BSTR __RPC_FAR *pbstr) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetText( + /* [in] */ BSTR bstr) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetChar( + /* [retval][out] */ long __RPC_FAR *pch) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetChar( + /* [in] */ long ch) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFormattedText( + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFormattedText( + /* [in] */ ITextRange __RPC_FAR *pRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStart( + /* [retval][out] */ long __RPC_FAR *pcpFirst) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStart( + /* [in] */ long cpFirst) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEnd( + /* [retval][out] */ long __RPC_FAR *pcpLim) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEnd( + /* [in] */ long cpLim) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFont( + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFont( + /* [in] */ ITextFont __RPC_FAR *pFont) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPara( + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPara( + /* [in] */ ITextPara __RPC_FAR *pPara) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryLength( + /* [retval][out] */ long __RPC_FAR *pcch) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStoryType( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Collapse( + /* [in] */ long bStart) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Expand( + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetIndex( + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetIndex( + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetRange( + /* [in] */ long cpActive, + /* [in] */ long cpOther) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE InRange( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE InStory( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Select( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE StartOf( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndOf( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Move( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStart( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEnd( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStartWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEndWhile( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveStartUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveEndUntil( + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindText( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindTextStart( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE FindTextEnd( + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Delete( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Cut( + /* [out] */ VARIANT __RPC_FAR *pVar) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Copy( + /* [out] */ VARIANT __RPC_FAR *pVar) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Paste( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanPaste( + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanEdit( + /* [retval][out] */ long __RPC_FAR *pbCanEdit) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ChangeCase( + /* [in] */ long Type) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetPoint( + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetPoint( + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ScrollIntoView( + /* [in] */ long Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEmbeddedObject( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextRangeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextRange __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextRange __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextRange __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextRange __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextRange __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextRange __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextRange __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetText )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetText )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetChar )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetChar )( + ITextRange __RPC_FAR * This, + /* [in] */ long ch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFormattedText )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFormattedText )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStart )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStart )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpFirst); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnd )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpLim); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFont )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFont )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPara )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPara )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryLength )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryType )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Collapse )( + ITextRange __RPC_FAR * This, + /* [in] */ long bStart); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Expand )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIndex )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndex )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRange )( + ITextRange __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InRange )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InStory )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Select )( + ITextRange __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartOf )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndOf )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStart )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndWhile )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndUntil )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindText )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextStart )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextEnd )( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Cut )( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Copy )( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Paste )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanPaste )( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanEdit )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChangeCase )( + ITextRange __RPC_FAR * This, + /* [in] */ long Type); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPoint )( + ITextRange __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPoint )( + ITextRange __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ScrollIntoView )( + ITextRange __RPC_FAR * This, + /* [in] */ long Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmbeddedObject )( + ITextRange __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + END_INTERFACE + } ITextRangeVtbl; + + interface ITextRange + { + CONST_VTBL struct ITextRangeVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextRange_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextRange_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextRange_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextRange_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextRange_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextRange_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextRange_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextRange_GetText(This,pbstr) \ + (This)->lpVtbl -> GetText(This,pbstr) + +#define ITextRange_SetText(This,bstr) \ + (This)->lpVtbl -> SetText(This,bstr) + +#define ITextRange_GetChar(This,pch) \ + (This)->lpVtbl -> GetChar(This,pch) + +#define ITextRange_SetChar(This,ch) \ + (This)->lpVtbl -> SetChar(This,ch) + +#define ITextRange_GetDuplicate(This,ppRange) \ + (This)->lpVtbl -> GetDuplicate(This,ppRange) + +#define ITextRange_GetFormattedText(This,ppRange) \ + (This)->lpVtbl -> GetFormattedText(This,ppRange) + +#define ITextRange_SetFormattedText(This,pRange) \ + (This)->lpVtbl -> SetFormattedText(This,pRange) + +#define ITextRange_GetStart(This,pcpFirst) \ + (This)->lpVtbl -> GetStart(This,pcpFirst) + +#define ITextRange_SetStart(This,cpFirst) \ + (This)->lpVtbl -> SetStart(This,cpFirst) + +#define ITextRange_GetEnd(This,pcpLim) \ + (This)->lpVtbl -> GetEnd(This,pcpLim) + +#define ITextRange_SetEnd(This,cpLim) \ + (This)->lpVtbl -> SetEnd(This,cpLim) + +#define ITextRange_GetFont(This,pFont) \ + (This)->lpVtbl -> GetFont(This,pFont) + +#define ITextRange_SetFont(This,pFont) \ + (This)->lpVtbl -> SetFont(This,pFont) + +#define ITextRange_GetPara(This,pPara) \ + (This)->lpVtbl -> GetPara(This,pPara) + +#define ITextRange_SetPara(This,pPara) \ + (This)->lpVtbl -> SetPara(This,pPara) + +#define ITextRange_GetStoryLength(This,pcch) \ + (This)->lpVtbl -> GetStoryLength(This,pcch) + +#define ITextRange_GetStoryType(This,pValue) \ + (This)->lpVtbl -> GetStoryType(This,pValue) + +#define ITextRange_Collapse(This,bStart) \ + (This)->lpVtbl -> Collapse(This,bStart) + +#define ITextRange_Expand(This,Unit,pDelta) \ + (This)->lpVtbl -> Expand(This,Unit,pDelta) + +#define ITextRange_GetIndex(This,Unit,pIndex) \ + (This)->lpVtbl -> GetIndex(This,Unit,pIndex) + +#define ITextRange_SetIndex(This,Unit,Index,Extend) \ + (This)->lpVtbl -> SetIndex(This,Unit,Index,Extend) + +#define ITextRange_SetRange(This,cpActive,cpOther) \ + (This)->lpVtbl -> SetRange(This,cpActive,cpOther) + +#define ITextRange_InRange(This,pRange,pb) \ + (This)->lpVtbl -> InRange(This,pRange,pb) + +#define ITextRange_InStory(This,pRange,pb) \ + (This)->lpVtbl -> InStory(This,pRange,pb) + +#define ITextRange_IsEqual(This,pRange,pb) \ + (This)->lpVtbl -> IsEqual(This,pRange,pb) + +#define ITextRange_Select(This) \ + (This)->lpVtbl -> Select(This) + +#define ITextRange_StartOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> StartOf(This,Unit,Extend,pDelta) + +#define ITextRange_EndOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndOf(This,Unit,Extend,pDelta) + +#define ITextRange_Move(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Move(This,Unit,Count,pDelta) + +#define ITextRange_MoveStart(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveStart(This,Unit,Count,pDelta) + +#define ITextRange_MoveEnd(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveEnd(This,Unit,Count,pDelta) + +#define ITextRange_MoveWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveStartWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveEndWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndWhile(This,Cset,Count,pDelta) + +#define ITextRange_MoveUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveUntil(This,Cset,Count,pDelta) + +#define ITextRange_MoveStartUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartUntil(This,Cset,Count,pDelta) + +#define ITextRange_MoveEndUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndUntil(This,Cset,Count,pDelta) + +#define ITextRange_FindText(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindText(This,bstr,cch,Flags,pLength) + +#define ITextRange_FindTextStart(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextStart(This,bstr,cch,Flags,pLength) + +#define ITextRange_FindTextEnd(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextEnd(This,bstr,cch,Flags,pLength) + +#define ITextRange_Delete(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Delete(This,Unit,Count,pDelta) + +#define ITextRange_Cut(This,pVar) \ + (This)->lpVtbl -> Cut(This,pVar) + +#define ITextRange_Copy(This,pVar) \ + (This)->lpVtbl -> Copy(This,pVar) + +#define ITextRange_Paste(This,pVar,Format) \ + (This)->lpVtbl -> Paste(This,pVar,Format) + +#define ITextRange_CanPaste(This,pVar,Format,pb) \ + (This)->lpVtbl -> CanPaste(This,pVar,Format,pb) + +#define ITextRange_CanEdit(This,pbCanEdit) \ + (This)->lpVtbl -> CanEdit(This,pbCanEdit) + +#define ITextRange_ChangeCase(This,Type) \ + (This)->lpVtbl -> ChangeCase(This,Type) + +#define ITextRange_GetPoint(This,Type,px,py) \ + (This)->lpVtbl -> GetPoint(This,Type,px,py) + +#define ITextRange_SetPoint(This,x,y,Type,Extend) \ + (This)->lpVtbl -> SetPoint(This,x,y,Type,Extend) + +#define ITextRange_ScrollIntoView(This,Value) \ + (This)->lpVtbl -> ScrollIntoView(This,Value) + +#define ITextRange_GetEmbeddedObject(This,ppv) \ + (This)->lpVtbl -> GetEmbeddedObject(This,ppv) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetText_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + +void __RPC_STUB ITextRange_GetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextRange_SetText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetChar_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + +void __RPC_STUB ITextRange_GetChar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetChar_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long ch); + + +void __RPC_STUB ITextRange_SetChar_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetDuplicate_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextRange_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetFormattedText_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextRange_GetFormattedText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetFormattedText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + +void __RPC_STUB ITextRange_SetFormattedText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStart_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + +void __RPC_STUB ITextRange_GetStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpFirst); + + +void __RPC_STUB ITextRange_SetStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + +void __RPC_STUB ITextRange_GetEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpLim); + + +void __RPC_STUB ITextRange_SetEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetFont_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + +void __RPC_STUB ITextRange_GetFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetFont_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + +void __RPC_STUB ITextRange_SetFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetPara_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + +void __RPC_STUB ITextRange_GetPara_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetPara_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + +void __RPC_STUB ITextRange_SetPara_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStoryLength_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + +void __RPC_STUB ITextRange_GetStoryLength_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetStoryType_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextRange_GetStoryType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Collapse_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long bStart); + + +void __RPC_STUB ITextRange_Collapse_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Expand_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Expand_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetIndex_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + +void __RPC_STUB ITextRange_GetIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetIndex_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + +void __RPC_STUB ITextRange_SetIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetRange_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + +void __RPC_STUB ITextRange_SetRange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_InRange_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_InRange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_InStory_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_InStory_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_IsEqual_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Select_Proxy( + ITextRange __RPC_FAR * This); + + +void __RPC_STUB ITextRange_Select_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_StartOf_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_StartOf_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_EndOf_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_EndOf_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Move_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Move_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStartWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStartWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEndWhile_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEndWhile_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveStartUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveStartUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_MoveEndUntil_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_MoveEndUntil_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindText_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindTextStart_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindTextStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_FindTextEnd_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + +void __RPC_STUB ITextRange_FindTextEnd_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Delete_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextRange_Delete_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Cut_Proxy( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + +void __RPC_STUB ITextRange_Cut_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Copy_Proxy( + ITextRange __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + +void __RPC_STUB ITextRange_Copy_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_Paste_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + +void __RPC_STUB ITextRange_Paste_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_CanPaste_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + +void __RPC_STUB ITextRange_CanPaste_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_CanEdit_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + +void __RPC_STUB ITextRange_CanEdit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_ChangeCase_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Type); + + +void __RPC_STUB ITextRange_ChangeCase_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetPoint_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + +void __RPC_STUB ITextRange_GetPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_SetPoint_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + +void __RPC_STUB ITextRange_SetPoint_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_ScrollIntoView_Proxy( + ITextRange __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextRange_ScrollIntoView_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextRange_GetEmbeddedObject_Proxy( + ITextRange __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + +void __RPC_STUB ITextRange_GetEmbeddedObject_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextRange_INTERFACE_DEFINED__ */ + + +#ifndef __ITextSelection_INTERFACE_DEFINED__ +#define __ITextSelection_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextSelection + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextSelection; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C1-A1DF-11ce-8098-00AA0047BE5D") + ITextSelection : public ITextRange + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFlags( + /* [retval][out] */ long __RPC_FAR *pFlags) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetFlags( + /* [in] */ LONG Flags) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetType( + /* [retval][out] */ long __RPC_FAR *pType) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveLeft( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveRight( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveUp( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE MoveDown( + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE HomeKey( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE EndKey( + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE TypeText( + /* [in] */ BSTR bstr) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextSelectionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextSelection __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextSelection __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextSelection __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextSelection __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextSelection __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextSelection __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextSelection __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetText )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetChar )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pch); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetChar )( + ITextSelection __RPC_FAR * This, + /* [in] */ long ch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFormattedText )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFormattedText )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStart )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpFirst); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpFirst); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnd )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcpLim); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpLim); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFont )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *pFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFont )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPara )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *pPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPara )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryLength )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pcch); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryType )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Collapse )( + ITextSelection __RPC_FAR * This, + /* [in] */ long bStart); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Expand )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIndex )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [retval][out] */ long __RPC_FAR *pIndex); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndex )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Index, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRange )( + ITextSelection __RPC_FAR * This, + /* [in] */ long cpActive, + /* [in] */ long cpOther); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InRange )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *InStory )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextSelection __RPC_FAR * This, + /* [in] */ ITextRange __RPC_FAR *pRange, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Select )( + ITextSelection __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartOf )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndOf )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Move )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndWhile )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveStartUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveEndUntil )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *Cset, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextStart )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FindTextEnd )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr, + /* [in] */ long cch, + /* [in] */ long Flags, + /* [retval][out] */ long __RPC_FAR *pLength); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Delete )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Cut )( + ITextSelection __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Copy )( + ITextSelection __RPC_FAR * This, + /* [out] */ VARIANT __RPC_FAR *pVar); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Paste )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanPaste )( + ITextSelection __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Format, + /* [retval][out] */ long __RPC_FAR *pb); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanEdit )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pbCanEdit); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ChangeCase )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Type); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPoint )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *px, + /* [out] */ long __RPC_FAR *py); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPoint )( + ITextSelection __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [in] */ long Type, + /* [in] */ long Extend); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ScrollIntoView )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmbeddedObject )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppv); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFlags )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pFlags); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFlags )( + ITextSelection __RPC_FAR * This, + /* [in] */ LONG Flags); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetType )( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pType); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveLeft )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveRight )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveUp )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MoveDown )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HomeKey )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndKey )( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *TypeText )( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + END_INTERFACE + } ITextSelectionVtbl; + + interface ITextSelection + { + CONST_VTBL struct ITextSelectionVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextSelection_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextSelection_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextSelection_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextSelection_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextSelection_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextSelection_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextSelection_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextSelection_GetText(This,pbstr) \ + (This)->lpVtbl -> GetText(This,pbstr) + +#define ITextSelection_SetText(This,bstr) \ + (This)->lpVtbl -> SetText(This,bstr) + +#define ITextSelection_GetChar(This,pch) \ + (This)->lpVtbl -> GetChar(This,pch) + +#define ITextSelection_SetChar(This,ch) \ + (This)->lpVtbl -> SetChar(This,ch) + +#define ITextSelection_GetDuplicate(This,ppRange) \ + (This)->lpVtbl -> GetDuplicate(This,ppRange) + +#define ITextSelection_GetFormattedText(This,ppRange) \ + (This)->lpVtbl -> GetFormattedText(This,ppRange) + +#define ITextSelection_SetFormattedText(This,pRange) \ + (This)->lpVtbl -> SetFormattedText(This,pRange) + +#define ITextSelection_GetStart(This,pcpFirst) \ + (This)->lpVtbl -> GetStart(This,pcpFirst) + +#define ITextSelection_SetStart(This,cpFirst) \ + (This)->lpVtbl -> SetStart(This,cpFirst) + +#define ITextSelection_GetEnd(This,pcpLim) \ + (This)->lpVtbl -> GetEnd(This,pcpLim) + +#define ITextSelection_SetEnd(This,cpLim) \ + (This)->lpVtbl -> SetEnd(This,cpLim) + +#define ITextSelection_GetFont(This,pFont) \ + (This)->lpVtbl -> GetFont(This,pFont) + +#define ITextSelection_SetFont(This,pFont) \ + (This)->lpVtbl -> SetFont(This,pFont) + +#define ITextSelection_GetPara(This,pPara) \ + (This)->lpVtbl -> GetPara(This,pPara) + +#define ITextSelection_SetPara(This,pPara) \ + (This)->lpVtbl -> SetPara(This,pPara) + +#define ITextSelection_GetStoryLength(This,pcch) \ + (This)->lpVtbl -> GetStoryLength(This,pcch) + +#define ITextSelection_GetStoryType(This,pValue) \ + (This)->lpVtbl -> GetStoryType(This,pValue) + +#define ITextSelection_Collapse(This,bStart) \ + (This)->lpVtbl -> Collapse(This,bStart) + +#define ITextSelection_Expand(This,Unit,pDelta) \ + (This)->lpVtbl -> Expand(This,Unit,pDelta) + +#define ITextSelection_GetIndex(This,Unit,pIndex) \ + (This)->lpVtbl -> GetIndex(This,Unit,pIndex) + +#define ITextSelection_SetIndex(This,Unit,Index,Extend) \ + (This)->lpVtbl -> SetIndex(This,Unit,Index,Extend) + +#define ITextSelection_SetRange(This,cpActive,cpOther) \ + (This)->lpVtbl -> SetRange(This,cpActive,cpOther) + +#define ITextSelection_InRange(This,pRange,pb) \ + (This)->lpVtbl -> InRange(This,pRange,pb) + +#define ITextSelection_InStory(This,pRange,pb) \ + (This)->lpVtbl -> InStory(This,pRange,pb) + +#define ITextSelection_IsEqual(This,pRange,pb) \ + (This)->lpVtbl -> IsEqual(This,pRange,pb) + +#define ITextSelection_Select(This) \ + (This)->lpVtbl -> Select(This) + +#define ITextSelection_StartOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> StartOf(This,Unit,Extend,pDelta) + +#define ITextSelection_EndOf(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndOf(This,Unit,Extend,pDelta) + +#define ITextSelection_Move(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Move(This,Unit,Count,pDelta) + +#define ITextSelection_MoveStart(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveStart(This,Unit,Count,pDelta) + +#define ITextSelection_MoveEnd(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> MoveEnd(This,Unit,Count,pDelta) + +#define ITextSelection_MoveWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveStartWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveEndWhile(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndWhile(This,Cset,Count,pDelta) + +#define ITextSelection_MoveUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveUntil(This,Cset,Count,pDelta) + +#define ITextSelection_MoveStartUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveStartUntil(This,Cset,Count,pDelta) + +#define ITextSelection_MoveEndUntil(This,Cset,Count,pDelta) \ + (This)->lpVtbl -> MoveEndUntil(This,Cset,Count,pDelta) + +#define ITextSelection_FindText(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindText(This,bstr,cch,Flags,pLength) + +#define ITextSelection_FindTextStart(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextStart(This,bstr,cch,Flags,pLength) + +#define ITextSelection_FindTextEnd(This,bstr,cch,Flags,pLength) \ + (This)->lpVtbl -> FindTextEnd(This,bstr,cch,Flags,pLength) + +#define ITextSelection_Delete(This,Unit,Count,pDelta) \ + (This)->lpVtbl -> Delete(This,Unit,Count,pDelta) + +#define ITextSelection_Cut(This,pVar) \ + (This)->lpVtbl -> Cut(This,pVar) + +#define ITextSelection_Copy(This,pVar) \ + (This)->lpVtbl -> Copy(This,pVar) + +#define ITextSelection_Paste(This,pVar,Format) \ + (This)->lpVtbl -> Paste(This,pVar,Format) + +#define ITextSelection_CanPaste(This,pVar,Format,pb) \ + (This)->lpVtbl -> CanPaste(This,pVar,Format,pb) + +#define ITextSelection_CanEdit(This,pbCanEdit) \ + (This)->lpVtbl -> CanEdit(This,pbCanEdit) + +#define ITextSelection_ChangeCase(This,Type) \ + (This)->lpVtbl -> ChangeCase(This,Type) + +#define ITextSelection_GetPoint(This,Type,px,py) \ + (This)->lpVtbl -> GetPoint(This,Type,px,py) + +#define ITextSelection_SetPoint(This,x,y,Type,Extend) \ + (This)->lpVtbl -> SetPoint(This,x,y,Type,Extend) + +#define ITextSelection_ScrollIntoView(This,Value) \ + (This)->lpVtbl -> ScrollIntoView(This,Value) + +#define ITextSelection_GetEmbeddedObject(This,ppv) \ + (This)->lpVtbl -> GetEmbeddedObject(This,ppv) + + +#define ITextSelection_GetFlags(This,pFlags) \ + (This)->lpVtbl -> GetFlags(This,pFlags) + +#define ITextSelection_SetFlags(This,Flags) \ + (This)->lpVtbl -> SetFlags(This,Flags) + +#define ITextSelection_GetType(This,pType) \ + (This)->lpVtbl -> GetType(This,pType) + +#define ITextSelection_MoveLeft(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveLeft(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveRight(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveRight(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveUp(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveUp(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_MoveDown(This,Unit,Count,Extend,pDelta) \ + (This)->lpVtbl -> MoveDown(This,Unit,Count,Extend,pDelta) + +#define ITextSelection_HomeKey(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> HomeKey(This,Unit,Extend,pDelta) + +#define ITextSelection_EndKey(This,Unit,Extend,pDelta) \ + (This)->lpVtbl -> EndKey(This,Unit,Extend,pDelta) + +#define ITextSelection_TypeText(This,bstr) \ + (This)->lpVtbl -> TypeText(This,bstr) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_GetFlags_Proxy( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pFlags); + + +void __RPC_STUB ITextSelection_GetFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_SetFlags_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ LONG Flags); + + +void __RPC_STUB ITextSelection_SetFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextSelection_GetType_Proxy( + ITextSelection __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pType); + + +void __RPC_STUB ITextSelection_GetType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveLeft_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveLeft_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveRight_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveRight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveUp_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveUp_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_MoveDown_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Count, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_MoveDown_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_HomeKey_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_HomeKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_EndKey_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ long Unit, + /* [in] */ long Extend, + /* [retval][out] */ long __RPC_FAR *pDelta); + + +void __RPC_STUB ITextSelection_EndKey_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextSelection_TypeText_Proxy( + ITextSelection __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextSelection_TypeText_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextSelection_INTERFACE_DEFINED__ */ + + +#ifndef __ITextFont_INTERFACE_DEFINED__ +#define __ITextFont_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextFont + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextFont; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C3-A1DF-11ce-8098-00AA0047BE5D") + ITextFont : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDuplicate( + /* [in] */ ITextFont __RPC_FAR *pFont) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanChange( + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStyle( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStyle( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAllCaps( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAllCaps( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAnimation( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAnimation( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetBackColor( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetBackColor( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetBold( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetBold( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEmboss( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEmboss( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetForeColor( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetForeColor( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetHidden( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetHidden( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetEngrave( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetEngrave( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetItalic( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetItalic( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKerning( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKerning( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLanguageID( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetLanguageID( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetName( + /* [retval][out] */ BSTR __RPC_FAR *pbstr) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetName( + /* [in] */ BSTR bstr) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetOutline( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetOutline( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPosition( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPosition( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetProtected( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetProtected( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetShadow( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetShadow( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSize( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSize( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSmallCaps( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSmallCaps( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpacing( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpacing( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStrikeThrough( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStrikeThrough( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSubscript( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSubscript( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSuperscript( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSuperscript( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetUnderline( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetUnderline( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetWeight( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetWeight( + /* [in] */ long Value) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextFontVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextFont __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextFont __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextFont __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextFont __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextFont __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextFont __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextFont __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDuplicate )( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanChange )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStyle )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStyle )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAllCaps )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAllCaps )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAnimation )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAnimation )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBackColor )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetBackColor )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetBold )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetBold )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEmboss )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEmboss )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetForeColor )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetForeColor )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHidden )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetHidden )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEngrave )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEngrave )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetItalic )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetItalic )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKerning )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKerning )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLanguageID )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetLanguageID )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetName )( + ITextFont __RPC_FAR * This, + /* [in] */ BSTR bstr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetOutline )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetOutline )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPosition )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPosition )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProtected )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetProtected )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetShadow )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetShadow )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSize )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSize )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSmallCaps )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSmallCaps )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpacing )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpacing )( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStrikeThrough )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStrikeThrough )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSubscript )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSubscript )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSuperscript )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSuperscript )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetUnderline )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetUnderline )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWeight )( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWeight )( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + END_INTERFACE + } ITextFontVtbl; + + interface ITextFont + { + CONST_VTBL struct ITextFontVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextFont_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextFont_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextFont_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextFont_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextFont_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextFont_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextFont_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextFont_GetDuplicate(This,ppFont) \ + (This)->lpVtbl -> GetDuplicate(This,ppFont) + +#define ITextFont_SetDuplicate(This,pFont) \ + (This)->lpVtbl -> SetDuplicate(This,pFont) + +#define ITextFont_CanChange(This,pB) \ + (This)->lpVtbl -> CanChange(This,pB) + +#define ITextFont_IsEqual(This,pFont,pB) \ + (This)->lpVtbl -> IsEqual(This,pFont,pB) + +#define ITextFont_Reset(This,Value) \ + (This)->lpVtbl -> Reset(This,Value) + +#define ITextFont_GetStyle(This,pValue) \ + (This)->lpVtbl -> GetStyle(This,pValue) + +#define ITextFont_SetStyle(This,Value) \ + (This)->lpVtbl -> SetStyle(This,Value) + +#define ITextFont_GetAllCaps(This,pValue) \ + (This)->lpVtbl -> GetAllCaps(This,pValue) + +#define ITextFont_SetAllCaps(This,Value) \ + (This)->lpVtbl -> SetAllCaps(This,Value) + +#define ITextFont_GetAnimation(This,pValue) \ + (This)->lpVtbl -> GetAnimation(This,pValue) + +#define ITextFont_SetAnimation(This,Value) \ + (This)->lpVtbl -> SetAnimation(This,Value) + +#define ITextFont_GetBackColor(This,pValue) \ + (This)->lpVtbl -> GetBackColor(This,pValue) + +#define ITextFont_SetBackColor(This,Value) \ + (This)->lpVtbl -> SetBackColor(This,Value) + +#define ITextFont_GetBold(This,pValue) \ + (This)->lpVtbl -> GetBold(This,pValue) + +#define ITextFont_SetBold(This,Value) \ + (This)->lpVtbl -> SetBold(This,Value) + +#define ITextFont_GetEmboss(This,pValue) \ + (This)->lpVtbl -> GetEmboss(This,pValue) + +#define ITextFont_SetEmboss(This,Value) \ + (This)->lpVtbl -> SetEmboss(This,Value) + +#define ITextFont_GetForeColor(This,pValue) \ + (This)->lpVtbl -> GetForeColor(This,pValue) + +#define ITextFont_SetForeColor(This,Value) \ + (This)->lpVtbl -> SetForeColor(This,Value) + +#define ITextFont_GetHidden(This,pValue) \ + (This)->lpVtbl -> GetHidden(This,pValue) + +#define ITextFont_SetHidden(This,Value) \ + (This)->lpVtbl -> SetHidden(This,Value) + +#define ITextFont_GetEngrave(This,pValue) \ + (This)->lpVtbl -> GetEngrave(This,pValue) + +#define ITextFont_SetEngrave(This,Value) \ + (This)->lpVtbl -> SetEngrave(This,Value) + +#define ITextFont_GetItalic(This,pValue) \ + (This)->lpVtbl -> GetItalic(This,pValue) + +#define ITextFont_SetItalic(This,Value) \ + (This)->lpVtbl -> SetItalic(This,Value) + +#define ITextFont_GetKerning(This,pValue) \ + (This)->lpVtbl -> GetKerning(This,pValue) + +#define ITextFont_SetKerning(This,Value) \ + (This)->lpVtbl -> SetKerning(This,Value) + +#define ITextFont_GetLanguageID(This,pValue) \ + (This)->lpVtbl -> GetLanguageID(This,pValue) + +#define ITextFont_SetLanguageID(This,Value) \ + (This)->lpVtbl -> SetLanguageID(This,Value) + +#define ITextFont_GetName(This,pbstr) \ + (This)->lpVtbl -> GetName(This,pbstr) + +#define ITextFont_SetName(This,bstr) \ + (This)->lpVtbl -> SetName(This,bstr) + +#define ITextFont_GetOutline(This,pValue) \ + (This)->lpVtbl -> GetOutline(This,pValue) + +#define ITextFont_SetOutline(This,Value) \ + (This)->lpVtbl -> SetOutline(This,Value) + +#define ITextFont_GetPosition(This,pValue) \ + (This)->lpVtbl -> GetPosition(This,pValue) + +#define ITextFont_SetPosition(This,Value) \ + (This)->lpVtbl -> SetPosition(This,Value) + +#define ITextFont_GetProtected(This,pValue) \ + (This)->lpVtbl -> GetProtected(This,pValue) + +#define ITextFont_SetProtected(This,Value) \ + (This)->lpVtbl -> SetProtected(This,Value) + +#define ITextFont_GetShadow(This,pValue) \ + (This)->lpVtbl -> GetShadow(This,pValue) + +#define ITextFont_SetShadow(This,Value) \ + (This)->lpVtbl -> SetShadow(This,Value) + +#define ITextFont_GetSize(This,pValue) \ + (This)->lpVtbl -> GetSize(This,pValue) + +#define ITextFont_SetSize(This,Value) \ + (This)->lpVtbl -> SetSize(This,Value) + +#define ITextFont_GetSmallCaps(This,pValue) \ + (This)->lpVtbl -> GetSmallCaps(This,pValue) + +#define ITextFont_SetSmallCaps(This,Value) \ + (This)->lpVtbl -> SetSmallCaps(This,Value) + +#define ITextFont_GetSpacing(This,pValue) \ + (This)->lpVtbl -> GetSpacing(This,pValue) + +#define ITextFont_SetSpacing(This,Value) \ + (This)->lpVtbl -> SetSpacing(This,Value) + +#define ITextFont_GetStrikeThrough(This,pValue) \ + (This)->lpVtbl -> GetStrikeThrough(This,pValue) + +#define ITextFont_SetStrikeThrough(This,Value) \ + (This)->lpVtbl -> SetStrikeThrough(This,Value) + +#define ITextFont_GetSubscript(This,pValue) \ + (This)->lpVtbl -> GetSubscript(This,pValue) + +#define ITextFont_SetSubscript(This,Value) \ + (This)->lpVtbl -> SetSubscript(This,Value) + +#define ITextFont_GetSuperscript(This,pValue) \ + (This)->lpVtbl -> GetSuperscript(This,pValue) + +#define ITextFont_SetSuperscript(This,Value) \ + (This)->lpVtbl -> SetSuperscript(This,Value) + +#define ITextFont_GetUnderline(This,pValue) \ + (This)->lpVtbl -> GetUnderline(This,pValue) + +#define ITextFont_SetUnderline(This,Value) \ + (This)->lpVtbl -> SetUnderline(This,Value) + +#define ITextFont_GetWeight(This,pValue) \ + (This)->lpVtbl -> GetWeight(This,pValue) + +#define ITextFont_SetWeight(This,Value) \ + (This)->lpVtbl -> SetWeight(This,Value) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetDuplicate_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ ITextFont __RPC_FAR *__RPC_FAR *ppFont); + + +void __RPC_STUB ITextFont_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetDuplicate_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont); + + +void __RPC_STUB ITextFont_SetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_CanChange_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextFont_CanChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_IsEqual_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ ITextFont __RPC_FAR *pFont, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextFont_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextFont_Reset_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetStyle_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetStyle_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetAllCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetAllCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetAllCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetAllCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetAnimation_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetAnimation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetAnimation_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetAnimation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetBackColor_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetBackColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetBackColor_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetBackColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetBold_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetBold_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetBold_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetBold_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetEmboss_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetEmboss_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetEmboss_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetEmboss_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetForeColor_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetForeColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetForeColor_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetForeColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetHidden_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetHidden_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetHidden_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetHidden_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetEngrave_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetEngrave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetEngrave_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetEngrave_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetItalic_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetItalic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetItalic_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetItalic_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetKerning_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetKerning_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetKerning_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetKerning_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetLanguageID_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetLanguageID_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetLanguageID_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetLanguageID_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetName_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pbstr); + + +void __RPC_STUB ITextFont_GetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetName_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ BSTR bstr); + + +void __RPC_STUB ITextFont_SetName_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetOutline_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetOutline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetOutline_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetOutline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetPosition_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetPosition_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetPosition_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetProtected_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetProtected_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetProtected_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetProtected_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetShadow_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetShadow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetShadow_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetShadow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSize_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSize_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetSize_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSmallCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSmallCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSmallCaps_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSmallCaps_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSpacing_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSpacing_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextFont_SetSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetStrikeThrough_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetStrikeThrough_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetStrikeThrough_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetStrikeThrough_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSubscript_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSubscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSubscript_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSubscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetSuperscript_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetSuperscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetSuperscript_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetSuperscript_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetUnderline_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetUnderline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetUnderline_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetUnderline_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextFont_GetWeight_Proxy( + ITextFont __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextFont_GetWeight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextFont_SetWeight_Proxy( + ITextFont __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextFont_SetWeight_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextFont_INTERFACE_DEFINED__ */ + + +#ifndef __ITextPara_INTERFACE_DEFINED__ +#define __ITextPara_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextPara + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextPara; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C4-A1DF-11ce-8098-00AA0047BE5D") + ITextPara : public IDispatch + { + public: + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetDuplicate( + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetDuplicate( + /* [in] */ ITextPara __RPC_FAR *pPara) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE CanChange( + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE IsEqual( + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Reset( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetStyle( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetStyle( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetAlignment( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetAlignment( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetHyphenation( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetHyphenation( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetFirstLineIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKeepTogether( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKeepTogether( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetKeepWithNext( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetKeepWithNext( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLeftIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLineSpacing( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetLineSpacingRule( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListAlignment( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListAlignment( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListLevelIndex( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListLevelIndex( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListStart( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListStart( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListTab( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListTab( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetListType( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetListType( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetNoLineNumber( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetNoLineNumber( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetPageBreakBefore( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetPageBreakBefore( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetRightIndent( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetRightIndent( + /* [in] */ float Value) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetIndents( + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetLineSpacing( + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpaceAfter( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpaceAfter( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetSpaceBefore( + /* [retval][out] */ float __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetSpaceBefore( + /* [in] */ float Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetWidowControl( + /* [retval][out] */ long __RPC_FAR *pValue) = 0; + + virtual /* [propput][id] */ HRESULT STDMETHODCALLTYPE SetWidowControl( + /* [in] */ long Value) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetTabCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddTab( + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE ClearAllTabs( void) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE DeleteTab( + /* [in] */ float tbPos) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetTab( + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextParaVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextPara __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextPara __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextPara __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextPara __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextPara __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextPara __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextPara __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDuplicate )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDuplicate )( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanChange )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsEqual )( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStyle )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetStyle )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetAlignment )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetAlignment )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHyphenation )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetHyphenation )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFirstLineIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKeepTogether )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKeepTogether )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetKeepWithNext )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetKeepWithNext )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLeftIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineSpacing )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineSpacingRule )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListAlignment )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListAlignment )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListLevelIndex )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListLevelIndex )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListStart )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListStart )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListTab )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetListType )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetListType )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNoLineNumber )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNoLineNumber )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPageBreakBefore )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetPageBreakBefore )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRightIndent )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRightIndent )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetIndents )( + ITextPara __RPC_FAR * This, + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetLineSpacing )( + ITextPara __RPC_FAR * This, + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpaceAfter )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpaceAfter )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSpaceBefore )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSpaceBefore )( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWidowControl )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWidowControl )( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTabCount )( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ClearAllTabs )( + ITextPara __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DeleteTab )( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTab )( + ITextPara __RPC_FAR * This, + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader); + + END_INTERFACE + } ITextParaVtbl; + + interface ITextPara + { + CONST_VTBL struct ITextParaVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextPara_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextPara_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextPara_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextPara_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextPara_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextPara_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextPara_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextPara_GetDuplicate(This,ppPara) \ + (This)->lpVtbl -> GetDuplicate(This,ppPara) + +#define ITextPara_SetDuplicate(This,pPara) \ + (This)->lpVtbl -> SetDuplicate(This,pPara) + +#define ITextPara_CanChange(This,pB) \ + (This)->lpVtbl -> CanChange(This,pB) + +#define ITextPara_IsEqual(This,pPara,pB) \ + (This)->lpVtbl -> IsEqual(This,pPara,pB) + +#define ITextPara_Reset(This,Value) \ + (This)->lpVtbl -> Reset(This,Value) + +#define ITextPara_GetStyle(This,pValue) \ + (This)->lpVtbl -> GetStyle(This,pValue) + +#define ITextPara_SetStyle(This,Value) \ + (This)->lpVtbl -> SetStyle(This,Value) + +#define ITextPara_GetAlignment(This,pValue) \ + (This)->lpVtbl -> GetAlignment(This,pValue) + +#define ITextPara_SetAlignment(This,Value) \ + (This)->lpVtbl -> SetAlignment(This,Value) + +#define ITextPara_GetHyphenation(This,pValue) \ + (This)->lpVtbl -> GetHyphenation(This,pValue) + +#define ITextPara_SetHyphenation(This,Value) \ + (This)->lpVtbl -> SetHyphenation(This,Value) + +#define ITextPara_GetFirstLineIndent(This,pValue) \ + (This)->lpVtbl -> GetFirstLineIndent(This,pValue) + +#define ITextPara_GetKeepTogether(This,pValue) \ + (This)->lpVtbl -> GetKeepTogether(This,pValue) + +#define ITextPara_SetKeepTogether(This,Value) \ + (This)->lpVtbl -> SetKeepTogether(This,Value) + +#define ITextPara_GetKeepWithNext(This,pValue) \ + (This)->lpVtbl -> GetKeepWithNext(This,pValue) + +#define ITextPara_SetKeepWithNext(This,Value) \ + (This)->lpVtbl -> SetKeepWithNext(This,Value) + +#define ITextPara_GetLeftIndent(This,pValue) \ + (This)->lpVtbl -> GetLeftIndent(This,pValue) + +#define ITextPara_GetLineSpacing(This,pValue) \ + (This)->lpVtbl -> GetLineSpacing(This,pValue) + +#define ITextPara_GetLineSpacingRule(This,pValue) \ + (This)->lpVtbl -> GetLineSpacingRule(This,pValue) + +#define ITextPara_GetListAlignment(This,pValue) \ + (This)->lpVtbl -> GetListAlignment(This,pValue) + +#define ITextPara_SetListAlignment(This,Value) \ + (This)->lpVtbl -> SetListAlignment(This,Value) + +#define ITextPara_GetListLevelIndex(This,pValue) \ + (This)->lpVtbl -> GetListLevelIndex(This,pValue) + +#define ITextPara_SetListLevelIndex(This,Value) \ + (This)->lpVtbl -> SetListLevelIndex(This,Value) + +#define ITextPara_GetListStart(This,pValue) \ + (This)->lpVtbl -> GetListStart(This,pValue) + +#define ITextPara_SetListStart(This,Value) \ + (This)->lpVtbl -> SetListStart(This,Value) + +#define ITextPara_GetListTab(This,pValue) \ + (This)->lpVtbl -> GetListTab(This,pValue) + +#define ITextPara_SetListTab(This,Value) \ + (This)->lpVtbl -> SetListTab(This,Value) + +#define ITextPara_GetListType(This,pValue) \ + (This)->lpVtbl -> GetListType(This,pValue) + +#define ITextPara_SetListType(This,Value) \ + (This)->lpVtbl -> SetListType(This,Value) + +#define ITextPara_GetNoLineNumber(This,pValue) \ + (This)->lpVtbl -> GetNoLineNumber(This,pValue) + +#define ITextPara_SetNoLineNumber(This,Value) \ + (This)->lpVtbl -> SetNoLineNumber(This,Value) + +#define ITextPara_GetPageBreakBefore(This,pValue) \ + (This)->lpVtbl -> GetPageBreakBefore(This,pValue) + +#define ITextPara_SetPageBreakBefore(This,Value) \ + (This)->lpVtbl -> SetPageBreakBefore(This,Value) + +#define ITextPara_GetRightIndent(This,pValue) \ + (This)->lpVtbl -> GetRightIndent(This,pValue) + +#define ITextPara_SetRightIndent(This,Value) \ + (This)->lpVtbl -> SetRightIndent(This,Value) + +#define ITextPara_SetIndents(This,StartIndent,LeftIndent,RightIndent) \ + (This)->lpVtbl -> SetIndents(This,StartIndent,LeftIndent,RightIndent) + +#define ITextPara_SetLineSpacing(This,LineSpacingRule,LineSpacing) \ + (This)->lpVtbl -> SetLineSpacing(This,LineSpacingRule,LineSpacing) + +#define ITextPara_GetSpaceAfter(This,pValue) \ + (This)->lpVtbl -> GetSpaceAfter(This,pValue) + +#define ITextPara_SetSpaceAfter(This,Value) \ + (This)->lpVtbl -> SetSpaceAfter(This,Value) + +#define ITextPara_GetSpaceBefore(This,pValue) \ + (This)->lpVtbl -> GetSpaceBefore(This,pValue) + +#define ITextPara_SetSpaceBefore(This,Value) \ + (This)->lpVtbl -> SetSpaceBefore(This,Value) + +#define ITextPara_GetWidowControl(This,pValue) \ + (This)->lpVtbl -> GetWidowControl(This,pValue) + +#define ITextPara_SetWidowControl(This,Value) \ + (This)->lpVtbl -> SetWidowControl(This,Value) + +#define ITextPara_GetTabCount(This,pCount) \ + (This)->lpVtbl -> GetTabCount(This,pCount) + +#define ITextPara_AddTab(This,tbPos,tbAlign,tbLeader) \ + (This)->lpVtbl -> AddTab(This,tbPos,tbAlign,tbLeader) + +#define ITextPara_ClearAllTabs(This) \ + (This)->lpVtbl -> ClearAllTabs(This) + +#define ITextPara_DeleteTab(This,tbPos) \ + (This)->lpVtbl -> DeleteTab(This,tbPos) + +#define ITextPara_GetTab(This,iTab,ptbPos,ptbAlign,ptbLeader) \ + (This)->lpVtbl -> GetTab(This,iTab,ptbPos,ptbAlign,ptbLeader) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetDuplicate_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ ITextPara __RPC_FAR *__RPC_FAR *ppPara); + + +void __RPC_STUB ITextPara_GetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetDuplicate_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara); + + +void __RPC_STUB ITextPara_SetDuplicate_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_CanChange_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextPara_CanChange_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_IsEqual_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ ITextPara __RPC_FAR *pPara, + /* [retval][out] */ long __RPC_FAR *pB); + + +void __RPC_STUB ITextPara_IsEqual_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_Reset_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_Reset_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetStyle_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetStyle_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetStyle_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetHyphenation_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetHyphenation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetHyphenation_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetHyphenation_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetFirstLineIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetFirstLineIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetKeepTogether_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetKeepTogether_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetKeepTogether_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetKeepTogether_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetKeepWithNext_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetKeepWithNext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetKeepWithNext_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetKeepWithNext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLeftIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLeftIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLineSpacing_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLineSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetLineSpacingRule_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetLineSpacingRule_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListAlignment_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListAlignment_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListLevelIndex_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListLevelIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListLevelIndex_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListLevelIndex_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListStart_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListStart_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListStart_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListTab_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetListTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetListType_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetListType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetListType_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetListType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetNoLineNumber_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetNoLineNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetNoLineNumber_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetNoLineNumber_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetPageBreakBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetPageBreakBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetPageBreakBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetPageBreakBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetRightIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetRightIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetRightIndent_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetRightIndent_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetIndents_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float StartIndent, + /* [in] */ float LeftIndent, + /* [in] */ float RightIndent); + + +void __RPC_STUB ITextPara_SetIndents_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetLineSpacing_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long LineSpacingRule, + /* [in] */ float LineSpacing); + + +void __RPC_STUB ITextPara_SetLineSpacing_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetSpaceAfter_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetSpaceAfter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetSpaceAfter_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetSpaceAfter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetSpaceBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetSpaceBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetSpaceBefore_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float Value); + + +void __RPC_STUB ITextPara_SetSpaceBefore_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetWidowControl_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + +void __RPC_STUB ITextPara_GetWidowControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propput][id] */ HRESULT STDMETHODCALLTYPE ITextPara_SetWidowControl_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long Value); + + +void __RPC_STUB ITextPara_SetWidowControl_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetTabCount_Proxy( + ITextPara __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextPara_GetTabCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_AddTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos, + /* [in] */ long tbAlign, + /* [in] */ long tbLeader); + + +void __RPC_STUB ITextPara_AddTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_ClearAllTabs_Proxy( + ITextPara __RPC_FAR * This); + + +void __RPC_STUB ITextPara_ClearAllTabs_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_DeleteTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ float tbPos); + + +void __RPC_STUB ITextPara_DeleteTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextPara_GetTab_Proxy( + ITextPara __RPC_FAR * This, + /* [in] */ long iTab, + /* [out] */ float __RPC_FAR *ptbPos, + /* [out] */ long __RPC_FAR *ptbAlign, + /* [out] */ long __RPC_FAR *ptbLeader); + + +void __RPC_STUB ITextPara_GetTab_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextPara_INTERFACE_DEFINED__ */ + + +#ifndef __ITextStoryRanges_INTERFACE_DEFINED__ +#define __ITextStoryRanges_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextStoryRanges + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextStoryRanges; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("8CC497C5-A1DF-11ce-8098-00AA0047BE5D") + ITextStoryRanges : public IDispatch + { + public: + virtual /* [restricted][id] */ HRESULT STDMETHODCALLTYPE _NewEnum( + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum) = 0; + + virtual /* [id] */ HRESULT STDMETHODCALLTYPE Item( + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange) = 0; + + virtual /* [propget][id] */ HRESULT STDMETHODCALLTYPE GetCount( + /* [retval][out] */ long __RPC_FAR *pCount) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextStoryRangesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextStoryRanges __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextStoryRanges __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextStoryRanges __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [restricted][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *_NewEnum )( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Item )( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCount )( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + END_INTERFACE + } ITextStoryRangesVtbl; + + interface ITextStoryRanges + { + CONST_VTBL struct ITextStoryRangesVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextStoryRanges_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextStoryRanges_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextStoryRanges_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextStoryRanges_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextStoryRanges_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextStoryRanges_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextStoryRanges_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextStoryRanges__NewEnum(This,ppunkEnum) \ + (This)->lpVtbl -> _NewEnum(This,ppunkEnum) + +#define ITextStoryRanges_Item(This,Index,ppRange) \ + (This)->lpVtbl -> Item(This,Index,ppRange) + +#define ITextStoryRanges_GetCount(This,pCount) \ + (This)->lpVtbl -> GetCount(This,pCount) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [restricted][id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges__NewEnum_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkEnum); + + +void __RPC_STUB ITextStoryRanges__NewEnum_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges_Item_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [in] */ long Index, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + +void __RPC_STUB ITextStoryRanges_Item_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [propget][id] */ HRESULT STDMETHODCALLTYPE ITextStoryRanges_GetCount_Proxy( + ITextStoryRanges __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + +void __RPC_STUB ITextStoryRanges_GetCount_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextStoryRanges_INTERFACE_DEFINED__ */ + + +#ifndef __ITextDocument2_INTERFACE_DEFINED__ +#define __ITextDocument2_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextDocument2 + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][dual][version][uuid] */ + + + +EXTERN_C const IID IID_ITextDocument2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("01c25500-4268-11d1-883a-3c8b00c10000") + ITextDocument2 : public ITextDocument + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachMsgFilter( + /* [in] */ IUnknown __RPC_FAR *pFilter) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetEffectColor( + /* [in] */ long Index, + /* [in] */ COLORREF cr) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetEffectColor( + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetCaretType( + /* [retval][out] */ long __RPC_FAR *pCaretType) = 0; + + virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE SetCaretType( + /* [in] */ long CaretType) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetImmContext( + /* [retval][out] */ long __RPC_FAR *pContext) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ReleaseImmContext( + /* [in] */ long Context) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPreferredFont( + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetNotificationMode( + /* [retval][out] */ long __RPC_FAR *pMode) = 0; + + virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE SetNotificationMode( + /* [in] */ long Mode) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetClientRect( + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom) = 0; + + virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE GetSelectionEx( + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetWindow( + /* [out] */ long __RPC_FAR *phWnd) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetFEFlags( + /* [out] */ long __RPC_FAR *pFlags) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UpdateWindow( void) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CheckTextLimit( + long cch, + long __RPC_FAR *pcch) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IMEInProgress( + long Mode) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextDocument2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextDocument2 __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextDocument2 __RPC_FAR * This); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ UINT __RPC_FAR *pctinfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ UINT iTInfo, + /* [in] */ LCID lcid, + /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, + /* [in] */ UINT cNames, + /* [in] */ LCID lcid, + /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); + + /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ DISPID dispIdMember, + /* [in] */ REFIID riid, + /* [in] */ LCID lcid, + /* [in] */ WORD wFlags, + /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, + /* [out] */ VARIANT __RPC_FAR *pVarResult, + /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, + /* [out] */ UINT __RPC_FAR *puArgErr); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ BSTR __RPC_FAR *pName); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelection )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryCount )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetStoryRanges )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSaved )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSaved )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Value); + + /* [propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDefaultTabStop )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ float __RPC_FAR *pValue); + + /* [propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultTabStop )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ float Value); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *New )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Open )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Save )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ VARIANT __RPC_FAR *pVar, + /* [in] */ long Flags, + /* [in] */ long CodePage); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Unfreeze )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCount); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEditCollection )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndEditCollection )( + ITextDocument2 __RPC_FAR * This); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Undo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Redo )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Count, + /* [retval][out] */ long __RPC_FAR *prop); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Range )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp1, + /* [in] */ long cp2, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RangeFromPoint )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long x, + /* [in] */ long y, + /* [retval][out] */ ITextRange __RPC_FAR *__RPC_FAR *ppRange); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachMsgFilter )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pFilter); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetEffectColor )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [in] */ COLORREF cr); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEffectColor )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCaretType )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCaretType); + + /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetCaretType )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long CaretType); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetImmContext )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pContext); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ReleaseImmContext )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Context); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetPreferredFont )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNotificationMode )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pMode); + + /* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNotificationMode )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Mode); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetClientRect )( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom); + + /* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSelectionEx )( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWindow )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *phWnd); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFEFlags )( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *pFlags); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UpdateWindow )( + ITextDocument2 __RPC_FAR * This); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CheckTextLimit )( + ITextDocument2 __RPC_FAR * This, + long cch, + long __RPC_FAR *pcch); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IMEInProgress )( + ITextDocument2 __RPC_FAR * This, + long Mode); + + END_INTERFACE + } ITextDocument2Vtbl; + + interface ITextDocument2 + { + CONST_VTBL struct ITextDocument2Vtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextDocument2_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextDocument2_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextDocument2_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextDocument2_GetTypeInfoCount(This,pctinfo) \ + (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) + +#define ITextDocument2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ + (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) + +#define ITextDocument2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ + (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) + +#define ITextDocument2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ + (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) + + +#define ITextDocument2_GetName(This,pName) \ + (This)->lpVtbl -> GetName(This,pName) + +#define ITextDocument2_GetSelection(This,ppSel) \ + (This)->lpVtbl -> GetSelection(This,ppSel) + +#define ITextDocument2_GetStoryCount(This,pCount) \ + (This)->lpVtbl -> GetStoryCount(This,pCount) + +#define ITextDocument2_GetStoryRanges(This,ppStories) \ + (This)->lpVtbl -> GetStoryRanges(This,ppStories) + +#define ITextDocument2_GetSaved(This,pValue) \ + (This)->lpVtbl -> GetSaved(This,pValue) + +#define ITextDocument2_SetSaved(This,Value) \ + (This)->lpVtbl -> SetSaved(This,Value) + +#define ITextDocument2_GetDefaultTabStop(This,pValue) \ + (This)->lpVtbl -> GetDefaultTabStop(This,pValue) + +#define ITextDocument2_SetDefaultTabStop(This,Value) \ + (This)->lpVtbl -> SetDefaultTabStop(This,Value) + +#define ITextDocument2_New(This) \ + (This)->lpVtbl -> New(This) + +#define ITextDocument2_Open(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Open(This,pVar,Flags,CodePage) + +#define ITextDocument2_Save(This,pVar,Flags,CodePage) \ + (This)->lpVtbl -> Save(This,pVar,Flags,CodePage) + +#define ITextDocument2_Freeze(This,pCount) \ + (This)->lpVtbl -> Freeze(This,pCount) + +#define ITextDocument2_Unfreeze(This,pCount) \ + (This)->lpVtbl -> Unfreeze(This,pCount) + +#define ITextDocument2_BeginEditCollection(This) \ + (This)->lpVtbl -> BeginEditCollection(This) + +#define ITextDocument2_EndEditCollection(This) \ + (This)->lpVtbl -> EndEditCollection(This) + +#define ITextDocument2_Undo(This,Count,prop) \ + (This)->lpVtbl -> Undo(This,Count,prop) + +#define ITextDocument2_Redo(This,Count,prop) \ + (This)->lpVtbl -> Redo(This,Count,prop) + +#define ITextDocument2_Range(This,cp1,cp2,ppRange) \ + (This)->lpVtbl -> Range(This,cp1,cp2,ppRange) + +#define ITextDocument2_RangeFromPoint(This,x,y,ppRange) \ + (This)->lpVtbl -> RangeFromPoint(This,x,y,ppRange) + + +#define ITextDocument2_AttachMsgFilter(This,pFilter) \ + (This)->lpVtbl -> AttachMsgFilter(This,pFilter) + +#define ITextDocument2_SetEffectColor(This,Index,cr) \ + (This)->lpVtbl -> SetEffectColor(This,Index,cr) + +#define ITextDocument2_GetEffectColor(This,Index,pcr) \ + (This)->lpVtbl -> GetEffectColor(This,Index,pcr) + +#define ITextDocument2_GetCaretType(This,pCaretType) \ + (This)->lpVtbl -> GetCaretType(This,pCaretType) + +#define ITextDocument2_SetCaretType(This,CaretType) \ + (This)->lpVtbl -> SetCaretType(This,CaretType) + +#define ITextDocument2_GetImmContext(This,pContext) \ + (This)->lpVtbl -> GetImmContext(This,pContext) + +#define ITextDocument2_ReleaseImmContext(This,Context) \ + (This)->lpVtbl -> ReleaseImmContext(This,Context) + +#define ITextDocument2_GetPreferredFont(This,cp,CodePage,Option,pbstr,pPitchAndFamily) \ + (This)->lpVtbl -> GetPreferredFont(This,cp,CodePage,Option,pbstr,pPitchAndFamily) + +#define ITextDocument2_GetNotificationMode(This,pMode) \ + (This)->lpVtbl -> GetNotificationMode(This,pMode) + +#define ITextDocument2_SetNotificationMode(This,Mode) \ + (This)->lpVtbl -> SetNotificationMode(This,Mode) + +#define ITextDocument2_GetClientRect(This,Type,pLeft,pTop,pRight,pBottom) \ + (This)->lpVtbl -> GetClientRect(This,Type,pLeft,pTop,pRight,pBottom) + +#define ITextDocument2_GetSelectionEx(This,ppSel) \ + (This)->lpVtbl -> GetSelectionEx(This,ppSel) + +#define ITextDocument2_GetWindow(This,phWnd) \ + (This)->lpVtbl -> GetWindow(This,phWnd) + +#define ITextDocument2_GetFEFlags(This,pFlags) \ + (This)->lpVtbl -> GetFEFlags(This,pFlags) + +#define ITextDocument2_UpdateWindow(This) \ + (This)->lpVtbl -> UpdateWindow(This) + +#define ITextDocument2_CheckTextLimit(This,cch,pcch) \ + (This)->lpVtbl -> CheckTextLimit(This,cch,pcch) + +#define ITextDocument2_IMEInProgress(This,Mode) \ + (This)->lpVtbl -> IMEInProgress(This,Mode) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_AttachMsgFilter_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ IUnknown __RPC_FAR *pFilter); + + +void __RPC_STUB ITextDocument2_AttachMsgFilter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetEffectColor_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [in] */ COLORREF cr); + + +void __RPC_STUB ITextDocument2_SetEffectColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetEffectColor_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Index, + /* [out] */ COLORREF __RPC_FAR *pcr); + + +void __RPC_STUB ITextDocument2_GetEffectColor_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetCaretType_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pCaretType); + + +void __RPC_STUB ITextDocument2_GetCaretType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetCaretType_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long CaretType); + + +void __RPC_STUB ITextDocument2_SetCaretType_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetImmContext_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pContext); + + +void __RPC_STUB ITextDocument2_GetImmContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_ReleaseImmContext_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Context); + + +void __RPC_STUB ITextDocument2_ReleaseImmContext_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetPreferredFont_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long cp, + /* [in] */ long CodePage, + /* [in] */ long Option, + /* [out] */ BSTR __RPC_FAR *pbstr, + /* [out] */ long __RPC_FAR *pPitchAndFamily); + + +void __RPC_STUB ITextDocument2_GetPreferredFont_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetNotificationMode_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ long __RPC_FAR *pMode); + + +void __RPC_STUB ITextDocument2_GetNotificationMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_SetNotificationMode_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Mode); + + +void __RPC_STUB ITextDocument2_SetNotificationMode_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetClientRect_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [in] */ long Type, + /* [out] */ long __RPC_FAR *pLeft, + /* [out] */ long __RPC_FAR *pTop, + /* [out] */ long __RPC_FAR *pRight, + /* [out] */ long __RPC_FAR *pBottom); + + +void __RPC_STUB ITextDocument2_GetClientRect_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetSelectionEx_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [retval][out] */ ITextSelection __RPC_FAR *__RPC_FAR *ppSel); + + +void __RPC_STUB ITextDocument2_GetSelectionEx_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetWindow_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *phWnd); + + +void __RPC_STUB ITextDocument2_GetWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_GetFEFlags_Proxy( + ITextDocument2 __RPC_FAR * This, + /* [out] */ long __RPC_FAR *pFlags); + + +void __RPC_STUB ITextDocument2_GetFEFlags_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_UpdateWindow_Proxy( + ITextDocument2 __RPC_FAR * This); + + +void __RPC_STUB ITextDocument2_UpdateWindow_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_CheckTextLimit_Proxy( + ITextDocument2 __RPC_FAR * This, + long cch, + long __RPC_FAR *pcch); + + +void __RPC_STUB ITextDocument2_CheckTextLimit_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextDocument2_IMEInProgress_Proxy( + ITextDocument2 __RPC_FAR * This, + long Mode); + + +void __RPC_STUB ITextDocument2_IMEInProgress_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextDocument2_INTERFACE_DEFINED__ */ + + +#ifndef __ITextMsgFilter_INTERFACE_DEFINED__ +#define __ITextMsgFilter_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: ITextMsgFilter + * at Thu May 07 14:12:12 1998 + * using MIDL 3.01.75 + ****************************************/ +/* [object][nonextensible][version][uuid] */ + + + +EXTERN_C const IID IID_ITextMsgFilter; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + interface DECLSPEC_UUID("a3787420-4267-11d1-883a-3c8b00c10000") + ITextMsgFilter : public IUnknown + { + public: + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachDocument( + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE HandleMessage( + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres) = 0; + + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AttachMsgFilter( + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter) = 0; + + }; + +#else /* C style interface */ + + typedef struct ITextMsgFilterVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ REFIID riid, + /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( + ITextMsgFilter __RPC_FAR * This); + + ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( + ITextMsgFilter __RPC_FAR * This); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachDocument )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HandleMessage )( + ITextMsgFilter __RPC_FAR * This, + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres); + + /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AttachMsgFilter )( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter); + + END_INTERFACE + } ITextMsgFilterVtbl; + + interface ITextMsgFilter + { + CONST_VTBL struct ITextMsgFilterVtbl __RPC_FAR *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ITextMsgFilter_QueryInterface(This,riid,ppvObject) \ + (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) + +#define ITextMsgFilter_AddRef(This) \ + (This)->lpVtbl -> AddRef(This) + +#define ITextMsgFilter_Release(This) \ + (This)->lpVtbl -> Release(This) + + +#define ITextMsgFilter_AttachDocument(This,hwnd,pTextDoc) \ + (This)->lpVtbl -> AttachDocument(This,hwnd,pTextDoc) + +#define ITextMsgFilter_HandleMessage(This,pmsg,pwparam,plparam,plres) \ + (This)->lpVtbl -> HandleMessage(This,pmsg,pwparam,plparam,plres) + +#define ITextMsgFilter_AttachMsgFilter(This,pMsgFilter) \ + (This)->lpVtbl -> AttachMsgFilter(This,pMsgFilter) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_AttachDocument_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ HWND hwnd, + /* [in] */ ITextDocument2 __RPC_FAR *pTextDoc); + + +void __RPC_STUB ITextMsgFilter_AttachDocument_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_HandleMessage_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [out][in] */ UINT __RPC_FAR *pmsg, + /* [out][in] */ WPARAM __RPC_FAR *pwparam, + /* [out][in] */ LPARAM __RPC_FAR *plparam, + /* [out] */ LRESULT __RPC_FAR *plres); + + +void __RPC_STUB ITextMsgFilter_HandleMessage_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + +/* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ITextMsgFilter_AttachMsgFilter_Proxy( + ITextMsgFilter __RPC_FAR * This, + /* [in] */ ITextMsgFilter __RPC_FAR *pMsgFilter); + + +void __RPC_STUB ITextMsgFilter_AttachMsgFilter_Stub( + IRpcStubBuffer *This, + IRpcChannelBuffer *_pRpcChannelBuffer, + PRPC_MESSAGE _pRpcMessage, + DWORD *_pdwStubPhase); + + + +#endif /* __ITextMsgFilter_INTERFACE_DEFINED__ */ + +#endif /* __tom_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +unsigned long __RPC_USER BSTR_UserSize( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER BSTR_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * ); +void __RPC_USER BSTR_UserFree( unsigned long __RPC_FAR *, BSTR __RPC_FAR * ); + +unsigned long __RPC_USER HWND_UserSize( unsigned long __RPC_FAR *, unsigned long , HWND __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER HWND_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, HWND __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER HWND_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, HWND __RPC_FAR * ); +void __RPC_USER HWND_UserFree( unsigned long __RPC_FAR *, HWND __RPC_FAR * ); + +unsigned long __RPC_USER VARIANT_UserSize( unsigned long __RPC_FAR *, unsigned long , VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserMarshal( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +unsigned char __RPC_FAR * __RPC_USER VARIANT_UserUnmarshal(unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, VARIANT __RPC_FAR * ); +void __RPC_USER VARIANT_UserFree( unsigned long __RPC_FAR *, VARIANT __RPC_FAR * ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.dsp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.dsp new file mode 100644 index 00000000..021eac1b --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.dsp @@ -0,0 +1,194 @@ +# Microsoft Developer Studio Project File - Name="TTSApp" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=TTSApp - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ttsapp.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ttsapp.mak" CFG="TTSApp - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "TTSApp - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "TTSApp - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TTSApp - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /I "..\..\..\..\..\sdk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\..\..\sdk\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\..\sdk\lib\i386" + +!ELSEIF "$(CFG)" == "TTSApp - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /I "..\..\..\..\..\sdk\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D _WIN32_WINNT=0x0500 /FR /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\..\sdk\lib\i386" + +!ENDIF + +# Begin Target + +# Name "TTSApp - Win32 Release" +# Name "TTSApp - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\childwin.cpp +# End Source File +# Begin Source File + +SOURCE=.\dlgmain.cpp +# End Source File +# Begin Source File + +SOURCE=.\globals.cpp +# End Source File +# Begin Source File + +SOURCE=.\ttsapp.rc +# End Source File +# Begin Source File + +SOURCE=.\winmain.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\globals.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\ttsapp.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\appicon.ico +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 10.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 11.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 12.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 13.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 2.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 3.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 4.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 5.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 6.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 7.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 8.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth 9.bmp" +# End Source File +# Begin Source File + +SOURCE=".\res\mic mouth wide.bmp" +# End Source File +# Begin Source File + +SOURCE=.\res\mic.bmp +# End Source File +# End Group +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.h b/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.h new file mode 100644 index 00000000..4f89d26a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.h @@ -0,0 +1,107 @@ +#ifndef _INC_TTSAPP +#define _INC_TTSAPP + +#include // System includes +#include // ATL +#include +#include // Common controls +#include +#include // Required for rich edit control +#include +#include "tom.h" +#include "textserv.h" +#include "resource.h" +#include +#include +#include // Required for showing property page +#include // SAPI includes +#include +#include + + +// Constant definitions +#define MAX_SIZE 102400 //100K +#define NORM_SIZE 256 +#define NUM_OUTPUTFORMATS 36 +#define WM_TTSAPPCUSTOMEVENT WM_APP // Window message used for systhesis events +#define CHILD_CLASS _T("TTSAppChildWin") // Child window for blitting mouth to +#define WEYESNAR 14 // eye positions +#define WEYESCLO 15 +#define NUM_PHONEMES 6 +#define CHARACTER_WIDTH 128 +#define CHARACTER_HEIGHT 128 +#define MAX_FILE_PATH 256 + +// +// Prototypes for dialog procs +// +LPARAM CALLBACK ChildWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +LRESULT CALLBACK About( HWND, UINT, WPARAM, LPARAM ); + +// Main Object used by app +class CTTSApp +{ +public: + CTTSApp(HINSTANCE hInstance) : + m_hInst(hInstance), m_hWnd(0) + { + m_bPause = FALSE; // pause audio? + m_bStop = TRUE; // stop audio? + m_DefaultVolume = 0; // default volume + m_DefaultRate = 0; // default rate + m_DefaultFormatIndex = 0; // default output format + m_pszwFileText = NULL; // text from file + m_szWFileName[0] = NULL; // wide text from file + } + ~CTTSApp() + { + // delete any allocated memory + if( m_pszwFileText ) + { + delete m_pszwFileText; + } + } + + // Member Functions + static LRESULT CALLBACK DlgProcMain (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + HRESULT InitSapi(); + void Stop(); + HRESULT VoiceChange(); + HRESULT ReadTheFile( TCHAR* szFileName, BOOL* bIsUnicode, WCHAR** ppszwBuff ); + void UpdateEditCtlW( WCHAR* pszwText ); + BOOL CallOpenFileDialog( TCHAR* szFileName, TCHAR* szFilter ); + BOOL CallSaveFileDialog( TCHAR* szFileName, TCHAR* szFilter ); + HIMAGELIST InitImageList(); + +// +// Private methods +// +private: + // Message handling member functions + BOOL OnInitDialog( HWND hWnd ); + void MainHandleSynthEvent(); + void HandleScroll( HWND hCtl ); + void MainHandleCommand( int id, HWND hWndControl, UINT codeNotify ); + void MainHandleClose(); + void HandleSpeak (); + void EnableSpeakButtons( BOOL fEnable ); + +// +// Member data +// +private: + const HINSTANCE m_hInst; + HWND m_hWnd; + HWND m_hChildWnd; + CComPtr m_cpVoice; + CComPtr m_cpOutAudio; + BOOL m_bPause; + BOOL m_bStop; + USHORT m_DefaultVolume; + long m_DefaultRate; + int m_DefaultFormatIndex; + WCHAR* m_pszwFileText; + WCHAR m_szWFileName[MAX_FILE_PATH]; +}; + +#endif // _INC_TTSAPP diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.rc b/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.rc new file mode 100644 index 00000000..f23bd635 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/ttsapp.rc @@ -0,0 +1,197 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APPICON ICON DISCARDABLE "res\\appicon.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MAIN DIALOG DISCARDABLE 0, 0, 379, 223 +STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | + WS_SYSMENU +CAPTION "SAPI5 TTSAPP" +FONT 8, "MS Shell Dlg" +BEGIN + PUSHBUTTON "About",IDC_ABOUT,313,194,54,14 + PUSHBUTTON "Open File",IDB_OPEN,313,16,54,14 + PUSHBUTTON "Speak",IDB_SPEAK,313,38,54,14 + PUSHBUTTON "Pause",IDB_PAUSE,313,60,54,14 + PUSHBUTTON "Stop",IDB_STOP,313,82,54,14 + PUSHBUTTON "Skip",IDB_SKIP,313,104,29,13 + EDITTEXT IDC_SKIP_EDIT,342,104,25,13,ES_AUTOHSCROLL + CONTROL "Spin2",IDC_SKIP_SPIN,"msctls_updown32",UDS_WRAP | + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS,361,55,10,14 + PUSHBUTTON "Speak .wav",IDB_SPEAKWAV,313,125,54,14 + PUSHBUTTON "Reset",IDB_RESET,313,147,54,14 + PUSHBUTTON "Save to .wav",IDC_SAVETOWAV,313,169,54,14 + CONTROL "",IDE_EDITBOX,"RichEdit20A",WS_BORDER | WS_VSCROLL | + WS_TABSTOP | 0x44,102,7,198,118 + LTEXT "Voice",IDC_STATIC,99,138,33,9 + COMBOBOX IDC_COMBO_VOICES,135,136,156,58,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + LTEXT "Rate",IDC_STATIC,99,157,24,10 + CONTROL "Slider1",IDC_RATE_SLIDER,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,130,155,167,14 + LTEXT "Volume",IDC_STATIC,99,177,24,10 + CONTROL "Slider1",IDC_VOLUME_SLIDER,"msctls_trackbar32",TBS_BOTH | + TBS_NOTICKS | WS_TABSTOP,130,175,167,14 + LTEXT "Format",IDC_STATIC,99,197,33,9 + COMBOBOX IDC_COMBO_OUTPUT,135,195,156,86,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP + CONTROL "Show all events",IDC_EVENTS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,19,190,63,10 + CONTROL "Process XML",IDC_SPEAKXML,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,19,204,63,10 + EDITTEXT IDC_DEBUG,9,102,80,84,ES_MULTILINE | ES_READONLY | + WS_VSCROLL | WS_HSCROLL | NOT WS_TABSTOP + GROUPBOX "Mouth Position",IDC_MOUTHPOS,9,7,80,91 + CONTROL "",IDC_CHARACTER,"Static",SS_BLACKFRAME,12,17,74,75 + GROUPBOX "Options",IDC_STATIC,307,3,65,185 +END + +IDD_ABOUT DIALOG DISCARDABLE 0, 0, 313, 68 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION +CAPTION "About TTSApp" +FONT 8, "MS Shell Dlg" +BEGIN + ICON IDI_APPICON,IDC_STATIC,7,7,20,20 + LTEXT "TTSApp ",IDC_STATIC,37,7,56,8 + LTEXT "(c) 2001 Microsoft Corporation. All rights reserved.", + IDC_STATIC,37,23,267,8 + DEFPUSHBUTTON "OK",IDOK,266,7,40,14,WS_GROUP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_MAIN, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 372 + TOPMARGIN, 7 + BOTTOMMARGIN, 216 + END + + IDD_ABOUT, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 306 + TOPMARGIN, 7 + BOTTOMMARGIN, 60 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_MICFULL BITMAP DISCARDABLE "res\\mic.bmp" +IDB_MICEYESCLO BITMAP DISCARDABLE "res\\mic eyes closed.bmp" +IDB_MICEYESNAR BITMAP DISCARDABLE "res\\mic_eyes_narrow.bmp" +IDB_MICMOUTH10 BITMAP DISCARDABLE "res\\mic_mouth_10.bmp" +IDB_MICMOUTH11 BITMAP DISCARDABLE "res\\mic_mouth_11.bmp" +IDB_MICMOUTH12 BITMAP DISCARDABLE "res\\mic_mouth_12.bmp" +IDB_MICMOUTH13 BITMAP DISCARDABLE "res\\mic_mouth_13.bmp" +IDB_MICMOUTH2 BITMAP DISCARDABLE "res\\mic_mouth_2.bmp" +IDB_MICMOUTH3 BITMAP DISCARDABLE "res\\mic_mouth_3.bmp" +IDB_MICMOUTH4 BITMAP DISCARDABLE "res\\mic_mouth_4.bmp" +IDB_MICMOUTH5 BITMAP DISCARDABLE "res\\mic_mouth_5.bmp" +IDB_MICMOUTH6 BITMAP DISCARDABLE "res\\mic_mouth_6.bmp" +IDB_MICMOUTH7 BITMAP DISCARDABLE "res\\mic_mouth_7.bmp" +IDB_MICMOUTH8 BITMAP DISCARDABLE "res\\mic_mouth_8.bmp" +IDB_MICMOUTH9 BITMAP DISCARDABLE "res\\mic_mouth_9.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_SAVE_NOTIFY "WAV file successfully written!" + IDS_NOTIFY_TITLE "File Saved" + IDS_SAVE_ERROR "An error was encountered attempting to save to a .wav file. Please make sure that the file is not in use by another application." + IDS_VOICE_INIT_ERROR "The voice could not be initialized. Please select a different TTS voice and/or a different audio output device." + IDS_UNSUPPORTED_FORMAT "The selected format is not supported by the current default audio output device. Please either select a different format, or select a different default audio output device from the Speech Control Panel." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/TTSApp/version.rc2 new file mode 100644 index 00000000..e61d542b --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "TTSApp Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TTSApp\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TTSApp.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/TTSApp/winmain.cpp b/sp/src/utils/sapi51/Samples/CPP/TTSApp/winmain.cpp new file mode 100644 index 00000000..851d8d76 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TTSApp/winmain.cpp @@ -0,0 +1,101 @@ +#include "globals.h" + +///////////////////////////////////////////////////////////////////////// +// SAPI5 TTSAPP +// +// Dialog box application used to manually verify SAPI5 TTS methods +// +// +// Revision History: +// 06/18/99 Created +//Copyright (c) Microsoft Corporation. All rights reserved. +// +///////////////////////////////////////////////////////////////////////// + +// +// Function prototypes +// +int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCmdLine, int nCmdShow ); + +// --------------------------------------------------------------------------- +// WinMain +// --------------------------------------------------------------------------- +// Description: Program entry point. +// Arguments: +// HINSTANCE [in] Program instance handle. +// HINSTANCE [in] Unused in Win32. +// LPSTR [in] Program command line. +// int [in] Command to pass to ShowWindow(). +// Returns: +// int 0 if all goes well. + +int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszCmdLine, int nCmdShow ) +{ + HWND hWnd = NULL; + HWND hChild = NULL; + WNDCLASSEX wc; + HRESULT hr = S_OK; + + // Initialize the Win95 control library + InitCommonControls(); + + // Load the library containing the rich edit control + HMODULE hMod = LoadLibrary( TEXT( "riched20.dll" ) ); + if( !hMod ) + { + MessageBox( NULL, _T("Couldn't find riched32.dll. Shutting down!"), + _T("Error - Missing dll"), MB_OK ); + } + + if ( hMod ) + { + // Initialize COM library on the current thread and identify the concurrency model as + // single-thread apartment (STA). Applications must initialize the COM library before they + // can call COM library functions other than CoGetMalloc and memory allocation functions. + // New application developers may choose to use CoInitializeEx rather than CoInitialize, allowing + // them to set the concurrency model to apartment or multi-threaded. + CoInitialize( NULL ); + + // Register the child window class + ZeroMemory( &wc, sizeof( wc ) ); + wc.cbSize = sizeof( wc ); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = ChildWndProc; + wc.hInstance = hInst; + wc.hIcon = LoadIcon( hInst, (LPCTSTR) IDI_APPICON ); + wc.hCursor = LoadCursor( NULL, IDC_CROSS ); + wc.hbrBackground = GetSysColorBrush( COLOR_3DFACE ); + wc.lpszMenuName = NULL; + wc.lpszClassName = CHILD_CLASS; + wc.hIconSm = LoadIcon( hInst, (LPCTSTR) IDI_APPICON ); + + if( RegisterClassEx( &wc ) ) + { + CTTSApp DlgClass( hInst ); + hr = DlgClass.InitSapi(); + + if( SUCCEEDED( hr ) ) + { + // Create the main dialog + DialogBoxParam( hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)CTTSApp::DlgProcMain, + (LPARAM)&DlgClass ); + } + else + { + // Error - shut down + MessageBox( NULL, + _T("Error initializing TTSApp. Shutting down."), + _T("Error"), MB_OK ); + } + } + + FreeLibrary( hMod ); + } + + // Unload COM + CoUninitialize(); + + // Return 0 + return 0; + +} diff --git a/sp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.cpp b/sp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.cpp new file mode 100644 index 00000000..f6c0fb53 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.cpp @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include +#include "sphelper.h" +//Copyright (c) Microsoft Corporation. All rights reserved. + +inline HRESULT BlockForResult(ISpRecoContext * pRecoCtxt, ISpRecoResult ** ppResult) +{ + HRESULT hr = S_OK; + CSpEvent event; + + while (SUCCEEDED(hr) && + SUCCEEDED(hr = event.GetFrom(pRecoCtxt)) && + hr == S_FALSE) + { + hr = pRecoCtxt->WaitForNotifyEvent(INFINITE); + } + + *ppResult = event.RecoResult(); + if (*ppResult) + { + (*ppResult)->AddRef(); + } + + return hr; +} + +const WCHAR * StopWord() +{ + const WCHAR * pchStop; + + LANGID LangId = ::SpGetUserDefaultUILanguage(); + + switch (LangId) + { + case MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT): + pchStop = L"\x7d42\x4e86\\\x30b7\x30e5\x30fc\x30ea\x30e7\x30fc/\x3057\x3085\x3046\x308a\x3087\x3046";; + break; + + default: + pchStop = L"Stop"; + break; + } + + return pchStop; +} + +int main(int argc, char* argv[]) +{ + HRESULT hr = E_FAIL; + bool fUseTTS = true; // turn TTS play back on or off + bool fReplay = true; // turn Audio replay on or off + + // Process optional arguments + if (argc > 1) + { + int i; + + for (i = 1; i < argc; i++) + { + if (_stricmp(argv[i], "-noTTS") == 0) + { + fUseTTS = false; + continue; + } + if (_stricmp(argv[i], "-noReplay") == 0) + { + fReplay = false; + continue; + } + printf ("Usage: %s [-noTTS] [-noReplay] \n", argv[0]); + return hr; + } + } + + if (SUCCEEDED(hr = ::CoInitialize(NULL))) + { + { + CComPtr cpRecoCtxt; + CComPtr cpGrammar; + CComPtr cpVoice; + hr = cpRecoCtxt.CoCreateInstance(CLSID_SpSharedRecoContext); + if(SUCCEEDED(hr)) + { + hr = cpRecoCtxt->GetVoice(&cpVoice); + } + + if (cpRecoCtxt && cpVoice && + SUCCEEDED(hr = cpRecoCtxt->SetNotifyWin32Event()) && + SUCCEEDED(hr = cpRecoCtxt->SetInterest(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION))) && + SUCCEEDED(hr = cpRecoCtxt->SetAudioOptions(SPAO_RETAIN_AUDIO, NULL, NULL)) && + SUCCEEDED(hr = cpRecoCtxt->CreateGrammar(0, &cpGrammar)) && + SUCCEEDED(hr = cpGrammar->LoadDictation(NULL, SPLO_STATIC)) && + SUCCEEDED(hr = cpGrammar->SetDictationState(SPRS_ACTIVE))) + { + USES_CONVERSION; + + const WCHAR * const pchStop = StopWord(); + CComPtr cpResult; + + printf( "I will repeat everything you say.\nSay \"%s\" to exit.\n", W2A(pchStop) ); + + while (SUCCEEDED(hr = BlockForResult(cpRecoCtxt, &cpResult))) + { + cpGrammar->SetDictationState( SPRS_INACTIVE ); + + CSpDynamicString dstrText; + + if (SUCCEEDED(cpResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, + TRUE, &dstrText, NULL))) + { + printf("I heard: %s\n", W2A(dstrText)); + + if (fUseTTS) + { + cpVoice->Speak( L"I heard", SPF_ASYNC, NULL); + cpVoice->Speak( dstrText, SPF_ASYNC, NULL ); + } + + if (fReplay) + { + if (fUseTTS) + cpVoice->Speak( L"when you said", SPF_ASYNC, NULL); + else + printf ("\twhen you said...\n"); + cpResult->SpeakAudio(NULL, 0, NULL, NULL); + } + + cpResult.Release(); + } + if (_wcsicmp(dstrText, pchStop) == 0) + { + break; + } + + cpGrammar->SetDictationState( SPRS_ACTIVE ); + } + } + } + ::CoUninitialize(); + } + return hr; +} diff --git a/sp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.dsp b/sp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.dsp new file mode 100644 index 00000000..01046457 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TalkBack/talkback.dsp @@ -0,0 +1,90 @@ +# Microsoft Developer Studio Project File - Name="talkback" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=talkback - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "talkback.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "talkback.mak" CFG="talkback - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "talkback - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "talkback - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "talkback - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "talkback - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "talkback - Win32 Release" +# Name "talkback - Win32 Debug" +# Begin Source File + +SOURCE=.\talkback.cpp +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/TalkBack/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/TalkBack/version.rc2 new file mode 100644 index 00000000..d96d6b00 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TalkBack/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "TalkBack Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "TalkBack\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TalkBack.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.cpp b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.cpp new file mode 100644 index 00000000..a0b6d06e --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.cpp @@ -0,0 +1,1008 @@ +// ASRStream.cpp : Implementation of CASRStream +#include "stdafx.h" +#include "STCustomStream.h" +#include "ASRStream.h" +#include "Spddkhlp.h" + +const WAIT_TIME_OUT = 20000; // 20 seconds +///////////////////////////////////////////////////////////////////////////// +// CASRStream + +//////////////////////////////////////////////////////////////////////// +HRESULT CASRStream::FinalConstruct() +{ + + HRESULT hr = S_OK; + + //Initialize data members + m_ulBufferSize = 0; + m_ulActualRead = 0; + m_pnDataBuffer = NULL; + m_ulLeftOver = 0; + m_ulLeftOverPos = 0; + m_nNumberOfSamples = 0; + m_pSampleReadyEvents = NULL; + m_ppStreamSamples = NULL; + m_pnLeftOverBuffer = NULL; + + m_bFlag = FALSE; + m_bPurgeFlag = FALSE; + + return hr; +} + +//////////////////////////////////////////////////////////////////////// +void CASRStream::FinalRelease() +{ + + //Release objects + CleanUp(); + + m_cpSRMediaStream.Release(); + +} + +//////////////////////////////////////////////////////////////////////// +// Initialize the SR render stream and store the wave format +// +STDMETHODIMP CASRStream::InitSRRenderStream( IUnknown *pRenderTerminal) +{ + + HRESULT hr = S_OK; + CComQIPtr cpTerminal(pRenderTerminal); + + //Release the stream, if it exists + if ( m_cpSRMediaStream ) + { + m_cpSRMediaStream.Release(); + } + + //Query the IMediaStream interface from the terminal + if ( cpTerminal ) + { + hr = cpTerminal->QueryInterface(IID_IMediaStream, (void**)&m_cpSRMediaStream); + + } + else + { + hr = E_INVALIDARG; + cpTerminal.Release(); + return hr; + } + + + //Get the ITAMMediaFormat and then retrieve the format + ITAMMediaFormat *pITFormat; + hr = cpTerminal->QueryInterface(IID_ITAMMediaFormat, (void **)&pITFormat); + + if (FAILED(hr)) + { + cpTerminal.Release(); + return hr; + } + + AM_MEDIA_TYPE *pmt; + if(SUCCEEDED(hr)) + { + hr = pITFormat->get_MediaFormat(&pmt); + } + pITFormat->Release(); + + //Store the wave format + if(SUCCEEDED(hr)) + { + hr = m_StreamFormat.AssignFormat (SPDFID_WaveFormatEx, ( WAVEFORMATEX * )pmt->pbFormat ); + ::CoTaskMemFree(pmt); + } + + cpTerminal.Release(); + return hr; +} + +//////////////////////////////////////////////////////////////////////// +// Release the internal objects +// +STDMETHODIMP CASRStream::CleanUp() +{ + HRESULT hr = S_OK; + m_hCritSec.Lock(); + + //Release objects + if ( m_pSampleReadyEvents) + { + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + } + + if ( m_ppStreamSamples ) + { + ReleaseSamples(m_ppStreamSamples, m_nNumberOfSamples); + m_ppStreamSamples = NULL; + } + + if ( m_pnDataBuffer ) + { + delete[] m_pnDataBuffer; + m_pnDataBuffer = NULL; + } + + if ( m_pnLeftOverBuffer ) + { + delete[] m_pnLeftOverBuffer; + m_pnLeftOverBuffer = NULL; + } + + m_hCritSec.Unlock(); + + return hr; +} + +//////////////////////////////////////////////////////////////////////// +// Set the purge stream flag to TRUE so that SR engine will get the less +// audio data than it wants. The SR engine will stop calling Read(), because +// the SR engine thinks it reaches the end of the stream. +// +STDMETHODIMP CASRStream::PurgeStream() +{ + HRESULT hr = S_OK; + m_hCritSec.Lock(); + + m_bPurgeFlag = TRUE; + m_bFlag = FALSE; + + m_hCritSec.Unlock(); + + return hr; +} + +//////////////////////////////////////////////////////////////////////// +// Set the purge stream flag to FALSE. This allows the SR engine to +// to get the data in the next Read() calls. +// Reset the other variables. +// +STDMETHODIMP CASRStream::RestartStream() +{ + HRESULT hr = S_OK; + m_hCritSec.Lock(); + + hr = CleanUp(); + + m_ulBufferSize = 0; + m_ulActualRead = 0; + + m_ulLeftOver = 0; + m_ulLeftOverPos = 0; + m_nNumberOfSamples = 0; + + m_bFlag = FALSE; + m_bPurgeFlag = FALSE; + + m_hCritSec.Unlock(); + + return hr; +} +//////////////////////////////////////////////////////////////////////// +// read the terminal's allocator properties to return the number of samples +// the terminal provides +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::GetNumberOfSamplesOnStream(IMediaStream *pTerminalMediaStream, + OUT DWORD *pnNumberOfSamples) +{ + + HRESULT hr = S_OK; + + + // + // don't return garbage + // + + *pnNumberOfSamples = 0; + + + // + // get allocator properties + // + + ITAllocatorProperties *pAllocProperites = NULL; + + hr = pTerminalMediaStream->QueryInterface(IID_ITAllocatorProperties, + (void **)&pAllocProperites); + + if (FAILED(hr)) + { + return hr; + } + + + // + // we want to know the number of samples we will be getting + // + + ALLOCATOR_PROPERTIES AllocProperties; + + hr = pAllocProperites->GetAllocatorProperties(&AllocProperties); + + pAllocProperites->Release(); + pAllocProperites = NULL; + + + if (FAILED(hr)) + { + return hr; + } + + *pnNumberOfSamples = AllocProperties.cBuffers; + + return S_OK; +} + +////////////////////////////////////////////////////////////////////////////// +// close the handles passed into the function and release the array of handles +// +/////////////////////////////////////////////////////////////////////////////// + +void CASRStream::ReleaseEvents(OUT HANDLE *pEvents, // array of events to be freed + DWORD nNumberOfEvents // number of events the array + ) +{ + + // + // close all the handles in the array + // + + for (DWORD i = 0; i < nNumberOfEvents; i++) + { + CloseHandle(pEvents[i]); + pEvents[i] = NULL; + } + + + // + // free the array itself + // + + FreeMemory(pEvents); + pEvents = NULL; +} + + +////////////////////////////////////////////////////////////////////////////// +// allocate the array of events of size nNumberOfSamples +// +// return pointer to the allocated and initialized array if success +// or NULL if failed +// +/////////////////////////////////////////////////////////////////////////////// + +HANDLE* CASRStream::AllocateEvents(DWORD nNumberOfEvents) +{ + + // + // pointer to an array of event handles + // + + HANDLE *pSampleReadyEvents = NULL; + + pSampleReadyEvents = + (HANDLE*)AllocateMemory(sizeof(HANDLE) * nNumberOfEvents); + + if (NULL == pSampleReadyEvents) + { + //Failed to allocate sample ready events. + + return NULL; + } + + + // + // create an event for every allocated handle + // + + + for (DWORD i = 0; i < nNumberOfEvents; i++) + { + + pSampleReadyEvents[i] = CreateEvent(NULL, FALSE, FALSE, NULL); + + if (NULL == pSampleReadyEvents[i]) + { + + // + // close handles we have created already + // + + for (DWORD j = 0; j< i; j++) + { + CloseHandle(pSampleReadyEvents[j]); + + pSampleReadyEvents[j] = NULL; + } + + + FreeMemory(pSampleReadyEvents); + pSampleReadyEvents = NULL; + + return NULL; + + } + + } // creating events for each sample + + + // + // succeded creating events. return the pointer to the array + // + + return pSampleReadyEvents; + +} + +////////////////////////////////////////////////////////////////////////////// +// aborts and releases every sample in the array of samples of size +// nNumberOfSamples and deallocates the array itself +// +// ppStreamSamples becomes invalid when the function returns +// +/////////////////////////////////////////////////////////////////////////////// + +void CASRStream::ReleaseSamples(IStreamSample **ppStreamSamples, + DWORD nNumberOfSamples) +{ + + for (DWORD i = 0; i < nNumberOfSamples; i++) + { + ppStreamSamples[i]->CompletionStatus(COMPSTAT_WAIT | + COMPSTAT_ABORT, + INFINITE); + + + // + // regardless of the error code, release the sample + // + + ppStreamSamples[i]->Release(); + ppStreamSamples[i] = NULL; + } + + FreeMemory(ppStreamSamples); + ppStreamSamples = NULL; +} + +////////////////////////////////////////////////////////////////////////////// +// allocate the array of nNumberOfSamples samples, and initialize each sample +// pointer in the array with samples from the supplied stream. +// +// return pointer to the allocated and initialized array if success +// or NULL if failed +// +/////////////////////////////////////////////////////////////////////////////// + +IStreamSample ** CASRStream::AllocateStreamSamples(IMediaStream *pMediaStream, + DWORD nNumberOfSamples) +{ + + // + // allocate stream sample array + // + + IStreamSample **ppStreamSamples = (IStreamSample **) + AllocateMemory( sizeof(IStreamSample*) * nNumberOfSamples ); + + + if (NULL == ppStreamSamples) + { + return NULL; + } + + + // + // allocate samples from the stream and put them into the array + // + + for (DWORD i = 0; i < nNumberOfSamples; i++) + { + + HRESULT hr = pMediaStream->AllocateSample(0, &ppStreamSamples[i]); + + if (FAILED(hr)) + { + + for (DWORD j = 0; j < i; j++) + { + ppStreamSamples[j]->Release(); + ppStreamSamples[j] = NULL; + } + + FreeMemory(ppStreamSamples); + ppStreamSamples = NULL; + + return NULL; + + } // failed AllocateSample() + + } // allocating samples on the stream + + + + // + // succeeded allocating samples + // + + return ppStreamSamples; + +} + + +////////////////////////////////////////////////////////////////////////////// +// call Update() on every sample of the array of stream samples to associate it +// with an event from the array of events. The events will be signaled when the +// corresponding sample has data and is ready to render to SAPI +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::AssociateEventsWithSamples(HANDLE *pSampleReadyEvents, + IStreamSample **ppStreamSamples, + DWORD nNumberOfSamples) +{ + + for (DWORD i = 0; i < nNumberOfSamples; i++) + { + + // + // the event passed to Update will be signaled when the sample is + // filled with data + // + + HRESULT hr = + ppStreamSamples[i]->Update(0, pSampleReadyEvents[i], NULL, 0); + + + if (FAILED(hr)) + { + + // + // abort the samples we have Update()'d + // + + for (DWORD j = 0; j < i; j++) + { + + // + // no need to check the return code here -- best effort attempt + // if failed -- too bad + // + + ppStreamSamples[j]->CompletionStatus(COMPSTAT_WAIT | + COMPSTAT_ABORT, + INFINITE); + } + + return hr; + + } // Update() failed + + } // Update()'ing all samples + + + return S_OK; +} + + +////////////////////////////////////////////////////////////////////////////// +// +// This function writes the data portion of the sample into the SAPI +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::ReadStreamSample(IStreamSample *pStreamSample, ULONG start) +{ + + // + // get the sample's IMemoryData interface so we can get to the + // sample's data + // + + IMemoryData *pSampleMemoryData = NULL; + + HRESULT hr = pStreamSample->QueryInterface(IID_IMemoryData, + (void **)&pSampleMemoryData); + + if (FAILED(hr)) + { + return hr; + } + + // + // get to the sample's data buffer + // + DWORD nBufferSize = 0; + BYTE *pnDataBuffer = NULL; + DWORD nActualDataSize = 0; + + hr = pSampleMemoryData->GetInfo(&nBufferSize, + &pnDataBuffer, + &nActualDataSize); + + + if ( SUCCEEDED ( hr ) ) + { + m_ulActualRead = (ULONG) nActualDataSize; + if ( nActualDataSize + start <= m_ulBufferSize ) + { + //If SR engine wants more data then the media stream contains, copy it directly + //to the current buffer + memcpy ( (BYTE *)&m_pnDataBuffer[start], (BYTE *)pnDataBuffer, nActualDataSize * sizeof(BYTE)); + } + else + { // we have left over data + memcpy ( (BYTE *)&m_pnDataBuffer[start], (BYTE *)pnDataBuffer, (m_ulBufferSize - start - m_ulLeftOver ) * sizeof(BYTE)); + + ULONG ulLeftOver = nActualDataSize + start + m_ulLeftOver - m_ulBufferSize; + + if ( m_pnLeftOverBuffer ) + { + delete[] m_pnLeftOverBuffer; + m_pnLeftOverBuffer = NULL; + } + + m_pnLeftOverBuffer = new BYTE[ ulLeftOver ]; + + if ( m_pnLeftOverBuffer == NULL ) + { + hr = E_OUTOFMEMORY; + } + else + { + memcpy ( (BYTE *)m_pnLeftOverBuffer, (BYTE *)&pnDataBuffer[m_ulBufferSize - start - m_ulLeftOver], ulLeftOver * sizeof(BYTE)); + } + } + } + + pSampleMemoryData->Release(); + pSampleMemoryData = NULL; + + return hr; +} + + + + +////////////////////////////////////////////////////////////////////////////// +// given the return code fom WaitForMultipleObjects, this function determines +// which sample was signal and returns S_OK and the id of the signaled sample +// or E_FAIL if WaitForMultipleEvents returned an error +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::GetSampleID(DWORD nWaitCode, // code from WaitForMultiple... + DWORD nNumberOfSamples, // the total number of samples + DWORD *pnSampleID) // the calculated id of the + // signaled sample +{ + + + // + // event abandoned? + // + + if ( (nWaitCode >= WAIT_ABANDONED_0) && + (nWaitCode < WAIT_ABANDONED_0 + nNumberOfSamples) ) + { + return E_FAIL; + } + + + // + // any other error? + // + + if ( (WAIT_OBJECT_0 + nNumberOfSamples <= nWaitCode) ) + { + return E_FAIL; + } + + + // + // which sample was signaled? + // + + *pnSampleID = nWaitCode - WAIT_OBJECT_0; + + return S_OK; +} + + +////////////////////////////////////////////////////////////////////////////// +// +// extract samples from the terminal's media stream and render it to SR engine +// +// returns when the call is disconnected (call disconnect causes media streaming +// terminal to abort the samples +// +/////////////////////////////////////////////////////////////////////////////// + +HRESULT CASRStream::RenderAudioStream(ULONG start) +{ + + HRESULT hr = S_OK; + DWORD nSampleID = 0; + + if ( !m_bFlag ) + { + //turn off the flag. Only initialize once for each connection + m_bFlag = TRUE; + + // get the number of stream samples we will be using + hr = GetNumberOfSamplesOnStream(m_cpSRMediaStream, &m_nNumberOfSamples); + + if (FAILED(hr)) + { + return hr; + } + + // + // the number of samples directly corresponds the number of events we will + // be waiting on later. WaitForMultipleObjects has a limit of + // MAXIMUM_WAIT_OBJECTS events. + // + + if (m_nNumberOfSamples > MAXIMUM_WAIT_OBJECTS) + { + return E_FAIL; + } + + + // + // allocate events that will be signaled when each sample is ready to be + // read + // + + m_pSampleReadyEvents = AllocateEvents(m_nNumberOfSamples); + + if (NULL == m_pSampleReadyEvents) + { + return E_OUTOFMEMORY; + } + + // + // allocate array of stream samples + // + + m_ppStreamSamples = AllocateStreamSamples(m_cpSRMediaStream, + m_nNumberOfSamples); + + if (NULL == m_ppStreamSamples) + { + // + // release events we have allocated + // + + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + + return E_FAIL; + } + + + // + // we have the samples, we have the events. + // associate events with samples so events get signaled when the + // corresponding samples are ready to be read + // + + hr = AssociateEventsWithSamples(m_pSampleReadyEvents, + m_ppStreamSamples, + m_nNumberOfSamples); + + if (FAILED(hr)) + { + // + // release events and samples we have allocated + // + + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + + ReleaseSamples(m_ppStreamSamples, m_nNumberOfSamples); + m_ppStreamSamples = NULL; + + return E_FAIL; + } + + } + if ( SUCCEEDED ( hr ) ) + { + + // + // wait for the events associated with the samples + // when a samples has data, the corresponding event will be + // signaled + // + + DWORD nWaitCode = WaitForMultipleObjects(m_nNumberOfSamples, + m_pSampleReadyEvents, + FALSE, + WAIT_TIME_OUT); + + + // + // get the id of the sample that was signaled. fail if Wait returned + // error + // + + hr = GetSampleID(nWaitCode, m_nNumberOfSamples, &nSampleID); + + } + + + // + // we filtered out all invalid error codes. so nSampleID has no + // choice but be a valid sample index. + // + + _ASSERTE(nSampleID < m_nNumberOfSamples); + + if ( SUCCEEDED ( hr ) ) + { + + // + // make sure the sample is ready to be read + // + + hr = m_ppStreamSamples[nSampleID]->CompletionStatus(COMPSTAT_WAIT, 0); + } + + + // + // we have the sample that was signaled and which is now ready to be + // read. Record the sample. + // + if ( SUCCEEDED ( hr ) ) + { + hr = ReadStreamSample(m_ppStreamSamples[nSampleID], start); + } + + + // + // we are done with this sample. return it to the source stream + // to be refilled with data + // + if ( SUCCEEDED ( hr ) ) + { + + hr = m_ppStreamSamples[nSampleID]->Update(0, m_pSampleReadyEvents[nSampleID],NULL,0); + + } + + if (FAILED(hr)) + { + // + // release events and samples we have allocated + // + + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + + ReleaseSamples(m_ppStreamSamples, m_nNumberOfSamples); + m_ppStreamSamples = NULL; + } + + return hr; +} + +////////////////////////////////////////////////////////////////////////////// +// +// use win32 heap api to allocate memory on the application's heap +// and zero the allocated memory +// +/////////////////////////////////////////////////////////////////////////////// +void *CASRStream::AllocateMemory(SIZE_T nMemorySize) +{ + // + // use HeapAlloc to allocate and clear memory + // + + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nMemorySize); +} + + +////////////////////////////////////////////////////////////////////////////// +// +// use win32 heap api to free memory previously allocated on the application's +// heap +// +/////////////////////////////////////////////////////////////////////////////// +void CASRStream::FreeMemory(void *pMemory) +{ + + // + // get size of the allocated memory + // + + DWORD nMemorySize = HeapSize(GetProcessHeap(), 0, pMemory); + + + // + // fill memory with 0xdd's before freeing, so it is easier to debug + // failures caused by using pointer to deallocated memory + // + + if (NULL != pMemory) + { + FillMemory(pMemory, nMemorySize, 0xdd); + } + + + // + // use HeapFree to free memory. use return code to log the result, but + // do not return it to the caller + // + + BOOL bFreeSuccess = HeapFree(GetProcessHeap(), 0, pMemory); + + if (FALSE == bFreeSuccess) + { + // + // if this assertion fires, it is likely there is a problem with the + // memory we are trying to deallocate. Was it allocated using heapalloc + // and on the same heap? Is this a valid pointer? + // + + _ASSERTE(FALSE); + } + +} + +////////////////////////////////////////////////////////////////////////////// +// +// SR engine calls the Read to get the audio through SAPI +// +/////////////////////////////////////////////////////////////////////////////// +STDMETHODIMP CASRStream::Read(void * pv, ULONG cb, ULONG *pcbRead) +{ + m_hCritSec.Lock(); + + ULONG start; + LONG len = cb; + BYTE * pnData = (BYTE *)pv; + HRESULT hr = S_OK; + + + if (m_bPurgeFlag) + { + //the app wants to stop rendering the stream + m_bPurgeFlag = FALSE; + ReleaseEvents(m_pSampleReadyEvents, m_nNumberOfSamples); + m_pSampleReadyEvents = NULL; + + ReleaseSamples(m_ppStreamSamples, m_nNumberOfSamples); + m_ppStreamSamples = NULL; + + *pcbRead = 0; + m_hCritSec.Unlock(); + return hr; + } + + //allocate the buffer + if ( m_pnDataBuffer == NULL ) + { + m_ulBufferSize = cb; + m_pnDataBuffer = new BYTE [ m_ulBufferSize ]; + if ( m_pnDataBuffer == NULL ) + { + m_hCritSec.Unlock(); + return E_OUTOFMEMORY; + } + } + else if ( m_ulBufferSize != cb) + { + //allocate a new buffer + delete []m_pnDataBuffer; + m_ulBufferSize = cb; + m_pnDataBuffer = new BYTE [ m_ulBufferSize ]; + if ( m_pnDataBuffer == NULL ) + { + m_hCritSec.Unlock(); + return E_OUTOFMEMORY; + } + } + + //copy the data left from the previous Read(). + if ( m_pnLeftOverBuffer && m_ulLeftOver > 0 ) + { + memcpy ( pnData, (BYTE *)&m_pnLeftOverBuffer[m_ulLeftOverPos], min(cb, m_ulLeftOver) * sizeof(BYTE) ); + } + + //Read the data from MST + start = 0; + len = cb - m_ulLeftOver; + + while ( SUCCEEDED ( hr ) && len > 0 ) + { + hr = RenderAudioStream( start ); + start += m_ulActualRead; + len = cb - m_ulLeftOver - start; + } + + if ( SUCCEEDED ( hr ) ) + { + // tell SR engine, we have cb bytes available. + *pcbRead = cb; + + // Copy the rest of data outside and set the postion and number of bytes left in + // the left over data buffer + long lRead = *pcbRead - m_ulLeftOver; + if ( lRead > 0 ) + { + m_ulLeftOverPos = 0; + memcpy ( &pnData[m_ulLeftOver], (BYTE *)m_pnDataBuffer, (*pcbRead - m_ulLeftOver) * sizeof(BYTE) ); + } + else + { + m_ulLeftOverPos += cb; + } + + if ( len < 0 ) + { + m_ulLeftOver = -len; + } + else + { + m_ulLeftOverPos = 0; + m_ulLeftOver = 0; + } + } + + m_hCritSec.Unlock(); + + return hr; +} + +////////////////////////////////////////////////////////////////////////////// +// +// This method is called by SAPI +// +/////////////////////////////////////////////////////////////////////////////// +STDMETHODIMP CASRStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + // We only accept queries for the current stream position + if (STREAM_SEEK_CUR != dwOrigin || dlibMove.QuadPart) + { + return E_INVALIDARG; + } + + // Validate the OUT parameter + if (SPIsBadWritePtr(plibNewPosition, sizeof(ULARGE_INTEGER))) + { + return E_POINTER; + } + + m_hCritSec.Lock(); + + plibNewPosition->QuadPart = (LONG)dlibMove.LowPart; + + m_hCritSec.Unlock(); + + return S_OK; +} + +//////////////////////////////////////////////////////////////////////////////// +// This method is called by SAPI +// +/////////////////////////////////////////////////////////////////////////////// +STDMETHODIMP CASRStream::GetFormat(GUID * pFmtId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + m_hCritSec.Lock(); + + HRESULT hr = S_OK; + + hr = m_StreamFormat.ParamValidateCopyTo( pFmtId, ppCoMemWaveFormatEx ); + + + m_hCritSec.Unlock(); + + return hr; +} + diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.h b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.h new file mode 100644 index 00000000..a65dd936 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.h @@ -0,0 +1,141 @@ +// ASRStream.h : Declaration of the CASRStream + +#ifndef __ASRSTREAM_H_ +#define __ASRSTREAM_H_ + +#include "resource.h" // main symbols +#include "sapi.h" + +#include +#include +#include "SAPI.h" +#include "sphelper.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CASRStream +class ATL_NO_VTABLE CASRStream : + public CComObjectRootEx, + public CComCoClass, + public ISpStreamFormat, + public IDispatchImpl +{ +public: + CASRStream() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_ASRSTREAM) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CASRStream) + COM_INTERFACE_ENTRY(IASRStream) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISpStreamFormat) + COM_INTERFACE_ENTRY(IStream) + +END_COM_MAP() + +// IASRStream +public: + STDMETHOD(InitSRRenderStream)(IUnknown *pRenderTerminal); + STDMETHOD(PurgeStream)(); + STDMETHOD(RestartStream)(); + STDMETHOD(CleanUp)(); + HRESULT FinalConstruct(); + void FinalRelease(); + + + // + // IStream + // + + STDMETHODIMP Read(void * pv, ULONG cb, ULONG * pcbRead); + STDMETHODIMP Write(const void * pv, ULONG cb, ULONG * pcbWritten) + { + return STG_E_ACCESSDENIED; + } + STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition); + STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize) + { + return STG_E_ACCESSDENIED; + } + STDMETHODIMP CopyTo(IStream *pStreamDest, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) + { + return E_NOTIMPL; + } + STDMETHODIMP Commit(DWORD grfCommitFlags) + { + return E_NOTIMPL; + } + STDMETHODIMP Revert(void) + { + return E_NOTIMPL; + } + STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) + { + return E_NOTIMPL; + } + STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) + { + return E_NOTIMPL; + } + STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag) + { + return E_NOTIMPL; + } + STDMETHODIMP Clone(IStream ** ppstm) + { + return E_NOTIMPL; + } + // + // ISpStreamFormat + // + STDMETHODIMP GetFormat(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); + + +private: + + HRESULT RenderAudioStream(ULONG start); + HRESULT GetSampleID(DWORD nWaitCode, DWORD nNumberOfSamples, DWORD *pnSampleID); + HRESULT ReadStreamSample(IStreamSample *pStreamSample, ULONG start ); + HRESULT AssociateEventsWithSamples(HANDLE *pSampleReadyEvents, + IStreamSample **ppStreamSamples, + DWORD nNumberOfSamples); + IStreamSample ** AllocateStreamSamples( IMediaStream *pMediaStream, DWORD nNumberOfSamples); + void ReleaseSamples(IStreamSample **ppStreamSamples, DWORD nNumberOfSamples); + HANDLE* AllocateEvents(DWORD nNumberOfEvents); + void ReleaseEvents(HANDLE *pEvents, DWORD nNumberOfEvents ); + HRESULT GetNumberOfSamplesOnStream(IMediaStream *pTerminalMediaStream,DWORD *pnNumberOfSamples); + void *AllocateMemory(SIZE_T nMemorySize); + void FreeMemory(void *pMemory); + +private: + + CComAutoCriticalSection m_hCritSec; + ULONG m_ulBufferSize; + ULONG m_ulActualRead; + BYTE * m_pnDataBuffer; + ULONG m_ulLeftOver; + ULONG m_ulLeftOverPos; + BYTE * m_pnLeftOverBuffer; + DWORD m_nNumberOfSamples ; + BOOL m_bFlag ; + BOOL m_bPurgeFlag; + HANDLE * m_pSampleReadyEvents ; + CComPtr m_cpSRMediaStream; + IStreamSample **m_ppStreamSamples ; + CSpStreamFormat m_StreamFormat; + +}; + +#endif //__ASRSTREAM_H_ diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.rgs b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.rgs new file mode 100644 index 00000000..95092201 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/ASRStream.rgs @@ -0,0 +1,26 @@ +HKCR +{ + STCustomStream.ASRStream.1 = s 'ASRStream Class' + { + CLSID = s '{6CD93B97-482E-409B-B2EB-128231F0FEA1}' + } + STCustomStream.ASRStream = s 'ASRStream Class' + { + CLSID = s '{6CD93B97-482E-409B-B2EB-128231F0FEA1}' + CurVer = s 'STCustomStream.ASRStream.1' + } + NoRemove CLSID + { + ForceRemove {6CD93B97-482E-409B-B2EB-128231F0FEA1} = s 'ASRStream Class' + { + ProgID = s 'STCustomStream.ASRStream.1' + VersionIndependentProgID = s 'STCustomStream.ASRStream' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{EDAEECD8-0D75-499E-9B69-187ACACF2C05}' + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.cpp b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.cpp new file mode 100644 index 00000000..1d4e2052 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.cpp @@ -0,0 +1,74 @@ +// STCustomStream.cpp : Implementation of DLL Exports. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f STCustomStreamps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "STCustomStream.h" + +#include "STCustomStream_i.c" +#include "ASRStream.h" +#include "TTSStream.h" + + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_ASRStream, CASRStream) +OBJECT_ENTRY(CLSID_TTSStream, CTTSStream) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_STCUSTOMSTREAMLib); + DisableThreadLibraryCalls(hInstance); + } + else if (dwReason == DLL_PROCESS_DETACH) + _Module.Term(); + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.def b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.def new file mode 100644 index 00000000..95e294b1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.def @@ -0,0 +1,9 @@ +; STCustomStream.def : Declares the module parameters. + +LIBRARY "STCustomStream.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.dsp b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.dsp new file mode 100644 index 00000000..b41477ed --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.dsp @@ -0,0 +1,337 @@ +# Microsoft Developer Studio Project File - Name="STCustomStream" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=STCustomStream - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "STCustomStream.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "STCustomStream.mak" CFG="STCustomStream - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "STCustomStream - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "STCustomStream - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "STCustomStream - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\include" /I "..\..\..\..\..\sdk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib t3iid.lib strmiids.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib\i386" /libpath:"..\..\..\..\..\sdk\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=.\Debug\STCustomStream.dll +InputPath=.\Debug\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\DebugU +TargetPath=.\DebugU\STCustomStream.dll +InputPath=.\DebugU\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=.\ReleaseMinSize\STCustomStream.dll +InputPath=.\ReleaseMinSize\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=.\ReleaseMinDependency\STCustomStream.dll +InputPath=.\ReleaseMinDependency\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=.\ReleaseUMinSize\STCustomStream.dll +InputPath=.\ReleaseUMinSize\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "STCustomStream - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\include" /I "..\..\..\..\..\sdk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib t3iid.lib strmiids.lib winmm.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"..\..\..\..\lib\i386" /libpath:"..\..\..\lib\i386" +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\STCustomStream.dll +InputPath=.\ReleaseUMinDependency\STCustomStream.dll +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + regsvr32 /s /c "$(TargetPath)" + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + goto end + :NOTNT + echo Warning : Cannot register Unicode DLL on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "STCustomStream - Win32 Debug" +# Name "STCustomStream - Win32 Unicode Debug" +# Name "STCustomStream - Win32 Release MinSize" +# Name "STCustomStream - Win32 Release MinDependency" +# Name "STCustomStream - Win32 Unicode Release MinSize" +# Name "STCustomStream - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\ASRStream.cpp +# End Source File +# Begin Source File + +SOURCE=.\STCustomStream.cpp +# End Source File +# Begin Source File + +SOURCE=.\STCustomStream.def +# End Source File +# Begin Source File + +SOURCE=.\STCustomStream.idl +# ADD MTL /tlb ".\STCustomStream.tlb" /h "STCustomStream.h" /iid "STCustomStream_i.c" /Oicf +# End Source File +# Begin Source File + +SOURCE=.\STCustomStream.rc +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\TTSStream.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\ASRStream.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\TTSStream.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\ASRStream.rgs +# End Source File +# Begin Source File + +SOURCE=.\TTSStream.rgs +# End Source File +# End Group +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.idl b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.idl new file mode 100644 index 00000000..6b85fd66 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.idl @@ -0,0 +1,63 @@ +// STCustomStream.idl : IDL source for STCustomStream.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (STCustomStream.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; + + + [ + object, + uuid(C78CDA8E-DC97-4B4A-964E-2CEDAC7145A7), + dual, + helpstring("IASRStream Interface"), + pointer_default(unique) + ] + interface IASRStream : IDispatch + { + [id(1), helpstring("method InitSRRenderStream")] HRESULT InitSRRenderStream(IUnknown *pRenderTerminal); + [id(2), helpstring("method PurgeStream")] HRESULT PurgeStream(); + [id(3), helpstring("method PurgeStream")] HRESULT RestartStream(); + + }; + [ + object, + uuid(006FF399-A14C-4767-9347-65A4388B7B14), + dual, + helpstring("ITTSStream Interface"), + pointer_default(unique) + ] + interface ITTSStream : IDispatch + { + [id(1), helpstring("method InitTTSCaptureStream")] HRESULT InitTTSCaptureStream(IUnknown *pCaptureTerminal); + }; + +[ + uuid(EDAEECD8-0D75-499E-9B69-187ACACF2C05), + version(1.0), + helpstring("STCustomStream 1.0 Type Library") +] +library STCUSTOMSTREAMLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + [ + uuid(6CD93B97-482E-409B-B2EB-128231F0FEA1), + helpstring("ASRStream Class") + ] + coclass ASRStream + { + [default] interface IASRStream; + }; + [ + uuid(B827D5CC-96FA-4A1E-9877-D54586D433F4), + helpstring("TTSStream Class") + ] + coclass TTSStream + { + [default] interface ITTSStream; + }; +}; diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.rc b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.rc new file mode 100644 index 00000000..892c33b1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/STCustomStream.rc @@ -0,0 +1,87 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "1 TYPELIB ""STCustomStream.tlb""\r\n" + "\0" +END +4 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END +#endif // APSTUDIO_INVOKED + + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_ASRSTREAM REGISTRY DISCARDABLE "ASRStream.rgs" +IDR_TTSSTREAM REGISTRY DISCARDABLE "TTSStream.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "STCustomStream" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "STCustomStream.tlb" + +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.cpp b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.cpp new file mode 100644 index 00000000..a5eea178 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.cpp @@ -0,0 +1,12 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.h b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.h new file mode 100644 index 00000000..4c9214ea --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/StdAfx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__BA631C5B_6B4E_4A40_AAAD_4ED7DD4AA2BB__INCLUDED_) +#define AFX_STDAFX_H__BA631C5B_6B4E_4A40_AAAD_4ED7DD4AA2BB__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +//#define STRICT +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif +#define _ATL_APARTMENT_THREADED + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include + +#ifndef MAXULONG_PTR +#error This sample application requires a newer version of the Platform SDK than you have installed. +#endif // MAXULONG_PTR + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__BA631C5B_6B4E_4A40_AAAD_4ED7DD4AA2BB__INCLUDED) diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.cpp b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.cpp new file mode 100644 index 00000000..502583a1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.cpp @@ -0,0 +1,436 @@ +// TTSStream.cpp : Implementation of CTTSStream +#include "stdafx.h" +#include "STCustomStream.h" +#include "TTSStream.h" + +#include "Spddkhlp.h" +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CTTSStream + +class CStreamSampleQueue; + +// contains an IStreamSample ptr and is doubly-linked in +// a CStreamSampleQueue +class CQueueElem +{ +public: + + friend CStreamSampleQueue; + + CQueueElem( + IN IStreamSample *pStreamSample, + IN CQueueElem *pPrev, + IN CQueueElem *pNext + ) + : m_pStreamSample(pStreamSample), + m_pPrev(pPrev), + m_pNext(pNext) + { + } + +protected: + + IStreamSample *m_pStreamSample; + CQueueElem *m_pPrev; + CQueueElem *m_pNext; +}; + +// queues CQueueElem instances (FIFO) +// keeps the instances in a doubly-linked list +class CStreamSampleQueue +{ +public: + + CStreamSampleQueue() + : m_Head(NULL, &m_Head, &m_Head) + {} + + IStreamSample *Dequeue() + { + if (m_Head.m_pNext == &m_Head) return NULL; + + CQueueElem *TargetQueueElem = m_Head.m_pNext; + m_Head.m_pNext = m_Head.m_pNext->m_pNext; + m_Head.m_pNext->m_pNext->m_pPrev = &m_Head; + + IStreamSample *ToReturn = TargetQueueElem->m_pStreamSample; + delete TargetQueueElem; + + return ToReturn; + } + + BOOL Enqueue( + IN IStreamSample *pStreamSample + ) + { + CQueueElem *TargetQueueElem = + new CQueueElem(pStreamSample, m_Head.m_pPrev, &m_Head); + if (NULL == TargetQueueElem) return FALSE; + + m_Head.m_pPrev->m_pNext = TargetQueueElem; + m_Head.m_pPrev = TargetQueueElem; + + return TRUE; + } + + +protected: + + CQueueElem m_Head; +}; + +////////////////////////////////////////////////////////////////////////////// +// Query the media stream interface and get the stream format from the capture +// terminal. This stream object is used for the H.323 connections. If +// you want to use it over the voice modem or other voice boards, you need to +// set the media stream format by using ITAMMediaFormat::put_MediaFormat(), +// which is mandatory or the terminal will not be able to connect. + +STDMETHODIMP CTTSStream::InitTTSCaptureStream( IUnknown *pCaptureTerminal) +{ + + HRESULT hr = S_OK; + CComQIPtr cpTerminal(pCaptureTerminal); + + m_cpTTSMediaStream.Release(); + + + //Query the IMediaStream interface from the terminal + if ( cpTerminal ) + { + hr = cpTerminal->QueryInterface(IID_IMediaStream, (void**)&m_cpTTSMediaStream); + + } + else + { + hr = E_INVALIDARG; + cpTerminal.Release(); + return hr; + } + + //Get the ITAMMediaFormat and then retrieve the format + ITAMMediaFormat *pITFormat; + hr = cpTerminal->QueryInterface(IID_ITAMMediaFormat, (void **)&pITFormat); + + if (FAILED(hr)) + { + cpTerminal.Release(); + return hr; + } + + AM_MEDIA_TYPE *pmt; + if(SUCCEEDED(hr)) + { + hr = pITFormat->get_MediaFormat(&pmt); + } + + //Store the wave format + if(SUCCEEDED(hr)) + { + hr = m_StreamFormat.AssignFormat (SPDFID_WaveFormatEx, ( WAVEFORMATEX * )pmt->pbFormat ); + ::CoTaskMemFree(pmt); + } + + //Release the objects + pITFormat->Release(); + cpTerminal.Release(); + return hr; +} + +////////////////////////////////////////////////////////////////////////////// +//Release the objects +// +void CTTSStream::FinalRelease() +{ + m_cpTTSMediaStream.Release(); + +} + +////////////////////////////////////////////////////////////////////////////// +// TTS engines call this method, Write(), through SAPI whenever the audio data +// is ready. +// +STDMETHODIMP CTTSStream::Write(const void * pv, ULONG cb, ULONG * pcbWritten) +{ + + m_hCritSec.Lock(); + HRESULT hr = S_OK; + ULONG lWritten = 0; + ULONG ulPos =0; + BYTE * pbData = (BYTE *)pv; + + + if (SPIsBadReadPtr(pv, cb) || SP_IS_BAD_OPTIONAL_WRITE_PTR(pcbWritten)) + { + hr = STG_E_INVALIDPOINTER; + } + + //wait for the media stream to be active. Maximum is 6 seconds + hr = WaitUntilReady(6000); + m_bFlag = 0; + + // + // create a queue (STL deque) that will hold all the samples that we ever + // submitted to media streaming terminal + // + // we need this so when we are finished reading the data, we can go through + // the list of all the samples that we have submitted and make sure mst + // is finished processing them + // + + CStreamSampleQueue DestSampleQ; + + // + // keep reading samples from the buffer and sending them. + // + while ( SUCCEEDED ( hr ) ) + { + + // + // allocate a sample on the terminal's media stream + // + // Note: the call to AllocateSample() will block if we filled all the + // samples with data, and there are no more samples for us to fill + // (waiting for media streaming terminal to process samples we have + // submitted). When MST is is done with at least one sample, the call + // will return. This logic will ensure that MST always has work and is + // never starved for samples. + // + + IStreamSample *pStreamSample = NULL; + + hr = m_cpTTSMediaStream->AllocateSample(0, &pStreamSample); + + if (FAILED(hr)) + { + break; + } + + // + // get IMemoryData on the sample so we can get to the sample's memory + // data + // + + IMemoryData *pSampleMemoryData = NULL; + + hr = pStreamSample->QueryInterface(IID_IMemoryData, + (void**)&pSampleMemoryData); + + if (FAILED(hr)) + { + pStreamSample->Release(); + pStreamSample = NULL; + + break; + + } + + // + // get to the sample's memory buffer + // + + ULONG nBufferSize = 0; + + BYTE *pBuffer = NULL; + + hr = pSampleMemoryData->GetInfo(&nBufferSize, &pBuffer, NULL); + + if (FAILED(hr)) + { + pStreamSample->Release(); + pStreamSample = NULL; + + pSampleMemoryData->Release(); + pSampleMemoryData = NULL; + + break; + + } + + // + // read ISptream into memory buffer provided by the sample + // + + nBufferSize = min ( nBufferSize, cb - ulPos); + memcpy ( pBuffer, (BYTE *)(pbData+ ulPos), nBufferSize); + + ulPos += nBufferSize; + + // + // tell the sample how many useful bytes are in the sample's buffer + // + + hr = pSampleMemoryData->SetActual(nBufferSize); + + pSampleMemoryData->Release(); + pSampleMemoryData = NULL; + + if (FAILED(hr)) + { + pStreamSample->Release(); + pStreamSample = NULL; + break; + } + + + // + // we are done with the sample. now let media streaming terminal + // process it asynchronously. when the terminal is finished with + // the sample, this sample will be returned to us from the call + // to AllocateSample() + // + + hr = pStreamSample->Update(SSUPDATE_ASYNC, NULL, NULL, 0); + + // + // with some MSPs, starting the stream can be done asynchronously, so + // there may be a delay between the time when terminal is selected + // (or call connected) and the time when the stream becomes usable. + // + // attempting to use the stream before the stream is active would + // result in the Update() returning error VFW_E_NOT_COMMITTED. + // + // Usually an application would not start using the stream until + // it gets media event CME_STREAM_ACTIVE. This requires the app + // to register a callback interface by calling + // ITTAPI::RegisterCallNotifications. Refer to documentation and other + // samples for more details on how this is done. + // + + //Break the loop when we reach the end of the buffer or errors + if ( FAILED(hr) || ulPos == cb ) + { + pStreamSample->Release(); + pStreamSample = NULL; + + break; + } + + + // + // keep the sample we have just submitted. on exit, we will wait + // for it to be processed by mst + // + + if (!DestSampleQ.Enqueue(pStreamSample)) + { + break; + } + + } // IStream reading/sample-filling loop + + if ( SUCCEEDED ( hr ) ) + { + //There is no error here, so set the hr to S_OK in case that some engines + //stop calling Write() when hr is not S_OK. + hr = S_OK; + + // + // walk through the list of all the samples we have submitted and wait for + // each sample to be done + // + IStreamSample *pStreamSample = DestSampleQ.Dequeue(); + while (NULL != pStreamSample) + { + // ignore any error values + pStreamSample->CompletionStatus(COMPSTAT_WAIT, INFINITE); + pStreamSample->Release(); + pStreamSample = NULL; + + pStreamSample = DestSampleQ.Dequeue(); + } + if ( pStreamSample ) + { + pStreamSample->Release(); + pStreamSample = NULL; + } + } + + m_hCritSec.Unlock(); + return hr; +}; + +//////////////////////////////////////////////////////////////////////// +// Wait until the stream is active +// +HRESULT CTTSStream::WaitUntilReady( DWORD WaitTime) +{ + HRESULT hr = S_OK; + IStreamSample *pStreamSample = NULL; + + //only checks if the stream is active at the first time per connection + if ( !m_bFlag ) + { + return hr; + } + + hr = m_cpTTSMediaStream->AllocateSample(0, &pStreamSample); + + if ( SUCCEEDED ( hr ) ) + { + //0x80040211 is the error code of VFW_E_NOT_COMMITTED in DirectShow + //VFW_E_NOT_COMMITTED error means: + //"Cannot allocate a sample when the allocator is not active" + + DWORD dwStart = GetTickCount(); + do + { + hr = pStreamSample->Update(SSUPDATE_ASYNC, NULL, NULL, 0); + + }while ( (0x80040211 == hr) && ((GetTickCount() - dwStart) < WaitTime) ); + } + + if (pStreamSample) + { + pStreamSample->Release(); + pStreamSample = NULL; + } + + return hr; +} + +//////////////////////////////////////////////////////////////////////// +// This method is used by SAPI +// +STDMETHODIMP CTTSStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + // We only accept queries for the current stream position + if (STREAM_SEEK_CUR != dwOrigin || dlibMove.QuadPart) + { + return E_INVALIDARG; + } + + // Validate the OUT parameter + if (SPIsBadWritePtr(plibNewPosition, sizeof(ULARGE_INTEGER))) + { + return E_POINTER; + } + + m_hCritSec.Lock(); + + plibNewPosition->QuadPart = (LONG)dlibMove.LowPart; + + m_hCritSec.Unlock(); + + return S_OK; +} + +//////////////////////////////////////////////////////////////////////// +// This method is used by SAPI +// +STDMETHODIMP CTTSStream::GetFormat(GUID * pFmtId, WAVEFORMATEX ** ppCoMemWaveFormatEx) +{ + m_hCritSec.Lock(); + + HRESULT hr = S_OK; + + hr = m_StreamFormat.ParamValidateCopyTo( pFmtId, ppCoMemWaveFormatEx ); + + + m_hCritSec.Unlock(); + + return hr; +} diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.h b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.h new file mode 100644 index 00000000..2af49d58 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.h @@ -0,0 +1,114 @@ +// TTSStream.h : Declaration of the CTTSStream + +#ifndef __TTSSTREAM_H_ +#define __TTSSTREAM_H_ + +#include "resource.h" // main symbols +#include "sapi.h" + +#include +#include +#include "SAPI.h" +#include "sphelper.h" +#include +#include +#include +#include +#include +#include +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// CTTSStream +class ATL_NO_VTABLE CTTSStream : + public CComObjectRootEx, + public CComCoClass, + public ISpStreamFormat, + public IDispatchImpl +{ +public: + CTTSStream() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_TTSSTREAM) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CTTSStream) + COM_INTERFACE_ENTRY(ITTSStream) + COM_INTERFACE_ENTRY(IDispatch) + COM_INTERFACE_ENTRY(ISpStreamFormat) + COM_INTERFACE_ENTRY(IStream) +END_COM_MAP() + +// ITTSStream +public: + + STDMETHOD(InitTTSCaptureStream)(IUnknown *pCaptureTerminal); + STDMETHOD(WaitUntilReady)(DWORD WaitTime); + void FinalRelease(); + + + // + // IStream + // + + STDMETHODIMP Read(void * pv, ULONG cb, ULONG * pcbRead) + { + return STG_E_ACCESSDENIED; + } + STDMETHODIMP Write(const void * pv, ULONG cb, ULONG * pcbWritten); + STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition); + STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize) + { + return STG_E_ACCESSDENIED; + } + STDMETHODIMP CopyTo(IStream *pStreamDest, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) + { + return E_NOTIMPL; + } + STDMETHODIMP Commit(DWORD grfCommitFlags) + { + return E_NOTIMPL; + } + STDMETHODIMP Revert(void) + { + return E_NOTIMPL; + } + STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) + { + return E_NOTIMPL; + } + STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) + { + return E_NOTIMPL; + } + STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag) + { + return E_NOTIMPL; + } + STDMETHODIMP Clone(IStream ** ppstm) + { + return E_NOTIMPL; + } + // + // ISpStreamFormat + // + STDMETHODIMP GetFormat(GUID * pFormatId, WAVEFORMATEX ** ppCoMemWaveFormatEx); + + +public: + + CSpStreamFormat m_StreamFormat; + +private: + + CComAutoCriticalSection m_hCritSec; + CComPtr m_cpTTSMediaStream; + BOOL m_bFlag:1; + +}; + +#endif //__TTSSTREAM_H_ diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.rgs b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.rgs new file mode 100644 index 00000000..64380b41 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/TTSStream.rgs @@ -0,0 +1,26 @@ +HKCR +{ + STCustomStream.TTSStream.1 = s 'TTSStream Class' + { + CLSID = s '{B827D5CC-96FA-4A1E-9877-D54586D433F4}' + } + STCustomStream.TTSStream = s 'TTSStream Class' + { + CLSID = s '{B827D5CC-96FA-4A1E-9877-D54586D433F4}' + CurVer = s 'STCustomStream.TTSStream.1' + } + NoRemove CLSID + { + ForceRemove {B827D5CC-96FA-4A1E-9877-D54586D433F4} = s 'TTSStream Class' + { + ProgID = s 'STCustomStream.TTSStream.1' + VersionIndependentProgID = s 'STCustomStream.TTSStream' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{EDAEECD8-0D75-499E-9B69-187ACACF2C05}' + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/resource.h b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/resource.h new file mode 100644 index 00000000..1cec0f24 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/resource.h @@ -0,0 +1,18 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by STCustomStream.rc +// +#define IDS_PROJNAME 100 +#define IDR_ASRSTREAM 101 +#define IDR_TTSSTREAM 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 103 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/version.rc2 new file mode 100644 index 00000000..4d8225ab --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/TapiCustomStream/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Tapi custom audio stream sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "Tapi custom audio stream sample\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "STCustomStream.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5.x samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.bmp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.cpp new file mode 100644 index 00000000..3d3a3c7d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.cpp @@ -0,0 +1,345 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + CComPtr cpAudio; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set rules to active, we are now listening for commands + hr = g_cpCmdGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + break; + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + } + } + break; + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + return ( 1 ); + + } + return ( 0 ); +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.h new file mode 100644 index 00000000..99d66a5c --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.h @@ -0,0 +1,39 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); + + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.rc b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.rc new file mode 100644 index 00000000..c29ccc6e --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.rc @@ -0,0 +1,112 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.xml b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.xml new file mode 100644 index 00000000..f3549018 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffee.xml @@ -0,0 +1,26 @@ + + + + + + + + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + +

counter

+

shop

+

store

+
+
+ +
diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffees0.dsp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffees0.dsp new file mode 100644 index 00000000..53600ff9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/coffees0.dsp @@ -0,0 +1,194 @@ +# Microsoft Developer Studio Project File - Name="coffees0" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=coffees0 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "coffees0.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "coffees0.mak" CFG="coffees0 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "coffees0 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "coffees0 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "coffees0 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "coffees0 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "coffees0 - Win32 Debug x86" +# Name "coffees0 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.ICO +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "XML" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "coffees0 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "coffees0 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/common.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/common.h new file mode 100644 index 00000000..338ded59 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/common.h @@ -0,0 +1,22 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/display.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/display.cpp new file mode 100644 index 00000000..028d0fe7 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/display.cpp @@ -0,0 +1,249 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/resource.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/resource.h new file mode 100644 index 00000000..4b35bfef --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/resource.h @@ -0,0 +1,54 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_FAILEDINIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/small.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.cpp new file mode 100644 index 00000000..c2905d4e --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/version.rc2 new file mode 100644 index 00000000..bf912a5a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS0/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 0 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees0\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees0.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.bmp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.cpp new file mode 100644 index 00000000..062e8b6e --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.cpp @@ -0,0 +1,489 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + CComPtr cpAudio; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set rules to active, we are now listening for commands + hr = g_cpCmdGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + break; + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + } + } + break; + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + } + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + KillTimer( hWnd, 0 ); + return ( 1 ); + } + return ( 0 ); +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.h new file mode 100644 index 00000000..99d66a5c --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.h @@ -0,0 +1,39 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); + + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.rc b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.rc new file mode 100644 index 00000000..684f4e0f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.rc @@ -0,0 +1,119 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.xml b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.xml new file mode 100644 index 00000000..9c9406ea --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffee.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + +

counter

+

shop

+

store

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + +
diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffees1.dsp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffees1.dsp new file mode 100644 index 00000000..db4df998 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/coffees1.dsp @@ -0,0 +1,202 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS1" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS1 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS1.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS1.mak" CFG="CoffeeS1 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS1 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS1 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS1 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS1 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS1 - Win32 Debug x86" +# Name "CoffeeS1 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\Coffee.bmp +# End Source File +# Begin Source File + +SOURCE=.\coffee.ico +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS1 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS1 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# Begin Source File + +SOURCE=.\itckrist.ttf +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/common.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/common.h new file mode 100644 index 00000000..6e4ccee9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/common.h @@ -0,0 +1,29 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/display.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/display.cpp new file mode 100644 index 00000000..028d0fe7 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/display.cpp @@ -0,0 +1,249 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/resource.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/resource.h new file mode 100644 index 00000000..3b973e80 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/resource.h @@ -0,0 +1,54 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_FAILEDINIT 138 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/small.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/version.rc2 new file mode 100644 index 00000000..f1df95f7 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS1/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 1 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees1\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees1.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.bmp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.cpp new file mode 100644 index 00000000..66d53818 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.cpp @@ -0,0 +1,589 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + CComPtr cpAudio; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + break; + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + } + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd ); + return ( 1 ); + + case WM_INITPANE: + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } +} + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.h new file mode 100644 index 00000000..74e0fe44 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.h @@ -0,0 +1,42 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd ); + + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.rc b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.rc new file mode 100644 index 00000000..77ae5003 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.rc @@ -0,0 +1,122 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the SAPI coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.xml b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.xml new file mode 100644 index 00000000..03eed6f9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffee.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + +
diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffees2.dsp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffees2.dsp new file mode 100644 index 00000000..199f6840 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/coffees2.dsp @@ -0,0 +1,198 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS2" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS2 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS2.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS2.mak" CFG="CoffeeS2 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS2 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS2 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS2 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_x86" +# PROP Intermediate_Dir "Debug_x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS2 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_x86" +# PROP Intermediate_Dir "Release_x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS2 - Win32 Debug x86" +# Name "CoffeeS2 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\Coffee.bmp +# End Source File +# Begin Source File + +SOURCE=.\coffee.ico +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\small.ico +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS2 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS2 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/common.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/common.h new file mode 100644 index 00000000..786bca60 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/common.h @@ -0,0 +1,32 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/display.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/display.cpp new file mode 100644 index 00000000..469f8ca4 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/display.cpp @@ -0,0 +1,300 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/resource.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/resource.h new file mode 100644 index 00000000..5d5233af --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/resource.h @@ -0,0 +1,57 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_FAILEDINIT 141 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/small.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/version.rc2 new file mode 100644 index 00000000..086aafdd --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS2/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 2 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees2\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees2.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.bmp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.cpp new file mode 100644 index 00000000..19c91f29 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.cpp @@ -0,0 +1,631 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + // Let the entry pane know its time to do initialization work + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + CComPtr cpAudio; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + // Get the default voice associated with our reco context + hr = g_cpRecoCtxt->GetVoice(&g_cpVoice); + if ( FAILED( hr ) ) + { + break; + } + + break; + + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } + // Release voice, if created + if ( g_cpVoice ) + { + g_cpVoice.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_INITPANE: + { + TCHAR tBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + // Speak the welcome prompt, and do not wait for the operation to complete + g_cpVoice->Speak( T2W(tBuf), SPF_ASYNC, NULL); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Speak the order + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + + } + + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + // Speak the didn't understand string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd ); + return ( 1 ); + + case WM_INITPANE: + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.h new file mode 100644 index 00000000..712b14d6 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.h @@ -0,0 +1,43 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +CComPtr g_cpVoice; // Pointer to our tts voice +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd ); + + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.rc b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.rc new file mode 100644 index 00000000..77ae5003 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.rc @@ -0,0 +1,122 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the SAPI coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.xml b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.xml new file mode 100644 index 00000000..03eed6f9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffee.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + +
diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffees3.dsp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffees3.dsp new file mode 100644 index 00000000..98eead6f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/coffees3.dsp @@ -0,0 +1,194 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS3" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS3 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS3.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS3.mak" CFG="CoffeeS3 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS3 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS3 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS3 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS3 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS3 - Win32 Debug x86" +# Name "CoffeeS3 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.ICO +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS3 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS3 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/common.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/common.h new file mode 100644 index 00000000..786bca60 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/common.h @@ -0,0 +1,32 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/display.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/display.cpp new file mode 100644 index 00000000..469f8ca4 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/display.cpp @@ -0,0 +1,300 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/resource.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/resource.h new file mode 100644 index 00000000..5d5233af --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/resource.h @@ -0,0 +1,57 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_FAILEDINIT 141 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/small.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/version.rc2 new file mode 100644 index 00000000..ceebba85 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS3/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 3 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees3\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees3.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.bmp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.cpp new file mode 100644 index 00000000..32fec4ce --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.cpp @@ -0,0 +1,890 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + // Let the entry pane know its time to do initialization work + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + // Call the current pane's handler first + (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + // Get the default voice associated with our reco context + hr = g_cpRecoCtxt->GetVoice(&g_cpVoice); + if ( FAILED( hr ) ) + { + break; + } + + break; + + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } + // Release voice, if created + if ( g_cpVoice ) + { + g_cpVoice.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + + case VID_Manage: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Employees: + PostMessage( hWnd, WM_MANAGEEMPLOYEES, NULL, NULL ); + break; + } + } + break; + + case VID_HearTheVoice: + { + PostMessage( hWnd, WM_HEARTHEVOICE, NULL, NULL ); + } + break; + + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_INITPANE: + { + TCHAR tBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + // Speak the welcome prompt, and do not wait for the operation to complete + g_cpVoice->Speak( T2W(tBuf), SPF_ASYNC, NULL); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Speak the order + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + + } + + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + // Speak the didn't understand string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + HRESULT hr; + + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_MANAGEEMPLOYEES: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = ManageEmployeesPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd ); + return ( 1 ); + + case WM_INITPANE: + // Set management rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } +} + +/****************************************************************************** +* ManageEmployeesPaneProc * +*-------------------------* +* Description: +* Handles messages specifically for the manage employees pane. +* +******************************************************************************/ +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + static ULONG ulNumTokens; + static ULONG ulCurToken; + static WCHAR** ppszTokenIds; + static CSpDynamicString* ppcDesciptionString; // This is string helper class in sphelper.h + + switch ( message ) + { + case WM_GOTOOFFICE: + { + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + { + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + case WM_PAINT: + { + // Do the actual UI paint + ManageEmployeesPanePaint( hWnd, ulNumTokens, ppcDesciptionString, ulCurToken ); + return ( 1 ); + } + + case WM_INITPANE: + { + ISpObjectToken *pToken = NULL; // Token interface pointer + CComPtr cpEnum; // Pointer to token enumerator + ULONG ulIndex = 0; + ulCurToken = 0xffffffff; + + // Get a token enumerator for tts voices available + HRESULT hr = SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum); + if ( S_OK == hr ) + { + // Get the numbers of tokens found + hr = cpEnum->GetCount( &ulNumTokens ); + + if ( SUCCEEDED( hr ) && 0 != ulNumTokens ) + { + // Create arrays we need for storing data + ppcDesciptionString = new CSpDynamicString [ulNumTokens]; + if ( NULL == ppcDesciptionString ) + { + hr = E_OUTOFMEMORY; + break; + } + + ppszTokenIds = new WCHAR* [ulNumTokens]; + if ( NULL == ppszTokenIds ) + { + hr = E_OUTOFMEMORY; + break; + } + ZeroMemory( ppszTokenIds, ulNumTokens*sizeof( WCHAR* ) ); + + // Get the next token in the enumeration + // State is maintained in the enumerator + while (cpEnum->Next(1, &pToken, NULL) == S_OK) + { + // Get a string which describes the token, in our case, the voice name + hr = SpGetDescription( pToken, &ppcDesciptionString[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Get the token id, for a low overhead way to retrieve the token later + // without holding on to the object itself + hr = pToken->GetId( &ppszTokenIds[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + ulIndex++; + + // Release the token itself + pToken->Release(); + pToken = NULL; + } + } + + // if we've failed to properly initialize, then we should completely shut-down + if ( S_OK != hr ) + { + if ( pToken ) + { + pToken->Release(); + } + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + } + // Find out which token corresponds to our voice which is currently in use + else + { + WCHAR *pszCurTokenId = NULL; + + // Get the token representing the current voice + HRESULT hr = g_cpVoice->GetVoice( &pToken ); + if ( SUCCEEDED( hr ) ) + { + // Get the current token ID, and compare it against others to figure out + // which desciption string is the one currently selected. + hr = pToken->GetId( &pszCurTokenId ); + if ( SUCCEEDED( hr ) ) + { + ulIndex = 0; + while ( ulIndex < ulNumTokens && + 0 != _wcsicmp( pszCurTokenId, ppszTokenIds[ulIndex] ) ) + { + ulIndex++; + } + + // We found it, so set the current index to that of the current token + if ( ulIndex < ulNumTokens ) + { + ulCurToken = ulIndex; + } + + CoTaskMemFree( pszCurTokenId ); + } + + pToken->Release(); + + } + + } + + } + + // Set the hear voice rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + return ( 1 ); + } + + case WM_DESTROY: + // Windows is closing down, so we should cleanup + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + return ( 1 ); + + case WM_HEARTHEVOICE: + // Set the voice to play + LoadString( g_hInst, IDS_VOICESPEAK, g_szCounterDisplay, MAX_LOADSTRING ); + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL ); + } + return ( 0 ); +} + +/****************************************************************************** +* ManageEmployeesPaneCleanup * +*----------------------------* +* Description: +* Helper function to cleanup objects allocated while the ManageEmployees +* pane is running. +* +******************************************************************************/ +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens) +{ + ULONG ulIndex; + + // Free all allocated token ids + if ( ppszTokenIds ) + { + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + if ( NULL != ppszTokenIds[ulIndex] ) + { + CoTaskMemFree( ppszTokenIds[ulIndex] ); + } + } + + delete [] ppszTokenIds; + } + + if ( ppcDesciptionString ) + { + delete [] ppcDesciptionString; + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.h new file mode 100644 index 00000000..8e613441 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.h @@ -0,0 +1,48 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +CComPtr g_cpVoice; // Pointer to our tts voice +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd ); +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, + CSpDynamicString* ppcDesciptionString, ULONG ulCurToken); + + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.rc b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.rc new file mode 100644 index 00000000..ca610473 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.rc @@ -0,0 +1,132 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the SAPI coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_MANAGEEMPLOYEES "Manage the Employees" + IDS_EMPLOYEEDUTY "Employee On Duty:" + IDS_VOICESPEAK "I will be the best employee you've ever had. Let me work." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HEARTHEM "Hear Them Speak!" + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.xml b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.xml new file mode 100644 index 00000000..33219a3f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffee.xml @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + Please +

Manage

+ the + +
+ +

Hear Them Speak

+
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + + + +

employees

+
+
+
diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffees4.dsp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffees4.dsp new file mode 100644 index 00000000..86c95a6d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/coffees4.dsp @@ -0,0 +1,190 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS4" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS4 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS4.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS4.mak" CFG="CoffeeS4 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS4 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS4 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS4 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS4 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS4 - Win32 Debug x86" +# Name "CoffeeS4 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.ICO +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS4 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS4 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/common.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/common.h new file mode 100644 index 00000000..69055fbc --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/common.h @@ -0,0 +1,34 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define WM_MANAGEEMPLOYEES WM_USER+212 // Notification to go to employee management pane +#define WM_HEARTHEVOICE WM_USER+213 // The User wants to hear the selected employee speak +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/display.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/display.cpp new file mode 100644 index 00000000..ce12b4fa --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/display.cpp @@ -0,0 +1,408 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sphelper.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* ManageEmployeesPanePaint * +*---------------------------* +* Description: +* Do the paint on the manage employees pane. +* +******************************************************************************/ +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken) +{ + USES_CONVERSION; + + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 200; + LoadString( g_hInst, IDS_EMPLOYEEDUTY, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + if ( 8 < ulNumTokens ) + { + ulNumTokens = 8; + } + ULONG ulIndex = 0; + rc.bottom +=5; + while( ulIndex < ulNumTokens ) + { + TCHAR * pszTitle = W2T( ppcDesciptionString[ulIndex] ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, pszTitle, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != ulCurToken ) + { + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + + ulIndex++; + + } + + LoadString( g_hInst, IDS_HEARTHEM, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = ( clientRC.bottom - iHeight ) - 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/resource.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/resource.h new file mode 100644 index 00000000..8562daf3 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/resource.h @@ -0,0 +1,61 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_MANAGEEMPLOYEES 141 +#define IDS_EMPLOYEEDUTY 142 +#define IDS_VOICESPEAK 143 +#define IDS_HEARTHEM 144 +#define IDS_FAILEDINIT 145 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/small.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/version.rc2 new file mode 100644 index 00000000..4aedb696 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS4/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 4 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees4\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees4.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.bmp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.cpp new file mode 100644 index 00000000..c78194ec --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.cpp @@ -0,0 +1,1016 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include // Defines for dynamic grammars +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + // Let the entry pane know its time to do initialization work + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + // Call the current pane's handler first + (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + // Get the default voice associated with our reco context + hr = g_cpRecoCtxt->GetVoice(&g_cpVoice); + if ( FAILED( hr ) ) + { + break; + } + + break; + + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } + // Release voice, if created + if ( g_cpVoice ) + { + g_cpVoice.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd) +{ + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + + case VID_Manage: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Employees: + PostMessage( hWnd, WM_MANAGEEMPLOYEES, NULL, NULL ); + break; + } + } + break; + + case VID_HearTheVoice: + { + PostMessage( hWnd, WM_HEARTHEVOICE, NULL, NULL ); + } + break; + + case VID_OtherRules: + { + PostMessage( hWnd, WM_MISCCOMMAND, NULL, + (LPARAM) pElements->pProperties->vValue.ulVal ); + } + break; + + case DYN_TTSVOICERULE: + { + PostMessage( hWnd, WM_TTSVOICESEL, NULL, + (LPARAM) pElements->pProperties->vValue.ulVal ); + } + break; + + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_INITPANE: + { + TCHAR tBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + // Speak the welcome prompt, and do not wait for the operation to complete + g_cpVoice->Speak( T2W(tBuf), SPF_ASYNC, NULL); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Speak the order + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + + } + + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + // Speak the didn't understand string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + HRESULT hr; + + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_MANAGEEMPLOYEES: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = ManageEmployeesPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, 2 ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd ); + return ( 1 ); + + case WM_INITPANE: + // Set management rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } +} + +/****************************************************************************** +* ManageEmployeesPaneProc * +*-------------------------* +* Description: +* Handles messages specifically for the manage employees pane. +* +******************************************************************************/ +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + static ULONG ulNumTokens; + static ULONG ulCurToken; + static WCHAR** ppszTokenIds; + static CSpDynamicString* ppcDesciptionString; // This is string helper class in sphelper.h + static UINT iCurEnum; // Indicates if we should list males, females, or both + + switch ( message ) + { + case WM_GOTOOFFICE: + { + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + { + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + case WM_PAINT: + { + // Do the actual UI paint + ManageEmployeesPanePaint( hWnd, ulNumTokens, ppcDesciptionString, ulCurToken, iCurEnum ); + return ( 1 ); + } + + case WM_INITPANE: + { + ISpObjectToken *pToken = NULL; // Token interface pointer + CComPtr cpEnum; // Pointer to token enumerator + ULONG ulIndex = 0; + ulCurToken = 0xffffffff; + WCHAR *szRequiredAttributes = NULL; + SPSTATEHANDLE hDynamicRuleHandle; // Handle to our dynamic rule + + // Set the required attributes field for the enum if we have special needs + // based on our LPARAM in + if ( 0 == lParam ) + { + szRequiredAttributes = L"Gender=Male"; + } + else if ( 1 == lParam ) + { + szRequiredAttributes = L"Gender=Female"; + } + + // Get a token enumerator for tts voices available + HRESULT hr = SpEnumTokens(SPCAT_VOICES, szRequiredAttributes, NULL, &cpEnum); + if ( S_OK == hr ) + { + // Get the numbers of tokens found + hr = cpEnum->GetCount( &ulNumTokens ); + + if ( SUCCEEDED( hr ) && 0 != ulNumTokens ) + { + // Create arrays we need for storing data + ppcDesciptionString = new CSpDynamicString [ulNumTokens]; + if ( NULL == ppcDesciptionString ) + { + hr = E_OUTOFMEMORY; + break; + } + + ppszTokenIds = new WCHAR* [ulNumTokens]; + if ( NULL == ppszTokenIds ) + { + hr = E_OUTOFMEMORY; + break; + } + ZeroMemory( ppszTokenIds, ulNumTokens*sizeof( WCHAR* ) ); + + // Get the next token in the enumeration + // State is maintained in the enumerator + while (cpEnum->Next(1, &pToken, NULL) == S_OK) + { + // Get a string which describes the token, in our case, the voice name + hr = SpGetDescription( pToken, &ppcDesciptionString[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Get the token id, for a low overhead way to retrieve the token later + // without holding on to the object itself + hr = pToken->GetId( &ppszTokenIds[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + ulIndex++; + + // Release the token itself + pToken->Release(); + pToken = NULL; + } + } + + // if we've failed to properly initialize, then we should completely shut-down + if ( S_OK != hr ) + { + if ( pToken ) + { + pToken->Release(); + } + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + } + // Find out which token corresponds to our voice which is currently in use + else + { + WCHAR *pszCurTokenId = NULL; + + // Get the token representing the current voice + HRESULT hr = g_cpVoice->GetVoice( &pToken ); + if ( SUCCEEDED( hr ) ) + { + // Get the current token ID, and compare it against others to figure out + // which desciption string is the one currently selected. + hr = pToken->GetId( &pszCurTokenId ); + if ( SUCCEEDED( hr ) ) + { + ulIndex = 0; + while ( ulIndex < ulNumTokens && + 0 != _wcsicmp( pszCurTokenId, ppszTokenIds[ulIndex] ) ) + { + ulIndex++; + } + + // We found it, so set the current index to that of the current token + if ( ulIndex < ulNumTokens ) + { + ulCurToken = ulIndex; + } + + CoTaskMemFree( pszCurTokenId ); + } + + pToken->Release(); + + } + + } + + } + + // Initially, we see both genders + _ASSERTE( lParam >= 0 && lParam <= 2); + iCurEnum = lParam; + + // Create a dynamic rule containing the description strings of the voice tokens + hr = g_cpCmdGrammar->GetRule(NULL, DYN_TTSVOICERULE, SPRAF_TopLevel | SPRAF_Active | SPRAF_Dynamic, TRUE, &hDynamicRuleHandle); + if ( SUCCEEDED( hr ) ) + { + // Clear the rule first + hr = g_cpCmdGrammar->ClearRule( hDynamicRuleHandle ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Commit the changes + hr = g_cpCmdGrammar->Commit(0); + _ASSERTE( SUCCEEDED( hr ) ); + + // Add description names as the word, ulIndex as id + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + SPPROPERTYINFO prop; + prop.pszName = L"Id"; + prop.pszValue = L"Property"; + prop.vValue.vt = VT_I4; + prop.vValue.ulVal = ulIndex; + hr = g_cpCmdGrammar->AddWordTransition( hDynamicRuleHandle, NULL, ppcDesciptionString[ulIndex], L" ", + SPWT_LEXICAL, 1.0, &prop); + _ASSERTE( SUCCEEDED( hr ) ); + } + + // Commit the changes + hr = g_cpCmdGrammar->Commit(0); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the dynamic rules to active + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + } + + // Set the hear voice rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_DESTROY: + // Windows is closing down, so we should cleanup + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + return ( 1 ); + + case WM_HEARTHEVOICE: + // Set the voice to play + LoadString( g_hInst, IDS_VOICESPEAK, g_szCounterDisplay, MAX_LOADSTRING ); + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL ); + return ( 1 ); + + case WM_MISCCOMMAND: + { + // Find out the offset from the first property we're interested in, so we can verify that + // it's within range. + int iSelection = lParam - VID_MalesOnly; + if ( 0 <= iSelection && 2 >= iSelection ) + { + // If we have a new listing criteria, we basically shutdown the pane and start it again + if ( (UINT) iSelection != iCurEnum ) + { + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + PostMessage( hWnd, WM_INITPANE, 0, (LPARAM) iSelection ); + } + } + return ( 1 ); + } + + case WM_TTSVOICESEL: + { + // If we are out of range, it is a programming error + _ASSERTE( 0 <= lParam && ulNumTokens > (ULONG) lParam ); + + // The returned Id is an index into our tokenId table, so create a token from the id + CComPtr< ISpObjectToken > pToken; + HRESULT hr = SpGetTokenFromId( ppszTokenIds[lParam], &pToken, FALSE); + if ( SUCCEEDED( hr ) ) + { + // Set our current voice from the returned token + hr = g_cpVoice->SetVoice( pToken ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Change our current voice index + ulCurToken = lParam; + } + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + } + return ( 0 ); +} + +/****************************************************************************** +* ManageEmployeesPaneCleanup * +*----------------------------* +* Description: +* Helper function to cleanup objects allocated while the ManageEmployees +* pane is running. +* +******************************************************************************/ +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens) +{ + ULONG ulIndex; + + // Free all allocated token ids + if ( ppszTokenIds ) + { + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + if ( NULL != ppszTokenIds[ulIndex] ) + { + CoTaskMemFree( ppszTokenIds[ulIndex] ); + } + } + + delete [] ppszTokenIds; + } + + if ( ppcDesciptionString ) + { + delete [] ppcDesciptionString; + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.h new file mode 100644 index 00000000..c6d09e13 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.h @@ -0,0 +1,48 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +CComPtr g_cpVoice; // Pointer to our tts voice +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpPhrase *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens); + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd ); +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken, UINT iEnumType ); + + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.rc b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.rc new file mode 100644 index 00000000..88a22081 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.rc @@ -0,0 +1,136 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the SAPI coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the SAPI coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_MANAGEEMPLOYEES "Manage the Employees" + IDS_EMPLOYEEDUTY "Employee On Duty:" + IDS_VOICESPEAK "I will be the best employee you've ever had. Let me work." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HEARTHEM "Hear Them Speak!" + IDS_SHOW "Show:" + IDS_MALESONLY "Males Only" + IDS_FEMALESONLY "Females Only" + IDS_BOTHGENDERS "Both Genders" + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.xml b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.xml new file mode 100644 index 00000000..89a39974 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffee.xml @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+
+
+ a +

+ +

+ please +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + Please +

Manage

+ the + +
+ +

Hear Them Speak

+
+ + +

?Show Males Only

+

?Show Females Only

+

?Show Both Genders

+
+
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + + + +

employees

+
+
+
diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffees5.dsp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffees5.dsp new file mode 100644 index 00000000..b58f58db --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/coffees5.dsp @@ -0,0 +1,178 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS5" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS5 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS5.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS5.mak" CFG="CoffeeS5 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS5 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS5 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS5 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS5 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS5 - Win32 Debug x86" +# Name "CoffeeS5 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "Xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS5 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\Coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS5 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/common.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/common.h new file mode 100644 index 00000000..41fa0e5f --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/common.h @@ -0,0 +1,37 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Normal size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define WM_MANAGEEMPLOYEES WM_USER+212 // Notification to go to employee management pane +#define WM_HEARTHEVOICE WM_USER+213 // The User wants to hear the selected employee speak +#define WM_MISCCOMMAND WM_USER+214 // Notification that something described under "other commands" was recognized +#define WM_TTSVOICESEL WM_USER+215 // Notification that the user selected a voice +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order +#define DYN_TTSVOICERULE 1001 // ID for the dynamic tts voice rule + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/display.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/display.cpp new file mode 100644 index 00000000..938bc669 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/display.cpp @@ -0,0 +1,442 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sphelper.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + LoadString( g_hInst, IDS_WELCOME, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* ManageEmployeesPanePaint * +*---------------------------* +* Description: +* Do the paint on the manage employees pane. +* +******************************************************************************/ +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken, UINT iEnumType ) +{ + USES_CONVERSION; + + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 200; + LoadString( g_hInst, IDS_EMPLOYEEDUTY, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + if ( 8 < ulNumTokens ) + { + ulNumTokens = 8; + } + ULONG ulIndex = 0; + rc.bottom +=5; + while( ulIndex < ulNumTokens ) + { + TCHAR * pszTitle = W2T( ppcDesciptionString[ulIndex] ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, pszTitle, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != ulCurToken ) + { + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + + ulIndex++; + + } + + LoadString( g_hInst, IDS_HEARTHEM, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = ( clientRC.bottom - iHeight ) - 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_SHOW, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 50; + rc.right += 50; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.bottom +=5; + for ( ulIndex = 0; ulIndex < 3; ulIndex++ ) + { + LoadString( g_hInst, IDS_MALESONLY+ulIndex, tBuf, MAX_LOADSTRING ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 75; + rc.right += 75; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != iEnumType ) + { + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + } + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/resource.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/resource.h new file mode 100644 index 00000000..ebc0567c --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/resource.h @@ -0,0 +1,65 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_MANAGEEMPLOYEES 141 +#define IDS_EMPLOYEEDUTY 142 +#define IDS_VOICESPEAK 143 +#define IDS_HEARTHEM 144 +#define IDS_SHOW 145 +#define IDS_MALESONLY 146 +#define IDS_FEMALESONLY 147 +#define IDS_BOTHGENDERS 148 +#define IDS_FAILEDINIT 149 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 133 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/small.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.h new file mode 100644 index 00000000..de48b460 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/stdafx.h @@ -0,0 +1,31 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/version.rc2 new file mode 100644 index 00000000..74efacb5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS5/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 5 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees5\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees5.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.bmp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.bmp new file mode 100644 index 00000000..0f5d5ced Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.bmp differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.cpp new file mode 100644 index 00000000..0656a4f2 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.cpp @@ -0,0 +1,1162 @@ +/****************************************************************************** +* coffee.cpp +* Contains entry point for the coffee tutorial application, as +* well as implementation of all application features. +* +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +* The source code supplied here is intended as a sample, so some +* error handling, etc. has been omitted for the sake of clarity. +******************************************************************************/ +#include "stdafx.h" +#include // Contains definitions of SAPI functions +#include // Contains definitions +#include "common.h" // Contains common defines +#include "coffee.h" // Forward declarations and constants +#include "cofgram.h" // This header is created by the grammar + // compiler and has our rule ids + +/****************************************************************************** +* WinMain * +*---------* +* Description: +* coffee entry point. +* +* Return: +* exit code +******************************************************************************/ +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + MSG msg; + + // Register the main window class + MyRegisterClass(hInstance, WndProc); + + // Initialize pane handler state + g_fpCurrentPane = EntryPaneProc; + + // Only continue if COM is successfully initialized + if ( SUCCEEDED( CoInitialize( NULL ) ) ) + { + // Perform application initialization: + if (!InitInstance( hInstance, nCmdShow )) + { + return FALSE; + } + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + CoUninitialize(); + } + + return msg.wParam; +} + +/****************************************************************************** +* WndProc * +*---------* +* Description: +* Main window procedure. +* +******************************************************************************/ +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) + { + case WM_CREATE: + // Try to initialize, quit with error message if we can't + if ( FAILED( InitSAPI( hWnd ) ) ) + { + const iMaxTitleLength = 64; + TCHAR tszBuf[ MAX_PATH ]; + LoadString( g_hInst, IDS_FAILEDINIT, tszBuf, MAX_PATH ); + TCHAR tszName[ iMaxTitleLength ]; + LoadString( g_hInst, IDS_APP_TITLE, tszName, iMaxTitleLength ); + + MessageBox( hWnd, tszBuf, tszName, MB_OK|MB_ICONWARNING ); + return( -1 ); + } + // Initialize shop name string + TCHAR tLoadBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_SHOPNAME, g_szShopName, NORMAL_LOADSTRING ); + LoadString( g_hInst, IDS_WELCOME, tLoadBuf, MAX_LOADSTRING ); + _stprintf( g_szCounterDisplay, tLoadBuf, g_szShopName ); + + // Let the entry pane know its time to do initialization work + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + break; + + // This is our application defined window message to let us know that a + // speech recognition event has occurred. + case WM_RECOEVENT: + ProcessRecoEvent( hWnd ); + break; + + case WM_ERASEBKGND: + EraseBackground( (HDC) wParam ); + return ( 1 ); + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMM = (LPMINMAXINFO) lParam; + + lpMM->ptMaxSize.x = MINMAX_WIDTH; + lpMM->ptMaxSize.y = MINMAX_HEIGHT; + lpMM->ptMinTrackSize.x = MINMAX_WIDTH; + lpMM->ptMinTrackSize.y = MINMAX_HEIGHT; + lpMM->ptMaxTrackSize.x = MINMAX_WIDTH; + lpMM->ptMaxTrackSize.y = MINMAX_HEIGHT; + return ( 0 ); + } + + // Release remaining SAPI related COM references before application exits + case WM_DESTROY: + // Call the current pane's handler first + (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + + KillTimer( hWnd, 0 ); + CleanupGDIObjects(); + CleanupSAPI(); + PostQuitMessage(0); + break; + + default: + { + _ASSERTE( g_fpCurrentPane ); + // Send unhandled messages to pane specific procedure for potential action + LRESULT lRet = (*g_fpCurrentPane)(hWnd, message, wParam, lParam); + if ( 0 == lRet ) + { + lRet = DefWindowProc(hWnd, message, wParam, lParam); + } + return ( lRet ); + } + } + return ( 0 ); +} + +/****************************************************************************** +* InitSAPI * +*----------* +* Description: +* Called once to get SAPI started. +* +******************************************************************************/ +HRESULT InitSAPI( HWND hWnd ) +{ + HRESULT hr = S_OK; + + while ( 1 ) + { + // create a recognition engine + hr = g_cpEngine.CoCreateInstance(CLSID_SpSharedRecognizer); + if ( FAILED( hr ) ) + { + break; + } + + // create the command recognition context + hr = g_cpEngine->CreateRecoContext( &g_cpRecoCtxt ); + if ( FAILED( hr ) ) + { + break; + } + + // Let SR know that window we want it to send event information to, and using + // what message + hr = g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ); + if ( FAILED( hr ) ) + { + break; + } + + // Tell SR what types of events interest us. Here we only care about command + // recognition. + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) ); + if ( FAILED( hr ) ) + { + break; + } + + // Load our grammar, which is the compiled form of simple.xml bound into this executable as a + // user defined ("SRGRAMMAR") resource type. + hr = g_cpRecoCtxt->CreateGrammar(GRAMMARID1, &g_cpCmdGrammar); + if (FAILED(hr)) + { + break; + } + hr = g_cpCmdGrammar->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(IDR_CMD_CFG), + L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + SPLO_DYNAMIC); + if ( FAILED( hr ) ) + { + break; + } + + // Set navigation rule to active, espresso order rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + hr = g_cpCmdGrammar->SetRuleIdState( VID_Navigation, SPRS_ACTIVE ); + if ( FAILED( hr ) ) + { + break; + } + + // Get the default voice associated with our reco context + hr = g_cpRecoCtxt->GetVoice(&g_cpVoice); + if ( FAILED( hr ) ) + { + break; + } + + break; + + } + + // if we failed and have a partially setup SAPI, close it all down + if ( FAILED( hr ) ) + { + CleanupSAPI(); + } + + return ( hr ); +} + +/****************************************************************************** +* CleanupSAPI * +*----------------* +* Description: +* Called to close down SAPI COM objects we have stored away. +* +******************************************************************************/ +void CleanupSAPI( void ) +{ + // Release grammar, if loaded + if ( g_cpCmdGrammar ) + { + g_cpCmdGrammar.Release(); + } + // Release recognition context, if created + if ( g_cpRecoCtxt ) + { + g_cpRecoCtxt->SetNotifySink(NULL); + g_cpRecoCtxt.Release(); + } + // Release recognition engine instance, if created + if ( g_cpEngine ) + { + g_cpEngine.Release(); + } + // Release voice, if created + if ( g_cpVoice ) + { + g_cpVoice.Release(); + } +} + +/****************************************************************************** +* ProcessRecoEvent * +*------------------* +* Description: +* Called to when reco event message is sent to main window procedure. +* In the case of a recognition, it extracts result and calls ExecuteCommand. +* +******************************************************************************/ +void ProcessRecoEvent( HWND hWnd ) +{ + CSpEvent event; // Event helper class + + // Loop processing events while there are any in the queue + while (event.GetFrom(g_cpRecoCtxt) == S_OK) + { + // Look at recognition event only + switch (event.eEventId) + { + case SPEI_RECOGNITION: + ExecuteCommand(event.RecoResult(), hWnd); + break; + case SPEI_FALSE_RECOGNITION: + HandleFalseReco(event.RecoResult(), hWnd); + break; + + } + } +} + +/****************************************************************************** +* ExecuteCommand * +*----------------* +* Description: +* Called to Execute commands that have been identified by the speech engine. +* +******************************************************************************/ +void ExecuteCommand(ISpRecoResult *pPhrase, HWND hWnd) +{ + USES_CONVERSION; + + SPPHRASE *pElements; + + // Get the phrase elements, one of which is the rule id we specified in + // the grammar. Switch on it to figure out which command was recognized. + if (SUCCEEDED(pPhrase->GetPhrase(&pElements))) + { + switch ( pElements->Rule.ulId ) + { + case VID_EspressoDrinks: + { + ID_TEXT *pulIds = new ID_TEXT[MAX_ID_ARRAY]; // This memory will be freed when the WM_ESPRESSOORDER + // message is processed + const SPPHRASEPROPERTY *pProp = NULL; + const SPPHRASERULE *pRule = NULL; + ULONG ulFirstElement, ulCountOfElements; + int iCnt = 0; + + if ( pulIds ) + { + ZeroMemory( pulIds, sizeof( ID_TEXT[MAX_ID_ARRAY] ) ); + pProp = pElements->pProperties; + pRule = pElements->Rule.pFirstChild; + // Fill in an array with the drink properties received + while ( pProp && iCnt < MAX_ID_ARRAY ) + { + // Fill out a structure with all the property ids received as well + // as their corresponding text + pulIds[iCnt].ulId = static_cast< ULONG >(pProp->pFirstChild->vValue.ulVal); + // Get the count of elements from the rule ref, not the actual leaf + // property + if ( pRule ) + { + ulFirstElement = pRule->ulFirstElement; + ulCountOfElements = pRule->ulCountOfElements; + } + else + { + ulFirstElement = 0; + ulCountOfElements = 0; + } + // This is the text corresponding to property iCnt - it must be + // released when we are done with it + pPhrase->GetText( ulFirstElement, ulCountOfElements, + FALSE, &(pulIds[iCnt].pwstrCoMemText), NULL); + // Loop through all properties + pProp = pProp->pNextSibling; + // Loop through rulerefs corresponding to properties + if ( pRule ) + { + pRule = pRule->pNextSibling; + } + iCnt++; + } + PostMessage( hWnd, WM_ESPRESSOORDER, NULL, (LPARAM) pulIds ); + } + } + break; + + case VID_Navigation: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Counter: + PostMessage( hWnd, WM_GOTOCOUNTER, NULL, NULL ); + break; + case VID_Office: + PostMessage( hWnd, WM_GOTOOFFICE, NULL, NULL ); + break; + } + } + break; + + case VID_Manage: + { + switch( pElements->pProperties->vValue.ulVal ) + { + case VID_Employees: + PostMessage( hWnd, WM_MANAGEEMPLOYEES, NULL, NULL ); + break; + + case VID_ShopName: + PostMessage( hWnd, WM_MANAGENAME, NULL, NULL ); + break; + } + } + break; + + case VID_HearTheVoice: + { + PostMessage( hWnd, WM_HEARTHEVOICE, NULL, NULL ); + } + break; + + case VID_OtherRules: + { + PostMessage( hWnd, WM_MISCCOMMAND, NULL, + (LPARAM) pElements->pProperties->vValue.ulVal ); + } + break; + + case DYN_TTSVOICERULE: + { + PostMessage( hWnd, WM_TTSVOICESEL, NULL, + (LPARAM) pElements->pProperties->vValue.ulVal ); + } + break; + + case VID_Rename: + { + WCHAR *wszCoMemNameText = NULL; + WCHAR *wszCoMemValueText = NULL; + + // Figure out where dictation starts and get that text + // Since we know how many words are in our rule ( 5 ) we can get the text + // after them, which will be the dictation. + if ( 5 <= pElements->Rule.ulCountOfElements ) + { + if ( SUCCEEDED( pPhrase->GetText( 5, pElements->Rule.ulCountOfElements - 5, FALSE, + &wszCoMemNameText, NULL ) ) ) + { + int ilen = wcslen( pElements->pProperties->pszName ); + ilen = (ilen + wcslen( wszCoMemNameText ) + 2) * sizeof(WCHAR); + wszCoMemValueText = (WCHAR *) CoTaskMemAlloc( ilen ); + if ( wszCoMemValueText ) + { + wcscpy( wszCoMemValueText, pElements->pProperties->pszName ); + wcscat( wszCoMemValueText, L" " ); + wcscat( wszCoMemValueText, wszCoMemNameText ); + + // Copy new shop name to global shop name + _tcsncpy( g_szShopName, W2T(wszCoMemNameText), NORMAL_LOADSTRING - 1 ); + PostMessage( hWnd, WM_RENAMEWINDOW, 0, (LPARAM) wszCoMemValueText ); + + CoTaskMemFree( wszCoMemNameText ); + } + } + } + } + break; + + } + // Free the pElements memory which was allocated for us + ::CoTaskMemFree(pElements); + } + +} + +/****************************************************************************** +* EntryPaneProc * +*---------------* +* Description: +* Handles messages specifically for the entry pane. +* +******************************************************************************/ +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + switch ( message ) + { + case WM_INITPANE: + { + TCHAR tLoadBuf[MAX_LOADSTRING]; + + LoadString( g_hInst, IDS_WELCOME, tLoadBuf, MAX_LOADSTRING ); + _stprintf( g_szCounterDisplay, tLoadBuf, g_szShopName ); + + // Speak the welcome prompt, and do not wait for the operation to complete + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_GOTOOFFICE: + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + EntryPanePaint( hWnd, g_szShopName ); + return ( 1 ); + } + return ( 0 ); + +} + +/****************************************************************************** +* CounterPaneProc * +*-----------------* +* Description: +* Handles messages specifically for the counter (order) pane. +* +******************************************************************************/ +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + HRESULT hr; + + switch ( message ) + { + case WM_ESPRESSOORDER: + { + _ASSERTE( lParam ); + KillTimer( hWnd, 0 ); + ID_TEXT *pulIds = (ID_TEXT *) lParam; + int i = 0, ilen = 0; + TCHAR szTempBuf[NORMAL_LOADSTRING]; + TCHAR szSpace[] = _T(" "); + int iTemplen; + + g_szCounterDisplay[0] = '\0'; + + // Sort the array + while ( 0 != pulIds[i].ulId ) + { + i++; + } + for ( int j = 0; j < i; j++ ) + { + int iminIndex = j; + for ( int k = j; k < i; k++ ) + { + if ( pulIds[iminIndex].ulId > pulIds[k].ulId ) + { + iminIndex = k; + } + } + ULONG ulId = pulIds[iminIndex].ulId; + WCHAR *pwstr = pulIds[iminIndex].pwstrCoMemText; + pulIds[iminIndex].pwstrCoMemText = pulIds[j].pwstrCoMemText; + pulIds[j].pwstrCoMemText = pwstr; + pulIds[iminIndex].ulId = pulIds[j].ulId; + pulIds[j].ulId = ulId; + } + + i = 0; + // Put in the first order words if we actually have an order + if ( 0 != pulIds[0].ulId ) + { + iTemplen = LoadString( g_hInst, IDS_ORDERBEGIN, szTempBuf, NORMAL_LOADSTRING ); + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + TCHAR *pTempStr = W2T( pulIds[i].pwstrCoMemText ); + + iTemplen = lstrlen( pTempStr ); + // We'll quit now so we dont overrun the buffer + if ( ilen + iTemplen >= MAX_LOADSTRING ) + { + break; + } + if ( i > 0 ) + { + lstrcat( g_szCounterDisplay + ilen, szSpace ); + ilen += 1; + } + lstrcat( g_szCounterDisplay, pTempStr ); + ilen += iTemplen; + i++; + } + // Put the thank you on this order + if ( 0 < i ) + { + iTemplen = LoadString( g_hInst, IDS_ORDEREND, szTempBuf, NORMAL_LOADSTRING ); + if ( ilen + iTemplen < MAX_LOADSTRING ) + { + lstrcat( g_szCounterDisplay + ilen, szTempBuf ); + ilen += iTemplen; + } + } + + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + + // Speak the order + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + // Delete the CoTaskMem we were given initially by ISpPhrase->GetText + i = 0; + while ( i < MAX_ID_ARRAY && 0 != pulIds[i].ulId ) + { + CoTaskMemFree( pulIds[i].pwstrCoMemText ); + i++; + } + delete [] pulIds; + return ( 1 ); + + } + + case WM_PAINT: + CounterPanePaint( hWnd, g_szCounterDisplay ); + return ( 1 ); + + case WM_INITPANE: + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + // Set the rule recognizing an espresso order to active, now that we are ready for it + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_ACTIVE ); + + // Set our interests to include false recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_RECOGNITION)|SPFEI(SPEI_FALSE_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + return ( 1 ); + + case WM_TIMER: + // Revert back to 'go ahead and order' message + LoadString( g_hInst, IDS_PLEASEORDER, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + // Speak the welcome string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + + KillTimer( hWnd, 0 ); + return ( 1 ); + + case WM_GOTOOFFICE: + KillTimer( hWnd, 0 ); + // Set the rule recognizing an espresso order to inactive + // since you cant order from the office + g_cpCmdGrammar->SetRuleIdState( VID_EspressoDrinks, SPRS_INACTIVE ); + + // Set our interests to include only recognitions + hr = g_cpRecoCtxt->SetInterest( SPFEI(SPEI_RECOGNITION),SPFEI(SPEI_RECOGNITION) ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_DIDNTUNDERSTAND: + KillTimer( hWnd, 0 ); + LoadString( g_hInst, IDS_DIDNTUNDERSTAND, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + // Speak the didn't understand string + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC, NULL); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* OfficePaneProc * +*---------------* +* Description: +* Handles messages specifically for the office pane. +* +******************************************************************************/ +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + HRESULT hr; + + switch ( message ) + { + case WM_GOTOCOUNTER: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_MANAGEEMPLOYEES: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = ManageEmployeesPaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, 2 ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_MANAGENAME: + // Set management rule to inactive + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + g_fpCurrentPane = ChangeNamePaneProc; + PostMessage( hWnd, WM_INITPANE, NULL, 0 ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + + case WM_PAINT: + OfficePanePaint( hWnd, g_szShopName); + return ( 1 ); + + case WM_INITPANE: + // Set management rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_Manage, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + return ( 1 ); + + } + return ( 0 ); +} + +/****************************************************************************** +* HandleFalseReco * +*----------------* +* Description: +* Called to respond to false recognition events. +* +******************************************************************************/ +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd) +{ + SPRECORESULTTIMES resultTimes; + + // Some panes only want to know about this if a significant amount of time has passed + if (SUCCEEDED( pRecoResult->GetResultTimes( &resultTimes ) ) ) + { + if ( GetTickCount() - resultTimes.dwTickCount > MIN_ORDER_INTERVAL ) + { + PostMessage( hWnd, WM_DIDNTUNDERSTAND, 0, 0); + } + } + PostMessage( hWnd, WM_FALSERECO, 0, 0 ); +} + +/****************************************************************************** +* ManageEmployeesPaneProc * +*-------------------------* +* Description: +* Handles messages specifically for the manage employees pane. +* +******************************************************************************/ +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + static ULONG ulNumTokens; + static ULONG ulCurToken; + static WCHAR** ppszTokenIds; + static CSpDynamicString* ppcDesciptionString; // This is string helper class in sphelper.h + static UINT iCurEnum; // Indicates if we should list males, females, or both + + switch ( message ) + { + case WM_GOTOOFFICE: + { + // Set the right message handler and repaint + g_fpCurrentPane = OfficePaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_GOTOCOUNTER: + { + // Set the right message handler and repaint + g_fpCurrentPane = CounterPaneProc; + //Cleanup our variables + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + + // Set the hear voice rule to inactive + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + PostMessage( hWnd, WM_INITPANE, NULL, NULL ); + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + case WM_PAINT: + { + // Do the actual UI paint + ManageEmployeesPanePaint( hWnd, ulNumTokens, ppcDesciptionString, ulCurToken, iCurEnum ); + return ( 1 ); + } + + case WM_INITPANE: + { + ISpObjectToken *pToken = NULL; // Token interface pointer + CComPtr cpEnum; // Pointer to token enumerator + ULONG ulIndex = 0; + ulCurToken = 0xffffffff; + WCHAR *szRequiredAttributes = NULL; + SPSTATEHANDLE hDynamicRuleHandle; // Handle to our dynamic rule + + // Set the required attributes field for the enum if we have special needs + // based on our LPARAM in + if ( 0 == lParam ) + { + szRequiredAttributes = L"Gender=Male"; + } + else if ( 1 == lParam ) + { + szRequiredAttributes = L"Gender=Female"; + } + + // Get a token enumerator for tts voices available + HRESULT hr = SpEnumTokens(SPCAT_VOICES, szRequiredAttributes, NULL, &cpEnum); + if ( S_OK == hr ) + { + // Get the numbers of tokens found + hr = cpEnum->GetCount( &ulNumTokens ); + + if ( SUCCEEDED( hr ) && 0 != ulNumTokens ) + { + // Create arrays we need for storing data + ppcDesciptionString = new CSpDynamicString [ulNumTokens]; + if ( NULL == ppcDesciptionString ) + { + hr = E_OUTOFMEMORY; + break; + } + + ppszTokenIds = new WCHAR* [ulNumTokens]; + if ( NULL == ppszTokenIds ) + { + hr = E_OUTOFMEMORY; + break; + } + ZeroMemory( ppszTokenIds, ulNumTokens*sizeof( WCHAR* ) ); + + // Get the next token in the enumeration + // State is maintained in the enumerator + while (cpEnum->Next(1, &pToken, NULL) == S_OK) + { + // Get a string which describes the token, in our case, the voice name + hr = SpGetDescription( pToken, &ppcDesciptionString[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Get the token id, for a low overhead way to retrieve the token later + // without holding on to the object itself + hr = pToken->GetId( &ppszTokenIds[ulIndex] ); + _ASSERTE( SUCCEEDED( hr ) ); + + ulIndex++; + + // Release the token itself + pToken->Release(); + pToken = NULL; + } + } + + // if we've failed to properly initialize, then we should completely shut-down + if ( S_OK != hr ) + { + if ( pToken ) + { + pToken->Release(); + } + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + ppszTokenIds = NULL; + ppcDesciptionString = NULL; + ulNumTokens = 0; + } + // Find out which token corresponds to our voice which is currently in use + else + { + WCHAR *pszCurTokenId = NULL; + + // Get the token representing the current voice + HRESULT hr = g_cpVoice->GetVoice( &pToken ); + if ( SUCCEEDED( hr ) ) + { + // Get the current token ID, and compare it against others to figure out + // which desciption string is the one currently selected. + hr = pToken->GetId( &pszCurTokenId ); + if ( SUCCEEDED( hr ) ) + { + ulIndex = 0; + while ( ulIndex < ulNumTokens && + 0 != _wcsicmp( pszCurTokenId, ppszTokenIds[ulIndex] ) ) + { + ulIndex++; + } + + // We found it, so set the current index to that of the current token + if ( ulIndex < ulNumTokens ) + { + ulCurToken = ulIndex; + } + + CoTaskMemFree( pszCurTokenId ); + } + + pToken->Release(); + + } + + } + + } + + // Initially, we see both genders + _ASSERTE( lParam >= 0 && lParam <= 2); + iCurEnum = lParam; + + // Create a dynamic rule containing the description strings of the voice tokens + hr = g_cpCmdGrammar->GetRule(NULL, DYN_TTSVOICERULE, SPRAF_TopLevel | SPRAF_Active | SPRAF_Dynamic, TRUE, &hDynamicRuleHandle); + if ( SUCCEEDED( hr ) ) + { + // Clear the rule first + hr = g_cpCmdGrammar->ClearRule( hDynamicRuleHandle ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Commit the changes + hr = g_cpCmdGrammar->Commit(0); + _ASSERTE( SUCCEEDED( hr ) ); + + // Add description names as the word, ulIndex as id + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + SPPROPERTYINFO prop; + prop.pszName = L"Id"; + prop.pszValue = L"Property"; + prop.vValue.vt = VT_I4; + prop.vValue.ulVal = ulIndex; + hr = g_cpCmdGrammar->AddWordTransition( hDynamicRuleHandle, NULL, ppcDesciptionString[ulIndex], L" ", + SPWT_LEXICAL, 1.0, &prop); + _ASSERTE( SUCCEEDED( hr ) ); + } + + // Commit the changes + hr = g_cpCmdGrammar->Commit(0); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the dynamic rules to active + hr = g_cpCmdGrammar->SetRuleIdState( DYN_TTSVOICERULE, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + } + + // Set the hear voice rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_DESTROY: + // Windows is closing down, so we should cleanup + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + return ( 1 ); + + case WM_HEARTHEVOICE: + // Set the voice to play + LoadString( g_hInst, IDS_VOICESPEAK, g_szCounterDisplay, MAX_LOADSTRING ); + g_cpVoice->Speak( T2W(g_szCounterDisplay), SPF_ASYNC | SPF_PURGEBEFORESPEAK, NULL ); + return ( 1 ); + + case WM_MISCCOMMAND: + { + // Find out the offset from the first property we're interested in, so we can verify that + // it's within range. + int iSelection = lParam - VID_MalesOnly; + if ( 0 <= iSelection && 2 >= iSelection ) + { + // If we have a new listing criteria, we basically shutdown the pane and start it again + if ( (UINT) iSelection != iCurEnum ) + { + HRESULT hr = g_cpCmdGrammar->SetRuleIdState( VID_HearTheVoice, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + hr = g_cpCmdGrammar->SetRuleIdState( VID_OtherRules, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + ManageEmployeesPaneCleanup( ppszTokenIds, ppcDesciptionString, ulNumTokens ); + + PostMessage( hWnd, WM_INITPANE, 0, (LPARAM) iSelection ); + } + } + return ( 1 ); + } + + case WM_TTSVOICESEL: + { + // If we are out of range, it is a programming error + _ASSERTE( 0 <= lParam && ulNumTokens > (ULONG) lParam ); + + // The returned Id is an index into our tokenId table, so create a token from the id + CComPtr< ISpObjectToken > pToken; + HRESULT hr = SpGetTokenFromId( ppszTokenIds[lParam], &pToken, FALSE); + if ( SUCCEEDED( hr ) ) + { + // Set our current voice from the returned token + hr = g_cpVoice->SetVoice( pToken ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Change our current voice index + ulCurToken = lParam; + } + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + } + return ( 0 ); +} + +/****************************************************************************** +* ManageEmployeesPaneCleanup * +*----------------------------* +* Description: +* Helper function to cleanup objects allocated while the ManageEmployees +* pane is running. +* +******************************************************************************/ +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens) +{ + ULONG ulIndex; + + // Free all allocated token ids + if ( ppszTokenIds ) + { + for ( ulIndex = 0; ulIndex < ulNumTokens; ulIndex++ ) + { + if ( NULL != ppszTokenIds[ulIndex] ) + { + CoTaskMemFree( ppszTokenIds[ulIndex] ); + } + } + + delete [] ppszTokenIds; + } + + if ( ppcDesciptionString ) + { + delete [] ppcDesciptionString; + } +} + +/****************************************************************************** +* ChangeNamePaneProc * +*--------------------* +* Description: +* Handles messages specifically for the change name pane. +* +******************************************************************************/ +LRESULT ChangeNamePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + USES_CONVERSION; + + HRESULT hr; + + switch ( message ) + { + case WM_GOTOOFFICE: + case WM_GOTOCOUNTER: + { + hr = g_cpCmdGrammar->SetRuleIdState( VID_Rename, SPRS_INACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + // Set the right message handler and repaint + if ( WM_GOTOOFFICE == message ) + { + g_fpCurrentPane = OfficePaneProc; + } + else if ( WM_GOTOCOUNTER == message ) + { + g_fpCurrentPane = CounterPaneProc; + } + + KillTimer( hWnd, 0 ); + PostMessage( hWnd, WM_INITPANE, 0, 0 ); + InvalidateRect( hWnd, NULL, TRUE ); + + return ( 1 ); + } + + case WM_PAINT: + { + // Do the actual UI paint + ChangeNamePanePaint( hWnd, g_szCounterDisplay); + return ( 1 ); + } + + case WM_INITPANE: + { + // Set the initial display + LoadString( g_hInst, IDS_NAMEPROMPT, g_szCounterDisplay, MAX_LOADSTRING ); + + // Set the hear voice rule to active + hr = g_cpCmdGrammar->SetRuleIdState( VID_Rename, SPRS_ACTIVE ); + _ASSERTE( SUCCEEDED( hr ) ); + + InvalidateRect( hWnd, NULL, TRUE ); + return ( 1 ); + } + + case WM_RENAMEWINDOW: + { + KillTimer( hWnd, 0 ); + + if ( lParam ) + { + _tcscpy( g_szCounterDisplay, W2T((LPWSTR) lParam) ); + } + CoTaskMemFree( (LPWSTR) lParam ); + InvalidateRect( hWnd, NULL, TRUE ); + SetTimer( hWnd, 0, TIMEOUT, NULL ); + return ( 1 ); + } + + case WM_TIMER: + KillTimer( hWnd, 0 ); + // Set the initial display + LoadString( g_hInst, IDS_NAMEPROMPT, g_szCounterDisplay, MAX_LOADSTRING ); + InvalidateRect( hWnd, NULL, TRUE ); + + return ( 1 ); + + + } + return ( 0 ); +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.h new file mode 100644 index 00000000..b3c07c26 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.h @@ -0,0 +1,51 @@ +/****************************************************************************** +* Coffee.h +* This module contains the base definitions for the coffee tutorial +* application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ +#pragma once + +#include "resource.h" + +// Global Variables: +HINSTANCE g_hInst; // current instance +TCHAR g_szCounterDisplay[MAX_LOADSTRING]; // Display String for counter +TCHAR g_szShopName[NORMAL_LOADSTRING]; // Name of the Coffee Shop +CComPtr g_cpCmdGrammar; // Pointer to our grammar object +CComPtr g_cpRecoCtxt; // Pointer to our recognition context +CComPtr g_cpEngine; // Pointer to our recognition engine instance +CComPtr g_cpVoice; // Pointer to our tts voice +PMSGHANDLER g_fpCurrentPane;// Pointer to current message handler + +// Foward declarations of functions included in this code module: +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +HRESULT InitSAPI( HWND hWnd ); +void CleanupSAPI( void ); +void ProcessRecoEvent( HWND hWnd ); +void ExecuteCommand(ISpRecoResult *pPhrase, HWND hWnd); +LRESULT EntryPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT CounterPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +LRESULT OfficePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void HandleFalseReco(ISpRecoResult *pRecoResult, HWND hWnd); +LRESULT ManageEmployeesPaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); +void ManageEmployeesPaneCleanup( WCHAR** ppszTokenIds, CSpDynamicString* ppcDesciptionString, + ULONG ulNumTokens); +LRESULT ChangeNamePaneProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + + +// Declaration of UI specific routines located in display.cpp +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc); +BOOL InitInstance(HINSTANCE, int); +void EraseBackground( HDC hDC ); +void CleanupGDIObjects( void ); +void EntryPanePaint( HWND hWnd, LPCTSTR szName ); +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ); +void OfficePanePaint( HWND hWnd, LPCTSTR szName ); +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken, UINT iEnumType ); +void ChangeNamePanePaint( HWND hWnd, LPCTSTR szCounterDisplay); + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.rc b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.rc new file mode 100644 index 00000000..2901a259 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.rc @@ -0,0 +1,139 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_COFFEE ICON DISCARDABLE "coffee.ICO" +IDI_SMALL ICON DISCARDABLE "SMALL.ICO" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""resource.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_CMD_CFG SRGRAMMAR DISCARDABLE "coffee.cfg" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "Coffee.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Coffee" + IDC_COFFEE "Coffee" + IDS_ERRORSTRING "Another application is running which is listening for speech using SAPI. Voice commands are disabled." + IDS_ENTERSTORE "Go to the counter" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WELCOME "Welcome to the %s coffee shop. Speak for service!" + IDS_PLEASEORDER "Please order when ready!" + IDS_PLEASEWAIT "Just one moment please..." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ORDERBEGIN "Your " + IDS_ORDEREND " is ready at the end of the counter. Thanks!" + IDS_OFFICE "Welcome to the %s coffee shop office" + IDS_ENTEROFFICE "Go to the office" + IDS_DIDNTUNDERSTAND "Sorry, I didn't get that order. Please try again." + IDS_MANAGEEMPLOYEES "Manage the Employees" + IDS_EMPLOYEEDUTY "Employee On Duty:" + IDS_VOICESPEAK "I will be the best employee you've ever had. Let me work." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HEARTHEM "Hear Them Speak!" + IDS_SHOW "Show:" + IDS_MALESONLY "Males Only" + IDS_FEMALESONLY "Females Only" + IDS_BOTHGENDERS "Both Genders" + IDS_MANAGENAME "Manage Store Name" + IDS_NAMEPROMPT "Say: Rename the coffee shop to "" """ + IDS_FAILEDINIT "SAPI failed to initialize. The application will now shut down." + IDS_SHOPNAME "SAPI" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.xml b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.xml new file mode 100644 index 00000000..199cc546 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffee.xml @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Rename the coffee shop to *+

+
+ + + +

May I have

+

Can I have

+

Can I get

+

Please get me

+

Get me

+

I'd like

+

I would like

+

...

+
+
+ a +

+ +

+ ... +
+ + Please +

+ +

Enter

+

Go to

+ +

+ the + +
+ + Please +

Manage

+ the + +
+ +

Hear Them Speak

+
+ + +

?Show Males Only

+

?Show Females Only

+

?Show Both Genders

+
+
+ + +

counter

+

shop

+

store

+

office

+
+
+ + +

Iced

+
+
+ + +

Decaf

+

Decaffeinated

+
+
+ + +

Single

+

Double

+

Triple

+

Quad

+
+
+ + +

Short

+

Tall

+

Grande

+
+
+ + +

Hazelnut

+

Irish Cream

+

Almond

+

Peppermint

+
+
+ + +

Nonfat

+

Two Percent

+

Whole

+
+
+ + +

Latte

+

Mocha

+

Espresso

+

Americano

+

Cappuccino

+
+
+ + + + + + + + + + + + + +

employees

+

-shop +name

+

-store +name

+
+
+
diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffees6.dsp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffees6.dsp new file mode 100644 index 00000000..6b25d9f9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/coffees6.dsp @@ -0,0 +1,190 @@ +# Microsoft Developer Studio Project File - Name="CoffeeS6" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=CoffeeS6 - Win32 Debug x86 +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS6.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CoffeeS6.mak" CFG="CoffeeS6 - Win32 Debug x86" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CoffeeS6 - Win32 Debug x86" (based on "Win32 (x86) Application") +!MESSAGE "CoffeeS6 - Win32 Release x86" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "CoffeeS6 - Win32 Debug x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug x86" +# PROP BASE Intermediate_Dir "Debug x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug x86" +# PROP Intermediate_Dir "Debug x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" + +!ELSEIF "$(CFG)" == "CoffeeS6 - Win32 Release x86" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release x86" +# PROP BASE Intermediate_Dir "Release x86" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release x86" +# PROP Intermediate_Dir "Release x86" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\include" /I "..\..\..\..\..\ddk\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "CoffeeS6 - Win32 Debug x86" +# Name "CoffeeS6 - Win32 Release x86" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\coffee.cpp +# End Source File +# Begin Source File + +SOURCE=.\display.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\coffee.h +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\resource.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\coffee.ICO +# End Source File +# Begin Source File + +SOURCE=.\coffee.rc +# End Source File +# Begin Source File + +SOURCE=.\SMALL.ICO +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "Xml" +# Begin Source File + +SOURCE=.\coffee.xml + +!IF "$(CFG)" == "CoffeeS6 - Win32 Debug x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\Coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "CoffeeS6 - Win32 Release x86" + +# Begin Custom Build +ProjDir=. +InputPath=.\coffee.xml +InputName=coffee + +BuildCmds= \ + ..\..\..\..\bin\gc $(InputName) \ + ..\..\..\..\bin\gc /h cofgram.h $(InputName) \ + + +"$(ProjDir)\coffee.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(ProjDir)\cofgram.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\coffee.cfg +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/common.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/common.h new file mode 100644 index 00000000..988f65f9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/common.h @@ -0,0 +1,47 @@ +/****************************************************************************** +* Common.h +* This module contains the definitions used by all modules in the +* coffee application. +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#define NORMAL_LOADSTRING 100 // Normal size of loaded strings +#define MAX_LOADSTRING 256 // Miximum size of loaded strings +#define GRAMMARID1 161 // Arbitrary grammar id +#define DICTGRAMMAR 164 // Arbitrary grammar id +#define WM_RECOEVENT WM_USER+190 // Arbitrary user defined message for reco callback +#define WM_CLEANUP WM_USER+201 // Notification to a pane to cleanup its residuals +#define WM_GOTOCOUNTER WM_USER+202 // Notification to go to counter pane +#define WM_INITPANE WM_USER+203 // Notification for any pane to initialize +#define WM_GOTOOFFICE WM_USER+204 // Notification to go to office pane +#define WM_ESPRESSOORDER WM_USER+210 // Notification that an order has been received +#define WM_DIDNTUNDERSTAND WM_USER+211 // Notification that we got a false recognition +#define WM_MANAGEEMPLOYEES WM_USER+212 // Notification to go to employee management pane +#define WM_HEARTHEVOICE WM_USER+213 // The User wants to hear the selected employee speak +#define WM_MISCCOMMAND WM_USER+214 // Notification that something described under "other commands" was recognized +#define WM_TTSVOICESEL WM_USER+215 // Notification that the user selected a voice +#define WM_FALSERECO WM_USER+217 // Notification of false recognition +#define WM_PHRASESTART WM_USER+218 // Notification words have been detected in incoming stream +#define WM_MANAGENAME WM_USER+219 // Notification user wants to see change name pane +#define WM_RENAMEWINDOW WM_USER+220 // Rename the window command +#define MY_RULE_ID 458 // Arbitrary rule id +#define MAX_ID_ARRAY 7 // Max number of ids in espresso rule +#define MINMAX_WIDTH 640 // Window width +#define MINMAX_HEIGHT 480 // Window height +#define TIMEOUT 12000 // Timer fires on this interval in ms +#define MIN_ORDER_INTERVAL 2500 // Minimum utterance time for a false reco to be + // considered a possible order +#define DYN_TTSVOICERULE 1001 // ID for the dynamic tts voice rule +#define RECORD_TIMER 5 // Timer # for pronunciation timer +#define RECORD_TIMEOUT 5000 // # of seconds to wait for sound +#define THANKS_TIMER 6 // Timer # for thanks timeout timer +#define THANKS_TIMEOUT 10000 // # of seconds to wait for sound + +typedef LRESULT (*PMSGHANDLER) (HWND, UINT, WPARAM, LPARAM ); // typedef msg handler + +typedef struct tagID_TEXT +{ + ULONG ulId; + WCHAR *pwstrCoMemText; +}ID_TEXT; diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/display.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/display.cpp new file mode 100644 index 00000000..803c39c0 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/display.cpp @@ -0,0 +1,497 @@ +/****************************************************************************** +* Display.cpp +* This module contains the UI specifc code for the coffee application +* +* Copyright (c) Microsoft Corporation. All rights reserved. +******************************************************************************/ + +#include "stdafx.h" +#include "sphelper.h" +#include "resource.h" +#include "common.h" + +// Static variables for this module +static HBITMAP s_hBmp; // Handle to background bitmap +static HBRUSH s_hBackBrush; // Pointer to background brush +static HFONT s_hDrawingFont; // Pointer to our font + +// Shared variables +extern HINSTANCE g_hInst; // current instance + +/****************************************************************************** +* MyRegisterClass * +*-----------------* +* Description: +* Register our window class. +* +******************************************************************************/ +ATOM MyRegisterClass(HINSTANCE hInstance, WNDPROC WndProc) +{ + WNDCLASSEX wcex; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + s_hBmp = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP1 ) ); + s_hDrawingFont = NULL; + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_COFFEE); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = NULL; + wcex.lpszMenuName = NULL; + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL); + + return RegisterClassEx(&wcex); +} + +/****************************************************************************** +* InitInstance * +*--------------* +* Description: +* Save the instance handle in a global variable and create and display +* the main program window. +* +******************************************************************************/ +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + HWND hWnd; + TCHAR szTitle[NORMAL_LOADSTRING]; + TCHAR szWindowClass[NORMAL_LOADSTRING]; + + g_hInst = hInstance; + + // Initialize label strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, NORMAL_LOADSTRING); + LoadString(hInstance, IDC_COFFEE, szWindowClass, NORMAL_LOADSTRING); + + hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, MINMAX_WIDTH, MINMAX_HEIGHT, NULL, NULL, hInstance, NULL); + + if (!hWnd) + { + return FALSE; + } + + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + + return TRUE; +} + +/****************************************************************************** +* Erase Background * +*------------------* +* Description: +* Erase the screen and paint with background bitmap. +* +******************************************************************************/ +void EraseBackground( HDC hDC ) +{ + HDC hMemDC = CreateCompatibleDC( hDC ); + HBITMAP hOldBmp = (HBITMAP) SelectObject( hMemDC, s_hBmp ); + int i = 0; + int j = 0; + + while ( i < MINMAX_WIDTH ) + { + j = 0; + while ( j < MINMAX_HEIGHT ) + { + BitBlt( hDC, i, j, i + 128, j + 128, hMemDC, 0, 0, SRCCOPY ); + j += 128; + } + i += 128; + } + + if ( !s_hDrawingFont ) + { + LOGFONT lf; + + lf.lfHeight = -MulDiv(12, GetDeviceCaps(hDC, LOGPIXELSY), 72);; + lf.lfWidth = 0; + lf.lfEscapement = 0; + lf.lfOrientation = 0; + lf.lfWeight = 0; + lf.lfItalic = 0; + lf.lfUnderline = 0; + lf.lfStrikeOut = 0; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfOutPrecision = OUT_TT_ONLY_PRECIS; + lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; + lf.lfQuality = DEFAULT_QUALITY; + lf.lfPitchAndFamily = VARIABLE_PITCH | FF_MODERN; + _tcscpy( lf.lfFaceName, _T("Kristen ITC") ); + s_hDrawingFont = CreateFontIndirect( &lf ); + if (!s_hDrawingFont ) + { + s_hDrawingFont = (HFONT) GetStockObject( DEFAULT_GUI_FONT ); + } + + } + SelectObject( hMemDC, hOldBmp ); + DeleteDC( hMemDC ); +} + +/****************************************************************************** +* CleanupGDIObjects * +*-------------------* +* Description: +* Cleanup any GDI objects we may have created. +* +******************************************************************************/ +void CleanupGDIObjects( void ) +{ + if ( s_hDrawingFont ) + { + DeleteObject( s_hDrawingFont ); + } + if ( s_hBmp ) + { + DeleteObject( s_hBmp ); + } +} + +/****************************************************************************** +* EntryPanePaint * +*----------------* +* Description: +* Do the paint on the entry pane. +* +******************************************************************************/ +void EntryPanePaint( HWND hWnd, LPCTSTR szName ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + TCHAR tLoadBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTERSTORE, tBuf, MAX_LOADSTRING ); + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 25; + rc.right += 25; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_ENTEROFFICE, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + + LoadString( g_hInst, IDS_WELCOME, tLoadBuf, MAX_LOADSTRING ); + _stprintf( tBuf, tLoadBuf, szName ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* CounterPanePaint * +*------------------* +* Description: +* Do the paint on the counter pane. +* +******************************************************************************/ +void CounterPanePaint( HWND hWnd, LPCTSTR szCounterDisplay ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } + +} + +/****************************************************************************** +* OfficePanePaint * +*------------------* +* Description: +* Do the paint on the office pane. +* +******************************************************************************/ +void OfficePanePaint( HWND hWnd, LPCTSTR szName ) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + TCHAR tLoadBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_OFFICE, tLoadBuf, MAX_LOADSTRING ); + _stprintf( tBuf, tLoadBuf, szName ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 125; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_MANAGENAME, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + iWidth = rc.right - rc.left; + rc.left = clientRC.left + 25; + rc.right = rc.left + 100; + rc.top = ( clientRC.bottom - iHeight ) / 2; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* ManageEmployeesPanePaint * +*---------------------------* +* Description: +* Do the paint on the manage employees pane. +* +******************************************************************************/ +void ManageEmployeesPanePaint( HWND hWnd, ULONG ulNumTokens, CSpDynamicString* ppcDesciptionString, + ULONG ulCurToken, UINT iEnumType ) +{ + USES_CONVERSION; + + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + TCHAR tBuf[MAX_LOADSTRING]; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + LoadString( g_hInst, IDS_MANAGEEMPLOYEES, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 25; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 200; + LoadString( g_hInst, IDS_EMPLOYEEDUTY, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + if ( 8 < ulNumTokens ) + { + ulNumTokens = 8; + } + ULONG ulIndex = 0; + rc.bottom +=5; + while( ulIndex < ulNumTokens ) + { + TCHAR * pszTitle = W2T( ppcDesciptionString[ulIndex] ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, pszTitle, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left = clientRC.right - 275; + rc.right = rc.left + 200; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != ulCurToken ) + { + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, pszTitle, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + + ulIndex++; + + } + + LoadString( g_hInst, IDS_HEARTHEM, tBuf, MAX_LOADSTRING ); + rc.left = 0; + rc.right = 450; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = ( clientRC.bottom - iHeight ) - 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.left = 0; + rc.right = 100; + LoadString( g_hInst, IDS_SHOW, tBuf, MAX_LOADSTRING ); + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 50; + rc.right += 50; + rc.top = ( clientRC.bottom - iHeight ) / 4; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + + rc.bottom +=5; + for ( ulIndex = 0; ulIndex < 3; ulIndex++ ) + { + LoadString( g_hInst, IDS_MALESONLY+ulIndex, tBuf, MAX_LOADSTRING ); + LONG lLastBottom = rc.bottom; + rc.left = 0; + rc.right = 200; + iHeight = DrawText( hDC, tBuf, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + rc.left += 75; + rc.right += 75; + rc.top = lLastBottom + 4; + rc.bottom = rc.top + iHeight + 1; + if ( ulIndex != iEnumType ) + { + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + } + else + { + COLORREF clrTmp = SetTextColor( hDC, RGB(255, 0, 0) ); + DrawText( hDC, tBuf, -1, &rc, DT_WORDBREAK ); + SetTextColor( hDC, clrTmp ); + } + } + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} + +/****************************************************************************** +* ChangeNamePanePaint * +*---------------------* +* Description: +* Do the paint on the change name pane. +* +******************************************************************************/ +void ChangeNamePanePaint( HWND hWnd, LPCTSTR szCounterDisplay) +{ + if ( GetUpdateRect( hWnd, NULL, TRUE ) ) + { + PAINTSTRUCT ps; + HDC hDC; + BeginPaint( hWnd, &ps ); + hDC = ps.hdc; + HFONT hOldFont = (HFONT) SelectObject( hDC, s_hDrawingFont ); + COLORREF sOldColor = SetTextColor( hDC, RGB( 255, 255, 255 ) ); + SetBkMode(hDC, TRANSPARENT); + + RECT rc; + RECT clientRC; + GetClientRect( hWnd, &clientRC ); + + rc.left = 0; + rc.right = 450; + int iHeight = DrawText( hDC, szCounterDisplay, -1, &rc, DT_CALCRECT | DT_WORDBREAK ); + int iWidth = rc.right - rc.left; + rc.left = (clientRC.right - iWidth) / 2; + rc.right = rc.left + iWidth; + rc.top = 100; + rc.bottom = rc.top + iHeight + 1; + DrawText( hDC, szCounterDisplay, -1, &rc, DT_WORDBREAK ); + + SetTextColor( hDC, sOldColor ); + SelectObject( hDC, hOldFont ); + EndPaint( hWnd, &ps ); + } +} diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/resource.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/resource.h new file mode 100644 index 00000000..be88fb76 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/resource.h @@ -0,0 +1,68 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by coffee.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDS_HELLO 106 +#define IDI_COFFEE 107 +#define IDI_SMALL 108 +#define IDC_COFFEE 109 +#define IDS_ERRORSTRING 110 +#define IDS_ENTERSTORE 111 +#define IDS_WELCOME 112 +#define IDS_PLEASEORDER 113 +#define IDS_PLEASEWAIT 114 +#define IDS_BASE 115 +#define IDS_BASE1 116 +#define IDS_BASE2 117 +#define IDS_BASE3 118 +#define IDS_BASE4 119 +#define IDS_BASE5 120 +#define IDS_BASE6 121 +#define IDS_BASE7 122 +#define IDS_BASE8 123 +#define IDS_BASE9 124 +#define IDS_BASE10 125 +#define IDS_BASE11 126 +#define IDS_BASE12 127 +#define IDR_MAINFRAME 128 +#define IDS_BASE13 128 +#define IDR_CMD_CFG 129 +#define IDS_BASE14 129 +#define IDS_BASE15 130 +#define IDB_BITMAP1 130 +#define IDS_BASE16 131 +#define IDS_BASE17 132 +#define IDS_BASE18 133 +#define IDS_BASE19 134 +#define IDS_BASE20 135 +#define IDS_ORDERBEGIN 136 +#define IDS_ORDEREND 137 +#define IDS_OFFICE 138 +#define IDS_ENTEROFFICE 139 +#define IDS_DIDNTUNDERSTAND 140 +#define IDS_MANAGEEMPLOYEES 141 +#define IDS_EMPLOYEEDUTY 142 +#define IDS_VOICESPEAK 143 +#define IDS_HEARTHEM 144 +#define IDS_SHOW 145 +#define IDS_MALESONLY 146 +#define IDS_FEMALESONLY 147 +#define IDS_BOTHGENDERS 148 +#define IDS_MANAGENAME 155 +#define IDS_NAMEPROMPT 156 +#define IDS_FAILEDINIT 157 +#define IDS_SHOPNAME 158 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 134 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/small.ico b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/small.ico new file mode 100644 index 00000000..0c8a5ff9 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.cpp b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.cpp new file mode 100644 index 00000000..35e573a0 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// SimpleCC.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information +//Copyright (c) Microsoft Corporation. All rights reserved. + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.h b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.h new file mode 100644 index 00000000..5fc3f375 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/stdafx.h @@ -0,0 +1,32 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) +#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif WIN32_LEAN_AND_MEAN + + +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_) diff --git a/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/version.rc2 b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/version.rc2 new file mode 100644 index 00000000..cbc58987 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CPP/Tutorials/CoffeeS6/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Coffee Tutorial Step 6 Sample\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "coffees6\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "coffees6.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.cs b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.cs new file mode 100644 index 00000000..dc16bf7d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.cs @@ -0,0 +1,387 @@ +//============================================================================= +// +// Copyright (c) Microsoft Corporation All Rights Reserved. +// +//============================================================================= + +namespace SAPI51Samples +{ + using System; + using System.Collections; + using System.ComponentModel; + using System.Drawing; + using System.Data; + using System.Windows.Forms; + using System.Diagnostics; + using SpeechLib; + + /// + /// SpeechListBox is a speech enabled listbox control. It inherits + /// from the standard System.Windows.Forms.ListBox, and thus exposes + /// all the standard properties, methods and events. A few new methods + /// are added to provide speech specific functionalities. + /// + public class SpeechListBox : System.Windows.Forms.ListBox + { + private const int grammarId = 10; + private bool speechEnabled = false; + private bool speechInitialized = false; + private String PreCommandString = "Select"; + private SpeechLib.SpSharedRecoContext objRecoContext; + private SpeechLib.ISpeechRecoGrammar grammar; + private SpeechLib.ISpeechGrammarRule ruleTopLevel; + private SpeechLib.ISpeechGrammarRule ruleListItems; + + /// + /// AddItem is used to add a newitem to the list item collection. + /// It will automatically update the grammar. It's equivalent to + /// calling ListBox.Items.Add() followed by BuildGrammar(). + /// + /// + /// The new item to be added to the list. + /// + /// + /// The index of the newly added item. + /// + public int AddItem(object newItem) + { + // Since we can't add the same word to the same transition in + // the grammar, we don't allow same string to be added + // multiple times. So do nothing if Item is already in the list. + // Some level of error message may be helpful. The sample chooses + // to silently ignore to keep code simple. + + // The leading and trailing spaces are not needed, trim it before + // inserting. SAPI will return error in AddWordTransition if two + // phrases differ only in spaces. A program needs to handle this + // error if random phrase is added to a rule. + // Note: In this sample, we only trim leading and trailing spaces. + // Internal spaces will need to be handled as well. + + string strItem; + int index = -1; + + strItem = newItem.ToString().Trim(); + + // only add it if trimmed phrase is not empty + if( strItem.Length > 0 ) + { + index = this.FindString(strItem); + + if( index < 0 ) + { + // if it doesn't exist yet, add it to the list + index = this.Items.Add(strItem); + + // if speech is enabled, we need to update grammar with the change + if( speechEnabled ) RebuildGrammar(); + } + } + + return index; + } + + /// + /// RemoveItem will remove the item with the given index and then + /// call BuildGrammar() to update grammar. It's equivalent to + /// calling ListBox.Items.RemoveAt() followed by BuildGrammar(). + /// + /// + /// Index of the item to be removed from the list. + /// + public void RemoveItem(int index) + { + this.Items.RemoveAt(index); + if( speechEnabled ) RebuildGrammar(); + } + + /// + /// Property SpeechEnabled is read/write-able. When it's set to + /// true, speech recognition will be started. When it's set to + /// false, speech recognition will be stopped. + /// + public bool SpeechEnabled + { + get + { + return speechEnabled; + } + set + { + if( speechEnabled != value ) + { + speechEnabled = value ; + if(this.DesignMode) return; + + if (speechEnabled) + { + EnableSpeech(); + } + else + { + DisableSpeech(); + } + } + } + } + + /// + /// RecoContext_Hypothesis is the event handler function for + /// SpSharedRecoContext object's Hypothesis event. + /// + /// + /// + /// + /// + /// See EnableSpeech() for how to hook up this function with the + /// event. + /// + public void RecoContext_Hypothesis(int StreamNumber, + object StreamPosition, + ISpeechRecoResult Result) + { + Debug.WriteLine("Hypothesis: " + + Result.PhraseInfo.GetText(0, -1, true) + ", " + + StreamNumber + ", " + StreamPosition); + } + + /// + /// RecoContext_Hypothesis is the event handler function for + /// SpSharedRecoContext object's Recognition event. + /// + /// + /// + /// + /// + /// + /// See EnableSpeech() for how to hook up this function with the + /// event. + /// + public void RecoContext_Recognition(int StreamNumber, + object StreamPosition, + SpeechRecognitionType RecognitionType, + ISpeechRecoResult Result) + { + Debug.WriteLine("Recognition: " + + Result.PhraseInfo.GetText(0, -1, true) + ", " + + StreamNumber + ", " + StreamPosition); + + int index; + ISpeechPhraseProperty oItem; + + // oItem will be the property of the second part in the recognized + // phase. For example, if the top level rule matchs + // "select Seattle". Then the ListItemsRule matches "Seattle" part. + // The following code will get the property of the "Seattle" + // phrase, which is set when the word "Seattle" is added to the + // ruleListItems in RebuildGrammar. + oItem = Result.PhraseInfo.Properties.Item(0).Children.Item(0); + index = oItem.Id; + + if ((System.Decimal)Result.PhraseInfo.GrammarId == grammarId) + { + // Check to see if the item at the same position in the list + // still has the same text. + // This is to prevent the rare case that the user keeps + // talking while the list is being added or removed. By the + // time this event is fired and handled, the list box may have + // already changed. + if( oItem.Name.CompareTo(this.Items[index].ToString())==0 ) + { + this.SelectedIndex = index; + } + } + } + + /// + /// This function will create the main SpSharedRecoContext object + /// and other required objects like Grammar and rules. + /// In this sample, we are building grammar dynamically since + /// listbox content can change from time to time. + /// If your grammar is static, you can write your grammar file + /// and ask SAPI to load it during run time. This can reduce the + /// complexity of your code. + /// + private void InitializeSpeech() + { + Debug.WriteLine("Initializing SAPI objects..."); + + try + { + // First of all, let's create the main reco context object. + // In this sample, we are using shared reco context. Inproc reco + // context is also available. Please see the document to decide + // which is best for your application. + objRecoContext = new SpeechLib.SpSharedRecoContext(); + + // Then, let's set up the event handler. We only care about + // Hypothesis and Recognition events in this sample. + objRecoContext.Hypothesis += new + _ISpeechRecoContextEvents_HypothesisEventHandler( + RecoContext_Hypothesis); + + objRecoContext.Recognition += new + _ISpeechRecoContextEvents_RecognitionEventHandler( + RecoContext_Recognition); + + // Now let's build the grammar. + // The top level rule consists of two parts: "select ". + // So we first add a word transition for the "select" part, then + // a rule transition for the "" part, which is dynamically + // built as items are added or removed from the listbox. + grammar = objRecoContext.CreateGrammar(grammarId); + ruleTopLevel = grammar.Rules.Add("TopLevelRule", + SpeechRuleAttributes.SRATopLevel | SpeechRuleAttributes.SRADynamic, 1); + ruleListItems = grammar.Rules.Add("ListItemsRule", + SpeechRuleAttributes.SRADynamic, 2); + + SpeechLib.ISpeechGrammarRuleState stateAfterSelect; + stateAfterSelect = ruleTopLevel.AddState(); + + object PropValue = ""; + ruleTopLevel.InitialState.AddWordTransition(stateAfterSelect, + PreCommandString, " ", SpeechGrammarWordType.SGLexical, + "", 0, ref PropValue, 1.0F ); + + PropValue = ""; + stateAfterSelect.AddRuleTransition(null, ruleListItems, "", + 1, ref PropValue, 0F); + + // Now add existing list items to the ruleListItems + RebuildGrammar(); + + // Now we can activate the top level rule. In this sample, only + // the top level rule needs to activated. The ListItemsRule is + // referenced by the top level rule. + grammar.CmdSetRuleState("TopLevelRule", SpeechRuleState.SGDSActive); + speechInitialized = true; + } + catch(Exception e) + { + System.Windows.Forms.MessageBox.Show( + "Exception caught when initializing SAPI." + + " This application may not run correctly.\r\n\r\n" + + e.ToString(), + "Error"); + } + } + + /// + /// EnableSpeech will initialize all speech objects on first time, + /// then rebuild grammar and start speech recognition. + /// + /// + /// true if speech is enabled and grammar updated. + /// false otherwise, which happens if we are in design mode. + /// + /// + /// This is a private function. + /// + private bool EnableSpeech() + { + Debug.Assert(speechEnabled, "speechEnabled must be true in EnableSpeech"); + + if (this.DesignMode) return false; + + if (speechInitialized == false) + { + InitializeSpeech(); + } + else + { + RebuildGrammar(); + } + + objRecoContext.State = SpeechRecoContextState.SRCS_Enabled; + return true; + } + + /// + /// RebuildGrammar() will update grammar object with current list + /// items. It is called automatically by AddItem and RemoveItem. + /// + /// + /// true if grammar is updated. + /// false if grammar is not updated, which can happen if speech is + /// not enabled or if it's in design mode. + /// + /// + /// RebuildGrammar should be called every time after the list item + /// has changed. AddItem and RemoveItem methods are provided as a + /// way to update list item and the grammar object automatically. + /// Don't forget to call RebuildGrammar if the list is changed + /// through ListBox.Items collection. Otherwise speech engine will + /// continue to recognize old list items. + /// + public bool RebuildGrammar() + { + if( !speechEnabled || this.DesignMode ) + { + return false; + } + + // In this funtion, we are only rebuilding the ruleListItems, as + // this is the only part that's really changing dynamically in + // this sample. However, you still have to call + // Grammar.Rules.Commit to commit the grammar. + int i, count; + String word; + object propValue = ""; + + try + { + ruleListItems.Clear(); + count = this.Items.Count; + + for(i=0; i + /// This is a private function that stops speech recognition. + /// + /// + private bool DisableSpeech() + { + if (this.DesignMode) return false; + + Debug.Assert(speechInitialized, + "speech must be initialized in DisableSpeech"); + + if( speechInitialized ) + { + // Putting the recognition context to disabled state will + // stop speech recognition. Changing the state to enabled + // will start recognition again. + objRecoContext.State = SpeechRecoContextState.SRCS_Disabled; + } + + return true; + } + + } +} + diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.csproj b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.csproj new file mode 100644 index 00000000..1aa067db --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.csproj @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.resx b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.resx new file mode 100644 index 00000000..b4872563 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/SpeechListBox.resx @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + + + True + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader + + + System.Resources.ResXResourceWriter + + \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/assemblyinfo.cs b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/assemblyinfo.cs new file mode 100644 index 00000000..05da15ba --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/assemblyinfo.cs @@ -0,0 +1,51 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("C# ListBox control sample")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft® Windows(TM) Operating System")] +[assembly: AssemblyCopyright("Copyright (C) Microsoft Corporation. 1981-2001")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified - the assembly cannot be signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. +// (*) If the key file and a key name attributes are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP - that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the file is installed into the CSP and used. +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/small.ico b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CSharp/Listbox/control/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/AssemblyInfo.cs b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/AssemblyInfo.cs new file mode 100644 index 00000000..05da15ba --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/AssemblyInfo.cs @@ -0,0 +1,51 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("C# ListBox control sample")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft® Windows(TM) Operating System")] +[assembly: AssemblyCopyright("Copyright (C) Microsoft Corporation. 1981-2001")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified - the assembly cannot be signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. +// (*) If the key file and a key name attributes are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP - that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the file is installed into the CSP and used. +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.cs b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.cs new file mode 100644 index 00000000..63734dbf --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.cs @@ -0,0 +1,188 @@ +//============================================================================= +// +// Copyright (c) Microsoft Corporation All Rights Reserved. +// +//============================================================================= + +namespace TestApp +{ + using System; + using System.Drawing; + using System.Collections; + using System.ComponentModel; + using System.Windows.Forms; + using System.Data; + using SAPI51Samples; + + /// + /// This form is a simple test application for the user control + /// defined in the SpeechListBox project. + /// + public class MainForm : System.Windows.Forms.Form + { + private System.Windows.Forms.CheckBox chkSpeechEnabled; + private SAPI51Samples.SpeechListBox speechListBox1; + private System.Windows.Forms.Button btnAdd; + private System.Windows.Forms.TextBox txtNewItem; + private System.Windows.Forms.Button btnRemove; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.ComponentModel.IContainer components = null; + + public MainForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + this.chkSpeechEnabled.Checked = this.speechListBox1.SpeechEnabled; + } + + /// + /// Clean up any resources being used. + /// + public override void Dispose() + { + base.Dispose(); + if(components != null) + components.Dispose(); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtNewItem = new System.Windows.Forms.TextBox(); + this.btnAdd = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.btnRemove = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.chkSpeechEnabled = new System.Windows.Forms.CheckBox(); + this.speechListBox1 = new SAPI51Samples.SpeechListBox(); + this.SuspendLayout(); + // + // txtNewItem + // + this.txtNewItem.Location = new System.Drawing.Point(86, 225); + this.txtNewItem.Name = "txtNewItem"; + this.txtNewItem.Size = new System.Drawing.Size(152, 20); + this.txtNewItem.TabIndex = 5; + this.txtNewItem.Text = "Seattle"; + this.txtNewItem.TextChanged += new System.EventHandler(this.txtNewItem_TextChanged); + // + // btnAdd + // + this.btnAdd.Location = new System.Drawing.Point(256, 224); + this.btnAdd.Name = "btnAdd"; + this.btnAdd.Size = new System.Drawing.Size(70, 23); + this.btnAdd.TabIndex = 6; + this.btnAdd.Text = "&Add"; + this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); + // + // label2 + // + this.label2.Location = new System.Drawing.Point(8, 2); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(328, 40); + this.label2.TabIndex = 0; + this.label2.Text = "Update the speech enabled list box using the Add/Remove button. Then say \"select\"" + + " + phrase to select an item in the list, e.g. you can say \"select Seattle\" if Se" + + "attle appears in the list. "; + // + // btnRemove + // + this.btnRemove.Location = new System.Drawing.Point(256, 192); + this.btnRemove.Name = "btnRemove"; + this.btnRemove.Size = new System.Drawing.Size(70, 23); + this.btnRemove.TabIndex = 3; + this.btnRemove.Text = "&Remove"; + this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(8, 227); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(78, 16); + this.label1.TabIndex = 4; + this.label1.Text = "&Phrase to add:"; + // + // chkSpeechEnabled + // + this.chkSpeechEnabled.Location = new System.Drawing.Point(8, 195); + this.chkSpeechEnabled.Name = "chkSpeechEnabled"; + this.chkSpeechEnabled.Size = new System.Drawing.Size(112, 16); + this.chkSpeechEnabled.TabIndex = 2; + this.chkSpeechEnabled.Text = "&Speech Enabled"; + this.chkSpeechEnabled.CheckedChanged += new System.EventHandler(this.chkSpeechEnabled_CheckedChanged); + // + // speechListBox1 + // + this.speechListBox1.Location = new System.Drawing.Point(8, 49); + this.speechListBox1.Name = "speechListBox1"; + this.speechListBox1.Size = new System.Drawing.Size(320, 134); + this.speechListBox1.SpeechEnabled = true; + this.speechListBox1.TabIndex = 1; + // + // MainForm + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(336, 253); + this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.label2, + this.label1, + this.btnRemove, + this.btnAdd, + this.txtNewItem, + this.chkSpeechEnabled, + this.speechListBox1}); + this.MaximizeBox = false; + this.Name = "MainForm"; + this.Text = "Speech Enabled ListBox"; + this.ResumeLayout(false); + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new MainForm()); + } + + private void btnAdd_Click(object sender, System.EventArgs e) + { + // Add the new item. Internally to SpeechListBox, this will cause + // a rebuild of the dynamic grammar used by speech recognition + // engine. + speechListBox1.AddItem(txtNewItem.Text); + txtNewItem.Text = ""; + } + + private void btnRemove_Click(object sender, System.EventArgs e) + { + // Just remove the current selected item. Same as AddItem, removing + // an item causes a grammar rebuild as well. + if( speechListBox1.SelectedIndex >= 0 ) + { + speechListBox1.RemoveItem(speechListBox1.SelectedIndex); + } + } + + private void chkSpeechEnabled_CheckedChanged(object sender, System.EventArgs e) + { + speechListBox1.SpeechEnabled = chkSpeechEnabled.Checked; + } + + private void txtNewItem_TextChanged(object sender, System.EventArgs e) + { + // don't allow empty string to be added + btnAdd.Enabled = txtNewItem.Text != ""; + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.resx b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.resx new file mode 100644 index 00000000..e2c28a90 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/MainForm.resx @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MainForm + + + text/microsoft-resx + + + 1.0.0.0 + + + System.Resources.ResXResourceReader + + + System.Resources.ResXResourceWriter + + \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/TestApp.csproj b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/TestApp.csproj new file mode 100644 index 00000000..d6cc6df1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/TestApp.csproj @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/small.ico b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/sp/src/utils/sapi51/Samples/CSharp/Listbox/testapp/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/AssemblyInfo.cs b/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/AssemblyInfo.cs new file mode 100644 index 00000000..80099989 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/AssemblyInfo.cs @@ -0,0 +1,51 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("C# Simple TTS")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyProduct("Microsoft® Windows(TM) Operating System")] +[assembly: AssemblyCopyright("Copyright (C) Microsoft Corporation. 1981-2001")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified - the assembly cannot be signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. +// (*) If the key file and a key name attributes are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP - that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the file is installed into the CSP and used. +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.cs b/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.cs new file mode 100644 index 00000000..72abf182 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.cs @@ -0,0 +1,145 @@ +//============================================================================= +// +// Copyright (c) Microsoft Corporation All Rights Reserved. +// +//============================================================================= + +namespace SimpleTTS +{ + using System; + using System.Windows.Forms; + using System.Threading; + using SpeechLib; + + /// + /// This form shows how TTS speak works. + /// + public class MainForm : System.Windows.Forms.Form + { + private System.Windows.Forms.CheckBox chkSaveToWavFile; + private System.Windows.Forms.Button btnSpeak; + private System.Windows.Forms.TextBox txtSpeakText; + private System.Windows.Forms.Button btnExit; + private System.ComponentModel.IContainer components; + + public MainForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + + /// + /// Clean up any resources being used. + /// + public override void Dispose() + { + base.Dispose(); + if(components != null) + components.Dispose(); + } + + #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnSpeak = new System.Windows.Forms.Button(); + this.chkSaveToWavFile = new System.Windows.Forms.CheckBox(); + this.chkSaveToWavFile.Location = new System.Drawing.Point(8, 80); + this.chkSaveToWavFile.Size = new System.Drawing.Size(90, 24); + + this.btnExit = new System.Windows.Forms.Button(); + this.txtSpeakText = new System.Windows.Forms.TextBox(); + this.btnSpeak.Location = new System.Drawing.Point(108, 80); + this.btnSpeak.Size = new System.Drawing.Size(80, 24); + this.btnSpeak.TabIndex = 4; + this.btnSpeak.Text = "&Speak"; + this.btnSpeak.Click += new System.EventHandler(this.btnSpeak_Click); + this.btnExit.Location = new System.Drawing.Point(200, 80); + this.btnExit.Size = new System.Drawing.Size(80, 24); + this.btnExit.TabIndex = 2; + this.btnExit.Text = "&Exit"; + this.btnExit.Click += new System.EventHandler(this.btnExit_Click); + this.chkSaveToWavFile.Text = "Save to .wav"; + this.txtSpeakText.Location = new System.Drawing.Point(8, 8); + this.txtSpeakText.Size = new System.Drawing.Size(284, 60); + this.txtSpeakText.TabIndex = 3; + this.txtSpeakText.Multiline = true; + + this.txtSpeakText.Text = "This is Simple TTS application."; + this.txtSpeakText.WordWrap = true; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(299, 120); + this.Controls.AddRange(new System.Windows.Forms.Control[] {this.btnExit, + this.btnSpeak, + this.txtSpeakText, + this.chkSaveToWavFile}); + this.MaximizeBox = false; + this.Text = "SimpleTTS"; + + } + #endregion + + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.Run(new MainForm()); + } + + private void btnSpeak_Click(object sender, System.EventArgs e) + { + //Create a TTS voice and speak. + try + { + SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync; + SpVoice Voice = new SpVoice(); + if (chkSaveToWavFile.Checked) + { + SaveFileDialog sfd = new SaveFileDialog(); + + sfd.Filter = "All files (*.*)|*.*|wav files (*.wav)|*.wav"; + sfd.Title = "Save to a wave file"; + sfd.FilterIndex = 2; + sfd.RestoreDirectory = true; + + if (sfd.ShowDialog()== DialogResult.OK) + { + + SpeechStreamFileMode SpFileMode = SpeechStreamFileMode.SSFMCreateForWrite; + + SpFileStream SpFileStream = new SpFileStream(); + SpFileStream.Open(sfd.FileName, SpFileMode, false); + + Voice.AudioOutputStream = SpFileStream; + Voice.Speak(txtSpeakText.Text, SpFlags); + Voice.WaitUntilDone(Timeout.Infinite); + + SpFileStream.Close(); + + } + } + else + { + Voice.Speak(txtSpeakText.Text, SpFlags); + } + } + catch(Exception error) + { + MessageBox.Show("Speak error", "SimpleTTS", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void btnExit_Click(object sender, System.EventArgs e) + { + this.Dispose(); + } + } +} diff --git a/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.resx b/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/MainForm.resx new file mode 100644 index 00000000..e69de29b diff --git a/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/SimpleTTS.csproj b/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/SimpleTTS.csproj new file mode 100644 index 00000000..4fe54ad9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/CSharp/SimpleTTS/SimpleTTS.csproj @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sp/src/utils/sapi51/Samples/Common/TTSXmlDemo.xml b/sp/src/utils/sapi51/Samples/Common/TTSXmlDemo.xml new file mode 100644 index 00000000..d8663997 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/Common/TTSXmlDemo.xml @@ -0,0 +1,30 @@ + + +This is a basic functionality test for SAPI5 XML markup within the TTS Engine. If you haven't done so already, please choose Microsoft Mary for your voice and check the box labeled "IsXML" before clicking on "Speak" in order to begin the tutorial. + + + +Hello, my name is Microsoft Mike. Hello, my name is Microsoft Mary. Hello, my name is Microsoft Sam. Together we make up Microsoft's SAPI5 Text-to-Speech engine. With the use of XML tags, we can avoid the normal, default way that we read words and speak in general. + +First of all, you canchoosewhich voiceyou wish to hear through the use of a voice tag.Either Sam, Mary or myself can spell out words for you too.For example, the company "Microsoft" is spelledMicrosoftand the word "Windows" is spelled windows. + +We can also change the rate at which we speak.I am currently speaking at three times my normal rate.and I am currently speaking at one third my normal rate.Our pitch can be easily manipulated as well.This is an example of a high pitchand this is an example of a low pitch + +Another way to adjust the prosody of our speech is through the use of a silence tag.With a silence tag, an end user can make one of us pause for up to 65,536 milliseconds.For example, Iampausing500millisecondsbetweeneachwordofthissentence. + +The volume of our individual voices can also be raised and lowered through the use of XML tags. This is the loudest I can speakand this is the softest I can speak. + +In order to make our voices sound more natural, an emphasis tag can be used to allow us to place emphasis on certain words in a sentence. Compare the following two phrases: The movie will be this friday. The movie will be this friday. Pretty neat, don't you think? + +Don't worry, that isn't all that we can do through the proper use of XML tags. An end user can also decide which part of speech to use for each word in a sentence. Using the part of speech tag, we can force a certain pronunciation of a word without relying on the context around it. For example, the nominal pronunciation of the word "compact" is compact and the verbal pronunciation of the word "compact" is compact. We can also force certain pronunciations for modifiers, functions , interjections and abbreviations. + +Another great use of XML tags within the TTS Engine is the creation of your own words. Perhaps you want the computer to say a word that is not in the lexicon, such as "extracalifragilisticexpiallidocious." As you just heard, we do not recognize this word and have to use letter to sound rules in order to try and guess at a proper pronunciation. The pronunciation tag may be used to force the correct pronunciation of the word, . Wow, now tell me, doesn't that sound better? + +Now let's insert a bookmark here. Your application should have received a bookmark event with a bookmark id of 8 when speech synthesis has passed this element in the input stream. Bookmark event is an easy way for an application to take action at a given point in the stream. + + + + +Thanks for participating in this tutorial. I hope you have a better understanding of the basic functionality of XML tag usage within the TTS Engine. Enjoy! + + \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/Common/sol.xml b/sp/src/utils/sapi51/Samples/Common/sol.xml new file mode 100644 index 00000000..ec65f76a --- /dev/null +++ b/sp/src/utils/sapi51/Samples/Common/sol.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + +

new +game

-please +
+ + please +

play the

+ ... + + please +
+ + please +

+ +

move

+

put

+ +

the

+

+ + + +

on

+

to

+
+

the

+ +
+ please +
+ + +

+ + red + black + + +

+

+ + +

of

+ + clubs + hearts + diamonds + spades + + +

+ + club + heart + diamond + spade + +
+
+ + + ace + two + three + four + five + six + seven + eight + nine + ten + jack + queen + king + lady + emperor + + +
diff --git a/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/SimpleTTS.html b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/SimpleTTS.html new file mode 100644 index 00000000..5c7f853d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/SimpleTTS.html @@ -0,0 +1,226 @@ + + + + +TTS Demo + + + + + + + + + + + + +

Simple TTS (DHTML)

+

        + 

+

+ +

+ +

+Rate  +  +       + +Volume  +  + +

+ +

+ +

Voice                                              + Audio Output 

+

+ + +            + + + + + + + + + +


+

+ + + diff --git a/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthclo.bmp b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthclo.bmp new file mode 100644 index 00000000..630e5f3f Binary files /dev/null and b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthclo.bmp differ diff --git a/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthmed.bmp b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthmed.bmp new file mode 100644 index 00000000..87fca9c3 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthmed.bmp differ diff --git a/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthnar.bmp b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthnar.bmp new file mode 100644 index 00000000..3f00d5c1 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthnar.bmp differ diff --git a/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop1.bmp b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop1.bmp new file mode 100644 index 00000000..315edf83 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop1.bmp differ diff --git a/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop2.bmp b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop2.bmp new file mode 100644 index 00000000..eabfea9c Binary files /dev/null and b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop2.bmp differ diff --git a/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop3.bmp b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop3.bmp new file mode 100644 index 00000000..a520cbb5 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop3.bmp differ diff --git a/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop4.bmp b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop4.bmp new file mode 100644 index 00000000..9c4d1d15 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/Scripts/SimpleTTS/mouthop4.bmp differ diff --git a/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioApp.bas b/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioApp.bas new file mode 100644 index 00000000..430efb9e --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioApp.bas @@ -0,0 +1,4 @@ +Attribute VB_Name = "AudioApp" +Public Declare Function Sleep Lib "kernel32" _ +(ByVal dwMilliseconds As Long) As Long + diff --git a/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frm b/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frm new file mode 100644 index 00000000..02fcce47 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frm @@ -0,0 +1,238 @@ +VERSION 5.00 +Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" +Begin VB.Form AudioAppFrm + BorderStyle = 3 'Fixed Dialog + Caption = "AudioApp" + ClientHeight = 5310 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 3705 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 5310 + ScaleWidth = 3705 + ShowInTaskbar = 0 'False + StartUpPosition = 3 'Windows Default + Begin MSComctlLib.StatusBar AudioStatusBar + Align = 2 'Align Bottom + Height = 255 + Left = 0 + TabIndex = 4 + Top = 5055 + Width = 3705 + _ExtentX = 6535 + _ExtentY = 450 + Style = 1 + _Version = 393216 + BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} + NumPanels = 1 + BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} + EndProperty + EndProperty + End + Begin VB.TextBox SpeakTxt + Height = 1095 + Left = 240 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 0 + Text = "AudioAppFrm.frx":0000 + Top = 720 + Width = 3015 + End + Begin VB.CommandButton SpeakBtn + Caption = "Reco From TTS" + Default = -1 'True + Height = 375 + Left = 240 + TabIndex = 2 + Top = 4080 + Width = 1335 + End + Begin VB.CommandButton ExitBtn + Caption = "Exit" + Height = 375 + Left = 2040 + TabIndex = 1 + Top = 4080 + Width = 1215 + End + Begin VB.TextBox Recotxt + Height = 1095 + Left = 240 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 3 + Top = 2640 + Width = 3015 + End + Begin VB.Label Label2 + Caption = "Recognition Results:" + Height = 255 + Left = 240 + TabIndex = 6 + Top = 2280 + Width = 1935 + End + Begin VB.Label Label1 + Caption = "Enter text to recognize:" + Height = 255 + Left = 240 + TabIndex = 5 + Top = 360 + Width = 1815 + End +End +Attribute VB_Name = "AudioAppFrm" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' AudioAppFrm +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +'============================================================================= +Option Explicit + +Const AUDIOFORMAT = SAFT8kHz16BitMono + +'tts variables +Dim WithEvents Voice As SpVoice +Attribute Voice.VB_VarHelpID = -1 +Dim EndofStream As Boolean +Dim AudioPlugOut As SpAudioPlug + +'sr variables +Dim WithEvents RecoContext As SpInProcRecoContext +Attribute RecoContext.VB_VarHelpID = -1 +Dim Grammar As ISpeechRecoGrammar +Dim Recognizer As SpInprocRecognizer +Dim AudioPlugIn As SpAudioPlug + + +Private Sub ExitBtn_Click() + Grammar.DictationSetState SGDSInactive + Unload AudioAppFrm +End Sub + + + + + +Private Sub Form_Load() + + Set Voice = New SpVoice + EndofStream = False + + 'Set up the output audio object + Set AudioPlugOut = New SpAudioPlug + AudioPlugOut.Init True, AUDIOFORMAT + Set Voice.AudioOutputStream = AudioPlugOut + + + Debug.Print "Initializing SAPI reco context object..." + Set Recognizer = New SpInprocRecognizer + + 'Set up the input audio object + Set AudioPlugIn = New SpAudioPlug + AudioPlugIn.Init False, AUDIOFORMAT + Set Recognizer.AudioInputStream = AudioPlugIn + + + Set RecoContext = Recognizer.CreateRecoContext + Set Grammar = RecoContext.CreateGrammar(1) + Grammar.DictationLoad + + + + + +End Sub + +Public Sub PlayPlug() + + On Error GoTo Cancel + + Dim output As Variant + + Recotxt.Text = "" + Voice.Speak SpeakTxt.Text, SVSFlagsAsync + + EndofStream = False + + 'Update the status bar, before we start the feed the audio + AudioStatusBar.SimpleText = "Feeding TTS audio to SR..." + AudioStatusBar.Refresh + + Grammar.DictationSetState SGDSActive + + Do While (EndofStream = False) + + 'We need to process the message in the message queue + DoEvents + + 'Get the audio data from the audio object + output = AudioPlugOut.GetData + + + + 'Output the audio data to the input audio object + If (Len(output) * 2 <> 0) Then + AudioPlugIn.SetData (output) + End If + Sleep (500) + Loop + + 'Update the status bar after the we have feed all the audio data + AudioStatusBar.SimpleText = "SR Engine is doing dictation recognition..." + AudioStatusBar.Refresh + +Cancel: + Exit Sub + +End Sub + + + +Private Sub Form_Unload(Cancel As Integer) + Set AudioPlugIn = Nothing +End Sub + +Private Sub RecoContext_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal StreamReleased As Boolean) + + 'Update the status bar + AudioStatusBar.SimpleText = "Recognition done" + AudioStatusBar.Refresh + + 'User can start another recognition + SpeakBtn.Enabled = True + SpeakTxt.SetFocus + + + Grammar.DictationSetState SGDSInactive + +End Sub + +Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) +Recotxt.Text = Result.PhraseInfo.GetText & Recotxt.Text +End Sub + +Private Sub SpeakBtn_Click() + PlayPlug +End Sub + + +Private Sub Voice_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + EndofStream = True + +End Sub + + +Private Sub Voice_StartStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + SpeakBtn.Enabled = False + +End Sub diff --git a/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frx b/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frx new file mode 100644 index 00000000..c40d5036 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/AudioApp/AudioAppFrm.frx @@ -0,0 +1 @@ +Please enter the text here. \ No newline at end of file diff --git a/sp/src/utils/sapi51/Samples/VB/AudioApp/audioapp.vbp b/sp/src/utils/sapi51/Samples/VB/AudioApp/audioapp.vbp new file mode 100644 index 00000000..b810af64 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/AudioApp/audioapp.vbp @@ -0,0 +1,37 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#..\..\..\..\..\sdn_60\sapi\sapi\objd\i386\sapi.dll#Microsoft Speech Object Library +Reference=*\G{17709AA0-2512-4FFE-BB24-1F6C535DEBCA}#1.0#0#..\..\cpp\simpleaudio\objd\i386\simpleaudio.dll#simpleaudio 1.0 Type Library +Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; mscomctl.ocx +Form=AudioAppFrm.frm +Module=AudioApp; AudioApp.bas +Startup="AudioAppFrm" +ExeName32="audioapp.exe" +Command32="" +Name="Project1" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="MS" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListBoxSampleApp.frx b/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListBoxSampleApp.frx new file mode 100644 index 00000000..1e0b0f13 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListBoxSampleApp.frx differ diff --git a/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSample.vbg b/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSample.vbg new file mode 100644 index 00000000..3e6452f6 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSample.vbg @@ -0,0 +1,3 @@ +VBGROUP 5.0 +Project=SAPI51ListBox.vbp +StartupProject=SAPI51SampleApp.vbp diff --git a/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSampleApp.frm b/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSampleApp.frm new file mode 100644 index 00000000..17013004 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/ListboxVB/ListboxSampleApp.frm @@ -0,0 +1,131 @@ +VERSION 5.00 +Object = "*\ASAPI51ListBox.vbp" +Begin VB.Form MainForm + BorderStyle = 1 'Fixed Single + Caption = "Speech Enabled ListBox" + ClientHeight = 4215 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 4935 + Icon = "ListBoxSampleApp.frx":0000 + LinkTopic = "Form1" + MaxButton = 0 'False + ScaleHeight = 4215 + ScaleWidth = 4935 + StartUpPosition = 3 'Windows Default + Begin VB.CommandButton cmdRemove + Caption = "&Remove" + Height = 355 + Left = 3700 + TabIndex = 3 + Top = 3200 + Width = 1100 + End + Begin VB.CheckBox chkSpeechEnabled + Caption = "Speech &enabled" + Height = 255 + Left = 120 + TabIndex = 2 + Top = 3250 + Width = 1695 + End + Begin VB.CommandButton cmdAdd + Caption = "&Add" + Height = 355 + Left = 3700 + TabIndex = 6 + Top = 3720 + Width = 1100 + End + Begin VB.TextBox txtNewItem + Height = 315 + Left = 1320 + TabIndex = 5 + Text = "Seattle" + Top = 3740 + Width = 2175 + End + Begin SAPI51ListBox.Sample SpeechListBox + Height = 2205 + Left = 120 + TabIndex = 1 + Top = 840 + Width = 4680 + _ExtentX = 8255 + _ExtentY = 3889 + BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 400 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + End + Begin VB.Label Label2 + Caption = $"ListBoxSampleApp.frx":014A + Height = 615 + Left = 120 + TabIndex = 0 + Top = 120 + Width = 4680 + End + Begin VB.Label Label1 + Caption = "&Phrase to add:" + Height = 255 + Left = 120 + TabIndex = 4 + Top = 3770 + Width = 1040 + End +End +Attribute VB_Name = "MainForm" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This form is simple test application for the user control defined in sample.vbp. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +'============================================================================= + +Private Sub Form_Load() + If SpeechListBox.SpeechEnabled Then + chkSpeechEnabled = 1 + Else + chkSpeechEnabled = 0 + End If +End Sub + +Private Sub chkSpeechEnabled_Click() + SpeechListBox.SpeechEnabled = (chkSpeechEnabled = 1) +End Sub + +Private Sub cmdAdd_Click() + ' Add the new item. Internally to SpeechListBox, this will cause a rebuild + ' of the dynamic grammar used by speech recognition engine. + SpeechListBox.AddItem (txtNewItem) + txtNewItem = "" +End Sub + +Private Sub cmdRemove_Click() + ' Just remove the current selected item. Same as AddItem, removing an item + ' causes a grammar rebuild as well. + If SpeechListBox.ListIndex <> -1 Then + SpeechListBox.RemoveItem SpeechListBox.ListIndex + End If +End Sub + +Private Sub txtNewItem_Change() + ' Disallow empty item. + cmdAdd.Enabled = txtNewItem <> "" +End Sub + +Private Sub txtNewItem_GotFocus() + ' When user focuses on the new item box, make the Add button default + ' so that return key is same as clicking on Add button. + cmdAdd.Default = True +End Sub diff --git a/sp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51Listbox.vbp b/sp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51Listbox.vbp new file mode 100644 index 00000000..c1065414 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51Listbox.vbp @@ -0,0 +1,44 @@ +Type=Control +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{7C0FFAB0-CD84-11D0-949A-00A0C91110ED}#1.0#0#C:\winnt\System32\msdatsrc.tlb#Microsoft Data Source Interfaces +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll#Microsoft Speech Object Library +UserControl=Sample.ctl +Startup="(None)" +HelpFile="" +Title="SAPI51ListBox" +ExeName32="SAPI51ListBox.ocx" +Command32="" +Name="SAPI51ListBox" +HelpContextID="0" +Description="Speech enabled ListBox ActiveX control" +CompatibleMode="1" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corporation" +VersionFileDescription="SAPI51 VB ListBox sample control" +VersionLegalCopyright="Copyright (C) Microsoft Corporation. 1981-2001" +VersionProductName="Microsoft® Windows(TM) Operating System" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=1 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +ThreadingModel=1 +DebugStartupOption=1 +DebugStartupComponent=Sample + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51SampleApp.vbp b/sp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51SampleApp.vbp new file mode 100644 index 00000000..63740830 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/ListboxVB/SAPI51SampleApp.vbp @@ -0,0 +1,42 @@ +Type=Exe +Form=ListBoxSampleApp.frm +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Object=*\ASAPI51ListBox.vbp +IconForm="MainForm" +Startup="MainForm" +HelpFile="" +Title="SAPI51SampleApp" +ExeName32="SAPI51SampleApp.exe" +Command32="" +Name="SAPI51SampleApp" +HelpContextID="0" +Description="SAPI51 sample application for the speech enabled VB ListBox sample control" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corporation" +VersionFileDescription="SAPI51 VB ListBox sample application" +VersionLegalCopyright="Copyright (C) Microsoft Corporation. 1981-2001" +VersionProductName="Microsoft® Windows(TM) Operating System" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Samples/VB/ListboxVB/Sample.ctl b/sp/src/utils/sapi51/Samples/VB/ListboxVB/Sample.ctl new file mode 100644 index 00000000..e935edb2 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/ListboxVB/Sample.ctl @@ -0,0 +1,867 @@ +VERSION 5.00 +Begin VB.UserControl Sample + ClientHeight = 690 + ClientLeft = 0 + ClientTop = 0 + ClientWidth = 1815 + ScaleHeight = 690 + ScaleWidth = 1815 + Begin VB.ListBox InnerList + Height = 450 + Left = 0 + TabIndex = 0 + Top = 0 + Width = 1575 + End +End +Attribute VB_Name = "Sample" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = True +Attribute VB_PredeclaredId = False +Attribute VB_Exposed = True +Option Explicit + +' See UserControl_Resize() for how iLevelInResize is used. +' It's needed to make sure our control resizes correctly. +Dim iLevelInResize As Integer + +' declare all speech related variables +Const m_GrammarId = 10 +Dim bSpeechInitialized As Boolean +Dim WithEvents RecoContext As SpSharedRecoContext +Attribute RecoContext.VB_VarHelpID = -1 +Dim Grammar As ISpeechRecoGrammar +Dim TopRule As ISpeechGrammarRule +Dim ListItemsRule As ISpeechGrammarRule + +'Event Declarations: +Event ItemCheck(Item As Integer) 'MappingInfo=InnerList,InnerList,-1,ItemCheck +Attribute ItemCheck.VB_Description = "Occurs when a ListBox control's Style property is set to 1 (checkboxes) and an item's checkbox in the ListBox control is selected or cleared." +Event OLEStartDrag(Data As DataObject, AllowedEffects As Long) 'MappingInfo=InnerList,InnerList,-1,OLEStartDrag +Attribute OLEStartDrag.VB_Description = "Occurs when an OLE drag/drop operation is initiated either manually or automatically." +Event OLESetData(Data As DataObject, DataFormat As Integer) 'MappingInfo=InnerList,InnerList,-1,OLESetData +Attribute OLESetData.VB_Description = "Occurs at the OLE drag/drop source control when the drop target requests data that was not provided to the DataObject during the OLEDragStart event." +Event OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean) 'MappingInfo=InnerList,InnerList,-1,OLEGiveFeedback +Attribute OLEGiveFeedback.VB_Description = "Occurs at the source control of an OLE drag/drop operation when the mouse cursor needs to be changed." +Event OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer) 'MappingInfo=InnerList,InnerList,-1,OLEDragOver +Attribute OLEDragOver.VB_Description = "Occurs when the mouse is moved over the control during an OLE drag/drop operation, if its OLEDropMode property is set to manual." +Event OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=InnerList,InnerList,-1,OLEDragDrop +Attribute OLEDragDrop.VB_Description = "Occurs when data is dropped onto the control via an OLE drag/drop operation, and OLEDropMode is set to manual." +Event OLECompleteDrag(Effect As Long) 'MappingInfo=InnerList,InnerList,-1,OLECompleteDrag +Attribute OLECompleteDrag.VB_Description = "Occurs at the OLE drag/drop source control after a manual or automatic drag/drop has been completed or canceled." +Event Scroll() 'MappingInfo=InnerList,InnerList,-1,Scroll +Attribute Scroll.VB_Description = "Occurs when you reposition the scroll box on a control." +Event Validate(Cancel As Boolean) 'MappingInfo=InnerList,InnerList,-1,Validate +Attribute Validate.VB_Description = "Occurs when a control loses focus to a control that causes validation." +'Default Property Values: +Const m_def_PreCommandString = "Select" +Const m_def_SpeechEnabled = True +'Property Variables: +Dim m_PreCommandString As String +Dim m_SpeechEnabled As Boolean + + +Private Sub InitializeSpeech() + ' This function will create the main SpSharedRecoContext object and other + ' required objects like Grammar and rules. In this sample, we are building + ' grammar dynamically since listbox content can change from time to time. + ' If your grammar is static, you can write your grammar file and ask SAPI + ' to load it during run time. This can reduce the complexity of your code. + + On Error GoTo ErrorHandler + + If Not bSpeechInitialized Then + Debug.Print "Initializing speech" + + Dim AfterCmdState As ISpeechGrammarRuleState + Set RecoContext = New SpSharedRecoContext + Set Grammar = RecoContext.CreateGrammar(m_GrammarId) + + ' Add two rules. The top level rule will reference the items rule. + Set TopRule = Grammar.Rules.Add("TopLevelRule", SRATopLevel Or SRADynamic, 1) + Set ListItemsRule = Grammar.Rules.Add("ListItemsRule", SRADynamic, 2) + + Set AfterCmdState = TopRule.AddState + + ' The top level rule consists of two parts: "select ". So we first + ' add a word transition for the "select" part, then a rule transition + ' for the "" part, which is dynamically built as items are added + ' or removed from the listbox. + TopRule.InitialState.AddWordTransition AfterCmdState, _ + m_PreCommandString, " ", , "", 0, 0 + AfterCmdState.AddRuleTransition Nothing, ListItemsRule, "", 1, 1 + + ' Now add existing list items to the ListItemsRule + RebuildGrammar + + ' Now we can activate the top level rule. In this sample, only the top + ' level rule needs to activated. The ListItemsRule is referenced by + ' the top level rule. + Grammar.CmdSetRuleState "TopLevelRule", SGDSActive + + bSpeechInitialized = True + End If + + Exit Sub + +ErrorHandler: + MsgBox "SAPI failed to initialize. This application may not run correctly." +End Sub + +Friend Sub EnableSpeech() + Debug.Print "Enabling speech" + If Not bSpeechInitialized Then Call InitializeSpeech + + ' once all objects are initialized, we need to update grammar + RebuildGrammar + RecoContext.State = SRCS_Enabled +End Sub + +Friend Sub DisableSpeech() + Debug.Print "Disabling speech" + + ' Putting the recognition context to disabled state will stop speech + ' recognition. Changing the state to enabled will start recognition again. + If bSpeechInitialized Then RecoContext.State = SRCS_Disabled +End Sub + + +Private Sub RebuildGrammar() + ' In this funtion, we are only rebuilding the ListItemRule, as this is the + ' only part that's really changing dynamically in this sample. However, + ' you still have to call Grammar.Rules.Commit to commit the grammar. + + On Error GoTo ErrorHandler + + ' First, clear the rule + ListItemsRule.Clear + + ' Now, add all items to the rule + Dim i As Integer + For i = 0 To InnerList.ListCount - 1 + Dim text As String + text = InnerList.List(i) + + ' Note: if the same word is added more than once to the same rule state, + ' SAPI will return error. In this sample, we don't allow identical items + ' in the list box so no need for the checking, otherwise special checking + ' for identical words would have to be done here. + ListItemsRule.InitialState.AddWordTransition Nothing, text, " ", , text, i, i + Next + + Grammar.Rules.Commit + Exit Sub + +ErrorHandler: + MsgBox "Error when rebuiling dynamic list box grammar: " & Err.Number +End Sub + + +Private Sub RecoContext_Hypothesis(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal Result As ISpeechRecoResult _ + ) + + ' This event is fired when the recognizer thinks there's possible + ' recognitions. + Debug.Print "Hypothesis: " & Result.PhraseInfo.GetText & ", " & _ + StreamNumber & ", " & StreamPosition +End Sub + +Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal RecognitionType As SpeechRecognitionType, _ + ByVal Result As ISpeechRecoResult _ + ) + + ' This event is fired when something in the grammar is recognized. + Debug.Print "Recognition: " & Result.PhraseInfo.GetText & ", " & _ + StreamNumber & ", " & StreamPosition + + Dim index As Integer + Dim oItem As ISpeechPhraseProperty + + ' oItem will be the property of the second part in the recognized phase. + ' For example, if the top level rule matchs "select Seattle". Then the + ' ListItemsRule matches "Seattle" part. The following code will get the + ' property of the "Seattle" phrase, which is set when the word "Seattle" + ' is added to the ListItemsRule in RebuildGrammar. + Set oItem = Result.PhraseInfo.Properties(1).Children(0) + index = oItem.Id + + If Result.PhraseInfo.GrammarId = m_GrammarId Then + + ' Check to see if the item at the same position in the list still has the + ' same text. + ' This is to prevent the rare case that the user keeps talking while + ' the list is being added or removed. By the time this event is fired + ' and handled, the list box may have already changed. + If oItem.Name = InnerList.List(index) Then + InnerList.ListIndex = index + End If + End If +End Sub + + +Private Sub UserControl_Initialize() + iLevelInResize = 0 + bSpeechInitialized = False +End Sub + +Private Sub UserControl_Resize() + + ' When the user control is resized, the inner listbox has to be resized + ' so that it takes up all the area. + ' Since height of inner ListBox changes by the height of a line of text, + ' we have to adjust the user control's size, which may cause reentrance to + ' this Resize() function. iLevelInResize is used to prevent infinite loop. + iLevelInResize = iLevelInResize + 1 + + If iLevelInResize = 1 Then + InnerList.Move 0, 0, Width, Height + + ' The following lines will cause Resize events and thus re-entrance + ' to this function. Since iLevelInResize will not be 1 during + ' re-entrance, we prevented infinite loop. + Height = InnerList.Height + Width = InnerList.Width + End If + + iLevelInResize = iLevelInResize - 1 +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,AddItem +Public Sub AddItem(ByVal Item As String, Optional ByVal index As Variant) +Attribute AddItem.VB_Description = "Adds an item to a ListBox or ComboBox control or a row to a Grid control." + + ' Since we can't add the same word to the same transition in the grammar, + ' we don't allow same string to be added multiple times. + ' So do nothing if Item is already in the list. Some level of error + ' message may be helpful. The sample chooses to silently ignore to keep + ' code simple. + + ' The leading and trailing spaces are not needed, trim it before inserting. + ' SAPI will return error in AddWordTransition if two phrases differ only + ' in spaces. A program needs to handle this error if random phrase is + ' added to a rule. + ' Note: In this sample, we only trim leading and trailing spaces. Internal + ' spaces will need to be handled as well. + + Item = Trim(Item) + + If Item = "" Then + Exit Sub + End If + + If InnerList.ListCount > 0 Then + Dim i As Integer + For i = 0 To InnerList.ListCount - 1 + If StrComp(Item, InnerList.List(i), vbTextCompare) = 0 Then + Exit Sub + End If + Next + End If + + ' if it doesn't exist yet, add it to the list + InnerList.AddItem Item, index + + ' if speech is enabled, we need to update the grammar with new changes + If m_SpeechEnabled Then RebuildGrammar +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Appearance +Public Property Get Appearance() As Integer +Attribute Appearance.VB_Description = "Returns/sets whether or not an object is painted at run time with 3-D effects." +Attribute Appearance.VB_ProcData.VB_Invoke_Property = ";Appearance" +Attribute Appearance.VB_UserMemId = -520 + Appearance = InnerList.Appearance +End Property + +Public Property Let Appearance(ByVal New_Appearance As Integer) + InnerList.Appearance() = New_Appearance + PropertyChanged "Appearance" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,BackColor +Public Property Get BackColor() As OLE_COLOR +Attribute BackColor.VB_Description = "Returns/sets the background color used to display text and graphics in an object." +Attribute BackColor.VB_ProcData.VB_Invoke_Property = ";Appearance" + BackColor = InnerList.BackColor +End Property + +Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR) + InnerList.BackColor() = New_BackColor + PropertyChanged "BackColor" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,CausesValidation +Public Property Get CausesValidation() As Boolean +Attribute CausesValidation.VB_Description = "Returns/sets whether validation occurs on the control which lost focus." +Attribute CausesValidation.VB_ProcData.VB_Invoke_Property = ";Behavior" + CausesValidation = InnerList.CausesValidation +End Property + +Public Property Let CausesValidation(ByVal New_CausesValidation As Boolean) + InnerList.CausesValidation() = New_CausesValidation + PropertyChanged "CausesValidation" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Clear +Public Sub Clear() +Attribute Clear.VB_Description = "Clears the contents of a control or the system Clipboard." + InnerList.Clear +End Sub + + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Columns +Public Property Get Columns() As Integer +Attribute Columns.VB_Description = "Returns/sets a value that determines whether a ListBox scrolls vertically in a single column (value of 0) or horizontally in snaking columns (values greater than 0)." + Columns = InnerList.Columns +End Property + +Public Property Let Columns(ByVal New_Columns As Integer) + InnerList.Columns() = New_Columns + PropertyChanged "Columns" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,DataMember +Public Property Get DataMember() As String +Attribute DataMember.VB_Description = "Returns/sets a value that describes the DataMember for a data connection." +Attribute DataMember.VB_ProcData.VB_Invoke_Property = ";Data" + DataMember = InnerList.DataMember +End Property + +Public Property Let DataMember(ByVal New_DataMember As String) + InnerList.DataMember() = New_DataMember + PropertyChanged "DataMember" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,DataSource +Public Property Get DataSource() As DataSource +Attribute DataSource.VB_Description = "Sets a value that specifies the Data control through which the current control is bound to a database. " +Attribute DataSource.VB_ProcData.VB_Invoke_Property = ";Data" + Set DataSource = InnerList.DataSource +End Property + +Public Property Set DataSource(ByVal New_DataSource As DataSource) + Set InnerList.DataSource = New_DataSource + PropertyChanged "DataSource" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Enabled +Public Property Get Enabled() As Boolean +Attribute Enabled.VB_Description = "Returns/sets a value that determines whether an object can respond to user-generated events." +Attribute Enabled.VB_ProcData.VB_Invoke_Property = ";Behavior" + Enabled = InnerList.Enabled +End Property + +Public Property Let Enabled(ByVal New_Enabled As Boolean) + InnerList.Enabled() = New_Enabled + PropertyChanged "Enabled" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontUnderline +Public Property Get FontUnderline() As Boolean +Attribute FontUnderline.VB_Description = "Returns/sets underline font styles." +Attribute FontUnderline.VB_MemberFlags = "400" + FontUnderline = InnerList.FontUnderline +End Property + +Public Property Let FontUnderline(ByVal New_FontUnderline As Boolean) + InnerList.FontUnderline() = New_FontUnderline +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontStrikethru +Public Property Get FontStrikethru() As Boolean +Attribute FontStrikethru.VB_Description = "Returns/sets strikethrough font styles." +Attribute FontStrikethru.VB_MemberFlags = "400" + FontStrikethru = InnerList.FontStrikethru +End Property + +Public Property Let FontStrikethru(ByVal New_FontStrikethru As Boolean) + InnerList.FontStrikethru() = New_FontStrikethru +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontSize +Public Property Get FontSize() As Single +Attribute FontSize.VB_Description = "Specifies the size (in points) of the font that appears in each row for the given level." +Attribute FontSize.VB_MemberFlags = "400" + FontSize = InnerList.FontSize +End Property + +Public Property Let FontSize(ByVal New_FontSize As Single) + InnerList.FontSize() = New_FontSize +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontName +Public Property Get FontName() As String +Attribute FontName.VB_Description = "Specifies the name of the font that appears in each row for the given level." +Attribute FontName.VB_MemberFlags = "400" + FontName = InnerList.FontName +End Property + +Public Property Let FontName(ByVal New_FontName As String) + InnerList.FontName() = New_FontName +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontItalic +Public Property Get FontItalic() As Boolean +Attribute FontItalic.VB_Description = "Returns/sets italic font styles." +Attribute FontItalic.VB_MemberFlags = "400" + FontItalic = InnerList.FontItalic +End Property + +Public Property Let FontItalic(ByVal New_FontItalic As Boolean) + InnerList.FontItalic() = New_FontItalic +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,FontBold +Public Property Get FontBold() As Boolean +Attribute FontBold.VB_Description = "Returns/sets bold font styles." +Attribute FontBold.VB_MemberFlags = "400" + FontBold = InnerList.FontBold +End Property + +Public Property Let FontBold(ByVal New_FontBold As Boolean) + InnerList.FontBold() = New_FontBold +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Font +Public Property Get Font() As Font +Attribute Font.VB_Description = "Returns a Font object." +Attribute Font.VB_ProcData.VB_Invoke_Property = ";Font" +Attribute Font.VB_UserMemId = -512 + Set Font = InnerList.Font +End Property + +Public Property Set Font(ByVal New_Font As Font) + Set InnerList.Font = New_Font + PropertyChanged "Font" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ForeColor +Public Property Get ForeColor() As OLE_COLOR +Attribute ForeColor.VB_Description = "Returns/sets the foreground color used to display text and graphics in an object." +Attribute ForeColor.VB_ProcData.VB_Invoke_Property = ";Appearance" + ForeColor = InnerList.ForeColor +End Property + +Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR) + InnerList.ForeColor() = New_ForeColor + PropertyChanged "ForeColor" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,hWnd +Public Property Get hWnd() As Long +Attribute hWnd.VB_Description = "Returns a handle (from Microsoft Windows) to an object's window." + hWnd = InnerList.hWnd +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,IntegralHeight +Public Property Get IntegralHeight() As Boolean +Attribute IntegralHeight.VB_Description = "Returns/Sets a value indicating whether the control displays partial items." +Attribute IntegralHeight.VB_ProcData.VB_Invoke_Property = ";List" + IntegralHeight = InnerList.IntegralHeight +End Property + +Private Sub InnerList_ItemCheck(Item As Integer) + RaiseEvent ItemCheck(Item) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ItemData +Public Property Get ItemData(ByVal index As Integer) As Long +Attribute ItemData.VB_Description = "Returns/sets a specific number for each item in a ComboBox or ListBox control." +Attribute ItemData.VB_ProcData.VB_Invoke_Property = ";List" + ItemData = InnerList.ItemData(index) +End Property + +Public Property Let ItemData(ByVal index As Integer, ByVal New_ItemData As Long) + InnerList.ItemData(index) = New_ItemData + PropertyChanged "ItemData" +End Property + + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ListIndex +Public Property Get ListIndex() As Integer +Attribute ListIndex.VB_Description = "Returns/sets the index of the currently selected item in the control." +Attribute ListIndex.VB_MemberFlags = "400" + ListIndex = InnerList.ListIndex +End Property + +Public Property Let ListIndex(ByVal New_ListIndex As Integer) + InnerList.ListIndex() = New_ListIndex +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ListCount +Public Property Get ListCount() As Integer +Attribute ListCount.VB_Description = "Returns the number of items in the list portion of a control." + ListCount = InnerList.ListCount +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,List +Public Property Get List(ByVal index As Integer) As String +Attribute List.VB_Description = "Returns/sets the items contained in a control's list portion." +Attribute List.VB_ProcData.VB_Invoke_Property = ";List" +Attribute List.VB_UserMemId = 0 + List = InnerList.List(index) +End Property + +Public Property Let List(ByVal index As Integer, ByVal New_List As String) + InnerList.List(index) = New_List + PropertyChanged "List" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,MousePointer +Public Property Get MousePointer() As Integer +Attribute MousePointer.VB_Description = "Returns/sets the type of mouse pointer displayed when over part of an object." + MousePointer = InnerList.MousePointer +End Property + +Public Property Let MousePointer(ByVal New_MousePointer As Integer) + InnerList.MousePointer() = New_MousePointer + PropertyChanged "MousePointer" +End Property + + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,MouseIcon +Public Property Get MouseIcon() As Picture +Attribute MouseIcon.VB_Description = "Sets a custom mouse icon." + Set MouseIcon = InnerList.MouseIcon +End Property + +Public Property Set MouseIcon(ByVal New_MouseIcon As Picture) + Set InnerList.MouseIcon = New_MouseIcon + PropertyChanged "MouseIcon" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,MultiSelect +Public Property Get MultiSelect() As Integer +Attribute MultiSelect.VB_Description = "Returns/sets a value that determines whether a user can make multiple selections in a control." + MultiSelect = InnerList.MultiSelect +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,NewIndex +Public Property Get NewIndex() As Integer +Attribute NewIndex.VB_Description = "Returns the index of the item most recently added to a control." + NewIndex = InnerList.NewIndex +End Property + +Private Sub InnerList_OLEStartDrag(Data As DataObject, AllowedEffects As Long) + RaiseEvent OLEStartDrag(Data, AllowedEffects) +End Sub + +Private Sub InnerList_OLESetData(Data As DataObject, DataFormat As Integer) + RaiseEvent OLESetData(Data, DataFormat) +End Sub + +Private Sub InnerList_OLEGiveFeedback(Effect As Long, DefaultCursors As Boolean) + RaiseEvent OLEGiveFeedback(Effect, DefaultCursors) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,OLEDropMode +Public Property Get OLEDropMode() As Integer +Attribute OLEDropMode.VB_Description = "Returns/Sets whether this object can act as an OLE drop target." +Attribute OLEDropMode.VB_ProcData.VB_Invoke_Property = ";Behavior" + OLEDropMode = InnerList.OLEDropMode +End Property + +Public Property Let OLEDropMode(ByVal New_OLEDropMode As Integer) + InnerList.OLEDropMode() = New_OLEDropMode + PropertyChanged "OLEDropMode" +End Property + +Private Sub InnerList_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer) + RaiseEvent OLEDragOver(Data, Effect, Button, Shift, X, Y, State) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,OLEDragMode +Public Property Get OLEDragMode() As Integer +Attribute OLEDragMode.VB_Description = "Returns/Sets whether this object can act as an OLE drag/drop source, and whether this process is started automatically or under programmatic control." +Attribute OLEDragMode.VB_ProcData.VB_Invoke_Property = ";Behavior" + OLEDragMode = InnerList.OLEDragMode +End Property + +Public Property Let OLEDragMode(ByVal New_OLEDragMode As Integer) + InnerList.OLEDragMode() = New_OLEDragMode + PropertyChanged "OLEDragMode" +End Property + +Private Sub InnerList_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single) + RaiseEvent OLEDragDrop(Data, Effect, Button, Shift, X, Y) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,OLEDrag +Public Sub OLEDrag() +Attribute OLEDrag.VB_Description = "Starts an OLE drag/drop event with the given control as the source." + InnerList.OLEDrag +End Sub + +Private Sub InnerList_OLECompleteDrag(Effect As Long) + RaiseEvent OLECompleteDrag(Effect) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,RemoveItem +Public Sub RemoveItem(ByVal index As Integer) +Attribute RemoveItem.VB_Description = "Removes an item from a ListBox or ComboBox control or a row from a Grid control." + InnerList.RemoveItem index + If m_SpeechEnabled Then RebuildGrammar +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Refresh +Public Sub Refresh() +Attribute Refresh.VB_Description = "Forces a complete repaint of a object." + InnerList.Refresh +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,RightToLeft +Public Property Get RightToLeft() As Boolean +Attribute RightToLeft.VB_Description = "Determines text display direction and control visual appearance on a bidirectional system." +Attribute RightToLeft.VB_ProcData.VB_Invoke_Property = ";Behavior" + RightToLeft = InnerList.RightToLeft +End Property + +Public Property Let RightToLeft(ByVal New_RightToLeft As Boolean) + InnerList.RightToLeft() = New_RightToLeft + PropertyChanged "RightToLeft" +End Property + +Private Sub InnerList_Scroll() + RaiseEvent Scroll +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Selected +Public Property Get Selected(ByVal index As Integer) As Boolean +Attribute Selected.VB_Description = "Returns/sets the selection status of an item in a control." + Selected = InnerList.Selected(index) +End Property + +Public Property Let Selected(ByVal index As Integer, ByVal New_Selected As Boolean) + InnerList.Selected(index) = New_Selected +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,SelCount +Public Property Get SelCount() As Integer +Attribute SelCount.VB_Description = "Returns the number of selected items in a ListBox control." + SelCount = InnerList.SelCount +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Style +Public Property Get Style() As Integer +Attribute Style.VB_Description = "Returns/sets a value that determines whether checkboxes are displayed inside a ListBox control." +Attribute Style.VB_ProcData.VB_Invoke_Property = ";Appearance" + Style = InnerList.Style +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Sorted +Public Property Get Sorted() As Boolean +Attribute Sorted.VB_Description = "Indicates whether the elements of a control are automatically sorted alphabetically." +Attribute Sorted.VB_ProcData.VB_Invoke_Property = ";Behavior" + Sorted = InnerList.Sorted +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,Text +Public Property Get text() As String +Attribute text.VB_Description = "Returns/sets the text contained in the control." + text = InnerList.text +End Property + +Public Property Let text(ByVal New_Text As String) + InnerList.text() = New_Text + PropertyChanged "Text" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,ToolTipText +Public Property Get ToolTipText() As String +Attribute ToolTipText.VB_Description = "Returns/sets the text displayed when the mouse is paused over the control." + ToolTipText = InnerList.ToolTipText +End Property + +Public Property Let ToolTipText(ByVal New_ToolTipText As String) + InnerList.ToolTipText() = New_ToolTipText + PropertyChanged "ToolTipText" +End Property + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,TopIndex +Public Property Get TopIndex() As Integer +Attribute TopIndex.VB_Description = "Returns/sets which item in a control is displayed in the topmost position." + TopIndex = InnerList.TopIndex +End Property + +Public Property Let TopIndex(ByVal New_TopIndex As Integer) + InnerList.TopIndex() = New_TopIndex + PropertyChanged "TopIndex" +End Property + +Private Sub InnerList_Validate(Cancel As Boolean) + RaiseEvent Validate(Cancel) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MappingInfo=InnerList,InnerList,-1,WhatsThisHelpID +Public Property Get WhatsThisHelpID() As Long +Attribute WhatsThisHelpID.VB_Description = "Returns/sets an associated context number for an object." + WhatsThisHelpID = InnerList.WhatsThisHelpID +End Property + +Public Property Let WhatsThisHelpID(ByVal New_WhatsThisHelpID As Long) + InnerList.WhatsThisHelpID() = New_WhatsThisHelpID + PropertyChanged "WhatsThisHelpID" +End Property + +'Load property values from storage +Private Sub UserControl_ReadProperties(PropBag As PropertyBag) + Dim index As Integer + Dim Count As Integer + + InnerList.Appearance = PropBag.ReadProperty("Appearance", 1) + InnerList.BackColor = PropBag.ReadProperty("BackColor", &H80000005) + InnerList.CausesValidation = PropBag.ReadProperty("CausesValidation", True) + If PropBag.ReadProperty("Columns", 0) <> 0 Then + InnerList.Columns = PropBag.ReadProperty("Columns", 0) + End If + InnerList.DataMember = PropBag.ReadProperty("DataMember", "") + Set DataSource = PropBag.ReadProperty("DataSource", Nothing) + InnerList.Enabled = PropBag.ReadProperty("Enabled", True) + Set InnerList.Font = PropBag.ReadProperty("Font", Ambient.Font) + InnerList.ForeColor = PropBag.ReadProperty("ForeColor", &H80000008) + + Count = PropBag.ReadProperty("ListCount", 0) + For index = 0 To Count - 1 + InnerList.ItemData(index) = PropBag.ReadProperty("ItemData" & index, 0) + InnerList.List(index) = PropBag.ReadProperty("List" & index, "") + Next + + InnerList.MousePointer = PropBag.ReadProperty("MousePointer", 0) + Set MouseIcon = PropBag.ReadProperty("MouseIcon", Nothing) + InnerList.OLEDropMode = PropBag.ReadProperty("OLEDropMode", 0) + InnerList.OLEDragMode = PropBag.ReadProperty("OLEDragMode", 0) + InnerList.RightToLeft = PropBag.ReadProperty("RightToLeft", False) + InnerList.text = PropBag.ReadProperty("Text", "") + InnerList.ToolTipText = PropBag.ReadProperty("ToolTipText", "") + InnerList.TopIndex = PropBag.ReadProperty("TopIndex", 0) + InnerList.WhatsThisHelpID = PropBag.ReadProperty("WhatsThisHelpID", 0) + m_PreCommandString = PropBag.ReadProperty("PreCommandString", m_def_PreCommandString) + Me.SpeechEnabled = PropBag.ReadProperty("SpeechEnabled", m_def_SpeechEnabled) +End Sub + +'Write property values to storage +Private Sub UserControl_WriteProperties(PropBag As PropertyBag) + Dim index As Integer + + Call PropBag.WriteProperty("Appearance", InnerList.Appearance, 1) + Call PropBag.WriteProperty("BackColor", InnerList.BackColor, &H80000005) + Call PropBag.WriteProperty("CausesValidation", InnerList.CausesValidation, True) + Call PropBag.WriteProperty("Columns", InnerList.Columns, 0) + Call PropBag.WriteProperty("DataMember", InnerList.DataMember, "") + Call PropBag.WriteProperty("DataSource", DataSource, Nothing) + Call PropBag.WriteProperty("Enabled", InnerList.Enabled, True) + Call PropBag.WriteProperty("Font", InnerList.Font, Ambient.Font) + Call PropBag.WriteProperty("ForeColor", InnerList.ForeColor, &H80000008) + + Call PropBag.WriteProperty("ListCount", InnerList.ListCount, 0) + For index = 0 To InnerList.ListCount - 1 + Call PropBag.WriteProperty("ItemData" & index, InnerList.ItemData(index), 0) + Call PropBag.WriteProperty("List" & index, InnerList.List(index), "") + Next + + Call PropBag.WriteProperty("MousePointer", InnerList.MousePointer, 0) + Call PropBag.WriteProperty("MouseIcon", MouseIcon, Nothing) + Call PropBag.WriteProperty("OLEDropMode", InnerList.OLEDropMode, 0) + Call PropBag.WriteProperty("OLEDragMode", InnerList.OLEDragMode, 0) + Call PropBag.WriteProperty("RightToLeft", InnerList.RightToLeft, False) + Call PropBag.WriteProperty("Text", InnerList.text, "") + Call PropBag.WriteProperty("ToolTipText", InnerList.ToolTipText, "") + Call PropBag.WriteProperty("TopIndex", InnerList.TopIndex, 0) + Call PropBag.WriteProperty("WhatsThisHelpID", InnerList.WhatsThisHelpID, 0) + Call PropBag.WriteProperty("SpeechEnabled", m_SpeechEnabled, m_def_SpeechEnabled) + Call PropBag.WriteProperty("PreCommandString", m_PreCommandString, m_def_PreCommandString) +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MemberInfo=0,0,0,True +Public Property Get SpeechEnabled() As Boolean +Attribute SpeechEnabled.VB_Description = "Whether speech recognition is enabled or not." + SpeechEnabled = m_SpeechEnabled +End Property + +Public Property Let SpeechEnabled(ByVal New_SpeechEnabled As Boolean) + If m_SpeechEnabled <> New_SpeechEnabled Then + m_SpeechEnabled = New_SpeechEnabled + + If Ambient.UserMode Then + If m_SpeechEnabled = True Then + Call EnableSpeech + Else + Call DisableSpeech + End If + End If + + PropertyChanged "SpeechEnabled" + End If +End Property + +'Initialize Properties for User Control +Private Sub UserControl_InitProperties() + m_PreCommandString = m_def_PreCommandString + Me.SpeechEnabled = m_def_SpeechEnabled +End Sub + +'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES! +'MemberInfo=13,1,0,Select +Public Property Get PreCommandString() As String +Attribute PreCommandString.VB_Description = "This property is used to determine what word or words a user needs to say to get the listbox to recognized individual list items." + PreCommandString = m_PreCommandString +End Property + +Public Property Let PreCommandString(ByVal New_PreCommandString As String) + + ' This property is not available during run time to simplify sample code. + ' To support it in run time, you will need to dynamically rebuild the top + ' level rule when this property changes. + + ' If a run time attempt is made to change this property, error is raised. + If Ambient.UserMode Then Err.Raise 382 + m_PreCommandString = New_PreCommandString + PropertyChanged "PreCommandString" +End Property + diff --git a/sp/src/utils/sapi51/Samples/VB/ListboxVB/small.ico b/sp/src/utils/sapi51/Samples/VB/ListboxVB/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/ListboxVB/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/VB/RecoVB/recovb.frm b/sp/src/utils/sapi51/Samples/VB/RecoVB/recovb.frm new file mode 100644 index 00000000..907d87bc --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/RecoVB/recovb.frm @@ -0,0 +1,1162 @@ +VERSION 5.00 +Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx" +Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" +Begin VB.Form Form1 + BorderStyle = 1 'Fixed Single + Caption = "Basic Speech Recognition" + ClientHeight = 9195 + ClientLeft = 150 + ClientTop = 720 + ClientWidth = 9435 + ForeColor = &H000000FF& + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 613 + ScaleMode = 3 'Pixel + ScaleWidth = 629 + StartUpPosition = 3 'Windows Default + Begin VB.CommandButton PlayAudio + Caption = "Play Audio" + Height = 375 + Left = 4320 + TabIndex = 39 + Top = 8760 + Width = 1815 + End + Begin VB.CheckBox RetainAudio + Caption = "Retain Audio" + Height = 255 + Left = 6240 + TabIndex = 38 + Top = 8880 + Width = 1215 + End + Begin VB.Frame Frame4 + Caption = "Engine Creation" + Height = 975 + Left = 6240 + TabIndex = 36 + Top = 1920 + Width = 3135 + Begin VB.OptionButton SharedRC + Caption = "Shared" + Height = 255 + Left = 120 + TabIndex = 3 + Top = 240 + Value = -1 'True + Width = 1455 + End + Begin VB.OptionButton Inproc + Caption = "Inproc" + Height = 255 + Left = 120 + TabIndex = 37 + Top = 600 + Width = 1455 + End + End + Begin VB.CheckBox ActivateMic + Caption = "Activate Mic" + Height = 255 + Left = 6240 + TabIndex = 35 + Top = 480 + Value = 1 'Checked + Width = 1335 + End + Begin VB.CommandButton ClearTree + Caption = "Clear Tree View" + Height = 375 + Left = 2220 + TabIndex = 27 + Top = 8760 + Width = 1815 + End + Begin VB.ComboBox SREngines + Enabled = 0 'False + Height = 315 + Left = 6240 + TabIndex = 4 + Text = "SREngines" + Top = 3120 + Width = 3135 + End + Begin MSComctlLib.TreeView TreeView1 + Height = 6375 + Left = 120 + TabIndex = 34 + Top = 0 + Width = 6015 + _ExtentX = 10610 + _ExtentY = 11245 + _Version = 393217 + LineStyle = 1 + Style = 7 + Appearance = 1 + End + Begin VB.CommandButton ExitBtn + Caption = "Exit" + Height = 375 + Left = 7560 + TabIndex = 28 + Top = 8760 + Width = 1815 + End + Begin VB.CommandButton ClearEvents + Caption = "Clear Event List" + Height = 375 + Left = 120 + TabIndex = 26 + Top = 8760 + Width = 1815 + End + Begin VB.Frame Frame3 + Caption = "Event Interests" + Height = 2895 + Left = 6240 + TabIndex = 33 + Top = 5760 + Width = 3135 + Begin VB.CheckBox StreamStart + Caption = "Stream Start" + Height = 255 + Left = 1560 + TabIndex = 24 + Top = 2520 + Width = 1215 + End + Begin VB.CheckBox StreamEnd + Caption = "Stream End" + Height = 255 + Left = 1560 + TabIndex = 23 + Top = 2280 + Width = 1215 + End + Begin VB.CheckBox StateChange + Caption = "State Change" + Height = 255 + Left = 1560 + TabIndex = 22 + Top = 2040 + Width = 1455 + End + Begin VB.CheckBox SoundStart + Caption = "Sound Start" + Height = 255 + Left = 1560 + TabIndex = 21 + Top = 1800 + Width = 1215 + End + Begin VB.CheckBox SoundEnd + Caption = "Sound End" + Height = 255 + Left = 1560 + TabIndex = 20 + Top = 1560 + Width = 1215 + End + Begin VB.CheckBox RequestUI + Caption = "Request UI" + Height = 255 + Left = 1560 + TabIndex = 19 + Top = 1320 + Width = 1215 + End + Begin VB.CheckBox Reco + Caption = "Recognition" + Height = 255 + Left = 1560 + TabIndex = 17 + Top = 720 + Width = 1215 + End + Begin VB.CheckBox PropertyStringChange + Caption = "Property String Change" + Height = 375 + Left = 1560 + TabIndex = 16 + Top = 360 + Width = 1335 + End + Begin VB.CheckBox PhraseStart + Caption = "Phrase Start" + Height = 255 + Left = 120 + TabIndex = 13 + Top = 1920 + Width = 1215 + End + Begin VB.CheckBox Interference + Caption = "Interference" + Height = 255 + Left = 120 + TabIndex = 12 + Top = 1680 + Width = 1215 + End + Begin VB.CheckBox FalseReco + Caption = "False Recognition" + Height = 375 + Left = 120 + TabIndex = 10 + Top = 1080 + Width = 1335 + End + Begin VB.CheckBox Bookmark + Caption = "Bookmark" + Height = 255 + Left = 120 + TabIndex = 9 + Top = 840 + Width = 1215 + End + Begin VB.CheckBox Adaption + Caption = "Adaptation" + Height = 255 + Left = 120 + TabIndex = 7 + Top = 360 + Width = 1215 + End + Begin VB.CheckBox RecoOther + Caption = "Reco Other Context" + Height = 375 + Left = 1560 + TabIndex = 18 + Top = 960 + Width = 1215 + End + Begin VB.CheckBox PropertyNumChange + Caption = "Property Num Change" + Height = 375 + Left = 120 + TabIndex = 15 + Top = 2400 + Width = 1335 + End + Begin VB.CheckBox Hypothesis + Caption = "Hypothesis" + Height = 255 + Left = 120 + TabIndex = 11 + Top = 1440 + Width = 1335 + End + Begin VB.CheckBox PrivateEng + Caption = "Private" + Height = 255 + Left = 120 + TabIndex = 14 + Top = 2160 + Width = 1215 + End + Begin VB.CheckBox AudioLevel + Caption = "Audio Level" + Height = 255 + Left = 120 + TabIndex = 8 + Top = 600 + Width = 1695 + End + End + Begin MSComDlg.CommonDialog ComDlg + Left = 8880 + Top = 5280 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.CheckBox ShowStreamInfo + Caption = "Show Stream Info" + Height = 255 + Left = 7800 + TabIndex = 25 + Top = 480 + Value = 1 'Checked + Width = 1815 + End + Begin VB.Frame Frame2 + Caption = "Recognition Type" + Height = 975 + Left = 6240 + TabIndex = 30 + Top = 840 + Width = 3135 + Begin VB.OptionButton Dict + Caption = "Dictation" + Height = 255 + Left = 120 + TabIndex = 29 + Top = 600 + Width = 1455 + End + Begin VB.OptionButton CandC + Caption = "C&&C" + Height = 255 + Left = 120 + TabIndex = 2 + Top = 240 + Value = -1 'True + Width = 1455 + End + End + Begin VB.CommandButton Recognition + Caption = "Start Recognition" + Height = 375 + Left = 6240 + TabIndex = 1 + Top = 0 + Width = 3135 + End + Begin VB.Frame Frame1 + Caption = "Emulate Recognition" + Height = 1575 + Left = 6240 + TabIndex = 31 + Top = 3600 + Width = 3135 + Begin VB.TextBox EmulateRecoTxt + Height = 855 + Left = 120 + MultiLine = -1 'True + TabIndex = 5 + Top = 240 + Width = 2895 + End + Begin VB.CommandButton Emulate + Caption = "Emulate" + Height = 255 + Left = 120 + TabIndex = 6 + Top = 1200 + Width = 2895 + End + End + Begin VB.TextBox EventTextField + Height = 2175 + Left = 120 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 3 'Both + TabIndex = 0 + Top = 6480 + Width = 6015 + End + Begin VB.Label CCLabel + Caption = "Current C&C Grammar:" + Height = 375 + Left = 6240 + TabIndex = 32 + Top = 5400 + Width = 3135 + End + Begin VB.Menu File + Caption = "&File" + Begin VB.Menu Exit + Caption = "E&xit" + End + End + Begin VB.Menu MenuRecognition + Caption = "&Recognition" + Begin VB.Menu LoadGrammar + Caption = "&Load Grammar..." + End + End + Begin VB.Menu Help + Caption = "&Help" + Begin VB.Menu About + Caption = "&About" + End + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This RecoVB App sample demonstrates most of the SR functionalities +' supported in SAPI 5.1. The main object used here for the RecoContext is RC. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +' +'============================================================================= + +Option Explicit + +Public WithEvents RC As SpSharedRecoContext 'The main shared Recognizer Context +Attribute RC.VB_VarHelpID = -1 +Public Grammar As ISpeechRecoGrammar 'Command and Control interface +Dim indent As Integer 'Sets indent level for small output window +Dim fRecoEnabled As Boolean 'Is recognition enabled +Dim fGrammarLoaded As Boolean 'Is a grammar loaded +Dim RecoResult As ISpeechRecoResult 'Recognition result interface + +Private Sub Form_Load() +' Set up error handler + On Error GoTo Err_SAPILoad + +' Initialize globals + indent = 0 + fRecoEnabled = False + fGrammarLoaded = False + +' Create the Shared Reco Context by default + Set RC = New SpSharedRecoContext + +' Load the SR Engines combo box + Dim Token As ISpeechObjectToken + For Each Token In RC.Recognizer.GetRecognizers + SREngines.AddItem Token.GetDescription() + Next + SREngines.ListIndex = 0 + +' Disable combo box for Shared Engine. Also disable other UI that's not initially needed. + SREngines.Enabled = False + ActivateMic.Enabled = False + PlayAudio.Enabled = False + +' Call the InitEventInterestCheckBoxes subroutine which uses the SR engine +' default event interests to initialize the event interest checkboxes. + InitEventInterestCheckBoxes + +' Create grammar objects + LoadGrammarObj + +' Attempt to load the default .xml file and set the RuleId State to Inactive until +' the user starts recognition. + LoadDefaultCnCGrammar + + Exit Sub + +Err_SAPILoad: + MsgBox "Error loading SAPI objects! Please make sure SAPI5.1 is correctly installed.", vbCritical + Exit_Click + Exit Sub +End Sub + +' This subroutine creates the Grammar object and sets the states to inactive +' until the user is ready to begin recognition. +Private Sub LoadGrammarObj() + Set Grammar = RC.CreateGrammar(1) + +' Load Dictation but set it to Inactive until user selects "Dictation" radio +' button. + Grammar.DictationLoad "", SLOStatic + Grammar.DictationSetState SGDSInactive +End Sub + +' This subroutine attempts to load the default English .xml file. It will prompt the +' user to load a valid .xml file if it cannot find sol.xml in either of the 2 +' specified paths. +Private Sub LoadDefaultCnCGrammar() +' First load attempt + On Error Resume Next + Grammar.CmdLoadFromFile "..\\samples\\common\\sol.xml", SLODynamic + +' Second load attempt + If Err Then + On Error GoTo Err_CFGLoad + Grammar.CmdLoadFromFile "..\\..\\common\\sol.xml", SLODynamic + End If + +' Set rule state to inactive until user clicks Recognition button + Grammar.CmdSetRuleIdState 0, SGDSInactive + +' Set the Label to indictate which .xml file is loaded. + CCLabel.Caption = "Current C+C Grammar: sol.xml" + + fGrammarLoaded = True + + Exit Sub + +Err_CFGLoad: + fGrammarLoaded = False + CCLabel.Caption = "Current C+C Grammar: NULL" + Exit Sub +End Sub + +' This subroutine calls the Common File Dialog control which is inserted into +' the form to select a .xml grammar file. +Private Sub LoadGrammar_Click() + ComDlg.CancelError = True + On Error GoTo Cancel + ComDlg.Flags = cdlOFNOverwritePrompt + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn + ComDlg.DialogTitle = "Open XML File" + ComDlg.Filter = "All Files (*.*)|*.*|XML Files " & "(*.xml)|*.xml" + ComDlg.FilterIndex = 2 + ComDlg.ShowOpen + +' Inactivate the grammar and associate a new .xml file with the grammar. + On Error GoTo Err_XMLLoad + Grammar.CmdLoadFromFile ComDlg.FileName, SLODynamic + Grammar.CmdSetRuleIdState 0, SGDSInactive + +' Then reactivate the grammar if it was currently enabled + If fRecoEnabled Then + Grammar.CmdSetRuleIdState 0, SGDSActive + End If + +' Set the Label to indictate which .xml file is loaded + CCLabel.Caption = "Current C+C Grammar: " + ComDlg.FileTitle + + fGrammarLoaded = True + Exit Sub + +Err_XMLLoad: + fGrammarLoaded = False + MsgBox "Invalid .xml file. Please load a valid .xml grammar file.", vbOKOnly + Exit Sub + +Cancel: + Exit Sub +End Sub + +' Activates or Deactivates either Command and Control or Dictation based on the +' current state of the Recognition button. +Private Sub Recognition_Click() + ActivateMic.Value = Checked + + On Error GoTo ErrorHandle + +' First make sure a valid .xml file is loaded if the user is selecting C&C + If fGrammarLoaded Or Dict.Value = True Then + + ' If recognition is currently not enabled, enable it. + If Not fRecoEnabled Then + ' Determine if user wants to activate Dictation or Command and Control + If Dict.Value Then + Grammar.DictationSetState SGDSActive + Else + Grammar.CmdSetRuleIdState 0, SGDSActive + End If + fRecoEnabled = True + ' Update caption on button. + Recognition.Caption = "Stop Recognition" + ' Allow user to activate/deactivate mute + ActivateMic.Enabled = True + ' Disable radio buttons and engines combo while recognizing so user doesn't + ' switch modes during recognition. + CandC.Enabled = False + Dict.Enabled = False + SREngines.Enabled = False + SharedRC.Enabled = False + Inproc.Enabled = False + ' If recognition is currently enabled, disable it. + Else + ' Deactivate either Dictation or Command and Control. + If Dict.Value Then + Grammar.DictationSetState SGDSInactive + Else + Grammar.CmdSetRuleIdState 0, SGDSInactive + End If + fRecoEnabled = False + ' Update caption on button. + Recognition.Caption = "Start Recognition" + ' Disallow user to activate/deactivate mute + ActivateMic.Enabled = False + ' Reenable radio buttons while not recognizing so user can switch modes + CandC.Enabled = True + Dict.Enabled = True + + ' Allow engine selection if the inproc button is selected. + If Inproc.Value Then + SREngines.Enabled = True + End If + + SharedRC.Enabled = True + Inproc.Enabled = True + End If + End If + Exit Sub + +ErrorHandle: + MsgBox "Failed to activate the grammar. It is possible that your audio device is used by other application.", vbOKOnly +End Sub + +' This subroutine calls the EmulateRecognition method on the recognizer. +Private Sub Emulate_Click() + If fGrammarLoaded Then +' First make sure not to try retaining audio when emulating. + RetainAudio.Value = Unchecked + +' Temporarily enable recognition state if it's not currently enabled. + If Not fRecoEnabled Then + If Dict.Value Then + Grammar.DictationSetState SGDSActive + Else + Grammar.CmdSetRuleIdState 0, SGDSActive + End If + End If + +' Call the EmmulateRecognition method with the text from the textbox. + If Not EmulateRecoTxt.Text = "" Then + RC.Recognizer.EmulateRecognition EmulateRecoTxt.Text, 0 + End If + +' Reset the recognition states to original values + If Not fRecoEnabled Then + If Dict.Value Then + Grammar.DictationSetState SGDSInactive + Else + Grammar.CmdSetRuleIdState 0, SGDSInactive + End If + End If + End If +End Sub + +' This subroutine is called by the event handler subroutines to update +' the small edit window with the events that were received. +Private Sub UpdateEventList(StreamNum As Long, StreamPos As Variant, szEvent As String, szEventInfo As String) + Dim szIndent As String + Dim szStreamInfo As String + Dim i As Integer + + For i = 0 To indent - 1 + szIndent = szIndent & " " + Next + If ShowStreamInfo.Value = Checked Then + szStreamInfo = " (StreamNum=" & StreamNum & " StreamPos=" & StreamPos & ")" + End If + EventTextField.Text = EventTextField.Text & szIndent & szEvent & szStreamInfo & szEventInfo & vbCrLf + EventTextField.SelStart = Len(EventTextField) + EventTextField.SelLength = 0 +End Sub + +' The following subroutines are event handlers that get called when the SR engine +' fires events. + +' Adaption event handler +Private Sub RC_Adaption(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + UpdateEventList StreamNumber, StreamPosition, "Adaptation", "" +End Sub +' Audio Level event handler +Private Sub RC_AudioLevel(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal AudioLevel As Long) + UpdateEventList StreamNumber, StreamPosition, "AudioLevel", " [Level=" & AudioLevel & "]" +End Sub +' Bookmark event handler +Private Sub RC_Bookmark(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal EventData As Variant, ByVal Options As SpeechLib.SpeechBookmarkOptions) + UpdateEventList StreamNumber, StreamPosition, "Bookmark", " [Data=" & EventData & " Option=" & Options & "]" +End Sub +' End Stream event handler +Private Sub RC_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal StreamReleased As Boolean) + indent = 0 + UpdateEventList StreamNumber, StreamPosition, "EndStream", " [Stream Released=" & StreamReleased & "]" +End Sub +' Engine Private event handler +Private Sub RC_EnginePrivate(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal lParam As Variant) + UpdateEventList StreamNumber, StreamPosition, "EnginePrivate", "" +End Sub +' False Recognition event handler +Private Sub RC_FalseRecognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal Result As SpeechLib.ISpeechRecoResult) + UpdateEventList StreamNumber, StreamPosition, "FalseRecognition", " [Text=" & Result.PhraseInfo.GetText() & "]" + Set RecoResult = Result +End Sub +' Hypothesis event handler +Private Sub RC_Hypothesis(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal Result As SpeechLib.ISpeechRecoResult) + UpdateEventList StreamNumber, StreamPosition, "Hypothesis", " [Text=" & Result.PhraseInfo.GetText() & "]" +End Sub +' Interference event handler +Private Sub RC_Interference(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal Interference As SpeechLib.SpeechInterference) + UpdateEventList StreamNumber, StreamPosition, "Interference", " [Value=" & Interference & "]" +End Sub +' Phrase Start event handler +Private Sub RC_PhraseStart(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + UpdateEventList StreamNumber, StreamPosition, "PhraseStart", "" +End Sub +' Property Number Change event handler +Private Sub RC_PropertyNumberChange(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal PropertyName As String, ByVal NewNumberValue As Long) + UpdateEventList StreamNumber, StreamPosition, "PropertyNumberChange", " [Name=" & PropertyName & " Value=" & NewNumberValue & "]" +End Sub +' Property String Change event handler +Private Sub RC_PropertyStringChange(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal PropertyName As String, ByVal NewStringValue As String) + UpdateEventList StreamNumber, StreamPosition, "PropertyStringChange", " [Name=" & PropertyName & " Value=" & NewStringValue & "]" +End Sub +' Recognition event handler +Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) + Dim RecoNode As Node + Static i As Integer + +' Update Event List window first + UpdateEventList StreamNumber, StreamPosition, "Recognition", " [Text=" & Result.PhraseInfo.GetText() & ", RecoType=" & RecognitionType & "]" + +' Increment unique value for RecoNode's key name. + i = i + 1 + +' Add top level node + Set RecoNode = TreeView1.Nodes.Add(, , "Reco" & i, "Recognition (" & Result.PhraseInfo.GetText() & ")") + +' Call the BuildResultTree subroutine to build up the Result tree + BuildResultTree Result.PhraseInfo, Result.Alternates(5), RecoNode + +' Save the recognition Result to the global RecoResult + Set RecoResult = Result +End Sub +' Recognition For Other Context event handler +Private Sub RC_RecognitionForOtherContext(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + UpdateEventList StreamNumber, StreamPosition, "RecognitionForOtherContext", "" +End Sub +' Recognizer State Change event handler +Private Sub RC_RecognizerStateChange(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal NewState As SpeechLib.SpeechRecognizerState) + UpdateEventList StreamNumber, StreamPosition, "RecognitionStateChange", " [NewState=" & NewState & "]" +End Sub +' Request UI event handler +Private Sub RC_RequestUI(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal UIType As String) + UpdateEventList StreamNumber, StreamPosition, "RequestUI", " [Type=" & UIType & "]" +End Sub +' Sound End event handler +Private Sub RC_SoundEnd(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + indent = 1 + UpdateEventList StreamNumber, StreamPosition, "SoundEnd", "" +End Sub +' Sound Start event handler +Private Sub RC_SoundStart(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + indent = 1 + UpdateEventList StreamNumber, StreamPosition, "SoundStart", "" + indent = 2 +End Sub +' Stream Start event handler +Private Sub RC_StartStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + indent = 0 + UpdateEventList StreamNumber, StreamPosition, "StartStream", "" + indent = 1 +End Sub + +' The following subroutine enables the event interest check boxes based on the +' SR engine's default event interests. +Private Sub InitEventInterestCheckBoxes() + If RC.EventInterests And SREAdaptation Then + Adaption.Value = Checked + End If + + If RC.EventInterests And SREAudioLevel Then + AudioLevel.Value = Checked + End If + + If RC.EventInterests And SREBookmark Then + Bookmark.Value = Checked + End If + + If RC.EventInterests And SREFalseRecognition Then + FalseReco.Value = Checked + End If + + If RC.EventInterests And SREHypothesis Then + Hypothesis.Value = Checked + End If + + If RC.EventInterests And SREInterference Then + Interference.Value = Checked + End If + + If RC.EventInterests And SREPhraseStart Then + PhraseStart.Value = Checked + End If + + If RC.EventInterests And SREPrivate Then + PrivateEng.Value = Checked + End If + + If RC.EventInterests And SREPropertyNumChange Then + PropertyNumChange.Value = Checked + End If + + If RC.EventInterests And SREPropertyStringChange Then + PropertyStringChange.Value = Checked + End If + + If RC.EventInterests And SRERecognition Then + Reco.Value = Checked + End If + + If RC.EventInterests And SRERecoOtherContext Then + RecoOther.Value = Checked + End If + + If RC.EventInterests And SRERequestUI Then + RequestUI.Value = Checked + End If + + If RC.EventInterests And SRESoundEnd Then + SoundEnd.Value = Checked + End If + + If RC.EventInterests And SRESoundStart Then + SoundStart.Value = Checked + End If + + If RC.EventInterests And SREStateChange Then + StateChange.Value = Checked + End If + + If RC.EventInterests And SREStreamEnd Then + StreamEnd.Value = Checked + End If + + If RC.EventInterests And SREStreamStart Then + StreamStart.Value = Checked + End If +End Sub + +' The following subroutines handle turning on/off the event interests when +' The user checks/unchecks them. + +Private Sub SetEventInterest(EventInterest As SpeechRecoEvents, EventCheckBox As CheckBox) + If EventCheckBox.Value = Checked Then + RC.EventInterests = RC.EventInterests Or EventInterest + Else + RC.EventInterests = RC.EventInterests And Not EventInterest + End If +End Sub + +' Adaption event interest +Private Sub Adaption_Click() + SetEventInterest SREAdaptation, Adaption +End Sub +' Audio Level event interest +Private Sub AudioLevel_Click() + SetEventInterest SREAudioLevel, AudioLevel +End Sub +' Bookmark event interest +Private Sub Bookmark_Click() + SetEventInterest SREBookmark, Bookmark +End Sub +' False Recognition event interest +Private Sub FalseReco_Click() + SetEventInterest SREFalseRecognition, FalseReco +End Sub +' Hypothesis event interest +Private Sub Hypothesis_Click() + SetEventInterest SREHypothesis, Hypothesis +End Sub +' Interference event interest +Private Sub Interference_Click() + SetEventInterest SREInterference, Interference +End Sub +' Phrase Start event interest +Private Sub PhraseStart_Click() + SetEventInterest SREPhraseStart, PhraseStart +End Sub +' Engine Private event interest +Private Sub PrivateEng_Click() + SetEventInterest SREPrivate, PrivateEng +End Sub +' Property Number Change event interest +Private Sub PropertyNumChange_Click() + SetEventInterest SREPropertyNumChange, PropertyNumChange +End Sub +' Property String Change event interest +Private Sub PropertyStringChange_Click() + SetEventInterest SREPropertyStringChange, PropertyStringChange +End Sub +' Recognition event interest +Private Sub Reco_Click() + SetEventInterest SRERecognition, Reco +End Sub +' Recognition on Other Context event interest +Private Sub RecoOther_Click() + SetEventInterest SRERecoOtherContext, RecoOther +End Sub +' Request UI event interest +Private Sub RequestUI_Click() + SetEventInterest SRERequestUI, RequestUI +End Sub +' Sound End event interest +Private Sub SoundEnd_Click() + SetEventInterest SRESoundEnd, SoundEnd +End Sub +' Sound Start event interest +Private Sub SoundStart_Click() + SetEventInterest SRESoundStart, SoundStart +End Sub +' State Change event interest +Private Sub StateChange_Click() + SetEventInterest SREStateChange, StateChange +End Sub +' Stream Start event interest +Private Sub StreamStart_Click() + SetEventInterest SREStreamStart, StreamStart +End Sub +' Stream End event interest +Private Sub StreamEnd_Click() + SetEventInterest SREStreamEnd, StreamEnd +End Sub + +' The following subroutines use the Recognition Result object to build up the +' TreeView display in the main window. + +' This subroutine builds up the result tree in the main treeview window. It uses +' the main ISpeechRecoResult object to build up this information. Additionally it +' also shows the alternates from the recognition. +Private Sub BuildResultTree(ByVal ResultPhraseInfo As ISpeechPhraseInfo, ByVal Alternates As ISpeechPhraseAlternates, ParentNode As Node, Optional DontDoAlternates As Boolean = False) + Dim id As Integer + id = TreeView1.Nodes.Count + Dim PhraseInfoNode As Node + Dim PropertiesNode As Node + +' Add the top level nodes for the result tree + Set PhraseInfoNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "PhraseInfo" & id, "Phrase Info") + Set PropertiesNode = TreeView1.Nodes.Add(PhraseInfoNode.Key, tvwChild, "Properties" & id, "Properties") + +' Call subroutines to build up lower level nodes for the Result rules, Result properties, +' and Result elements. + BuildPhraseRuleTree ResultPhraseInfo.Rule, PhraseInfoNode + BuildPhrasePropertyTree ResultPhraseInfo.Properties, PropertiesNode + BuildPhraseElementsTree ResultPhraseInfo.Elements, PhraseInfoNode, ResultPhraseInfo.LanguageId + +' Call subroutine to build up lower level nodes for the alternates. + If Not DontDoAlternates And Not Alternates Is Nothing Then + Dim AltNode As Node + Set AltNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "Alternates" & id, "Alternates") + BuildAlternatesTree Alternates, AltNode + End If +End Sub +' This subroutine is called by the BuildResultTree subroutine to build up the Result +' rules. +Private Sub BuildPhraseRuleTree(ByVal PhraseRule As ISpeechPhraseRule, ParentNode As Node, Optional i As Integer = 0) + Dim Rule As ISpeechPhraseRule + Dim RuleNode As Node + + Set RuleNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "RuleNode" & ParentNode.Key & i, "Rule (" & PhraseRule.Name & ")") + +' Call the subroutine recusively if you have child rules + If Not PhraseRule.Children Is Nothing Then + For Each Rule In PhraseRule.Children + i = i + 1 + BuildPhraseRuleTree Rule, RuleNode, i + Next + End If +End Sub +' This subroutine is called by the BuildResultTree subroutine to build up the Result +' properties. +Private Sub BuildPhrasePropertyTree(ByVal Properties As ISpeechPhraseProperties, ParentNode As Node) + Dim Property As ISpeechPhraseProperty + Dim i As Integer + i = 0 + + If Not Properties Is Nothing Then + If Properties.Count > 0 Then + For Each Property In Properties + Dim PropertyNode As Node + Dim DisplayString As String + i = i + 1 + + If Property.Value = Empty Then + DisplayString = "Property (" & Property.Name & ")" + Else + DisplayString = "Property (" & Property.Name & ") (" & Property.Value & ")" + End If + Set PropertyNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, ParentNode.Key & i, DisplayString) + +' Call the subroutine recusively if you have child properties + If Not Property.Children Is Nothing Then + BuildPhrasePropertyTree Property.Children, PropertyNode + End If + Next + End If + Else + ParentNode.Text = "Properties - No Properties" + End If +End Sub +' This subroutine is called by the BuildResultTree subroutine to build up the Result +' elements. +Private Sub BuildPhraseElementsTree(ByVal Elements As ISpeechPhraseElements, ParentNode As Node, LangId As Long) + Dim Element As ISpeechPhraseElement + Dim ElementsNode As Node + Dim i As Integer + i = 0 + + If Not Elements Is Nothing Then + If Elements.Count > 0 Then + Set ElementsNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "Elements" & ParentNode.Key, "Elements") + For Each Element In Elements + i = i + 1 + Dim ElementNode As Node + Set ElementNode = TreeView1.Nodes.Add(ElementsNode.Key, tvwChild, "Element" & ParentNode.Key & i, "Element (" & Element.DisplayText & ")") + If Not IsEmpty(Element.Pronunciation) Then + BuildPronunciationTree Element.Pronunciation, ElementNode, LangId + End If + Next + End If + Else + Set ElementNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "Elements" & ParentNode.Key, "Elements - No Elements") + End If +End Sub +' This subroutine is called by the BuildPhraseElementsTree subroutine to build up the +' Result pronunciations for each of the Result elements. +Private Sub BuildPronunciationTree(ByVal Pronunciation As Variant, ParentNode As Node, LangId As Long) + Dim PronunciationNode As Node + Dim PC As New SpPhoneConverter + Dim i As Integer + i = 0 + +' Initialize the Phone Converter + PC.LanguageId = LangId + + Set PronunciationNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, "Pronunciations" & ParentNode.Key, "Pronunciations") + + For i = 0 To UBound(Pronunciation) + Dim Phone As String + Phone = PC.IdToPhone(Pronunciation(i)) + Call TreeView1.Nodes.Add(PronunciationNode.Key, tvwChild, "Pronunciation" & ParentNode.Key & i, "Pronunciation (" & Phone & ")") + Next +End Sub + +' This subroutine is called by the BuildResultTree subroutine to build up the +' Result alternates if there are any. +Private Sub BuildAlternatesTree(ByVal Alternates As ISpeechPhraseAlternates, ParentNode As Node) + Dim alt As ISpeechPhraseAlternate + Dim i As Integer + i = 0 + + For Each alt In Alternates + i = i + 1 + Dim AltNode As Node + Set AltNode = TreeView1.Nodes.Add(ParentNode.Key, tvwChild, ParentNode.Key & i, "Alternate" & i) + BuildResultTree alt.PhraseInfo, Nothing, AltNode, True + Next +End Sub + +' The following 2 subroutines destroy/create Inproc and Shared RecoContext's depending +' on what the user has checked. + +' This subroutine destroys the Inproc RecoContext and creates and Shared RecoContext +Private Sub SharedRC_Click() +' Destroy the Inproc RecoContext + Set RC = Nothing + +' Create the Shared RecoContext + Set RC = New SpSharedRecoContext + +' Call the InitEventInterestCheckBoxes subroutine which uses the SR engine +' default event interests to initialize the event interest checkboxes. + InitEventInterestCheckBoxes + +' Create grammar objects + LoadGrammarObj + +' Attempt to load the default .xml file and set the RuleId State to Inactive until +' the user starts recognition. + LoadDefaultCnCGrammar + +' Disable the engine selection drop down box and reset to the default shared engine. + SREngines.ListIndex = 0 + SREngines.Enabled = False +End Sub +' This subroutine destroys the Shared RecoContext and creates and Inproc RecoContext +Private Sub Inproc_Click() + Dim Recognizer As ISpeechRecognizer + +' Destroy Shared RecoContext + Set RC = Nothing + +' Create Inproc Recognizer which we will use to create the Inproc RecoContext. + Set Recognizer = New SpInprocRecognizer + +' To create an Inproc RecoContext we must set an Audio Input. To do this we create +' an SpObjectTokenCategory object with the category of AudioIn. This object enumerates +' the registry to see what types of audio input devices are available. + Dim ObjectTokenCat As ISpeechObjectTokenCategory + Set ObjectTokenCat = New SpObjectTokenCategory + ObjectTokenCat.SetId SpeechCategoryAudioIn + +' Set the default AudioInput device which is typically the first item and is usually +' the microphone. + Set Recognizer.AudioInput = ObjectTokenCat.EnumerateTokens.Item(0) + +' Set the Recognizer to the one selected in the drop down box. + Set Recognizer.Recognizer = Recognizer.GetRecognizers().Item(SREngines.ListIndex) + +' Now go ahead and actually create the Inproc RecoContext. +' Note - in VB even though the global "RC" object is declaired as a +' SpSharedRecoContext, it is still possible to set it to a SpInprocRecoContext. + Set RC = Recognizer.CreateRecoContext + +' Call the InitEventInterestCheckBoxes subroutine which uses the SR engine +' default event interests to initialize the event interest checkboxes. + InitEventInterestCheckBoxes + +' Create grammar objects + LoadGrammarObj + +' Attempt to load the default .xml file and set the RuleId State to Inactive until +' the user starts recognition. + LoadDefaultCnCGrammar + +' Enable the engine selection drop down box + SREngines.Enabled = True +End Sub + +' The remaining subroutines handle simple UI and exiting. + +' This subroutine activates/deactivates the microphone. +Private Sub ActivateMic_Click() + If ActivateMic.Value = Checked Then + If Dict.Value Then + Grammar.DictationSetState SGDSActive + Else + Grammar.CmdSetRuleIdState 0, SGDSActive + End If + Else + If Dict.Value Then + Grammar.DictationSetState SGDSInactive + Else + Grammar.CmdSetRuleIdState 0, SGDSInactive + End If + End If +End Sub +' This subroutine clears the event text box +Private Sub ClearEvents_Click() + EventTextField.Text = "" +End Sub +' This subroutine clears the TreeView window +Private Sub ClearTree_Click() + TreeView1.Nodes.Clear +End Sub +' This subroutine changes the SR Engine to the selected one +Private Sub SREngines_Click() +' This subroutine can be called when you update the listindex of SREngines in the form load subroutine + If Inproc.Value Then + Inproc_Click + End If +End Sub +' Set the 'Emulate' button to be the default when the user is typing text into +' the EmulateRecoTxt text box. +Private Sub EmulateRecoTxt_Change() + Emulate.Default = True +End Sub +' Retain the audio +Private Sub RetainAudio_Click() + If RetainAudio.Value = Checked Then + RC.RetainedAudio = SRAORetainAudio + PlayAudio.Enabled = True + Else + RC.RetainedAudio = SRAONone + PlayAudio.Enabled = False + End If + +' Clear out any old recognition results + Set RecoResult = Nothing +End Sub +' Play the Retained Audio +Private Sub PlayAudio_Click() + If Not RecoResult Is Nothing Then + RecoResult.SpeakAudio + End If +End Sub +' About box +Private Sub About_Click() + MsgBox "(c) 2001 Microsoft Corporation. All rights reserved.", vbInformation, "About RecoVB" +End Sub +Private Sub ExitBtn_Click() + Unload Form1 +End Sub +Private Sub Exit_Click() + Unload Form1 +End Sub diff --git a/sp/src/utils/sapi51/Samples/VB/RecoVB/recovb.vbp b/sp/src/utils/sapi51/Samples/VB/RecoVB/recovb.vbp new file mode 100644 index 00000000..d6415fbf --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/RecoVB/recovb.vbp @@ -0,0 +1,42 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#s:\binaries.x86fre\sapi.dll#Microsoft Speech Object Library +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX +Form=RecoVB.frm +Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; mscomctl.ocx +Object={86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0; mscomct2.ocx +Object={38911DA0-E448-11D0-84A3-00DD01104159}#1.1#0; comct332.ocx +IconForm="Form1" +Startup="Form1" +HelpFile="" +Title="recovb" +ExeName32="RecoVB.exe" +Command32="" +Name="RecoVb" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frm b/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frm new file mode 100644 index 00000000..92595ae9 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frm @@ -0,0 +1,126 @@ +VERSION 5.00 +Begin VB.Form SimpleDict + BorderStyle = 1 'Fixed Single + Caption = "Simple Dictation" + ClientHeight = 3780 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 4680 + Icon = "SimpleDict.frx":0000 + LinkTopic = "SimpleDict" + MaxButton = 0 'False + ScaleHeight = 3780 + ScaleWidth = 4680 + StartUpPosition = 3 'Windows Default + Begin VB.CommandButton btnStart + Caption = "St&art" + Height = 375 + Left = 840 + TabIndex = 1 + Top = 3240 + Width = 1215 + End + Begin VB.CommandButton btnStop + Caption = "St&op" + Height = 375 + Left = 2520 + TabIndex = 2 + Top = 3240 + Width = 1215 + End + Begin VB.TextBox txtSpeech + Height = 2895 + Left = 120 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 0 + Top = 120 + Width = 4455 + End +End +Attribute VB_Name = "SimpleDict" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' This sample demonstrates how to do simple dictation in VB with SAPI 5.1. +' +' It uses shared reco context object, uses the default audio input, loads in +' dictation grammar, sets up event handlers, and shows the recognized text in +' the dialog text box. +' +' Note: since the text box is using system locale, it may not correctly show +' characters in other languages. For example, if you use Chinese Speech +' Recognition engine as the default engine on your English OS, the text box +' may show garbage even though the engine recognizes Chinese. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +' +'============================================================================= + +Option Explicit + +Dim WithEvents RecoContext As SpSharedRecoContext +Attribute RecoContext.VB_VarHelpID = -1 +Dim Grammar As ISpeechRecoGrammar + +Dim m_bRecoRunning As Boolean +Dim m_cChars As Integer + + +Private Sub Form_Load() + SetState False + m_cChars = 0 +End Sub + +Private Sub btnStart_Click() + Debug.Assert Not m_bRecoRunning + + ' Initialize recognition context object and grammar object, then + ' start dictation + If (RecoContext Is Nothing) Then + Debug.Print "Initializing SAPI reco context object..." + Set RecoContext = New SpSharedRecoContext + Set Grammar = RecoContext.CreateGrammar(1) + Grammar.DictationLoad + End If + + Grammar.DictationSetState SGDSActive + SetState True +End Sub + +Private Sub btnStop_Click() + Debug.Assert m_bRecoRunning + Grammar.DictationSetState SGDSInactive + SetState False +End Sub + +' This function handles Recognition event from the reco context object. +' Recognition event is fired when the speech recognition engines recognizes +' a sequences of words. +Private Sub RecoContext_Recognition(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal RecognitionType As SpeechRecognitionType, _ + ByVal Result As ISpeechRecoResult _ + ) + Dim strText As String + strText = Result.PhraseInfo.GetText + Debug.Print "Recognition: " & strText & ", " & _ + StreamNumber & ", " & StreamPosition + + ' Append the new text to the text box, and add a space at the end of the + ' text so that it looks better + txtSpeech.SelStart = m_cChars + txtSpeech.SelText = strText & " " + m_cChars = m_cChars + 1 + Len(strText) +End Sub + +' This function handles the state of Start and Stop buttons according to +' whether dictation is running. +Private Sub SetState(ByVal bNewState As Boolean) + m_bRecoRunning = bNewState + btnStart.Enabled = Not m_bRecoRunning + btnStop.Enabled = m_bRecoRunning +End Sub diff --git a/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frx b/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frx new file mode 100644 index 00000000..302344ae Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDict.frx differ diff --git a/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDictVB.vbp b/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDictVB.vbp new file mode 100644 index 00000000..c82aa9be --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/SimpleDict/SimpleDictVB.vbp @@ -0,0 +1,42 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll#Microsoft Speech Object Library +Form=SimpleDict.frm +IconForm="SimpleDict" +Startup="SimpleDict" +HelpFile="" +Title="SimpleDictVB" +ExeName32="SimpleDictVB.exe" +Command32="" +Name="SimpleDictVB" +HelpContextID="0" +Description="SAPI SDK VB SimpleDict sample" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corporation" +VersionFileDescription="SimpleDictVB sample" +VersionLegalCopyright="Copyright (C) Microsoft Corporation. 1981-2001" +VersionProductName="Microsoft® Windows(TM) Operating System" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Samples/VB/SimpleDict/small.ico b/sp/src/utils/sapi51/Samples/VB/SimpleDict/small.ico new file mode 100644 index 00000000..8f94d9aa Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/SimpleDict/small.ico differ diff --git a/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frm b/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frm new file mode 100644 index 00000000..a9801de6 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frm @@ -0,0 +1,155 @@ +VERSION 5.00 +Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" +Begin VB.Form Form1 + BorderStyle = 1 'Fixed Single + Caption = "Simple TTS" + ClientHeight = 1800 + ClientLeft = 45 + ClientTop = 330 + ClientWidth = 4125 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 120 + ScaleMode = 3 'Pixel + ScaleWidth = 275 + StartUpPosition = 3 'Windows Default + Begin MSComDlg.CommonDialog ComDlg + Left = 1800 + Top = 600 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.CommandButton SpeakItBtn + Caption = "Speak It" + Default = -1 'True + Height = 375 + Left = 1560 + TabIndex = 3 + Top = 1200 + Width = 1095 + End + Begin VB.CheckBox SaveToWavCheckBox + Caption = "Save to .wav" + Height = 255 + Left = 120 + TabIndex = 2 + ToolTipText = "The text is a file name" + Top = 1260 + Width = 1335 + End + Begin VB.CommandButton ExitBtn + Caption = "Exit" + Height = 375 + Left = 2880 + TabIndex = 1 + Top = 1200 + Width = 1095 + End + Begin VB.TextBox TextField + Height = 765 + Left = 0 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 0 + Text = "SimpleTTS.frx":0000 + Top = 120 + Width = 4095 + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This SimpleTTS sample application demonstrates how to create a SpVoice object +' and how to use it to speak text and save it to a .wav file. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +'============================================================================= + +Option Explicit + +'Declare the SpVoice object. +Dim Voice As SpVoice +'Note - Applications that require handling of SAPI events should declair the +'SpVoice as follows: +'Dim WithEvents Voice As SpVoice + +Private Sub Form_Load() +' Initialize the voice object + Set Voice = New SpVoice +End Sub +Private Sub ExitBtn_Click() + Unload Form1 +End Sub + +Private Sub SpeakItBtn_Click() + On Error GoTo Speak_Error + +' If the 'Save to wav' checkbox is checked handle this special case by +' calling the SaveToWav() function. + If SaveToWavCheckBox Then + SaveToWav + Else +' Call the Speak method with the text from the text box. We use the +' SVSFlagsAsync flag to speak asynchronously and return immediately +' from this call. + If Not TextField.Text = "" Then + Voice.Speak TextField.Text, SVSFlagsAsync + End If + End If + +' Return focus to text box + TextField.SetFocus + Exit Sub + +Speak_Error: + MsgBox "Speak Error!", vbOKOnly +End Sub + +Private Sub SaveToWav() +' Create a wave stream + Dim cpFileStream As New SpFileStream + +' Set audio format + cpFileStream.Format.Type = SAFT22kHz16BitMono + +' Call the Common File Dialog control which is inserted into the form to +' select a name for the .wav file. + ComDlg.CancelError = True + On Error GoTo Cancel + ComDlg.Flags = cdlOFNOverwritePrompt + cdlOFNPathMustExist + cdlOFNNoReadOnlyReturn + ComDlg.DialogTitle = "Save to a Wave File" + ComDlg.Filter = "All Files (*.*)|*.*|Wave Files " & "(*.wav)|*.wav" + ComDlg.FilterIndex = 2 + ComDlg.ShowSave + +' Create a new .wav file for writing. False indicates that we're not +' interested in writing events into the .wav file. +' Note - this line of code will fail if the file exists and is currently open. + cpFileStream.Open ComDlg.FileName, SSFMCreateForWrite, False + +' Set the .wav file stream as the output for the Voice object + Set Voice.AudioOutputStream = cpFileStream + +' Calling the Speak method now will send the output to the "SimpTTS.wav" file. +' We use the SVSFDefault flag so this call does not return until the file is +' completely written. + Voice.Speak TextField.Text, SVSFDefault + +' Close the file + cpFileStream.Close + Set cpFileStream = Nothing + +' Reset the Voice object's output to 'Nothing'. This will force it to use +' the default audio output the next time. + Set Voice.AudioOutputStream = Nothing + +Cancel: + Exit Sub +End Sub + diff --git a/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frx b/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frx new file mode 100644 index 00000000..eda4d91c --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.frx @@ -0,0 +1 @@ +Speak this text. diff --git a/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.vbp b/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.vbp new file mode 100644 index 00000000..13d0f596 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/SimpleTTS/SimpleTTS.vbp @@ -0,0 +1,38 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#..\..\..\..\sapi\sapi\objd\i386\sapi.dll#Microsoft Speech Object Library +Form=SimpleTTS.frm +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX +IconForm="Form1" +Startup="Form1" +HelpFile="" +Title="SimpleTTS" +ExeName32="SimpleTTS.exe" +Command32="" +Name="SimpleTTS" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="SPG" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frm b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frm new file mode 100644 index 00000000..0126b13d --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frm @@ -0,0 +1,1162 @@ +VERSION 5.00 +Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx" +Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx" +Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx" +Begin VB.Form TTSAppMain + BorderStyle = 1 'Fixed Single + Caption = "SAPI5 TTSAPP" + ClientHeight = 6600 + ClientLeft = 3345 + ClientTop = 3645 + ClientWidth = 8085 + Icon = "TTSAppMain.frx":0000 + LinkTopic = "Form1" + MaxButton = 0 'False + NegotiateMenus = 0 'False + ScaleHeight = 6600 + ScaleWidth = 8085 + Begin VB.PictureBox VisemePicture + Height = 2175 + Left = 120 + ScaleHeight = 2115 + ScaleWidth = 1635 + TabIndex = 27 + TabStop = 0 'False + Top = 60 + Width = 1700 + End + Begin VB.CheckBox chkShowEvents + Caption = "Show Events" + Height = 195 + Left = 4560 + TabIndex = 25 + Top = 4200 + Width = 1335 + End + Begin VB.CommandButton StopBtn + Caption = "Stop" + Enabled = 0 'False + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 350 + Left = 6840 + TabIndex = 2 + Top = 500 + Width = 1125 + End + Begin VB.CheckBox chkSpFlagNLPSpeakPunc + Caption = "NLPSpeakPunc" + Height = 255 + Left = 6120 + TabIndex = 24 + Top = 3480 + Width = 1575 + End + Begin VB.CheckBox chkSpFlagPurgeBeforeSpeak + Caption = "PurgeBeforeSpeak" + Height = 255 + Left = 6120 + TabIndex = 22 + Top = 3120 + Width = 1695 + End + Begin VB.CheckBox chkSpFlagAync + Caption = "FlagsAsync" + Height = 255 + Left = 6120 + TabIndex = 20 + Top = 2760 + Width = 1575 + End + Begin VB.CheckBox chkSpFlagIsFilename + Caption = "IsFilename" + Height = 255 + Left = 4560 + TabIndex = 23 + Top = 3480 + Width = 1215 + End + Begin VB.CheckBox chkSpFlagPersistXML + Caption = "PersistXML" + Height = 255 + Left = 4560 + TabIndex = 21 + Top = 3120 + Width = 1215 + End + Begin VB.Frame Frame1 + Caption = "Speak Flags" + Height = 1575 + Left = 4320 + TabIndex = 18 + Top = 2400 + Width = 3615 + Begin VB.CheckBox chkSpFlagIsXML + Caption = "IsXML" + Height = 255 + Left = 240 + TabIndex = 19 + Top = 360 + Width = 855 + End + End + Begin VB.ComboBox AudioOutputCB + Height = 315 + ItemData = "TTSAppMain.frx":030A + Left = 840 + List = "TTSAppMain.frx":030C + Style = 2 'Dropdown List + TabIndex = 17 + Top = 4125 + Width = 3300 + End + Begin VB.TextBox MainTxtBox + Height = 2175 + HideSelection = 0 'False + Left = 1900 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 0 + Text = "TTSAppMain.frx":030E + Top = 60 + Width = 4575 + End + Begin VB.CommandButton ResetBtn + Caption = "Reset" + Height = 350 + Left = 6840 + TabIndex = 7 + Top = 1820 + Width = 1125 + End + Begin MSComctlLib.ImageList MouthImgList + Left = 6840 + Top = 3960 + _ExtentX = 1005 + _ExtentY = 1005 + BackColor = -2147483643 + MaskColor = 12632256 + _Version = 393216 + End + Begin VB.TextBox DebugTxtBox + BackColor = &H80000000& + Height = 1920 + Left = 120 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 3 'Both + TabIndex = 26 + Top = 4600 + Width = 7815 + End + Begin VB.CommandButton SkipBtn + Caption = "Skip" + Height = 350 + Left = 6840 + TabIndex = 4 + Top = 1380 + Width = 500 + End + Begin MSComCtl2.UpDown UpDown1 + Height = 350 + Left = 7725 + TabIndex = 6 + Top = 1380 + Width = 240 + _ExtentX = 423 + _ExtentY = 609 + _Version = 393216 + AutoBuddy = -1 'True + BuddyControl = "SkipTxtBox" + BuddyDispid = 196624 + OrigLeft = 7560 + OrigTop = 1800 + OrigRight = 7800 + OrigBottom = 2145 + Max = 50 + Min = -50 + SyncBuddy = -1 'True + BuddyProperty = 0 + Enabled = -1 'True + End + Begin VB.TextBox SkipTxtBox + Height = 350 + Left = 7320 + TabIndex = 5 + Text = "0" + Top = 1380 + Width = 400 + End + Begin MSComDlg.CommonDialog ComDlg + Left = 7560 + Top = 4080 + _ExtentX = 847 + _ExtentY = 847 + _Version = 393216 + End + Begin VB.ComboBox FormatCB + Height = 315 + Left = 840 + Style = 2 'Dropdown List + TabIndex = 15 + Top = 3705 + Width = 3300 + End + Begin MSComctlLib.Slider RateSldr + Height = 315 + Left = 840 + TabIndex = 11 + ToolTipText = "Changes voice playback rate" + Top = 2895 + Width = 3300 + _ExtentX = 5821 + _ExtentY = 556 + _Version = 393216 + LargeChange = 1 + Min = -10 + TickStyle = 3 + End + Begin VB.ComboBox VoiceCB + Height = 315 + Left = 840 + Style = 2 'Dropdown List + TabIndex = 9 + Top = 2475 + Width = 3300 + End + Begin VB.CommandButton PauseBtn + Caption = "Pause" + Enabled = 0 'False + Height = 350 + Left = 6840 + MaskColor = &H00808080& + TabIndex = 3 + Top = 940 + Width = 1125 + End + Begin VB.CommandButton SpeakBtn + Caption = "Speak" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 350 + Left = 6840 + TabIndex = 1 + Top = 60 + Width = 1125 + End + Begin MSComctlLib.Slider VolumeSldr + Height = 315 + Left = 840 + TabIndex = 13 + ToolTipText = "Changes voice playback volume" + Top = 3300 + Width = 3300 + _ExtentX = 5821 + _ExtentY = 556 + _Version = 393216 + Max = 100 + SelStart = 100 + TickStyle = 3 + Value = 100 + End + Begin VB.Label Label1 + Caption = "Audio Output" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 375 + Left = 120 + TabIndex = 16 + Top = 4095 + Width = 615 + End + Begin VB.Label Label5 + Caption = "Format" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 255 + Left = 120 + TabIndex = 14 + Top = 3735 + Width = 615 + End + Begin VB.Label Label4 + Caption = "Volume" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 255 + Left = 120 + TabIndex = 12 + Top = 3330 + Width = 735 + End + Begin VB.Label Label3 + Caption = "Rate" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 255 + Left = 120 + TabIndex = 10 + Top = 2925 + Width = 735 + End + Begin VB.Label Label2 + Caption = "Voice" + BeginProperty Font + Name = "MS Sans Serif" + Size = 8.25 + Charset = 0 + Weight = 700 + Underline = 0 'False + Italic = 0 'False + Strikethrough = 0 'False + EndProperty + Height = 255 + Left = 120 + TabIndex = 8 + Top = 2505 + Width = 495 + End + Begin VB.Menu menuFile + Caption = "File" + Begin VB.Menu menuFileOpenText + Caption = "Open Text File" + Shortcut = ^O + End + Begin VB.Menu menuFileSpeakWave + Caption = "Speak Wave File" + Shortcut = ^W + End + Begin VB.Menu menuFileSaveToWave + Caption = "Save To Wave File" + Shortcut = ^S + End + Begin VB.Menu menuSep + Caption = "-" + End + Begin VB.Menu menuFileExit + Caption = "Quit" + Shortcut = ^Q + End + End + Begin VB.Menu menuHelp + Caption = "Help" + Begin VB.Menu menuAbout + Caption = "About" + End + End +End +Attribute VB_Name = "TTSAppMain" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This VB TTS App sample demonstrates most of the TTS functionalities +' supported in SAPI 5.1. The main object used here is SpVoice. +' +' Copyright @ 2001 Microsoft Corporation All Rights Reserved. +'============================================================================= + +Option Explicit + +' First, declare the main SAPI object we are using in this sample. It is +' created inside Form_Load and released inside Form_Unload. +Dim WithEvents Voice As SpVoice +Attribute Voice.VB_VarHelpID = -1 + +' Speak flags is a combination of bit flags. These individual bits correspond +' to check boxes on the UI. So m_speakFlags should always be kept in sync +' with the state of those check boxes. +Dim m_speakFlags As SpeechVoiceSpeakFlags + +' This is the default format we will use. +Const DefaultFmt = "SAFT22kHz16BitMono" + +' We will disable the output combo box and show this if there's no audio output. +Const NoAudioOutput = "No audio ouput object available" + +' We will enable/disable menu items and buttons based on current state +' m_speaking indicates whether a speak task is in progress +' m_paused indicates whether Voice.Pause is called +Private m_bSpeaking As Boolean +Private m_bPaused As Boolean + + +Private Sub Form_Load() + On Error GoTo ErrHandler + + ' Creates the voice object first + Set Voice = New SpVoice + + ' Load the voices combo box + Dim Token As ISpeechObjectToken + + For Each Token In Voice.GetVoices + VoiceCB.AddItem (Token.GetDescription()) + Next + VoiceCB.ListIndex = 0 + + 'load the format combo box + AddItemToFmtCB + + ' set rate and volume to the same as the Voice + RateSldr.Value = Voice.Rate + VolumeSldr.Value = Voice.Volume + + 'set the default format + FormatCB.Text = DefaultFmt + + ' Load the audio output combo box + If Voice.GetAudioOutputs.Count > 0 Then + For Each Token In Voice.GetAudioOutputs + AudioOutputCB.AddItem (Token.GetDescription) + Next + Else + AudioOutputCB.AddItem NoAudioOutput + AudioOutputCB.Enabled = False + End If + AudioOutputCB.ListIndex = 0 + + 'load image list + LoadMouthImages + + MouthImgList.MaskColor = vbMagenta + MouthImgList.BackColor = GetSysColor(COLOR_3DFACE) + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICFULL") + + ' init speak flags and sync flag check boxes + m_speakFlags = SVSFlagsAsync Or SVSFPurgeBeforeSpeak Or SVSFIsXML + chkSpFlagAync.Value = Checked + chkSpFlagPurgeBeforeSpeak.Value = Checked + chkSpFlagIsXML.Value = Checked + + SetSpeakingState False, False + Exit Sub + +ErrHandler: + MsgBox "Error in initialization: " & vbCrLf & vbCrLf & Err.Description & _ + vbCrLf & vbCrLf & "Shutting down.", vbOKOnly, "TTSApp" + Set Voice = Nothing + End +End Sub + +Private Sub Form_Unload(Cancel As Integer) + Set Voice = Nothing +End Sub + +Private Sub AudioOutputCB_Click() + On Error GoTo ErrHandler + + ' change the output to the selected one + Set Voice.AudioOutput = Voice.GetAudioOutputs().Item(AudioOutputCB.ListIndex) + + ' changing output may have also changed the format, so call function + ' FormatCB_Click to make sure we are using the format as selected + FormatCB_Click + Exit Sub + +ErrHandler: + AddDebugInfo "Set audio output error: ", Err.Description +End Sub + +Private Sub FormatCB_Click() + On Error GoTo ErrHandler + + ' Note: AllowAudioOutputFormatChangesOnNextSet is a hidden property, VB + ' object browser doesn't show it by default. To see it, you can go to + ' VB object viewer, right click and turn on the "show hidden members". + Voice.AllowAudioOutputFormatChangesOnNextSet = False + + ' The format Type is associated with the selected list item as a long. + Voice.AudioOutputStream.Format.Type = FormatCB.ItemData(FormatCB.ListIndex) + + ' Currently you have to call this so that SAPI picks up the new format. + Set Voice.AudioOutputStream = Voice.AudioOutputStream + + Exit Sub + +ErrHandler: + AddDebugInfo "Set format error: ", Err.Description +End Sub + +Private Sub menuAbout_Click() + MsgBox "TTSApp" & vbCrLf & vbCrLf & "Copyright (c) 2001 Microsoft Corporation. All rights reserved.", _ + vbOKOnly Or vbInformation, "About TTSApp" +End Sub + +Private Sub menuFileExit_Click() + Unload TTSAppMain + End +End Sub + +Private Sub menuFileOpenText_Click() + + Dim sLocation As String + + ' Set CancelError is True + ComDlg.CancelError = True + On Error GoTo ErrHandler + + ' Set flags + ComDlg.Flags = cdlOFNFileMustExist Or cdlOFNPathMustExist + ' Set Dialog title + ComDlg.DialogTitle = "Open a Text File" + ' Set open directory + sLocation = GetDirectory() + If Len(sLocation) <> 0 Then + ComDlg.InitDir = sLocation + End If + + ' Set filters + ComDlg.Filter = "All Files (*.*)|*.*|Text, XML Files " & "(*.txt;*.xml)|*.txt;*.xml" + + ' Specify default filter + ComDlg.FilterIndex = 2 + ' Display the Open dialog box + ComDlg.ShowOpen + + ' Now open the text file and open it in the text box. + ' We only support text files encoded with the system code page as the + ' binary to unicode conversion in VB is using system code page. + Open ComDlg.FileName For Binary Access Read As 1 + MainTxtBox.Text = StrConv(InputB$(LOF(1), 1), vbUnicode) + Close #1 + + Exit Sub + +ErrHandler: + 'User pressed the Cancel button, do not show error + If Not (Err.Number = 32755) Then + AddDebugInfo "Open file: ", Err.Description + End If +End Sub + +Private Sub menuFileSaveToWave_Click() + ' Set CancelError is True + ComDlg.CancelError = True + On Error GoTo ErrHandler + + ' Set flags + ComDlg.Flags = cdlOFNOverwritePrompt Or cdlOFNPathMustExist Or cdlOFNNoReadOnlyReturn + ' Set Dialog title + ComDlg.DialogTitle = "Save to a Wave File" + ' Set filters + ComDlg.Filter = "All Files (*.*)|*.*|Wave Files " & "(*.wav)|*.wav" + ' Specify default filter + ComDlg.FilterIndex = 2 + ' Display the Open dialog box + ComDlg.ShowSave + + ' create a wave stream + Dim cpFileStream As New SpFileStream + + ' Set output format to selected format + cpFileStream.Format.Type = FormatCB.ItemData(FormatCB.ListIndex) + + ' Open the file for write + cpFileStream.Open ComDlg.FileName, SSFMCreateForWrite, False + + ' Set output stream to the file stream + Voice.AllowAudioOutputFormatChangesOnNextSet = False + Set Voice.AudioOutputStream = cpFileStream + + ' show action + AddDebugInfo "Save to .wav file" + + ' speak the given text with given flags + Voice.Speak MainTxtBox.Text, m_speakFlags + + ' wait until it's done speaking with a really really long timeout. + ' the tiemout value is in unit of millisecond. -1 means forever. + Voice.WaitUntilDone -1 + + ' Since the output stream was set to the file stream, we need to + ' set back to the selected audio output by calling AudioOutputCB_Click + ' as if user just changed it through UI + AudioOutputCB_Click + + ' close the file stream + cpFileStream.Close + Set cpFileStream = Nothing + + MsgBox "WAV file successfully written!", vbOKOnly, "File Saved" + Exit Sub + +ErrHandler: + 'User pressed the Cancel button, do not show error + If Not (Err.Number = 32755) Then + AddDebugInfo "Save to Wave file Error: ", Err.Description + End If + + If Not cpFileStream Is Nothing Then + Set cpFileStream = Nothing + End If +End Sub + +Private Sub menuFileSpeakWave_Click() + ' Set CancelError is True + ComDlg.CancelError = True + On Error GoTo ErrHandler + ' Set flags + ComDlg.Flags = cdlOFNFileMustExist Or cdlOFNPathMustExist + ' Set Dialog title + ComDlg.DialogTitle = "Speak a Wave File" + ' Set filters + ComDlg.Filter = "All Files (*.*)|*.*|Wave Files " & "(*.wav)|*.wav" + ' Specify default filter + ComDlg.FilterIndex = 2 + ' Display the Open dialog box + ComDlg.ShowOpen + + AddDebugInfo "Speak .wav file" + + ' Speak the contents of the wavefile. Notice here we are passing in the + ' file name so the filename flag is set. + MainTxtBox.Text = ComDlg.FileName + chkSpFlagIsFilename.Value = Checked + SpeakBtn_Click + + Exit Sub + +ErrHandler: + 'User pressed the Cancel button, do not show error + If Not (Err.Number = 32755) Then + AddDebugInfo "Speak Wave Error: ", Err.Description + End If + + SetSpeakingState False, m_bPaused + Exit Sub +End Sub + +Private Sub PauseBtn_Click() + Select Case PauseBtn.Caption + Case "Pause" + AddDebugInfo "Pause" + Voice.Pause + SetSpeakingState m_bSpeaking, True + + Case "Resume" + AddDebugInfo "Resume" + Voice.Resume + SetSpeakingState m_bSpeaking, False + End Select +End Sub + +Private Sub RateSldr_Scroll() + Voice.Rate = RateSldr.Value +End Sub + +Private Sub ResetBtn_Click() + 'set output to default + AudioOutputCB.ListIndex = 0 + Set Voice.AudioOutput = Nothing + + 'use default voice + VoiceCB.ListIndex = 0 + + 'Format to default + FormatCB.Text = DefaultFmt + + 'reset main text field + MainTxtBox.Text = "Enter text you wish spoken here." + + 'reset volume and rate + VolumeSldr.Value = 100 + VolumeSldr_Scroll + + RateSldr.Value = 0 + RateSldr_Scroll + + ' reset speak flags + m_speakFlags = SVSFlagsAsync Or SVSFPurgeBeforeSpeak Or SVSFIsXML + chkSpFlagAync.Value = Checked + chkSpFlagPurgeBeforeSpeak.Value = Checked + chkSpFlagIsXML.Value = Checked + chkSpFlagIsFilename.Value = Unchecked + chkSpFlagNLPSpeakPunc.Value = Unchecked + chkSpFlagPersistXML.Value = Unchecked + + 'reset DebugTxtbox text + DebugTxtBox.Text = Empty + + 'reset skip text box + SkipTxtBox.Text = "0" + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICFULL") + + ' if it's paused, call Resume to reset state + If m_bPaused Then Voice.Resume + + SetSpeakingState False, False +End Sub + +Private Sub SkipBtn_Click() + On Error GoTo ErrHandler + Dim SkipType As String + Dim SkipNum As Integer + + AddDebugInfo "Skip" + + ' skip by the number specified + SkipNum = SkipTxtBox.Text + SkipType = "Sentence" + + Voice.Skip SkipType, SkipNum + Exit Sub + +ErrHandler: + 'MsgBox Err.Description & ":" & Err.Number, vbOKOnly, "Skip Error" + AddDebugInfo "Skip Error: ", Err.Description + Exit Sub +End Sub + +Private Sub SpeakBtn_Click() + On Error GoTo ErrHandler + AddDebugInfo ("Speak") + + ' exit if there's nothing to speak + If MainTxtBox.Text = "" Then + Exit Sub + End If + + ' If it's paused and some text still remains to be spoken, Speak button + ' acts the same as Resume button. However a programmer can choose to + ' speak from the beginning again or any other behavior. + ' In other cases, we speak the text with given flags. + If Not (m_bPaused And m_bSpeaking) Then + ' just speak the text with the given flags + Voice.Speak MainTxtBox.Text, m_speakFlags + End If + + ' Resume if Voice is paused + If m_bPaused Then Voice.Resume + + ' set the state of menu items and buttons + SetSpeakingState True, False + Exit Sub + +ErrHandler: + AddDebugInfo "Speak Error: ", Err.Description + SetSpeakingState False, m_bPaused +End Sub + +Private Sub StopBtn_Click() + On Error GoTo ErrHandler + AddDebugInfo ("Stop") + + ' when string to speak is NULL and dwFlags is set to SPF_PURGEBEFORESPEAK + ' it indicates to SAPI that any remaining data to be synthesized should + ' be discarded. + Voice.Speak vbNullString, SVSFPurgeBeforeSpeak + If m_bPaused Then Voice.Resume + + SetSpeakingState False, False + Exit Sub + +ErrHandler: + AddDebugInfo "Speak Error: ", Err.Description +End Sub + +Private Sub Voice_AudioLevel(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal AudioLevel As Long) + ShowEvent "AudioLevel", "StreamNumber=" & StreamNumber, _ + "StreamPosition=" & StreamPosition, "AudioLevel=" & AudioLevel +End Sub + +Private Sub Voice_Bookmark(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal Bookmark As String, _ + ByVal BookmarkId As Long) + ShowEvent "BookMark", "StreamNumber=" & StreamNumber, _ + "StreamPosition=" & StreamPosition, "Bookmark=" & Bookmark, _ + "BookmarkId=" & BookmarkId +End Sub + +Private Sub Voice_EndStream(ByVal StreamNum As Long, ByVal StreamPos As Variant) + ShowEvent "EndStream", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos + + ' select all text to indicate that we are done + HighLightSpokenWords 0, Len(MainTxtBox.Text) + + ' reset the mouth + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICFULL") + + ' reset the state of buttons, checkboxes and menu items + SetSpeakingState False, m_bPaused +End Sub + +Private Sub Voice_EnginePrivate(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Long, _ + ByVal lParam As Variant) + ShowEvent "EnginePrivate", "StreamNumber=" & StreamNumber, _ + "StreamPosition=" & StreamPosition, "lParam=" & lParam +End Sub + +Private Sub Voice_Phoneme(ByVal StreamNumber As Long, _ + ByVal StreamPosition As Variant, _ + ByVal Duration As Long, _ + ByVal NextPhoneId As Integer, _ + ByVal Feature As SpeechLib.SpeechVisemeFeature, _ + ByVal CurrentPhoneId As Integer) + ShowEvent "Phoneme", "StreamNumber=" & StreamNumber, _ + "StreamPosition=" & StreamPosition, "NextPhoneId=" & NextPhoneId, _ + "Feature=" & Feature, "CurrentPhoneId=" & CurrentPhoneId +End Sub + +Private Sub Voice_Sentence(ByVal StreamNum As Long, _ + ByVal StreamPos As Variant, _ + ByVal Pos As Long, _ + ByVal Length As Long) + ShowEvent "Sentence", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos, _ + "Pos=" & Pos, "Length=" & Length +End Sub + +Private Sub Voice_StartStream(ByVal StreamNum As Long, ByVal StreamPos As Variant) + ShowEvent "StartStream", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos + + ' reset the state of buttons, checkboxes and menu items + SetSpeakingState True, m_bPaused +End Sub + +Private Sub Voice_Viseme(ByVal StreamNum As Long, _ + ByVal StreamPos As Variant, _ + ByVal Duration As Long, _ + ByVal VisemeType As SpeechVisemeType, _ + ByVal Feature As SpeechVisemeFeature, _ + ByVal VisemeId As Long) + + ShowEvent "Viseme", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos, _ + "Duration=" & Duration, "VisemeType=" & VisemeType, _ + "Feature=" & Feature, "VisemeId=" & VisemeId + + ' Here we are going to show different mouth positions according to the viseme. + ' The picture we show doesn't necessarily match the real mouth position. + ' Just trying to make it more interesting. + If VisemeId = 0 Then + VisemeId = VisemeId + 1 + End If + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", VisemeId) + If (VisemeId Mod 6 = 2) Then + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICEYECLOSED") + Else + If (VisemeId Mod 6 = 5) Then + Set VisemePicture.Picture = MouthImgList.Overlay("MICFULL", "MICEYENARROW") + End If + End If +End Sub + +Private Sub Voice_VoiceChange(ByVal StreamNum As Long, _ + ByVal StreamPos As Variant, _ + ByVal Token As SpeechLib.ISpeechObjectToken) + + ShowEvent "VoiceChange", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos, _ + "Token=" & Token.GetDescription + + ' Let's sync up the combo box with the new value + Dim i As Long + For i = 0 To VoiceCB.ListCount - 1 + If VoiceCB.List(i) = Token.GetDescription() Then + VoiceCB.ListIndex = i + Exit For + End If + Next +End Sub + +Private Sub Voice_Word(ByVal StreamNum As Long, _ + ByVal StreamPos As Variant, _ + ByVal Pos As Long, _ + ByVal Length As Long) + + ShowEvent "Word", "StreamNum=" & StreamNum, "StreamPos=" & StreamPos, _ + "Pos=" & Pos, "Length=" & Length + + Debug.Print Pos, Length, MainTxtBox.SelStart, MainTxtBox.SelLength + + ' Select the word that's currently being spoken. + HighLightSpokenWords Pos, Length +End Sub + +Private Sub VoiceCB_Click() + ' change the voice to the selected one + Set Voice.Voice = Voice.GetVoices().Item(VoiceCB.ListIndex) +End Sub + +Private Sub VolumeSldr_Scroll() + Voice.Volume = VolumeSldr.Value +End Sub + +' The following functions are simply to sync up the speak flags. +' When the check box is checked, the corresponding bit is set in the flags. +Private Sub chkSpFlagAync_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagAync.Value, m_speakFlags, SVSFlagsAsync) +End Sub + +Private Sub chkSpFlagIsFilename_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagIsFilename.Value, m_speakFlags, SVSFIsFilename) +End Sub + +Private Sub chkSpFlagIsXML_Click() + ' Note: special case here. There are two flags,SVSFIsXML and SVSFIsNotXML. + ' When neither is set, SAPI will guess by peeking at beginning characters. + ' In this sample, we explicitly set one of them. + + If chkSpFlagIsXML.Value = 0 Then + ' clear SVSFIsXML bit and set SVSFIsNotXML bit + m_speakFlags = m_speakFlags And Not SVSFIsXML + m_speakFlags = m_speakFlags Or SVSFIsNotXML + Else + ' clear SVSFIsNotXML bit and set SVSFIsXML bit + m_speakFlags = m_speakFlags And Not SVSFIsNotXML + m_speakFlags = m_speakFlags Or SVSFIsXML + End If +End Sub + +Private Sub chkSpFlagNLPSpeakPunc_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagNLPSpeakPunc.Value, m_speakFlags, SVSFNLPSpeakPunc) +End Sub + +Private Sub chkSpFlagPersistXML_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagPersistXML.Value, m_speakFlags, SVSFPersistXML) +End Sub + +Private Sub chkSpFlagPurgeBeforeSpeak_Click() + m_speakFlags = SetOrClearFlag(chkSpFlagPurgeBeforeSpeak.Value, m_speakFlags, SVSFPurgeBeforeSpeak) +End Sub + + +Private Sub AddFmts(ByRef name As String, ByVal fmt As SpeechAudioFormatType) + Dim index As String + + ' get the count of existing list so that we are adding to the bottom of the list + index = FormatCB.ListCount + + ' add the name to the list box and associate the format type with the item + FormatCB.AddItem name, index + FormatCB.ItemData(index) = fmt +End Sub + +Private Sub AddItemToFmtCB() + AddFmts "SAFT8kHz8BitMono", SAFT8kHz16BitMono + AddFmts "SAFT8kHz8BitStereo", SAFT8kHz8BitStereo + AddFmts "SAFT8kHz16BitMono", SAFT8kHz16BitMono + AddFmts "SAFT8kHz16BitStereo", SAFT8kHz16BitStereo + + AddFmts "SAFT11kHz8BitMono", SAFT11kHz8BitMono + AddFmts "SAFT11kHz8BitStereo", SAFT11kHz8BitStereo + AddFmts "SAFT11kHz16BitMono", SAFT11kHz16BitMono + AddFmts "SAFT11kHz16BitStereo", SAFT11kHz16BitStereo + + AddFmts "SAFT12kHz8BitMono", SAFT12kHz8BitMono + AddFmts "SAFT12kHz8BitStereo", SAFT12kHz8BitStereo + AddFmts "SAFT12kHz16BitMono", SAFT12kHz16BitMono + AddFmts "SAFT12kHz16BitStereo", SAFT12kHz16BitStereo + + AddFmts "SAFT16kHz8BitMono", SAFT16kHz8BitMono + AddFmts "SAFT16kHz8BitStereo", SAFT16kHz8BitStereo + AddFmts "SAFT16kHz16BitMono", SAFT16kHz16BitMono + AddFmts "SAFT16kHz16BitStereo", SAFT16kHz16BitStereo + + AddFmts "SAFT22kHz8BitMono", SAFT22kHz8BitMono + AddFmts "SAFT22kHz8BitStereo", SAFT22kHz8BitStereo + AddFmts "SAFT22kHz16BitMono", SAFT22kHz16BitMono + AddFmts "SAFT22kHz16BitStereo", SAFT22kHz16BitStereo + + AddFmts "SAFT24kHz8BitMono", SAFT24kHz8BitMono + AddFmts "SAFT24kHz8BitStereo", SAFT24kHz8BitStereo + AddFmts "SAFT24kHz16BitMono", SAFT24kHz16BitMono + AddFmts "SAFT24kHz16BitStereo", SAFT24kHz16BitStereo + + AddFmts "SAFT32kHz8BitMono", SAFT32kHz8BitMono + AddFmts "SAFT32kHz8BitStereo", SAFT32kHz8BitStereo + AddFmts "SAFT32kHz16BitMono", SAFT32kHz16BitMono + AddFmts "SAFT32kHz16BitStereo", SAFT32kHz16BitStereo + + AddFmts "SAFT44kHz8BitMono", SAFT44kHz8BitMono + AddFmts "SAFT44kHz8BitStereo", SAFT44kHz8BitStereo + AddFmts "SAFT44kHz16BitMono", SAFT44kHz16BitMono + AddFmts "SAFT44kHz16BitStereo", SAFT44kHz16BitStereo + + AddFmts "SAFT48kHz8BitMono", SAFT48kHz8BitMono + AddFmts "SAFT48kHz8BitStereo", SAFT48kHz8BitStereo + AddFmts "SAFT48kHz16BitMono", SAFT48kHz16BitMono + AddFmts "SAFT48kHz16BitStereo", SAFT48kHz16BitStereo +End Sub +Private Sub LoadMouthImages() + On Error GoTo ErrHandler + + MouthImgList.ListImages.Add 1, "MICFULL", LoadResPicture("MICFULL", vbResBitmap) + MouthImgList.ListImages.Add 2, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 3, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 4, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 5, , LoadResPicture("MIC10", vbResBitmap) + MouthImgList.ListImages.Add 6, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 7, , LoadResPicture("MIC9", vbResBitmap) + MouthImgList.ListImages.Add 8, , LoadResPicture("MIC2", vbResBitmap) + MouthImgList.ListImages.Add 9, , LoadResPicture("MIC13", vbResBitmap) + MouthImgList.ListImages.Add 10, , LoadResPicture("MIC9", vbResBitmap) + MouthImgList.ListImages.Add 11, , LoadResPicture("MIC12", vbResBitmap) + MouthImgList.ListImages.Add 12, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 13, , LoadResPicture("MIC9", vbResBitmap) + MouthImgList.ListImages.Add 14, , LoadResPicture("MIC3", vbResBitmap) + MouthImgList.ListImages.Add 15, , LoadResPicture("MIC6", vbResBitmap) + MouthImgList.ListImages.Add 16, , LoadResPicture("MIC7", vbResBitmap) + MouthImgList.ListImages.Add 17, , LoadResPicture("MIC8", vbResBitmap) + MouthImgList.ListImages.Add 18, , LoadResPicture("MIC5", vbResBitmap) + MouthImgList.ListImages.Add 19, , LoadResPicture("MIC4", vbResBitmap) + MouthImgList.ListImages.Add 20, , LoadResPicture("MIC7", vbResBitmap) + MouthImgList.ListImages.Add 21, , LoadResPicture("MIC9", vbResBitmap) + MouthImgList.ListImages.Add 22, , LoadResPicture("MIC11", vbResBitmap) + MouthImgList.ListImages.Add 23, "MICEYECLOSED", LoadResPicture("MICEYECLOSED", vbResBitmap) + MouthImgList.ListImages.Add 24, "MICEYENARROW", LoadResPicture("MICEYENARROW", vbResBitmap) + + Exit Sub +ErrHandler: + MsgBox Err.Description & ":" & Err.Number, vbOKOnly, "Load Images Error" +End Sub + +Private Sub AddDebugInfo(DebugStr As String, Optional Error As String = Empty) + ' This function adds debug string to the info window. + + ' First of all, let's delete a few charaters if the text box is about to + ' overflow. In this sample we are using the default limit of charaters. + If Len(DebugTxtBox.Text) > 64000 Then + Debug.Print "Too much stuff in the debug window. Remove first 10K chars" + DebugTxtBox.SelStart = 0 + DebugTxtBox.SelLength = 10240 + DebugTxtBox.SelText = "" + End If + + ' append the string to the DebugTxtBox text box and add a newline + DebugTxtBox.SelStart = Len(DebugTxtBox.Text) + DebugTxtBox.SelText = DebugStr & Error & vbCrLf +End Sub + +Private Sub ShowEvent(ParamArray strArray()) + ' we will only show the events if the ShowEvents box is checked + If chkShowEvents.Value = Checked Then + Dim strText As String + strText = Join(strArray, ", ") + AddDebugInfo " Event: " & strText + End If +End Sub + +Private Sub HighLightSpokenWords(ByVal Pos As Long, ByVal Length As Long) + On Error GoTo ErrHandler + + ' Only high light when the MainTxtBox is actually showing the spoken text, + ' instead of file name + If chkSpFlagIsFilename.Value = Unchecked Then + MainTxtBox.SelStart = Pos + MainTxtBox.SelLength = Length + End If + + Exit Sub + +ErrHandler: + AddDebugInfo "Failed to high light words. This may be caused by too many charaters in the main text box." +End Sub + +' This following helper function will set or clear a bit (flag) in the given +' integer (base) according to the condition (cond). If cond is 0, the bit +' is cleared. Otherwise, the bit is set. The resulting integer is returned. +Private Function SetOrClearFlag(ByVal cond As Long, _ + ByVal base As Long, _ + ByVal flag As Long) As Long + + If cond = 0 Then + ' the condition is false, clear the flag + SetOrClearFlag = base And Not flag + Else + ' the condition is false, set the flag + SetOrClearFlag = base Or flag + End If +End Function + +Private Sub SetSpeakingState(ByVal bSpeaking As Boolean, ByVal bPaused As Boolean) + ' change state of menu items and buttons accordingly + menuFileOpenText.Enabled = Not bSpeaking + menuFileSpeakWave.Enabled = Not bSpeaking + menuFileSaveToWave.Enabled = Not bSpeaking + + SpeakBtn.Enabled = True + + StopBtn.Enabled = bSpeaking + SkipBtn.Enabled = (bSpeaking And Not bPaused) + PauseBtn.Enabled = bSpeaking + + If bPaused Then + PauseBtn.Caption = "Resume" + Else + PauseBtn.Caption = "Pause" + End If + + m_bSpeaking = bSpeaking + m_bPaused = bPaused +End Sub + +Public Function GetDirectory() As String + + Err.Clear + + On Error GoTo ErrHandler + + Dim DataKey As ISpeechDataKey + Dim Category As New SpObjectTokenCategory + + 'Get the sdk installation location from the registry + 'The value is under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech". The string name is SDKPath" + Category.SetId SpeechRegistryLocalMachineRoot + Set DataKey = Category.GetDataKey + GetDirectory = DataKey.GetStringValue("SDKPath") + GetDirectory = GetDirectory + "samples\common" + + + +ErrHandler: + If Err.Number <> 0 Then + GetDirectory = "" + End If +End Function diff --git a/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frx b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frx new file mode 100644 index 00000000..b74a9cf0 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMain.frx differ diff --git a/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMod.bas b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMod.bas new file mode 100644 index 00000000..a32d11ee --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/TTSAppMod.bas @@ -0,0 +1,8 @@ +Attribute VB_Name = "TTSAppMod" +Option Explicit + +Declare Function GetSysColor Lib "user32" (ByVal index As Long) As Long + +Public Const COLOR_BTNFACE = 15 +Public Const COLOR_3DFACE = COLOR_BTNFACE + diff --git a/sp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.RES b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.RES new file mode 100644 index 00000000..dbe5c670 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.RES differ diff --git a/sp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.vbp b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.vbp new file mode 100644 index 00000000..7aef3591 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/TTSAppVB/ttsapp.vbp @@ -0,0 +1,47 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#C:\Program Files\Common Files\Microsoft Shared\Speech\sapi.dll#Microsoft Speech Object Library +Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX +Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX +Object={86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCT2.OCX +Form=TTSAppMain.frm +Module=TTSAppMod; TTSAppMod.bas +ResFile32="ttsapp.RES" +IconForm="TTSAppMain" +Startup="TTSAppMain" +HelpFile="" +Title="TTSAppVB" +ExeName32="TTSAppVB.exe" +Command32="" +Name="TTSApp" +HelpContextID="0" +Description="SAPI SDK VB TTS App sample" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corporation" +VersionFileDescription="TTSAppVB" +VersionLegalCopyright="Copyright (C) Microsoft Corporation. 1981-2001" +VersionProductName="Microsoft® Windows(TM) Operating System" +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.RES b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.RES new file mode 100644 index 00000000..21b65aae Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.RES differ diff --git a/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.vbp b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.vbp new file mode 100644 index 00000000..e20b2268 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutGoingCall.vbp @@ -0,0 +1,37 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\..\..\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{21D6D480-A88B-11D0-83DD-00AA003CCABD}#1.0#0#..\..\..\..\..\..\..\..\WINNT\System32\tapi3.dll#Microsoft TAPI 3.0 Type Library +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#..\..\..\..\..\sapi\sapi\objd\i386\sapi.dll#Microsoft Speech Object Library +Reference=*\G{EDAEECD8-0D75-499E-9B69-187ACACF2C05}#1.0#0#..\..\..\cpp\tapicustomstream\objd\i386\STCustomStream.dll#STCustomStream 1.0 Type Library +Form=VBOutgoingcall.frm +ResFile32="VBOutGoingCall.RES" +Startup="Form1" +ExeName32="VBOutGoingCall.exe" +Command32="" +Name="VBOutGoingCall" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corp." +CompilationType=0 +OptimizationType=0 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=0 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frm b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frm new file mode 100644 index 00000000..69ef1bdc --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frm @@ -0,0 +1,469 @@ +VERSION 5.00 +Begin VB.Form Form1 + BorderStyle = 1 'Fixed Single + Caption = "VB Outgoing Call" + ClientHeight = 3555 + ClientLeft = 150 + ClientTop = 720 + ClientWidth = 6105 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 3555 + ScaleWidth = 6105 + StartUpPosition = 3 'Windows Default + Begin VB.TextBox Text1 + Height = 1815 + Left = 240 + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 1 + Text = "VBOutgoingcall.frx":0000 + Top = 840 + Width = 4455 + End + Begin VB.ComboBox DestAddressCombo + Height = 315 + Left = 1320 + TabIndex = 0 + Top = 240 + Width = 3375 + End + Begin VB.CommandButton DisconnectBtn + Caption = "Disconnect" + Height = 450 + Left = 4920 + TabIndex = 4 + Top = 1320 + Width = 1000 + End + Begin VB.CommandButton CallBtn + Caption = "Dial" + Height = 450 + Left = 4920 + TabIndex = 2 + Top = 240 + Width = 1000 + End + Begin VB.Label Label1 + Caption = "Internet Call" + Height = 255 + Left = 240 + TabIndex = 6 + Top = 240 + Width = 975 + End + Begin VB.Label TitleLbl + Caption = "Call Status:" + Height = 255 + Left = 120 + TabIndex = 5 + Top = 3000 + Width = 855 + End + Begin VB.Label StatusLbl + Height = 375 + Left = 1080 + TabIndex = 3 + Top = 3000 + Width = 3495 + End + Begin VB.Menu menuFile + Caption = "File" + Begin VB.Menu menuFileExit + Caption = "Exit" + End + End + Begin VB.Menu menuHelp + Caption = "Help" + Begin VB.Menu menuAbout + Caption = "About" + End + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This VB Speech Telephony App sample demonstrates how to use SAPI TTS +' functionalities to speech enable the TAPI apps. The main objects used +' here are SAPI SpVoice, TAPI object, and custom real time audio object +' STCUSTOMSTREAMLib.TTSStream +' +'============================================================================= +Option Explicit + +Dim WithEvents gObjTapiWithEvents As TAPI +Attribute gObjTapiWithEvents.VB_VarHelpID = -1 +Dim WithEvents gObjVoice As SpVoice +Attribute gObjVoice.VB_VarHelpID = -1 +Dim gObjTapi As TAPI +Dim gobjAddress As ITAddress +Dim objCallControl As ITBasicCallControl +Dim AddressTypeSelected As Long +Dim MemStream As SpMemoryStream +Dim bConnectionStatus As Boolean +Const VFW_E_NOT_COMMITTED = &H80040211 'DirectShow Error :Cannot allocate a sample when the allocator is not active + +Const TAPI3_ALL_TAPI_EVENTS = _ + TE_ACDGROUP Or _ + TE_ADDRESS Or _ + TE_AGENT Or _ + TE_AGENTHANDLER Or _ + TE_AGENTSESSION Or _ + TE_CALLHUB Or _ + TE_CALLINFOCHANGE Or _ + TE_CALLMEDIA Or _ + TE_CALLNOTIFICATION Or _ + TE_CALLSTATE Or _ + TE_DIGITEVENT Or _ + TE_GENERATEEVENT Or _ + TE_PRIVATE Or _ + TE_QOSEVENT Or _ + TE_QUEUE Or _ + TE_REQUEST Or _ + TE_TAPIOBJECT +Private Sub menuAbout_Click() + MsgBox "VB Outgoing Call App" & vbCrLf & vbCrLf & "Copyright (c) 2001 Microsoft Corporation. All rights reserved.", _ + vbOKOnly Or vbInformation, "VB Outgoing Call" +End Sub + +Private Sub menuFileExit_Click() + Unload Me +End Sub + +Private Sub CallBtn_Click() + StatusLbl.Caption = _ + "Dial ..." + StatusLbl.Refresh + DisconnectBtn.Enabled = True + Call MakeTheCall +End Sub + +Private Sub DisconnectBtn_Click() + + Dim strMsg As String + + If objCallControl Is Nothing Then + strMsg = "Already disconnected." + StatusLbl.Caption = strMsg + StatusLbl.Refresh + Else + objCallControl.Disconnect (DC_NORMAL) + + 'Since the call has been disconnected, disable the Disconnect button + DisconnectBtn.Enabled = False + End If + +End Sub + +Private Sub Form_Load() + Dim strMsg As String + Dim objcollAddress As ITCollection + Dim nAddressIndex As Long + + 'Initialize Sapi + Set gObjVoice = New SpVoice + + 'Create a Tapi object + Set gObjTapi = New TAPI + + 'Initialize TAPI. this must be called before + 'any other tapi functions are called. + Call gObjTapi.Initialize + + 'set the EventFilter to accept all defined tapi events + gObjTapi.EventFilter = TAPI3_ALL_TAPI_EVENTS + + Set gObjTapiWithEvents = gObjTapi + + Call IpAddressOpt + + 'Load a good bye wave file and write it to the SpMemoryStream + Dim WaveData As Variant + WaveData = LoadResData("WAVEFILE", "CUSTOM") + + Set MemStream = New SpMemoryStream + MemStream.SetData WaveData + + 'Disable the button right now. It will be enabled after the connection + DisconnectBtn.Enabled = False + + 'There is no connection right now + bConnectionStatus = False +End Sub + +Private Sub Form_Unload(Cancel As Integer) + + If bConnectionStatus Then + MsgBox "The application is busy. Cannot exit now. Please try to disconnect first" + 'do not exit the app + Cancel = True + Else + 'shut down tapi and release global objects + If Not (gObjTapi Is Nothing) Then + gObjTapi.Shutdown + End If + Set objCallControl = Nothing + Set gobjAddress = Nothing + Set gObjTapi = Nothing + Set MemStream = Nothing + End If +End Sub + +Private Sub FindAnAddress(AddressTypeSelected As Long) + Dim Address As ITAddress + Dim AddressCaps As ITAddressCapabilities + Dim lType As Long + Dim MediaSupport As ITMediaSupport + + For Each Address In gObjTapi.Addresses + + 'query for ITAddressCapabilities + Set AddressCaps = Address + lType = AddressCaps.AddressCapability(AC_ADDRESSTYPES) + Set AddressCaps = Nothing + + 'is the type we are looking for? + If lType And AddressTypeSelected Then + If AddressSupportsMediaType(Address, TAPIMEDIATYPE_AUDIO) Then + If Len(Address.AddressName) <> 0 Then + 'save to global variable + Set gobjAddress = Address + Exit For + End If + End If + End If + + Set Address = Nothing + + Next + +End Sub + +Private Function AddressSupportsMediaType(Address As ITAddress, lType As Long) As Boolean + + Dim bType As Boolean + Dim pMediaSupport As ITMediaSupport + bType = False + + 'Check whether the service provider associated with the current address + 'supports the media type, lType + + Set pMediaSupport = Address + If pMediaSupport Is Nothing Then + bType = False + Else + bType = pMediaSupport.QueryMediaType(lType) + End If + + Set pMediaSupport = Nothing + AddressSupportsMediaType = bType +End Function + +Private Sub SelectTerminalsOnCall() + Dim objStreamControl As ITStreamControl + Set objStreamControl = objCallControl + + If Not (objStreamControl Is Nothing) Then + Dim objITCollStreams As ITCollection + Dim nIndex As Long, objCrtStream As ITStream + Dim objTerminalSupport As ITTerminalSupport + + Set objITCollStreams = objStreamControl.Streams + Set objTerminalSupport = gobjAddress + + 'Create a media streaming terminal and select the capture stream for the SAPI/TTS + 'audio output + Dim objTerminal As ITTerminal + Dim MediaStreamTerminalClsid As String + MediaStreamTerminalClsid = "{E2F7AEF7-4971-11D1-A671-006097C9A2E8}" + + For nIndex = 1 To objITCollStreams.Count + Set objCrtStream = objITCollStreams.Item(nIndex) + + + If (objCrtStream.Direction = TD_CAPTURE) Then + Set objTerminal = objTerminalSupport.CreateTerminal( _ + MediaStreamTerminalClsid, objCrtStream.MediaType, objCrtStream.Direction) + + Call objCrtStream.SelectTerminal(objTerminal) + End If + Set objCrtStream = Nothing + Next nIndex + + '''''''''''''' + ''USE SAPI TTS + '''''''''''''' + Dim CustomStream As New SpCustomStream + Dim SapiTapiTTSStream As STCUSTOMSTREAMLib.TTSStream + + 'Create the TTSStream object + Set SapiTapiTTSStream = New STCUSTOMSTREAMLib.TTSStream + + 'Initialize the TTSStream object + SapiTapiTTSStream.InitTTSCaptureStream objTerminal + + 'Set the TTSStream object as a BaseStream in the SAPI CustomStream object + Set CustomStream.BaseStream = SapiTapiTTSStream + + 'Use the current format and prevent the SAPI object from changing it + gObjVoice.AllowAudioOutputFormatChangesOnNextSet = False + + 'Set the audio output to the SAPI CustomStream + Set gObjVoice.AudioOutputStream = CustomStream + + 'release not needed objects + Set SapiTapiTTSStream = Nothing + Set CustomStream = Nothing + Set objTerminalSupport = Nothing + Set objITCollStreams = Nothing + Set objStreamControl = Nothing + End If +End Sub + +Private Sub MakeTheCall() + Dim lMediaType As Long + + If (AddressSupportsMediaType(gobjAddress, TAPIMEDIATYPE_AUDIO)) Then + + lMediaType = TAPIMEDIATYPE_AUDIO + lMediaType + End If + + Set objCallControl = gobjAddress.CreateCall(DestAddressCombo.Text, _ + AddressTypeSelected, lMediaType) + + + Call SelectTerminalsOnCall + + + 'connect + On Error GoTo ErrHandler + objCallControl.Connect False + On Error GoTo 0 + +ErrHandler: + If Err.Number = -2147221492 Then + MsgBox "Connection failed. Is the domain name or the IP Address correct?" + StatusLbl.Caption = "Connection failed." + DisconnectBtn.Enabled = False + End If +End Sub + +Private Sub gobjTapiWithEvents_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) + + Dim strMsg + + Select Case TapiEvent + Case TE_CALLNOTIFICATION + + Case TE_CALLSTATE + + 'for this type of event, the object pEvent must be + 'queried for its ITCallStateEvent interface + Dim objCallStateEvent As ITCallStateEvent + Set objCallStateEvent = pEvent + + Dim State As CALL_STATE + State = objCallStateEvent.State + + DisplayCallState (State) + Set objCallStateEvent = Nothing + + Case TE_CALLMEDIA + Dim MediaEvent As ITCallMediaEvent + Set MediaEvent = pEvent + + Select Case MediaEvent.Event + Case CME_STREAM_ACTIVE + + On Error GoTo ErrorHandler + 'prompt greetings + If (Text1.Text = "") Then + gObjVoice.Speak "Hello" + gObjVoice.Speak "Welcome to the Speech and Telephony API app. Have a nice day! Bye now", SVSFlagsAsync + + Else + gObjVoice.Speak Text1.Text, SVSFlagsAsync + End If + + 'Wait until the speak completes + Do + DoEvents + Loop Until gObjVoice.WaitUntilDone(1) = True + + + MemStream.Seek 0, SSSPTRelativeToStart + gObjVoice.SpeakStream MemStream + + DisconnectBtn_Click + End Select + End Select + Exit Sub + +ErrorHandler: + If Err.Number = VFW_E_NOT_COMMITTED Then + StatusLbl.Caption = "The connection was lost. Disconnecting ..." + StatusLbl.Refresh + DisconnectBtn_Click + Else + MsgBox "Error occurs: " & Err.Description & Err.Number + End If +End Sub + +Private Sub DisplayCallState(State As CALL_STATE) + Dim strMsg As String + + 'Display the current call status + Select Case State + Case CS_CONNECTED + 'The app is connected so we set the connection status to true + bConnectionStatus = True + StatusLbl.Caption = "CS_CONNECTED" + + Case CS_DISCONNECTED + DisconnectBtn_Click + 'The app is disconnected so we set the connection status to false + bConnectionStatus = False + StatusLbl.Caption = "CS_DISCONNECTED" + + Case CS_HOLD + StatusLbl.Caption = " CS_HOLD" + + Case CS_IDLE + StatusLbl.Caption = "CS_IDLE" + + Case CS_INPROGRESS + StatusLbl.Caption = "CS_INPROGRESS" + + Case CS_OFFERING + StatusLbl.Caption = "CS_OFFERING" + + Case CS_QUEUED + StatusLbl.Caption = "CS_QUEUED" + + Case Else + StatusLbl.Caption = "Unknown!!" + End Select + + StatusLbl.Refresh +End Sub + +Private Sub IpAddressOpt() + AddressTypeSelected = LINEADDRESSTYPE_DOMAINNAME + FindAnAddress AddressTypeSelected + + 'The app only supports the Internet call. You can add your interest IP + 'addresses or machine names here programmatically or simply add them in the + 'Properties of the DestAddressCombo ComBobox. + + DestAddressCombo.Text = " or IP address" + If Not (gobjAddress Is Nothing) Then + StatusLbl.Caption = "Using " & gobjAddress.AddressName + End If + StatusLbl.Refresh +End Sub + diff --git a/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frx b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frx new file mode 100644 index 00000000..b8566052 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/OutgoingCall/VBOutgoingcall.frx @@ -0,0 +1 @@ +GWelcome to the Speech and Telephony API app. Have a nice day! Bye now diff --git a/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.RES b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.RES new file mode 100644 index 00000000..d9257876 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.RES differ diff --git a/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frm b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frm new file mode 100644 index 00000000..ec908aa1 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frm @@ -0,0 +1,1081 @@ +VERSION 5.00 +Begin VB.Form Form1 + BackColor = &H8000000B& + BorderStyle = 1 'Fixed Single + Caption = "SAPI TAPI App" + ClientHeight = 4725 + ClientLeft = 150 + ClientTop = 720 + ClientWidth = 4605 + LinkTopic = "Form1" + MaxButton = 0 'False + MinButton = 0 'False + ScaleHeight = 4725 + ScaleWidth = 4605 + StartUpPosition = 3 'Windows Default + Begin VB.TextBox StatusBox + Height = 2655 + Left = 0 + Locked = -1 'True + MultiLine = -1 'True + ScrollBars = 2 'Vertical + TabIndex = 3 + Top = 2040 + Width = 4575 + End + Begin VB.CommandButton AnswerBtn + Caption = "Answer" + Height = 495 + Left = 840 + TabIndex = 1 + Top = 720 + Width = 2895 + End + Begin VB.ComboBox AddressTypesComBox + Height = 315 + Left = 840 + TabIndex = 0 + Text = "Combo1" + Top = 120 + Width = 2895 + End + Begin VB.CommandButton DisconnectBtn + Caption = "Disconnect" + Height = 495 + Left = 840 + TabIndex = 2 + Top = 1440 + Width = 2895 + End + Begin VB.Menu FileMenu + Caption = "File" + Begin VB.Menu ExitMenu + Caption = "Exit" + End + End + Begin VB.Menu AboutMenu + Caption = "About" + End +End +Attribute VB_Name = "Form1" +Attribute VB_GlobalNameSpace = False +Attribute VB_Creatable = False +Attribute VB_PredeclaredId = True +Attribute VB_Exposed = False +'============================================================================= +' +' This VB Speech Telephony App sample demonstrates how to use SAPI TTS and SR +' functionalities to speech enable the TAPI applications. The main objects used +' here are SAPI SpVoice, SpInprocRecognizer, SpMemoryStream TAPI object, and +' custom real time audio object STCUSTOMSTREAMLib.TTSStream and +' STCUSTOMSTREAMLib.ASRStream. The STCUSTOMSTREAMLib object is included in SAPI SDK. +' This object allows users to have the Internet calls between two computers and +' standard phone calls via the voice modem. This SAPI TAPI app uses the Internet call. +' However, users can enhance it to support the phone call by supporting +' LINEADDRESSTYPE_PHONENUMBER in FindAddressIndex() subroutine and add +' LINEADDRESSTYPE_PHONENUMBER to the AddressTypesComBox ComboBox. For the detail +' information about how to add the support for phone calls via the voice modem, +' please refer to TAPI SDK. +' +'============================================================================= + +Option Explicit + +Dim WithEvents gObjVoice As SpVoice +Attribute gObjVoice.VB_VarHelpID = -1 +Dim gObjRecognizer As SpInprocRecognizer +Dim WithEvents gObjRecoContext As SpInProcRecoContext +Attribute gObjRecoContext.VB_VarHelpID = -1 +Dim RecoDictationGrammar As ISpeechRecoGrammar +Dim RecoCCGrammar As ISpeechRecoGrammar +Dim TopRule As ISpeechGrammarRule +Dim CmdRule As ISpeechGrammarRule + +Dim WithEvents gObjTapiWithEvents As TAPI +Attribute gObjTapiWithEvents.VB_VarHelpID = -1 +Dim gObjTapi As TAPI +Attribute gObjTapi.VB_VarHelpID = -1 +Dim gobjAddress As ITAddress +Dim glRegistrationToken As Long +Dim gobjReceivedCallInfo As ITCallInfo +Dim gbSupportedCall As Boolean +Dim gobjCallControl As ITBasicCallControl + +Dim TimeOut As Long +Dim gMemStream As SpMemoryStream +Dim gByeWave As New SpMemoryStream +Dim gChimeWaveStream As New SpMemoryStream + +Dim gWriteSize As Long +Dim StreamSaveArray() As Long +Dim gIndex As Long + +Dim objSRTerminal As ITTerminal +Dim objTTSTerminal As ITTerminal +Dim gNextCall As Boolean +Dim bNeedWaitForEndStreamEvent As Boolean +Dim bConnectionStatus As Boolean + +Enum GRAMMARIDS + GID_DICTATION = 1 'ID for the dictation grammar + GID_CC = 3 'ID for the C&C grammar that's active when dictation is not +End Enum + +Const TAPI3_ALL_TAPI_EVENTS = _ + TE_ACDGROUP Or _ + TE_ADDRESS Or _ + TE_AGENT Or _ + TE_AGENTHANDLER Or _ + TE_AGENTSESSION Or _ + TE_CALLHUB Or _ + TE_CALLINFOCHANGE Or _ + TE_CALLMEDIA Or _ + TE_CALLNOTIFICATION Or _ + TE_CALLSTATE Or _ + TE_DIGITEVENT Or _ + TE_GENERATEEVENT Or _ + TE_PRIVATE Or _ + TE_QOSEVENT Or _ + TE_QUEUE Or _ + TE_REQUEST Or _ + TE_TAPIOBJECT +Const OPTTIMEOUT = &HFFFFF +Const LEAVEMESSAGEOPTION = &H1 +Const CHECKMESSAGEOPTION = &H2 +Const DISCONNECTED = &H4 +Const EVENTENDSTREAM = &H5 +Const VFW_E_NOT_COMMITTED = &H80040211 'DirectShow Error :Cannot allocate a sample when the allocator is not active + +Function TimeIt(PauseTime, Key, ExKey, Optional altExKey = OPTTIMEOUT) As Boolean + Dim Start, Finish, TotalTime + + Start = Timer ' Get start time. + Do While (Timer < Start + PauseTime) And (Key <> ExKey) And (Key <> altExKey) + DoEvents ' Yield to other processes. + Loop + + If Key = ExKey Then + TimeIt = True + Else + If Key = altExKey Then + TimeIt = True + Else + TimeIt = False ' time out + End If + End If +End Function + +Private Sub AboutMenu_Click() + MsgBox "Copyright (c) 2001 Microsoft Corporation", vbOKOnly + vbInformation, "SAPI TAPI App" +End Sub + +Private Sub AddressTypesComBox_Change() + AddressTypesComBox.ListIndex = 0 + RegisterForReceiveCall +End Sub + +Private Sub AddressTypesComBox_Click() + AddressTypesComBox.ListIndex = 0 + RegisterForReceiveCall +End Sub + +Private Sub LeaveMessage() + + Dim strMsg + + 'Reset the indices + gWriteSize = 0 + gIndex = 0 + ReDim StreamSaveArray(50) + + 'Create a new stream + Set gMemStream = New SpMemoryStream + + 'Assume that the maxinum time is 20 seconds for leaving a message + TimeOut = 0 + TimeIt 20, TimeOut, EVENTENDSTREAM, DISCONNECTED + +End Sub + +Private Sub AnswerBtn_Click() + + Dim strMsg + + 'Disable the answer button + AnswerBtn.Enabled = False + gNextCall = True + + If gobjReceivedCallInfo Is Nothing Then + strMsg = "There is no call to be answered!" + StatusBox.SelText = vbCrLf & strMsg + + Exit Sub + End If + + If Not (gobjReceivedCallInfo.CallState = CS_OFFERING) Then + strMsg = "Cannot answer call that doesn't have offering state." + StatusBox.SelText = vbCrLf & strMsg + + Exit Sub + End If + + ' + 'Not all addresses support ITTerminalSupport and ITStreamControl + 'therefore we need to be prepared for exceptions. + ' + On Error Resume Next + + + 'Query ITBasicCallControl, the call control interface + Set gobjCallControl = gobjReceivedCallInfo + + ' + 'Createa two media streaming terminals: One for TTS and another for SR + ' + 'query ITTerminalSupport from Address object + Dim objTerminalSupport As ITTerminalSupport + Set objTerminalSupport = gobjAddress + + If Not (objTerminalSupport Is Nothing) Then + + Dim MediaStreamTerminalClsid As String + + MediaStreamTerminalClsid = "{E2F7AEF7-4971-11D1-A671-006097C9A2E8}" + Set objTTSTerminal = objTerminalSupport.CreateTerminal( _ + MediaStreamTerminalClsid, TAPIMEDIATYPE_AUDIO, TD_CAPTURE) + Set objSRTerminal = objTerminalSupport.CreateTerminal( _ + MediaStreamTerminalClsid, TAPIMEDIATYPE_AUDIO, TD_RENDER) + + + 'Release not needed objects + Set objTerminalSupport = Nothing + + ' + 'Select the terminals before answering - select them one by one; + 'we'll need the ITStreamControl interface for doing this. + 'Select each terminal on the corresponding stream. + ' + + 'Note, if you are using a half-duplex voice modem, you only can select one + 'terminal at a time. Here, the app is designed for the Internet communications + 'so that the both terminals are selected + + + Dim objStreamControl As ITStreamControl + Set objStreamControl = gobjCallControl + + If Not (objStreamControl Is Nothing) Then + Dim objITCollStreams As ITCollection + + Set objITCollStreams = objStreamControl.Streams + + Dim nIndex As Long, objCrtStream As ITStream + + For nIndex = 1 To objITCollStreams.Count + Set objCrtStream = objITCollStreams.Item(nIndex) + + If objCrtStream.MediaType = TAPIMEDIATYPE_AUDIO Then + If objCrtStream.Direction = TD_CAPTURE Then + If Not (objTTSTerminal Is Nothing) Then + Call objCrtStream.SelectTerminal(objTTSTerminal) + End If + End If + If objCrtStream.Direction = TD_RENDER Then + If Not (objSRTerminal Is Nothing) Then + Call objCrtStream.SelectTerminal(objSRTerminal) + End If + End If + End If + + Set objCrtStream = Nothing + Next nIndex + + Set objITCollStreams = Nothing + Set objStreamControl = Nothing + End If + + End If + + On Error GoTo 0 + + 'Answer the call + gobjCallControl.Answer + + ' + 'Set the recognition state to active to get ready for recognition + 'Note: In SAPI 5.1, sapi turns off the recognition while the Read opration gets + 'any errors. + gObjRecognizer.State = SRSActive + + +End Sub + +Private Sub DisconnectBtn_Click() + + 'Set the disconnect flag + TimeOut = DISCONNECTED + + If gobjReceivedCallInfo Is Nothing Then + Dim strMsg As String + strMsg = "There is no call to be disconnected." + StatusBox.SelText = vbCrLf & strMsg + + Exit Sub + End If + + If Not (gobjCallControl Is Nothing) Then + gobjCallControl.Disconnect (DC_NORMAL) + + 'release the call control interface + Set gobjCallControl = Nothing + End If + + + 'Deactive grammars + RecoDictationGrammar.DictationSetState SGDSInactive + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSInactive + + 'Release terminals + If Not (objTTSTerminal Is Nothing) Then + Set objTTSTerminal = Nothing + End If + + If Not (objSRTerminal Is Nothing) Then + Set objSRTerminal = Nothing + End If + + If bNeedWaitForEndStreamEvent Then + 'Wait about 30 seconds for the endstream event + TimeIt 30, TimeOut, EVENTENDSTREAM + End If + + 'Disable the Disconnect and Answer button + DisconnectBtn.Enabled = False + AnswerBtn.Enabled = False +End Sub + +Private Sub ExitMenu_Click() + + 'Unload the form + Unload Me + +End Sub + +Private Sub Form_Load() + + 'Initialize Sapi + Set gObjRecognizer = New SpInprocRecognizer + Set gObjRecoContext = gObjRecognizer.CreateRecoContext + + 'Obtain the voice from Reco Context + Set gObjVoice = gObjRecoContext.Voice + + 'Set interest events. Assume that we are only interested in the following four + 'SAPI SR events. + gObjRecoContext.EventInterests = SRERecognition + SRESoundEnd + SREStreamEnd + _ + SREStreamStart + SRESoundEnd + + 'Retain the audio so that we can Speak the audio later + gObjRecoContext.RetainedAudio = SRAORetainAudio + + 'Create and Load the grammars + Set RecoDictationGrammar = gObjRecoContext.CreateGrammar(GID_DICTATION) + Set RecoCCGrammar = gObjRecoContext.CreateGrammar(GID_CC) + + RecoDictationGrammar.DictationLoad vbNullString, SLOStatic + + 'Build a dynamic Command and Control grammar + Dim CommandState As ISpeechGrammarRuleState + + ' Add two rules. The top level rule will reference the command rule. + ' User can choose the following commands: leave message, check message, leave, and check. + Set TopRule = RecoCCGrammar.Rules.Add("TopLevelRule", SRATopLevel Or SRADynamic, 1) + Set CmdRule = RecoCCGrammar.Rules.Add("CmdRule", SRADynamic, 2) + + Set CommandState = TopRule.AddState + + TopRule.InitialState.AddRuleTransition CommandState, CmdRule, 0, 0 + + CmdRule.InitialState.AddWordTransition Nothing, "leave", " ", , "", 0, "", 0 + CmdRule.InitialState.AddWordTransition Nothing, "check", " ", , "", 1, 1, 1 + + CommandState.AddWordTransition Nothing, "message", " ", , "", 1, "", 1 + + RecoCCGrammar.Rules.Commit + + 'Disable the Answer button. It will be enabled after a call is placed. + AnswerBtn.Enabled = False + + 'Disable the Disconnect button + DisconnectBtn.Enabled = False + + 'This application only supports the Internet call between two computers. You can use + 'AddressTypesComBox, to add more types of the connections, such as LINEADDRESSTYPE_PHONENUMBER + 'For example, if you want to support the phone calls, you need to add more code in + 'FindAddressIndex(). In addition, if you only have a half-duplex voice modem, then you + 'have to make some changes to ensure that you select one terminal at any time. + + AddressTypesComBox.AddItem ("H323 Calls") + AddressTypesComBox.ItemData(AddressTypesComBox.NewIndex) = LINEADDRESSTYPE_DOMAINNAME + + AddressTypesComBox.ListIndex = 0 + + 'Load the tone wave file to the SpMemoryStream + Dim WaveData As Variant + WaveData = LoadResData("CHIMES", "CUSTOM") + gChimeWaveStream.SetData WaveData + + 'Load the good bye wave file + Dim ByeWave As Variant + ByeWave = LoadResData("BYEWAVE", "CUSTOM") + gByeWave.SetData ByeWave + + 'Init the flag. The flag will be set to true when a start stream event is received + bNeedWaitForEndStreamEvent = False + + 'There is no connection + bConnectionStatus = False + +End Sub + +Private Sub RegisterForReceiveCall() + Dim strMsg As String + + 'Don't let the user do this in the middle of a call + If Not (gobjReceivedCallInfo Is Nothing) Then + StatusBox.SelText = vbCrLf & "Don't do this in the middle of a call." + Exit Sub + End If + + 'Initialize Tapi + Set gObjTapi = New TAPI + + 'Initialize before calling any other tapi function + Call gObjTapi.Initialize + + 'Set the EventFilter to accept all defined tapi events + gObjTapi.EventFilter = TAPI3_ALL_TAPI_EVENTS + + Set gObjTapiWithEvents = gObjTapi + + 'Pick up the collection of addresses + ' + Dim objcollAddress As ITCollection + Set objcollAddress = gObjTapi.Addresses + + If (objcollAddress Is Nothing) Then + StatusBox.SelText = vbCrLf & "Failed in query ITCollection" + Exit Sub + End If + + 'Search address that supports the desired address type and media type + ' + Dim nAddressIndex + nAddressIndex = FindAddressIndex(objcollAddress) + + If nAddressIndex < 1 Or nAddressIndex > objcollAddress.Count Then + + strMsg = "Could not find an appropriate address for this address type!" + StatusBox.SelText = vbCrLf & strMsg + + 'Release the object + Set objcollAddress = Nothing + Exit Sub + End If + + 'If RegisterCallNotifications had been previously called, + 'unregister here, before registering for the new address + 'This is not a required step, a TAPI3 app can register for + 'receiving call notifications on more than one address in + 'the same time, but the app must be able to handle multiple + 'calls on multiple addresses. + 'This sample prefers to register on only one address at a time. + If glRegistrationToken <> 0 Then + Call gObjTapi.UnregisterNotifications(glRegistrationToken) + glRegistrationToken = 0 + End If + + 'pick up the "N"-th address - the address on which + 'you want to register for receiving calls + Set gobjAddress = objcollAddress.Item(nAddressIndex) + Set objcollAddress = Nothing 'no more needed, release + + 'Register (specify) media types for which you want to receive calls; + 'only calls that have this media type will be offered to the app. + 'The media types must be passed to RegisterCallNotifications + 'bits in a "dword", which in VB is actually a "long". + ' + Dim fOwner As Boolean, fMonitor As Boolean + Dim lMediaTypes As Long, lCallbackInstance As Long + + 'fOwner = True ensures that app receives incoming calls + 'and their call state events + fOwner = True + fMonitor = False + lMediaTypes = TAPIMEDIATYPE_AUDIO + lCallbackInstance = 1 + + On Error Resume Next + glRegistrationToken = gObjTapi.RegisterCallNotifications( _ + gobjAddress, fMonitor, fOwner, lMediaTypes, lCallbackInstance) + If Err.Number <> 0 Then + strMsg = "Registering for receiving calls failed." & vbCrLf & _ + "If you have a data modem, replace it with a voice modem. " & _ + "Quit the app and try again." + + StatusBox.SelText = vbCrLf & strMsg + + Exit Sub + End If + + 'From now on the app is able to receive calls made on the + 'specified address, with the specified media type + + StatusBox.SelText = vbCrLf & "Registration for calls succeeded. " & vbCrLf & "Waiting for a call..." + + Exit Sub +End Sub + +'Search through all addresses that support "audio". +'Return 0 if no address found. Otherwise return its index, which will be +'between 1 and Addresses.Count +Private Function FindAddressIndex(objCollAddresses As ITCollection) As Long + + Dim nSelectedType As Long + Dim indexAddr As Long + Dim objCrtAddress As ITAddress + Dim lAddrTypes As Long + Dim objMediaSupport As ITMediaSupport + Dim objAddressCaps As ITAddressCapabilities + Dim lMediaTypes As Long + Dim bFound As Boolean + + ' + 'Retrieve from combo box the type of the selected address type + ' + nSelectedType = AddressTypesComBox.ItemData(AddressTypesComBox.ListIndex) + + ' + 'search through all addresses the first one that matches this type + 'and also supports the media type "audio" + ' + bFound = False + + For indexAddr = 1 To objCollAddresses.Count + + Set objCrtAddress = objCollAddresses.Item(indexAddr) + + Set objMediaSupport = objCrtAddress + Set objAddressCaps = objCrtAddress + + lMediaTypes = objMediaSupport.MediaTypes + + ' + 'Note: objMediaSupport.MediaTypes is a long that has + 'a bit set for each supported media type; + 'check if the bit for "audio" is set. + ' + If lMediaTypes And TAPIMEDIATYPE_AUDIO Then + + lAddrTypes = objAddressCaps.AddressCapability(AC_ADDRESSTYPES) + + If nSelectedType = LINEADDRESSTYPE_DOMAINNAME Then + 'the user selected "h323 calls" + 'we must expect such an address to support + 'LINEADDRESSTYPE_DOMAINNAME; it's enough to check only + 'for this flag. + If lAddrTypes And LINEADDRESSTYPE_DOMAINNAME Then + bFound = True + End If + End If + + End If + + Set objAddressCaps = Nothing + Set objMediaSupport = Nothing + Set objCrtAddress = Nothing + + If bFound = True Then Exit For + Next indexAddr + + ' + 'Return the index of the found address, or 0 if no address found + ' + If bFound = True Then + FindAddressIndex = indexAddr + Else + FindAddressIndex = 0 + End If + Exit Function +End Function + +Private Sub Form_Terminate() + 'Release all global objects + + Set gobjReceivedCallInfo = Nothing + Set gobjAddress = Nothing + Set gObjTapiWithEvents = Nothing + If Not (gObjTapi Is Nothing) Then + gObjTapi.Shutdown + End If + Set gObjTapi = Nothing + + 'Deactivate the grammars and release them + RecoDictationGrammar.DictationSetState SGDSInactive + RecoCCGrammar.CmdSetRuleState vbNullString, SGDSInactive + + TopRule.Clear + CmdRule.Clear + + Set RecoCCGrammar = Nothing + Set RecoDictationGrammar = Nothing + Set gObjRecoContext = Nothing + Set gObjRecognizer = Nothing + + 'Release the stream objects + Set gMemStream = Nothing + Set gByeWave = Nothing + Set gChimeWaveStream = Nothing + +End Sub + +Private Sub Form_Unload(Cancel As Integer) + + If bConnectionStatus Then + MsgBox "The application is busy. Cannot exit now. Please try to disconnect first" + Cancel = True + End If + +End Sub + +Private Sub gObjRecoContext_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult) + + StatusBox.SelText = vbCrLf & "SR Recognition" + Dim text As String + + Select Case Result.PhraseInfo.GrammarId + + Case GID_DICTATION + ' Dictation events + text = Result.PhraseInfo.GetText + Dim SerializeResult As Variant + Dim WriteSize As Long + + + StatusBox.SelText = vbCrLf & text + SerializeResult = Result.SaveToMemory + WriteSize = gMemStream.Write(SerializeResult) + + If (gIndex > UBound(StreamSaveArray)) Then + ReDim Preserve StreamSaveArray((UBound(StreamSaveArray) + 50)) + End If + + StreamSaveArray(gIndex) = WriteSize + gWriteSize = gWriteSize + WriteSize + gIndex = gIndex + 1 + + Case GID_CC + ' Command and Control events + text = Result.PhraseInfo.GetText + StatusBox.SelText = vbCrLf & text + Select Case text + + Case "leave message", "leave" + TimeOut = LEAVEMESSAGEOPTION + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSInactive + + Case "check message", "check" + TimeOut = CHECKMESSAGEOPTION + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSInactive + End Select + End Select + +End Sub + +Private Sub gObjRecoContext_SoundEnd(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + + StatusBox.SelText = vbCrLf & "SR SoundEnd" +End Sub + +Private Sub gObjRecoContext_SoundStart(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + + StatusBox.SelText = vbCrLf & "SR SoundStart" +End Sub + +Private Sub gObjRecoContext_StartStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant) + bNeedWaitForEndStreamEvent = True + StatusBox.SelText = vbCrLf & "SR StartStream" +End Sub + +Private Sub gObjRecoContext_EndStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal StreamReleased As Boolean) + TimeOut = EVENTENDSTREAM + bNeedWaitForEndStreamEvent = False + StatusBox.SelText = vbCrLf & "SR EndStream" +End Sub + +Private Sub gobjTapiWithEvents_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) + + Dim strMsg + + If TapiEvent = TE_CALLNOTIFICATION Then + + StatusBox.SelText = vbCrLf & "TAPI: TE_CALLNOTIFICATION" + + 'In the case of TE_CALLNOTIFICATION, pEvent contains an ITCallNotficationEvent + 'interface, so query for the interface + + Dim objCallNotificationEvent As ITCallNotificationEvent + Set objCallNotificationEvent = pEvent + + 'Decide if we can take this call: this app only + 'supports one call at a time, so if it already has a call, + 'it will reject any other call that arrives in the same time. + ' + gbSupportedCall = True + + If Not (gobjReceivedCallInfo Is Nothing) Then + + gbSupportedCall = False + + strMsg = "This app doesn't support a second call. " + strMsg = strMsg & "Unsupported second call will be rejected!" + + StatusBox.SelText = vbCrLf & strMsg + + 'Note: objCallNotificationEvent.Call actually contains an + 'ITCallInfo interface, but by assigning it to an ITBasicCallControl + 'interface, we actually query for the interface "ITBasicCallControl" + Dim objReceivedCallControl As ITBasicCallControl + Set objReceivedCallControl = objCallNotificationEvent.Call + + 'Reject the not supported call by calling Disconnect + 'Note: this second call will arrive only if the tsp (tapi service provider) + 'supports more than 1 call per address. + Dim code As DISCONNECT_CODE + code = DC_REJECTED + objReceivedCallControl.Disconnect (code) + + 'release all objects that are not needed any longer + Set objReceivedCallControl = Nothing + Set objCallNotificationEvent = Nothing + + Exit Sub + + End If + + 'Query ITCallInfo interface for the new call, and store it + Set gobjReceivedCallInfo = objCallNotificationEvent.Call + + 'Reenable the button + AnswerBtn.Enabled = True + + Set objCallNotificationEvent = Nothing + + Exit Sub + End If + + If TapiEvent = TE_CALLSTATE Then + + StatusBox.SelText = vbCrLf & "TAPI: TE_CALLSTATE" + + 'For this type of event, the object pEvent must be + 'queried for its ITCallStateEvent interface + Dim objCallStateEvent As ITCallStateEvent + Set objCallStateEvent = pEvent + + Dim State As CALL_STATE + Dim objEventCallInfo As ITCallInfo + + 'Extract the call object from pEvent (from its + 'ITCallStateEvent interface) + Set objEventCallInfo = objCallStateEvent.Call + State = objCallStateEvent.State + + If objEventCallInfo Is gobjReceivedCallInfo Then + + 'Display the all status + DisplayCallState (State) + + If State = CS_DISCONNECTED Then + 'After call is disconnected, release the object + Set gobjReceivedCallInfo = Nothing + End If + + End If + + Set objEventCallInfo = Nothing + Set objCallStateEvent = Nothing + + Exit Sub + End If + + If TapiEvent = TE_CALLMEDIA Then + 'Handle the call + HandleTheCall pEvent + + End If + + Exit Sub +End Sub + +Private Sub HandleTheCall(pEvent As Object) + Dim MediaEvent As ITCallMediaEvent + + Set MediaEvent = pEvent + + 'Handle one call at a time when the connection is established and + ' the media stream is active + If (CME_STREAM_ACTIVE = MediaEvent.Event) And (gNextCall) And (bConnectionStatus) Then + + gNextCall = False + Dim CustomStream As New SpCustomStream + Dim SapiTapiTTSStream As STCUSTOMSTREAMLib.TTSStream + Dim SapiTapiSRStream As STCUSTOMSTREAMLib.ASRStream + + + '''''''''''''' + ''TTS + '''''''''''''' + 'Create the audio stream object + Set SapiTapiTTSStream = New STCUSTOMSTREAMLib.TTSStream + + 'Initialize the stream object + SapiTapiTTSStream.InitTTSCaptureStream objTTSTerminal + + 'Set the audio stream object as the BaseStream + Set CustomStream.BaseStream = SapiTapiTTSStream + + 'Prevent the format from being changes + gObjVoice.AllowAudioOutputFormatChangesOnNextSet = False + + 'Set up the audio output + Set gObjVoice.AudioOutputStream = CustomStream + + 'Release the objects + Set SapiTapiTTSStream = Nothing + Set CustomStream = Nothing + + '''''''''''''' + ''SR + '''''''''''''' + 'Create a SAPI CustomStream object + Set CustomStream = New SpCustomStream + + 'Create the audio stream object + Set SapiTapiSRStream = New STCUSTOMSTREAMLib.ASRStream + + 'Initialize the stream object + SapiTapiSRStream.InitSRRenderStream objSRTerminal + + 'Set the audio stream object as the BaseStream + Set CustomStream.BaseStream = SapiTapiSRStream + + 'Prevent the format from being changes + gObjRecognizer.AllowAudioInputFormatChangesOnNextSet = False + + 'Set up the audio input + Set gObjRecognizer.AudioInputStream = CustomStream + + 'Release the object + Set CustomStream = Nothing + + 'Wait 3 seconds for the media streaming to be active. In most cases, this + 'is unnecessary. Somehow on some machines, the media stream is still + 'inactive although we have CME_STREAM_ACTIVE event. + + StatusBox.SelText = vbCrLf & "Waiting for the media streaming to be active ..." + Dim j + TimeOut = 0 + For j = 0 To 3 + TimeIt 1, TimeOut, 1, DISCONNECTED + StatusBox.SelText = "." + Next j + + 'If users click the disconnect button, exit the app + If (TimeOut = DISCONNECTED) Then + Set SapiTapiSRStream = Nothing + Exit Sub + End If + + + On Error GoTo ErrorHandler + 'greetings + gObjVoice.Speak "Welcome to the Speech and Telephony API app." + gObjVoice.Speak "Please select the following two options: Leave message or Check message", SVSFIsXML + + 'use Command and Control for the option menu + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSActive + + 'the maxinum time for selecting a menu is 10 seconds + TimeOut = 0 + TimeIt 10, TimeOut, LEAVEMESSAGEOPTION, CHECKMESSAGEOPTION + RecoCCGrammar.CmdSetRuleState "TopLevelRule", SGDSInactive + + If (TimeOut = LEAVEMESSAGEOPTION) Then + 'User selects "leave a message menu" + 'Reset the timeout flag + TimeOut = 0 + + 'Wait for the endstream event + TimeIt 30, TimeOut, EVENTENDSTREAM, DISCONNECTED + + gObjVoice.Speak "Please leave the message after the tone" + gChimeWaveStream.Seek 0, SSSPTRelativeToStart + gObjVoice.SpeakStream gChimeWaveStream + + RecoDictationGrammar.DictationSetState SGDSActive + LeaveMessage + RecoDictationGrammar.DictationSetState SGDSInactive + + 'Release the object + Set SapiTapiSRStream = Nothing + + 'Wait for the endstream event + TimeIt 30, TimeOut, EVENTENDSTREAM, DISCONNECTED + + 'Play back the audio if any + If (gWriteSize <> 0) Then + StatusBox.SelText = vbCrLf & "Playing the message" + gMemStream.Seek 0, SSSPTRelativeToStart + Dim resultGet As Variant, length As Long + Dim RecoResultGet As ISpeechRecoResult + + gObjVoice.Speak "Following is your message" + + Dim i + For i = 0 To gIndex - 1 + + length = gMemStream.Read(resultGet, StreamSaveArray(i)) + Set RecoResultGet = gObjRecoContext.CreateResultFromMemory(resultGet) + DoEvents + RecoResultGet.SpeakAudio + Set RecoResultGet = Nothing + Next i + gObjVoice.Speak "end of your message" + + End If + + Else + If (TimeOut = CHECKMESSAGEOPTION) Then + StatusBox.SelText = vbCrLf & "Playing the message" + 'Reset the timeout flag + TimeOut = 0 + + 'Wait for the endstream event + TimeIt 30, TimeOut, EVENTENDSTREAM, DISCONNECTED + + If (gWriteSize <> 0) Then + gMemStream.Seek 0, SSSPTRelativeToStart + gObjVoice.Speak "The following is your message" + + For i = 0 To gIndex - 1 + + length = gMemStream.Read(resultGet, StreamSaveArray(i)) + Set RecoResultGet = gObjRecoContext.CreateResultFromMemory(resultGet) + DoEvents + RecoResultGet.SpeakAudio + Set RecoResultGet = Nothing + Next i + gObjVoice.Speak "end of your message" + Else + gObjVoice.Speak "You do not have any messages" + + End If + Else + gObjVoice.Speak "You did not select anything" + + End If ' check message + End If 'leave message + gObjVoice.Speak "good bye!" + gByeWave.Seek 0, SSSPTRelativeToStart + gObjVoice.SpeakStream gByeWave + + 'Release the object + If Not (SapiTapiSRStream Is Nothing) Then + Set SapiTapiSRStream = Nothing + End If + + DisconnectBtn_Click + + End If ' media stream active + Exit Sub + +ErrorHandler: + If Err.Number = VFW_E_NOT_COMMITTED Then + StatusBox.SelText = vbCrLf & "The connection was lost. Disconnecting ..." + DisconnectBtn_Click + Else + MsgBox "Error occurs in HandleTheCall: " & Err.Description & vbCrLf & " " & Err.Number + Resume Next + End If + 'Release the object + If Not (SapiTapiSRStream Is Nothing) Then + Set SapiTapiSRStream = Nothing + End If +End Sub + +Private Sub DisplayCallState(State As CALL_STATE) + Dim strMsg As String + + Select Case State + Case CS_CONNECTED + bConnectionStatus = True + strMsg = "call state: CS_CONNECTED" + StatusBox.SelText = vbCrLf & strMsg + + 'Enable the Disconnect button + DisconnectBtn.Enabled = True + Case CS_DISCONNECTED + DisconnectBtn_Click + bConnectionStatus = False + strMsg = "call state: CS_DISCONNECTED" & vbCrLf + strMsg = strMsg & "New incoming calls will be accepted. " + + StatusBox.SelText = vbCrLf & strMsg + Case CS_HOLD + + StatusBox.SelText = vbCrLf & "call state: CS_HOLD" + Case CS_IDLE + + StatusBox.SelText = vbCrLf & "call state: CS_IDLE" + + Case CS_INPROGRESS + + StatusBox.SelText = vbCrLf & "call state: CS_INPROGRESS" + + Case CS_OFFERING + If gbSupportedCall = True Then + strMsg = "call state: CS_OFFERING" + Dim RemoteMachine As String + + '.CallInfoString fails sometimes on some networks, so we ignore the error in + 'getting the remote machine name + On Error Resume Next + 'get caller's machine name + RemoteMachine = gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNAME) + On Error GoTo 0 + + strMsg = strMsg & vbCrLf & "A call " + If Not (RemoteMachine = "") Then + 'Some machine names contain the line feed. So we remove it here + strMsg = strMsg & "from ' " + Dim str + For Each str In Split(RemoteMachine, vbLf) + strMsg = strMsg & str & " " + Next str + strMsg = strMsg & "' " + End If + strMsg = strMsg & "has been received. You can answer it by clicking the Answer button." + StatusBox.SelText = vbCrLf & strMsg + End If + + Case CS_QUEUED + StatusBox.SelText = vbCrLf & "call state: CS_QUEUED" + + Case Else + StatusBox.SelText = vbCrLf & "call state: unknown!!" + + End Select + +End Sub + diff --git a/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frx b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frx new file mode 100644 index 00000000..8ebef8e2 Binary files /dev/null and b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.frx differ diff --git a/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.vbp b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.vbp new file mode 100644 index 00000000..d430bac5 --- /dev/null +++ b/sp/src/utils/sapi51/Samples/VB/VBTAPISamples/SAPITAPIWithInternetCall/SapiTapi.vbp @@ -0,0 +1,40 @@ +Type=Exe +Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\..\..\WINNT\System32\stdole2.tlb#OLE Automation +Reference=*\G{C866CA3A-32F7-11D2-9602-00C04F8EE628}#5.0#0#..\..\..\..\..\sapi\sapi\objd\i386\sapi.dll#Microsoft Speech Object Library +Reference=*\G{21D6D480-A88B-11D0-83DD-00AA003CCABD}#1.0#0#..\..\..\..\..\..\..\..\WINNT\System32\tapi3.dll#Microsoft TAPI 3.0 Type Library +Reference=*\G{EDAEECD8-0D75-499E-9B69-187ACACF2C05}#1.0#0#..\..\..\cpp\tapicustomstream\objd\i386\STCustomStream.dll#STCustomStream 1.0 Type Library +Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0; RICHTX32.OCX +Form=SapiTapi.frm +ResFile32="SapiTapi.RES" +Startup="Form1" +HelpFile="" +ExeName32="SapiTapi.exe" +Command32="" +Name="SapiTapi" +HelpContextID="0" +CompatibleMode="0" +MajorVer=1 +MinorVer=0 +RevisionVer=0 +AutoIncrementVer=0 +ServerSupportFiles=0 +VersionCompanyName="Microsoft Corp." +CompilationType=0 +OptimizationType=2 +FavorPentiumPro(tm)=0 +CodeViewDebugInfo=-1 +NoAliasing=0 +BoundsCheck=0 +OverflowCheck=0 +FlPointCheck=0 +FDIVCheck=0 +UnroundedFP=0 +StartMode=0 +Unattended=0 +Retained=0 +ThreadPerObject=0 +MaxNumberOfThreads=1 +DebugStartupOption=0 + +[MS Transaction Server] +AutoRefresh=1 diff --git a/sp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.bat b/sp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.bat new file mode 100644 index 00000000..aea38d1d --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.bat @@ -0,0 +1 @@ +spcomp.exe "srcompopt.pro" -r \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.pro b/sp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.pro new file mode 100644 index 00000000..f2c40baa --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Bin/srcompopt.pro @@ -0,0 +1,42 @@ +[SAPI Engine Compliance Tool Version 1.0] +LogFile.Log File=srcompopt.log +Cmd.Size=1 +Cmd.Hex0000=00 +Position=83, 82, 894, 613 +Options=386 +RunCount=1 +Search= +LogWindowLevel=1 +LogLog FileLevel=1 +FontName=FixedSys +FontAttr=-19 400 128 16908545 +TUX Dll=srcomp.dll +NumTests=14 +testcase0008=Optional\Grammar\Use correct grammar with unambiguous rules +tcdata0008=0 0 +testcase0007=Optional\Grammar\Tags\WILDCARD Tag +tcdata0007=0 0 +testcase0006=Optional\Grammar\Tags\CFGTextBuffer +tcdata0006=0 0 +testcase0005=Optional\Dictation\Dictation Alternates +tcdata0005=0 0 +testcase0004=Optional\Dictation\DICTATION Tag +tcdata0004=0 0 +testcase0003=Optional\Dictation\User Lexicon\Synchronize Dictation grammar after loading engine +tcdata0003=0 0 +testcase0002=Optional\Dictation\User Lexicon\Synchronize before loading dictation grammar +tcdata0002=0 0 +testcase0001=Optional\Events\Get: Interference +tcdata0001=0 0 +testcase0000=Optional\Events\Get: Hypothesis +tcdata0000=0 0 +testcase0010=Optional\Other\Recognition with Inverse Text Normalization +tcdata0010=0 0 +testcase0009=Optional\Grammar\Use most recently activated grammar with ambiguous rules +tcdata0009=0 0 +testcase0013=Optional\Other\Command&Control Alternates +tcdata0013=0 0 +testcase0012=Optional\Other\Engine Text Properties +tcdata0012=0 0 +testcase0011=Optional\Other\Engine Numeric Properties +tcdata0011=0 0 diff --git a/sp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.bat b/sp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.bat new file mode 100644 index 00000000..243ab158 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.bat @@ -0,0 +1 @@ +spcomp.exe "srcompreq.pro" -r \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.pro b/sp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.pro new file mode 100644 index 00000000..ffeb6b32 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Bin/srcompreq.pro @@ -0,0 +1,66 @@ +[SAPI Engine Compliance Tool Version 1.0] +LogFile.Log File=srcompreq.log +Cmd.Size=1 +Cmd.Hex0000=00 +Position=83, 82, 894, 613 +Options=386 +RunCount=1 +Search= +LogWindowLevel=1 +LogLog FileLevel=1 +FontName=FixedSys +FontAttr=-19 400 128 16908545 +TUX Dll=srcomp.dll +NumTests=26 +testcase0023=Required\Other\Invalidate non-top level rule +tcdata0023=0 0 +testcase0022=Required\Other\Invalidate top level rule +tcdata0022=0 0 +testcase0021=Required\Other\Automatically pause engine on recognition +tcdata0021=0 0 +testcase0020=Required\Other\SpPhraseElements +tcdata0020=0 0 +testcase0019=Required\Grammar\Case sensitive grammar +tcdata0019=0 0 +testcase0018=Required\Grammar\/Disp/lex/pron +tcdata0018=0 0 +testcase0017=Required\Grammar\RULE and RULEREF tags +tcdata0017=0 0 +testcase0016=Required\Grammar\O[ptional] tag +tcdata0016=0 0 +testcase0015=Required\Grammar\P[hrase] tag +tcdata0015=0 0 +testcase0014=Required\Grammar\Expected Rule +tcdata0014=0 0 +testcase0013=Required\Grammar\L tag +tcdata0013=0 0 +testcase0012=Required\Lexicon\Case sensitive lexicon +tcdata0012=0 0 +testcase0011=Required\Lexicon\Uses user lexicon before application lexicon for Command & Control +tcdata0011=0 0 +testcase0010=Required\Lexicon\Application Lexicon for Command & Control +tcdata0010=0 0 +testcase0009=Required\Lexicon\User Lexicon\Synchronize Command & Control grammar after loading engine +tcdata0009=0 0 +testcase0008=Required\Lexicon\User Lexicon\Synchronize before loading Command & Control grammar +tcdata0008=0 0 +testcase0007=Required\Events\Multi Events\Events Offset +tcdata0007=0 0 +testcase0006=Required\Events\Multi Events\PhraseStart -> Recognition order +tcdata0006=0 0 +testcase0005=Required\Events\Multi Events\SoundStart -> SoundEnd order +tcdata0005=0 0 +testcase0004=Required\Events\Single Event\Recognition +tcdata0004=0 0 +testcase0003=Required\Events\Single Event\PhraseStart +tcdata0003=0 0 +testcase0002=Required\Events\Single Event\FalseRecognition +tcdata0002=0 0 +testcase0001=Required\Events\Single Event\SoundEnd +tcdata0001=0 0 +testcase0000=Required\Events\Single Event\SoundStart +tcdata0000=0 0 +testcase0025=Required\Other\Multiple application contexts [ISpRecoContext] +tcdata0025=0 0 +testcase0024=Required\Other\Multi instances +tcdata0024=0 0 diff --git a/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.bat b/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.bat new file mode 100644 index 00000000..e106d497 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.bat @@ -0,0 +1 @@ +spcomp.exe "ttscompopt.pro" -r \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.pro b/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.pro new file mode 100644 index 00000000..b5c6746c --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompopt.pro @@ -0,0 +1,20 @@ +[SAPI Engine Compliance Tool Version 1.0] +LogFile.Log File=spcomp.log +Cmd.Size=1 +Cmd.Hex0000=00 +Position=164, 232, 933, 808 +Options=386 +RunCount=1 +Search=fail +LogWindowLevel=1 +LogLog FileLevel=1 +FontName=FixedSys +FontAttr=-13 400 128 16908545 +TUX Dll=ttscomp.dll +NumTests=3 +testcase0002=Features\PartOfSp +tcdata0002=0 0 +testcase0001=Features\Phoneme & Viseme Events +tcdata0001=0 0 +testcase0000=Features\Emph +tcdata0000=0 0 diff --git a/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.bat b/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.bat new file mode 100644 index 00000000..b2a2564d --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.bat @@ -0,0 +1 @@ +spcomp.exe "ttscompreq.pro" -r \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.pro b/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.pro new file mode 100644 index 00000000..827c0f49 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Bin/ttscompreq.pro @@ -0,0 +1,58 @@ +[SAPI Engine Compliance Tool Version 1.0] +LogFile.Log File=spcomp.log +Cmd.Size=1 +Cmd.Hex0000=00 +Position=164, 232, 933, 808 +Options=386 +RunCount=1 +Search=fail +LogWindowLevel=1 +LogLog FileLevel=1 +FontName=FixedSys +FontAttr=-13 400 128 16908545 +TUX Dll=ttscomp.dll +NumTests=22 +testcase0021=TTS Compliance Test\Multiple Instance Test\Multiple-Instance Test +tcdata0021=0 0 +testcase0020=TTS Compliance Test\Lexicon Tests\App Lexicon Test +tcdata0020=0 0 +testcase0019=TTS Compliance Test\Lexicon Tests\User Lexicon Test +tcdata0019=0 0 +testcase0018=TTS Compliance Test\Audio State Tests\Speak Destroy +tcdata0018=0 0 +testcase0017=TTS Compliance Test\Audio State Tests\Speak Stop +tcdata0017=0 0 +testcase0016=TTS Compliance Test\Real Time Rate/Vol Tests\Real time volume change +tcdata0016=0 0 +testcase0015=TTS Compliance Test\Real Time Rate/Vol Tests\Real time rate change +tcdata0015=0 0 +testcase0014=TTS Compliance Test\TTS XML Markup\Context +tcdata0014=0 0 +testcase0013=TTS Compliance Test\TTS XML Markup\Non-SAPI tags +tcdata0013=0 0 +testcase0012=TTS Compliance Test\TTS XML Markup\Pitch +tcdata0012=0 0 +testcase0011=TTS Compliance Test\TTS XML Markup\Volume +tcdata0011=0 0 +testcase0010=TTS Compliance Test\TTS XML Markup\Rate +tcdata0010=0 0 +testcase0009=TTS Compliance Test\TTS XML Markup\Pronounce +tcdata0009=0 0 +testcase0008=TTS Compliance Test\TTS XML Markup\Spell +tcdata0008=0 0 +testcase0007=TTS Compliance Test\TTS XML Markup\Silence +tcdata0007=0 0 +testcase0006=TTS Compliance Test\TTS XML Markup\Bookmark +tcdata0006=0 0 +testcase0005=TTS Compliance Test\Eventing\Check SAPI required Events +tcdata0005=0 0 +testcase0004=TTS Compliance Test\ISpTTSEngine\SetVolume +tcdata0004=0 0 +testcase0003=TTS Compliance Test\ISpTTSEngine\SetRate +tcdata0003=0 0 +testcase0002=TTS Compliance Test\ISpTTSEngine\GetOutputFormat +tcdata0002=0 0 +testcase0001=TTS Compliance Test\ISpTTSEngine\Skip +tcdata0001=0 0 +testcase0000=TTS Compliance Test\ISpTTSEngine\Speak +tcdata0000=0 0 diff --git a/sp/src/utils/sapi51/Tools/Comp/Common/CPP/tuxdll.cpp b/sp/src/utils/sapi51/Tools/Comp/Common/CPP/tuxdll.cpp new file mode 100644 index 00000000..3ae51453 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Common/CPP/tuxdll.cpp @@ -0,0 +1,386 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// tuxdll.cpp +// +//****************************************************************************** + +//****************************************************************************** +//***** Make sure _WIN32_WCE is set when building for Windows CE +//****************************************************************************** + + +#if defined(PEGASUS) && !defined(_WIN32_WCE) +#define _WIN32_WCE +#endif + +#if defined(UNDER_CE) && !defined(_WIN32_WCE) +#define _WIN32_WCE +#endif + + +//****************************************************************************** +//***** Includes +//****************************************************************************** + +#ifndef _WIN32_DCOM + #define _WIN32_DCOM 1 +#endif +#include + +#include +#include +#include +#include +#include + +#ifndef _WIN32_WCE +#include +#endif + +//****************************************************************************** +//***** Global Constants +//****************************************************************************** + +#define LOG_EXCEPTION 0 +#define LOG_FAIL 2 +#define LOG_ABORT 4 +#define LOG_SKIP 6 +#define LOG_NOT_IMPLEMENTED 8 +#define LOG_PASS 10 +#define LOG_DETAIL 12 +#define LOG_COMMENT 14 + + +//****************************************************************************** +//***** Global Variables +//****************************************************************************** + +// Global CKato logging object. Set while processing SPM_LOAD_DLL message. +CKato *g_pKato = NULL; + +// Global shell info structure. Set while processing SPM_SHELL_INFO message. +SPS_SHELL_INFO *g_pShellInfo; + +// Global critical section to be used by threaded tests if necessary. +CRITICAL_SECTION g_csProcess; + +//****************************************************************************** +//***** Test functions +//****************************************************************************** + +extern void CleanupTest( void ); +extern HRESULT PreTestSetup( void ); +extern HRESULT PostTestCleanup( void ); + +//****************************************************************************** +//***** Windows CE specific code +//****************************************************************************** + +#ifdef _WIN32_WCE + +#ifndef STARTF_USESIZE +#define STARTF_USESIZE 0x00000002 +#endif + +#ifndef STARTF_USEPOSITION +#define STARTF_USEPOSITION 0x00000004 +#endif + +#ifndef ZeroMemory +#define ZeroMemory(Destination,Length) memset(Destination, 0, Length) +#endif + +#ifndef _vsntprintf +#define _vsntprintf(d,c,f,a) wvsprintf(d,f,a) +#endif + +BOOL WINAPI DllMain(HANDLE hInstance, ULONG dwReason, LPVOID lpReserved) { + return TRUE; +} +#endif + + + +//****************************************************************************** +//***** Internal Macros +//****************************************************************************** +#ifndef countof +#define countof(a) (sizeof(a)/sizeof(*(a))) +#endif + + + +//****************************************************************************** +//***** Our Debug Output Function +//****************************************************************************** + +void TRACE(LPCTSTR szFormat, ...) { + TCHAR szBuffer[1024] = TEXT("TUXDLL: "); + + va_list pArgs; + va_start(pArgs, szFormat); + _vsntprintf(szBuffer + 9, countof(szBuffer) - 11, szFormat, pArgs); + va_end(pArgs); + + _tcscat(szBuffer, TEXT("\r\n")); + + OutputDebugString(szBuffer); +} + + + +//****************************************************************************** +//***** ShellProc() +//****************************************************************************** + +SHELLPROCAPI ShellProc(UINT uMsg, SPPARAM spParam) { + + switch (uMsg) { + + //------------------------------------------------------------------------ + // Message: SPM_LOAD_DLL + // + // Sent once to the DLL immediately after it is loaded. The spParam + // parameter will contain a pointer to a SPS_LOAD_DLL structure. The DLL + // should set the fUnicode member of this structre to TRUE if the DLL is + // built with the UNICODE flag set. By setting this flag, Tux will ensure + // that all strings passed to your DLL will be in UNICODE format, and all + // strings within your function table will be processed by Tux as UNICODE. + // The DLL may return SPR_FAIL to prevent the DLL from continuing to load. + //------------------------------------------------------------------------ + + case SPM_LOAD_DLL: { + TRACE(TEXT("ShellProc(SPM_LOAD_DLL, ...) called")); + + // If we are UNICODE, then tell Tux this by setting the following flag. + #ifdef UNICODE + ((LPSPS_LOAD_DLL)spParam)->fUnicode = TRUE; + #else + ((LPSPS_LOAD_DLL)spParam)->fUnicode = FALSE; + #endif + + // Get/Create our global logging object. + g_pKato = (CKato*)KatoGetDefaultObject(); + + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + // Initialize our global critical section. + InitializeCriticalSection(&g_csProcess); + + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_UNLOAD_DLL + // + // Sent once to the DLL immediately before it is unloaded. + //------------------------------------------------------------------------ + + case SPM_UNLOAD_DLL: { + TRACE(TEXT("ShellProc(SPM_UNLOAD_DLL, ...) called")); + + // This is a good place to destroy our global critical section. + DeleteCriticalSection(&g_csProcess); + + //cleanup test + CleanupTest(); + + // counitialize + CoUninitialize(); + + + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_SHELL_INFO + // + // Sent once to the DLL immediately after SPM_LOAD_DLL to give the DLL + // some useful information about its parent shell and environment. The + // spParam parameter will contain a pointer to a SPS_SHELL_INFO structure. + // The pointer to the structure may be stored for later use as it will + // remain valid for the life of this Tux Dll. The DLL may return SPR_FAIL + // to prevent the DLL from continuing to load. + //------------------------------------------------------------------------ + + case SPM_SHELL_INFO: { + TRACE(TEXT("ShellProc(SPM_SHELL_INFO, ...) called")); + + // Store a pointer to our shell info for later use. + g_pShellInfo = (LPSPS_SHELL_INFO)spParam; + + // Display our Dlls command line if we have one. + if (g_pShellInfo->szDllCmdLine && *g_pShellInfo->szDllCmdLine) { + MessageBox(g_pShellInfo->hWnd, g_pShellInfo->szDllCmdLine, + TEXT("TUXDLL.DLL Command Line Arguments"), MB_OK); + } + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_REGISTER + // + // This is the only ShellProc() message that a DLL is required to handle + // (except for SPM_LOAD_DLL if you are UNICODE). This message is sent + // once to the DLL immediately after the SPM_SHELL_INFO message to query + // the DLL for it’s function table. The spParam will contain a pointer to + // a SPS_REGISTER structure. The DLL should store its function table in + // the lpFunctionTable member of the SPS_REGISTER structure. The DLL may + // return SPR_FAIL to prevent the DLL from continuing to load. + //------------------------------------------------------------------------ + + case SPM_REGISTER: { + TRACE(TEXT("ShellProc(SPM_REGISTER, ...) called")); + ((LPSPS_REGISTER)spParam)->lpFunctionTable = g_lpFTE; + #ifdef UNICODE + return SPR_HANDLED | SPF_UNICODE; + #else + return SPR_HANDLED; + #endif + } + + //------------------------------------------------------------------------ + // Message: SPM_START_SCRIPT + // + // Sent to the DLL immediately before a script is started. It is sent to + // all Tux DLLs, including loaded Tux DLLs that are not in the script. + // All DLLs will receive this message before the first TestProc() in the + // script is called. + //------------------------------------------------------------------------ + + case SPM_START_SCRIPT: { + TRACE(TEXT("ShellProc(SPM_START_SCRIPT, ...) called")); + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_STOP_SCRIPT + // + // Sent to the DLL when the script has stopped. This message is sent when + // the script reaches its end, or because the user pressed stopped prior + // to the end of the script. This message is sent to all Tux DLLs, + // including loaded Tux DLLs that are not in the script. + //------------------------------------------------------------------------ + + case SPM_STOP_SCRIPT: { + TRACE(TEXT("ShellProc(SPM_STOP_SCRIPT, ...) called")); + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_BEGIN_GROUP + // + // Sent to the DLL before a group of tests from that DLL is about to be + // executed. This gives the DLL a time to initialize or allocate data for + // the tests to follow. Only the DLL that is next to run receives this + // message. The prior DLL, if any, will first receive a SPM_END_GROUP + // message. For global initialization and de-initialization, the DLL + // should probably use SPM_START_SCRIPT and SPM_STOP_SCRIPT, or even + // SPM_LOAD_DLL and SPM_UNLOAD_DLL. + //------------------------------------------------------------------------ + + case SPM_BEGIN_GROUP: { + TRACE(TEXT("ShellProc(SPM_BEGIN_GROUP, ...) called")); + g_pKato->BeginLevel(0, TEXT("BEGIN GROUP: TUXDLL.DLL")); + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_END_GROUP + // + // Sent to the DLL after a group of tests from that DLL has completed + // running. This gives the DLL a time to cleanup after it has been run. + // This message does not mean that the DLL will not be called again to run + // tests; it just means that the next test to run belongs to a different + // DLL. SPM_BEGIN_GROUP and SPM_END_GROUP allow the DLL to track when it + // is active and when it is not active. + //------------------------------------------------------------------------ + + case SPM_END_GROUP: { + TRACE(TEXT("ShellProc(SPM_END_GROUP, ...) called")); + g_pKato->EndLevel(TEXT("END GROUP: TUXDLL.DLL")); + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_BEGIN_TEST + // + // Sent to the DLL immediately before a test executes. This gives the DLL + // a chance to perform any common action that occurs at the beginning of + // each test, such as entering a new logging level. The spParam parameter + // will contain a pointer to a SPS_BEGIN_TEST structure, which contains + // the function table entry and some other useful information for the next + // test to execute. If the ShellProc function returns SPR_SKIP, then the + // test case will not execute. + //------------------------------------------------------------------------ + + case SPM_BEGIN_TEST: { + TRACE(TEXT("ShellProc(SPM_BEGIN_TEST, ...) called")); + + // Start our logging level. + LPSPS_BEGIN_TEST pBT = (LPSPS_BEGIN_TEST)spParam; + g_pKato->BeginLevel(pBT->lpFTE->dwUniqueID, + TEXT("BEGIN TEST: \"%s\", Threads=%u, Seed=%u"), + pBT->lpFTE->lpDescription, pBT->dwThreadCount, + pBT->dwRandomSeed); + + if (S_OK != PreTestSetup() ) { + g_pKato->Log(LOG_SKIP, TEXT("Pre-Test Setup failed - Skipping test")); + return SPR_SKIP; + } + + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_END_TEST + // + // Sent to the DLL after a single test executes from the DLL. This gives + // the DLL a time perform any common action that occurs at the completion + // of each test, such as exiting the current logging level. The spParam + // parameter will contain a pointer to a SPS_END_TEST structure, which + // contains the function table entry and some other useful information for + // the test that just completed. + //------------------------------------------------------------------------ + + case SPM_END_TEST: { + TRACE(TEXT("ShellProc(SPM_END_TEST, ...) called")); + + PostTestCleanup(); + + // End our logging level. + LPSPS_END_TEST pET = (LPSPS_END_TEST)spParam; + g_pKato->EndLevel(TEXT("END TEST: \"%s\", %s, Time=%u.%03u"), + pET->lpFTE->lpDescription, + pET->dwResult == TPR_SKIP ? TEXT("SKIPPED") : + pET->dwResult == TPR_PASS ? TEXT("PASSED") : + pET->dwResult == TPR_FAIL ? TEXT("FAILED") : + pET->dwResult == TPR_SUPPORTED ? TEXT("SUPPORTED") : + pET->dwResult == TPR_UNSUPPORTED ? TEXT("UNSUPPORTED") : TEXT("ABORTED"), + pET->dwExecutionTime / 1000, pET->dwExecutionTime % 1000); + + return SPR_HANDLED; + } + + //------------------------------------------------------------------------ + // Message: SPM_EXCEPTION + // + // Sent to the DLL whenever code execution in the DLL causes and exception + // fault. By default, Tux traps all exceptions that occur while executing + // code inside a Tux DLL. + //------------------------------------------------------------------------ + + case SPM_EXCEPTION: { + TRACE(TEXT("ShellProc(SPM_EXCEPTION, ...) called")); + g_pKato->Log(LOG_EXCEPTION, TEXT("Exception occurred!")); + return SPR_HANDLED; + } + } + + return SPR_NOT_HANDLED; +} + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** + diff --git a/sp/src/utils/sapi51/Tools/Comp/Common/Def/srcomp.def b/sp/src/utils/sapi51/Tools/Comp/Common/Def/srcomp.def new file mode 100644 index 00000000..51caf2c1 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Common/Def/srcomp.def @@ -0,0 +1,3 @@ +EXPORTS + ShellProc + diff --git a/sp/src/utils/sapi51/Tools/Comp/Common/Def/ttscomp.def b/sp/src/utils/sapi51/Tools/Comp/Common/Def/ttscomp.def new file mode 100644 index 00000000..b25e196e --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Common/Def/ttscomp.def @@ -0,0 +1,2 @@ +EXPORTS + ShellProc diff --git a/sp/src/utils/sapi51/Tools/Comp/Common/Include/kato.h b/sp/src/utils/sapi51/Tools/Comp/Common/Include/kato.h new file mode 100644 index 00000000..189805ea --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Common/Include/kato.h @@ -0,0 +1,235 @@ +//****************************************************************************** +// +// KATO.H +// +// Definition module for the Kato constants and CKato interface +// +// Date Name Description +// -------- -------- ----------------------------------------------------------- +// 02/13/95 SteveMil Created +// +//****************************************************************************** + +#ifndef __KATO_H__ +#define __KATO_H__ + +//****************************************************************************** +// Define functions as import when building kato, and as export when this file +// is included by all other applications. We only use KATOAPI on C++ classes. +// For straight C functions, our DEF file will take care of exporting them. +//****************************************************************************** + +#ifndef KATOAPI + #define KATOAPI __declspec(dllimport) +#endif + +//****************************************************************************** +// Define EXTERN_C so that the flat API's will not get mangled by C++ +//****************************************************************************** + +#ifndef EXTERN_C + #ifdef __cplusplus + #define EXTERN_C extern "C" + #else + #define EXTERN_C + #endif +#endif + +//****************************************************************************** +// Specify 32 bit pack size to ensure everyone creates the correct size objects +//****************************************************************************** + +#pragma pack(4) + +//****************************************************************************** +// Constants +//****************************************************************************** + +#define KATO_MAX_LEVEL 31 +#define KATO_MAX_VERBOSITY 15 +#define KATO_MAX_STRING_LENGTH 1023 +#define KATO_MAX_DATA_SIZE 1024 + +//****************************************************************************** +// Types +//****************************************************************************** + +typedef HANDLE HKATO; + +typedef struct _KATOCALLBACKSTRUCTW { + LPARAM lParam; + HKATO hKato; + DWORD dwThreadID; + DWORD dwTickCount; + DWORD dwLevel; + DWORD dwLevelID; + DWORD dwVerbosity; + LPCWSTR wszLog; +} KATOCALLBACKSTRUCTW, *LPKATOCALLBACKSTRUCTW; + +typedef struct _KATOCALLBACKSTRUCTA { + LPARAM lParam; + HKATO hKato; + DWORD dwThreadID; + DWORD dwTickCount; + DWORD dwLevel; + DWORD dwLevelID; + DWORD dwVerbosity; + LPCSTR szLog; +} KATOCALLBACKSTRUCTA, *LPKATOCALLBACKSTRUCTA; + +typedef BOOL (CALLBACK *LPKATOCALLBACKW)(LPKATOCALLBACKSTRUCTW); +typedef BOOL (CALLBACK *LPKATOCALLBACKA)(LPKATOCALLBACKSTRUCTA); + +typedef enum _KATO_FLUSH_TYPE { + KATO_FLUSH_ON, + KATO_FLUSH_OFF, + KATO_FLUSH_NOW, +} KATO_FLUSH_TYPE, *LPKATO_FLUSH_TYPE; + +//****************************************************************************** +// Common APIs for C and C++ interfaces +//****************************************************************************** + +EXTERN_C BOOL WINAPI KatoSetServerW(LPCWSTR wszServer); +EXTERN_C BOOL WINAPI KatoSetServerA(LPCSTR szServer); +EXTERN_C BOOL WINAPI KatoGetServerW(LPWSTR wszServer, INT nCount); +EXTERN_C BOOL WINAPI KatoGetServerA(LPSTR szServer, INT nCount); +EXTERN_C BOOL WINAPI KatoSetCallbackW(LPKATOCALLBACKW lpCallbackW, LPARAM lParam); +EXTERN_C BOOL WINAPI KatoSetCallbackA(LPKATOCALLBACKA lpCallbackA, LPARAM lParam); +EXTERN_C BOOL WINAPI KatoFlush(KATO_FLUSH_TYPE flushType); +EXTERN_C BOOL WINAPI KatoDebug(BOOL fEnabled, DWORD dwMaxLogVersbosity, + DWORD dwMaxCommentVersbosity, DWORD dwMaxLevel); + +EXTERN_C HKATO WINAPI KatoGetDefaultObject(VOID); + +//****************************************************************************** +// APIs for C interface (C++ applications should use the CKato class) +//****************************************************************************** + +// Construction and destruction +EXTERN_C HKATO WINAPI KatoCreateW(LPCWSTR wszName); +EXTERN_C HKATO WINAPI KatoCreateA(LPCSTR szName); +EXTERN_C BOOL WINAPI KatoDestroy(HKATO hKato); + +// Unicode functions +EXTERN_C INT WINAPIV KatoBeginLevelW(HKATO hKato, DWORD dwLevelID, LPCWSTR wszFormat, ...); +EXTERN_C INT WINAPIV KatoBeginLevelVW(HKATO hKato, DWORD dwLevelID, LPCWSTR wszFormat, va_list pArgs); +EXTERN_C INT WINAPIV KatoEndLevelW(HKATO hKato, LPCWSTR wszFormat, ...); +EXTERN_C INT WINAPIV KatoEndLevelVW(HKATO hKato, LPCWSTR wszFormat, va_list pArgs); +EXTERN_C BOOL WINAPIV KatoLogW(HKATO hKato, DWORD dwVerbosity, LPCWSTR wszFormat, ...); +EXTERN_C BOOL WINAPIV KatoLogVW(HKATO hKato, DWORD dwVerbosity, LPCWSTR wszFormat, va_list pArgs); +EXTERN_C BOOL WINAPIV KatoCommentW(HKATO hKato, DWORD dwVerbosity, LPCWSTR wszFormat, ...); +EXTERN_C BOOL WINAPIV KatoCommentVW(HKATO hKato, DWORD dwVerbosity, LPCWSTR wszFormat, va_list pArgs); + +// ASCII functions +EXTERN_C INT WINAPIV KatoBeginLevelA(HKATO hKato, DWORD dwLevelID, LPCSTR szFormat, ...); +EXTERN_C INT WINAPIV KatoBeginLevelVA(HKATO hKato, DWORD dwLevelID, LPCSTR szFormat, va_list pArgs); +EXTERN_C INT WINAPIV KatoEndLevelA(HKATO hKato, LPCSTR szFormat, ...); +EXTERN_C INT WINAPIV KatoEndLevelVA(HKATO hKato, LPCSTR szFormat, va_list pArgs); +EXTERN_C BOOL WINAPIV KatoLogA(HKATO hKato, DWORD dwVerbosity, LPCSTR szFormat, ...); +EXTERN_C BOOL WINAPIV KatoLogVA(HKATO hKato, DWORD dwVerbosity, LPCSTR szFormat, va_list pArgs); +EXTERN_C BOOL WINAPIV KatoCommentA(HKATO hKato, DWORD dwVerbosity, LPCSTR szFormat, ...); +EXTERN_C BOOL WINAPIV KatoCommentVA(HKATO hKato, DWORD dwVerbosity, LPCSTR szFormat, va_list pArgs); + +// Non-string functions +EXTERN_C BOOL WINAPI KatoSetItemData(HKATO hKato, DWORD dwItemData); +EXTERN_C DWORD WINAPI KatoGetItemData(HKATO hKato); +EXTERN_C BOOL WINAPI KatoSendSystemData(HKATO hKato, DWORD dwSystemID, LPCVOID lpcvBuffer, DWORD dwSize); +EXTERN_C DWORD WINAPI KatoGetCurrentLevel(HKATO hKato); +EXTERN_C INT WINAPI KatoGetVerbosityCount(HKATO hKato, DWORD dwVerbosity, DWORD dwLevel); + +//****************************************************************************** +// Map function names to the correct APIs based on the UNICODE flag +//****************************************************************************** + +#ifdef UNICODE + #define KATOCALLBACKSTRUCT KATOCALLBACKSTRUCTW + #define LPKATOCALLBACKSTRUCT LPKATOCALLBACKSTRUCTW + #define LPKATOCALLBACK LPKATOCALLBACKW + #define KatoCreate KatoCreateW + #define KatoSetCallback KatoSetCallbackW + #define KatoSetServer KatoSetServerW + #define KatoGetServer KatoGetServerW + #define KatoBeginLevel KatoBeginLevelW + #define KatoBeginLevelV KatoBeginLevelVW + #define KatoEndLevel KatoEndLevelW + #define KatoEndLevelV KatoEndLevelVW + #define KatoLog KatoLogW + #define KatoLogV KatoLogVW + #define KatoComment KatoCommentW + #define KatoCommentV KatoCommentVW +#else + #define KATOCALLBACKSTRUCT KATOCALLBACKSTRUCTA + #define LPKATOCALLBACKSTRUCT LPKATOCALLBACKSTRUCTA + #define LPKATOCALLBACK LPKATOCALLBACKA + #define KatoCreate KatoCreateA + #define KatoSetCallback KatoSetCallbackA + #define KatoSetServer KatoSetServerA + #define KatoGetServer KatoGetServerA + #define KatoBeginLevel KatoBeginLevelA + #define KatoBeginLevelV KatoBeginLevelVA + #define KatoEndLevel KatoEndLevelA + #define KatoEndLevelV KatoEndLevelVA + #define KatoLog KatoLogA + #define KatoLogV KatoLogVA + #define KatoComment KatoCommentA + #define KatoCommentV KatoCommentVA +#endif + +//****************************************************************************** +// CKato - Interface for C++ applications +//****************************************************************************** + +#ifdef __cplusplus + +class KATOAPI CKato { +public: + // Overlaod new and delete to prevent mismatched heaps (KB:Q122675) + void* __cdecl operator new(size_t stAllocate); + void __cdecl operator delete(void *pvMemory); + + // Construction and destruction + CKato(LPCWSTR wszName = NULL); + CKato(LPCSTR szName); + virtual ~CKato(VOID); + + // Unicode functions + INT WINAPIV BeginLevel (DWORD dwLevelID, LPCWSTR wszFormat, ...); + INT WINAPI BeginLevelV(DWORD dwLevelID, LPCWSTR wszFormat, va_list pArgs); + INT WINAPIV EndLevel (LPCWSTR wszFormat, ...); + INT WINAPI EndLevelV(LPCWSTR wszFormat, va_list pArgs); + BOOL WINAPIV Log (DWORD dwVerbosity, LPCWSTR wszFormat, ...); + BOOL WINAPI LogV(DWORD dwVerbosity, LPCWSTR wszFormat, va_list pArgs); + BOOL WINAPIV Comment (DWORD dwVerbosity, LPCWSTR wszFormat, ...); + BOOL WINAPI CommentV(DWORD dwVerbosity, LPCWSTR wszFormat, va_list pArgs); + + // ASCII functions + INT WINAPIV BeginLevel (DWORD dwLevelID, LPCSTR szFormat, ...); + INT WINAPI BeginLevelV(DWORD dwLevelID, LPCSTR szFormat, va_list pArgs); + INT WINAPIV EndLevel (LPCSTR szFormat, ...); + INT WINAPI EndLevelV(LPCSTR szFormat, va_list pArgs); + BOOL WINAPIV Log (DWORD dwVerbosity, LPCSTR szFormat, ...); + BOOL WINAPI LogV(DWORD dwVerbosity, LPCSTR szFormat, va_list pArgs); + BOOL WINAPIV Comment (DWORD dwVerbosity, LPCSTR szFormat, ...); + BOOL WINAPI CommentV(DWORD dwVerbosity, LPCSTR szFormat, va_list pArgs); + + // Non-string functions + BOOL WINAPI SetItemData(DWORD dwItemData); + DWORD WINAPI GetItemData(VOID); + BOOL WINAPI SendSystemData(DWORD dwSystemID, LPCVOID lpcvBuffer, DWORD dwSize); + DWORD WINAPI GetCurrentLevel(VOID); + INT WINAPI GetVerbosityCount(DWORD dwVerbosity, DWORD dwLevel = -1); + + // Internal functions and data +protected: + friend VOID WINAPI Internal(CKato*, DWORD, LPARAM); + VOID WINAPI Internal(DWORD, LPARAM); + LPVOID m_lpvKatoData; +}; + +#endif // __cplusplus + +#pragma pack() // restore packing size to previous state + +#endif // __KATO_H__ diff --git a/sp/src/utils/sapi51/Tools/Comp/Common/Include/tux.h b/sp/src/utils/sapi51/Tools/Comp/Common/Include/tux.h new file mode 100644 index 00000000..011f2520 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Common/Include/tux.h @@ -0,0 +1,191 @@ +/*++ +THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF +ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +PARTICULAR PURPOSE. + +Copyright 1997 Microsoft Corporation. All Rights Reserved. + +Module Name: + + tux.h + +Abstract: +Functions: +Notes: +--*/ +//****************************************************************************** +// +// TUX.H +// +// Definitions of Tux types, structures, and messages. +// +// Date Name Description +// -------- -------- ----------------------------------------------------------- +// 02/14/95 SteveMil Created +// +//****************************************************************************** + +#ifndef __TUX_H__ +#define __TUX_H__ + +//****************************************************************************** +//***** Function Types +//****************************************************************************** + +// Forward declaration of LPFUNCTION_TABLE_ENTRY +typedef struct _FUNCTION_TABLE_ENTRY *LPFUNCTION_TABLE_ENTRY; + +// Define our ShellProc Param and TestProc Param types +typedef LPARAM SPPARAM; +typedef LPDWORD TPPARAM; + +// Shell and Test message handling procs +typedef INT (WINAPI *SHELLPROC)(UINT uMsg, SPPARAM spParam); +typedef INT (WINAPI *TESTPROC )(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE); + +// SHELLPROCAPI and TESTPROCAPI +#ifdef __cplusplus +#define SHELLPROCAPI extern "C" INT __declspec(dllexport) WINAPI +#else +#define SHELLPROCAPI INT __declspec(dllexport) WINAPI +#endif +#define TESTPROCAPI INT WINAPI + +//****************************************************************************** +//***** Function Table Entry Structure +//****************************************************************************** + +typedef struct _FUNCTION_TABLE_ENTRY { + LPCTSTR lpDescription; // description of test + UINT uDepth; // depth of item in tree hierarchy + LPVOID dwUserData; // user defined data that will be passed to TestProc at runtime + DWORD dwUniqueID; // uniquely identifies the test - used in loading/saving scripts + TESTPROC lpTestProc; // pointer to TestProc function to be called for this test +} FUNCTION_TABLE_ENTRY, *LPFUNCTION_TABLE_ENTRY; + +extern FUNCTION_TABLE_ENTRY g_lpFTE[]; + +//****************************************************************************** +//***** ShellProc() Message values +//****************************************************************************** + +#define SPM_LOAD_DLL 1 +#define SPM_UNLOAD_DLL 2 +#define SPM_START_SCRIPT 3 +#define SPM_STOP_SCRIPT 4 +#define SPM_BEGIN_GROUP 5 +#define SPM_END_GROUP 6 +#define SPM_SHELL_INFO 7 +#define SPM_REGISTER 8 +#define SPM_EXCEPTION 9 +#define SPM_BEGIN_TEST 10 +#define SPM_END_TEST 11 + +//****************************************************************************** +//***** ShellProc() Return values +//****************************************************************************** + +#define SPR_NOT_HANDLED 0 +#define SPR_HANDLED 1 +#define SPR_SKIP 2 +#define SPR_FAIL 3 + +//****************************************************************************** +//***** TestProc() Message values +//****************************************************************************** + +#define TPM_EXECUTE 101 +#define TPM_QUERY_THREAD_COUNT 102 + +//****************************************************************************** +//***** TestProc() Return values +//****************************************************************************** + +#define TPR_SKIP 2 +#define TPR_PASS 3 +#define TPR_FAIL 4 +#define TPR_ABORT 5 +#define TPR_SUPPORTED 6 +#define TPR_UNSUPPORTED 7 + +//****************************************************************************** +//***** ShellProc() Structures +//****************************************************************************** + +// ShellProc() Structure for SPM_LOAD_DLL message +typedef struct _SPS_LOAD_DLL { + BOOL fUnicode; // Set to true if your Dll is UNICODE +} SPS_LOAD_DLL, *LPSPS_LOAD_DLL; + +// ShellProc() Structure for SPM_SHELL_INFO message +typedef struct _SPS_SHELL_INFO { + HINSTANCE hInstance; // Instance handle of shell. + HWND hWnd; // Main window handle of shell (currently set to NULL). + HINSTANCE hLib; // Test Dll instance handle. + HANDLE hevmTerminate; // Manual event that is set by Tux to inform all + // tests to shutdown (currently not used). + BOOL fUsingServer; // Set if Tux is connected to Tux Server. + LPCTSTR szDllCmdLine; // Command line arguments for test DLL. +} SPS_SHELL_INFO, *LPSPS_SHELL_INFO; + +// ShellProc() Structure for SPM_REGISTER message +typedef struct _SPS_REGISTER { + LPFUNCTION_TABLE_ENTRY lpFunctionTable; +} SPS_REGISTER, *LPSPS_REGISTER; + +// ShellProc() Structure for SPM_BEGIN_TEST message +typedef struct _SPS_BEGIN_TEST { + LPFUNCTION_TABLE_ENTRY lpFTE; + DWORD dwRandomSeed; + DWORD dwThreadCount; +} SPS_BEGIN_TEST, *LPSPS_BEGIN_TEST; + +// ShellProc() Structure for SPM_END_TEST message +typedef struct _SPS_END_TEST { + LPFUNCTION_TABLE_ENTRY lpFTE; + DWORD dwResult; + DWORD dwRandomSeed; + DWORD dwThreadCount; + DWORD dwExecutionTime; +} SPS_END_TEST, *LPSPS_END_TEST; + +// ShellProc() Structure for SPM_EXCEPTION message +typedef struct _SPS_EXCEPTION { + LPFUNCTION_TABLE_ENTRY lpFTE; + DWORD dwExceptionCode; + EXCEPTION_POINTERS *lpExceptionPointers; + DWORD dwExceptionFilter; + UINT uMsg; +} SPS_EXCEPTION, *LPSPS_EXCEPTION; + + +//****************************************************************************** +//***** TestProc() Structures +//****************************************************************************** + +// TestProc() Structure for TPM_EXECUTE message +typedef struct _TPS_EXECUTE { + DWORD dwRandomSeed; + DWORD dwThreadCount; + DWORD dwThreadNumber; +} TPS_EXECUTE, *LPTPS_EXECUTE; + +// TestProc() Structure for TPM_QUERY_THREAD_COUNT message +typedef struct _TPS_QUERY_THREAD_COUNT { + DWORD dwThreadCount; +} TPS_QUERY_THREAD_COUNT, *LPTPS_QUERY_THREAD_COUNT; + +//****************************************************************************** +//***** Old constants defined for compatibility - DO NOT USE THESE CONSTANTS!!! +//****************************************************************************** + +#define TPR_NOT_HANDLED 0 +#define TPR_HANDLED 1 +#define SPM_START_TESTS SPM_BEGIN_GROUP +#define SPM_STOP_TESTS SPM_END_GROUP +#define SHELLINFO SPS_SHELL_INFO +#define LPSHELLINFO LPSPS_SHELL_INFO +#define SPF_UNICODE 0x00010000 + +#endif //__TUX_H__ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/applex.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/applex.wav new file mode 100644 index 00000000..8f83e4a8 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/applex.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/audioformats.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/audioformats.wav new file mode 100644 index 00000000..21c1d42e Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/audioformats.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/autopause.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/autopause.wav new file mode 100644 index 00000000..53aee816 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/autopause.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/black.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/black.wav new file mode 100644 index 00000000..e366847e Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/black.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/checkevents.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/checkevents.wav new file mode 100644 index 00000000..6e8878fc Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/checkevents.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/invalidaterule_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/invalidaterule_j.wav new file mode 100644 index 00000000..262d37cf Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/invalidaterule_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/lexicon.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/lexicon.wav new file mode 100644 index 00000000..8f83e4a8 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/lexicon.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/lexicon_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/lexicon_j.wav new file mode 100644 index 00000000..3d672a28 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/lexicon_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/multireco.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/multireco.wav new file mode 100644 index 00000000..2dd2cb4c Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/multireco.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/multireco_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/multireco_j.wav new file mode 100644 index 00000000..8dd12e98 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/multireco_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/oboe.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/oboe.wav new file mode 100644 index 00000000..6b9d1991 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/oboe.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/play.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/play.wav new file mode 100644 index 00000000..d8b85c31 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/play.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/playblack.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/playblack.wav new file mode 100644 index 00000000..2b6009c9 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/playblack.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/please.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/please.wav new file mode 100644 index 00000000..3cd7c0be Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/please.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/pleasewalk.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/pleasewalk.wav new file mode 100644 index 00000000..7c0b5b99 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/pleasewalk.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/put.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/put.wav new file mode 100644 index 00000000..e413223c Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/put.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/red.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/red.wav new file mode 100644 index 00000000..1103a388 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/red.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/selcity.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/selcity.wav new file mode 100644 index 00000000..59ed62de Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/selcity.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/selcity.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/selcity.xml new file mode 100644 index 00000000..3da69c62 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Resources/selcity.xml @@ -0,0 +1,10 @@ + + +

The weather of

+ +

Nice

+

Rainy

+
+
+
+ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/seven.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/seven.wav new file mode 100644 index 00000000..95385112 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/seven.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/silence.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/silence.wav new file mode 100644 index 00000000..5001a3d9 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/silence.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/snork.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/snork.wav new file mode 100644 index 00000000..8f83e4a8 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/snork.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/snork.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/snork.xml new file mode 100644 index 00000000..f7ba7fa3 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Resources/snork.xml @@ -0,0 +1,5 @@ + + +

skooky

+
+
diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/snork_j.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/snork_j.xml new file mode 100644 index 00000000..0de1f586 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/snork_j.xml differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.wav new file mode 100644 index 00000000..1b887517 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.xml new file mode 100644 index 00000000..729b6aa3 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule.xml @@ -0,0 +1,18 @@ + + +

play the

+ + please +
+ +

play the

+ + please +
+ + +

oboe

+

trombone

+
+
+
diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.wav new file mode 100644 index 00000000..c85345fe Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.xml new file mode 100644 index 00000000..6ead7cb0 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_exprule_j.xml differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l.wav new file mode 100644 index 00000000..796d2378 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l.xml new file mode 100644 index 00000000..e3d61431 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l.xml @@ -0,0 +1,9 @@ + + + +

move

+

put

+

get

+
+
+
diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.wav new file mode 100644 index 00000000..18d0c1c9 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.xml new file mode 100644 index 00000000..ab9c5e15 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_l_j.xml differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o.xml new file mode 100644 index 00000000..7400ed9d --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o.xml @@ -0,0 +1,7 @@ + + + please +

walk

+ slowly +
+
diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o1.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o1.wav new file mode 100644 index 00000000..e6c6912c Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o1.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o1_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o1_j.wav new file mode 100644 index 00000000..91e16800 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o1_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o2.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o2.wav new file mode 100644 index 00000000..fbc58c34 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o2.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o2_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o2_j.wav new file mode 100644 index 00000000..af4d48cd Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o2_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o3.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o3.wav new file mode 100644 index 00000000..6fc6c287 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o3.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o3_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o3_j.wav new file mode 100644 index 00000000..e3a410ee Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o3_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o_j.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o_j.xml new file mode 100644 index 00000000..02668344 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_o_j.xml differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p.wav new file mode 100644 index 00000000..3c8db8e9 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p1.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p1.xml new file mode 100644 index 00000000..79232c77 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p1.xml @@ -0,0 +1,5 @@ + + +

white

+
+
diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p1_j.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p1_j.xml new file mode 100644 index 00000000..010ff9fa Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p1_j.xml differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p2.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p2.xml new file mode 100644 index 00000000..4e100fc2 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p2.xml @@ -0,0 +1,5 @@ + + +

black

+
+
diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p2_j.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p2_j.xml new file mode 100644 index 00000000..db14052d Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p2_j.xml differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p_j.wav new file mode 100644 index 00000000..8dd12e98 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_p_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.wav new file mode 100644 index 00000000..3e8abb00 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.xml new file mode 100644 index 00000000..ab56c65b --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule.xml @@ -0,0 +1,27 @@ + + + please +

play the

+ + please +
+ + +

ace

+

two

+

three

+

four

+

five

+

six

+

seven

+

eight

+

nine

+

ten

+

jack

+

queen

+

king

+

lady

+

emperor

+
+
+
diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.wav new file mode 100644 index 00000000..01025ca5 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.xml b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.xml new file mode 100644 index 00000000..886793a0 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/tag_rule_j.xml differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/test.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/test.wav new file mode 100644 index 00000000..21c1d42e Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/test.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/walk.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/walk.wav new file mode 100644 index 00000000..ff897950 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/walk.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/walkslowly.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/walkslowly.wav new file mode 100644 index 00000000..e69738eb Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/walkslowly.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/Resources/white.wav b/sp/src/utils/sapi51/Tools/Comp/Resources/white.wav new file mode 100644 index 00000000..667826b0 Binary files /dev/null and b/sp/src/utils/sapi51/Tools/Comp/Resources/white.wav differ diff --git a/sp/src/utils/sapi51/Tools/Comp/SR/resource.h b/sp/src/utils/sapi51/Tools/Comp/SR/resource.h new file mode 100644 index 00000000..448c4213 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/SR/resource.h @@ -0,0 +1,160 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by srcomp.rc +// +#define IDD_DIALOG_LOADOPTIONS 101 +#define IDR_RULE_GRAMMAR 102 +#define IDR_L_GRAMMAR 103 +#define IDR_LNPN_GRAMMAR 104 +#define IDR_O_GRAMMAR 105 +#define IDR_P1_GRAMMAR 106 +#define IDR_P2_GRAMMAR 107 +#define IDR_EXPRULE_GRAMMAR 108 +#define IDR_SNORK_GRAMMAR 109 +#define IDC_COMBO_SRENGINES 1000 +#define IDC_COMBO_TTSDRIVERS 1001 +#define IDC_CHECK1 1002 +#define IDC_CHECK2 1003 +#define IDS_WAV_AUDIO_FORMATS 1004 +#define IDS_WAV_SOUNDSTART 1005 +#define IDS_WAV_SOUNDEND 1006 +#define IDS_WAV_SOUNDSTARTEND 1007 +#define IDS_WAV_PHRASESTART 1008 +#define IDS_WAV_RECOGNITION_1 1009 +#define IDS_WAV_RECOGNITION_2 1010 +#define IDS_WAV_HYPOTHESIS 1011 +#define IDS_WAV_PHRASE_RECO_HYP 1012 +#define IDS_WAV_SYNCH_BEFORE_LOAD 1013 +#define IDS_WAV_SYNCH_AFTER_DICT 1014 +#define IDS_WAV_SYNCH_AFTER_GRAM 1015 +#define IDS_WAV_L_TAG 1016 +#define IDS_WAV_MULT_RECO 1017 +#define IDS_WAV_EXPRULE_TAG 1018 +#define IDS_WAV_P_TAG 1019 +#define IDS_WAV_O_TAG_1 1020 +#define IDS_WAV_O_TAG_2 1021 +#define IDS_WAV_O_TAG_3 1022 +#define IDS_WAV_RULE_TAG 1023 +#define IDS_WAV_LN_TAG 1024 +#define IDS_RECO_SYNCH_BEFORE_LOAD 1025 +#define IDS_RECO_SYNCH_AFTER_DICT 1026 +#define IDS_RECO_SYNCH_AFTER_GRAM 1027 +#define IDS_RECO_L_TAG 1028 +#define IDS_RECO_EXPRULE_TAG_1 1029 +#define IDS_RECO_EXPRULE_TAG_2 1030 +#define IDS_RECO_P_TAG 1031 +#define IDS_RECO_O_TAG_1 1032 +#define IDS_RECO_O_TAG_2 1033 +#define IDS_RECO_O_TAG_3 1034 +#define IDS_RECO_RULE_TAG 1035 +#define IDS_RECO_LN_TAG 1036 +#define IDS_RESOURCE_LOCATION1 1037 +#define IDS_RESOURCE_LOCATION2 1038 +#define IDS_UNEXPECTED_ERR 1039 +#define IDS_UNEXPECTED_EVENT 1040 +#define IDS_ERR_AUDIOFORMAT_TOMANY 1041 +#define IDS_ERR_AUDIOFORMAT_UNSUPPORTED 1042 +#define IDS_ERR_AUDIOFORMAT_NOTENOUGH 1043 +#define IDS_ERR_SOUNDSTART_NOEVENT 1044 +#define IDS_ERR_STREAMEND_NOEVENT 1045 +#define IDS_ERR_SOUNDEND_NOEVENT 1046 +#define IDS_ERR_SOUNDSTART_BADPOSITION1 1047 +#define IDS_ERR_SOUNDSTART_BADPOSITION2 1048 +#define IDS_ERR_SOUNDEND_BADPOSITION1 1049 +#define IDS_ERR_SOUNDEND_BADPOSITION2 1050 +#define IDS_ERR_SOUNDSTARTEND_NOEVENT 1051 +#define IDS_ERR_SOUNDSTARTEND_WRONGORDER 1052 +#define IDS_ERR_PHRASESTART_NOEVENT 1053 +#define IDS_ERR_RECOGNITION_NOEVENT 1054 +#define IDS_ERR_RECOGNITION_EVENTONSILENCE 1055 +#define IDS_ERR_RECOGNITION_WRONGORDER 1056 +#define IDS_ERR_HYPOTHESIS_NOEVENT 1057 +#define IDS_ERR_HYPOTHESIS_WRONGORDER 1058 +#define IDS_ERR_RESULT_WRONGWORD 1059 +#define IDS_ERR_LEX_REMOVEUSER 1060 +#define IDS_ERR_LEX_EXPECTNOWORD 1061 +#define IDS_RECO_NEWWORD_PRON 1062 +#define IDS_ERR_FALSERECOGNITION_NOEVENT 1063 +#define IDS_AUTOPAUSE_DYNAMICWORD1 1064 +#define IDS_AUTOPAUSE_DYNAMICWORD2 1065 +#define IDS_AUTOPAUSE_DYNAMICRULE1 1066 +#define IDS_AUTOPAUSE_DYNAMICRULE2 1067 +#define IDS_WAV_AUTOPAUSE 1068 +#define IDS_INVALIDATETOPLEVEL_DYNAMICWORDS 1069 +#define IDS_INVALIDATETOPLEVEL_DYNAMICRULE 1070 +#define IDS_WAV_INVALIDATETOPLEVEL_OLD 1071 +#define IDS_INVALIDATETOPLEVEL_DYNAMICNEWWORDS 1072 +#define IDS_ERR_INVALIDATETOPLEVEL 1073 +#define IDS_WAV_INVALIDATETOPLEVEL_NEW 1074 +#define IDS_INVALIDATENONTOPLEVEL_RULE1 1075 +#define IDS_INVALIDATENONTOPLEVEL_RULE2 1076 +#define IDS_INVALIDATENONTOPLEVEL_TOPLEVELRULE 1077 +#define IDS_INVALIDATENONTOPLEVEL_WORD1 1078 +#define IDS_INVALIDATENONTOPLEVEL_OLDWORD1 1078 +#define IDS_INVALIDATENONTOPLEVEL_OLDWORD2 1079 +#define IDS_INVALIDATENONTOPLEVEL_NEWWORD2 1080 +#define IDS_INVALIDATENONTOPLEVEL_TOPLEVELWORDS 1081 +#define IDS_WAV_INVALIDATENONTOPLEVEL_OLD 1082 +#define IDS_WAV_INVALIDATENONTOPLEVEL_NEW 1083 +#define IDS_WAV_CFGTEXTBUFFER 1084 +#define IDS_CFGTEXTBUFFER_WORDS 1085 +#define IDS_CFGTEXTBUFFER_BUFFERWORD 1086 +#define IDS_CFGTEXTBUFFER_RULE 1087 +#define IDS_WAV_ALTERMATESCFG 1088 +#define IDS_ALTERNATESCFG_BESTWORD 1089 +#define IDS_ALTERNATESCFG_ALTERNATE1 1090 +#define IDS_ALTERNATESCFG_ALTERNATE2 1091 +#define IDS_ALTERNATESCFG_WORDS 1092 +#define IDS_ALTERNATESCFG_RULE 1093 +#define IDS_ERR_INTERFERENCE_NOEVENT 1094 +#define IDS_WAV_INTERFERENCE 1095 +#define IDS_WAV_GETITNRESULT 1096 +#define IDS_RECO_GETITNRESULT 1097 +#define IDS_CUSTOMPROP_NEWWORD_PRON 1098 +#define IDS_CUSTOMPROP_RULE 1099 +#define IDS_WAV_CUSTOMPROP 1100 +#define IDS_CUSTOMPROP_NEWWORD_DISP 1101 +#define IDS_CUSTOMPROP_NEWWORD_LEX 1102 +#define IDS_DICTATIONTAG_WORDS 1103 +#define IDS_DICTATIONTAG_RULE 1104 +#define IDS_WAV_DICTATIONTAG 1105 +#define IDS_WILDCARD_WORDS 1106 +#define IDS_WILDCARD_RULE 1107 +#define IDS_WAV_WILDCARD 1108 +#define IDS_APPLEX_WORD 1109 +#define IDS_APPLEX_PROP 1110 +#define IDS_USERLEXBEFOREAPPLEX_WORD 1111 +#define IDS_USERLEXBEFOREAPPLEX_USERPROP 1112 +#define IDS_USERLEXBEFOREAPPLEX_APPPROP 1113 +#define IDS_WAV_APPLEX 1114 +#define IDS_WAV_USERLEXBEFOREAPPLEX 1115 +#define IDS_INVALIDATENONTOPLEVEL_NEWWORD1 1116 +#define IDS_RESOURCE_LOCATION3 1117 +#define IDS_RECO_EXPRULE_FIRSTRULE 1118 +#define IDS_RECO_EXPRULE_SECONDRULE 1119 +#define IDS_CASESENSITIVEGRAMMAR_RULENAME 1120 +#define IDS_CASESENSITIVEGRAMMAR_LEX1 1121 +#define IDS_CASESENSITIVEGRAMMAR_PRON1 1122 +#define IDS_CASESENSITIVEGRAMMAR_LEX2 1123 +#define IDS_CASESENSITIVEGRAMMAR_PRON2 1124 +#define IDS_CASESENSITIVEGRAMMAR_WAVE 1126 +#define IDS_CASESENSITIVEGRAMMAR_DISP1 1127 +#define IDS_CASESENSITIVEGRAMMAR_DISP2 1128 +#define IDS_CASESENSITIVELEXICON_WORD1 1129 +#define IDS_CASESENSITIVELEXICON_SYMBOL1 1130 +#define IDS_CASESENSITIVELEXICON_WORD2 1131 +#define IDS_CASESENSITIVELEXICON_SYMBOL2 1132 +#define IDS_CASESENSITIVELEXICON_WAVE 1133 +#define IDS_CASESENSITIVELEXICON_RULENAME 1134 +#define IDS_CFGTEXTBUFFER_NOTINTERESTEDWORDS 1135 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 116 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1062 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sp/src/utils/sapi51/Tools/Comp/SR/sr.dsp b/sp/src/utils/sapi51/Tools/Comp/SR/sr.dsp new file mode 100644 index 00000000..f2e60b17 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/SR/sr.dsp @@ -0,0 +1,576 @@ +# Microsoft Developer Studio Project File - Name="SRCOMP" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=SRCOMP - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sr.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sr.mak" CFG="SRCOMP - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "SRCOMP - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "SRCOMP - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRCOMP_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\sdk\include" /I "..\..\..\..\ddk\include" /I "..\..\source\common\include" /I "..\..\source\sr" /I "..\common\include" /I "..\..\..\include" /I "..\common\cpp" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRCOMP_EXPORTS" /D _WIN32_WINNT=0x0500 /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kato.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"Debug/srcomp.pdb" /machine:I386 /out:"Release/SRCOMP.dll" /implib:"Debug/srcomp.lib" /pdbtype:sept /libpath:"..\..\..\..\sdk\lib" /libpath:"..\..\..\..\sdk\lib\i386" /libpath:"..\..\source\common\lib" /libpath:"..\common\lib" /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none /incremental:yes /debug + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRCOMP_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\common\cpp" /I "..\..\..\..\sdk\include" /I "..\..\..\..\ddk\include" /I "..\..\source\common\include" /I "..\..\source\sr" /I "..\common\include" /I "..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SRCOMP_EXPORTS" /D _WIN32_WINNT=0x0500 /FR /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /I "..\..\..\sdk\idl" /D "_DEBUG" /win32 +# SUBTRACT MTL /mktyplib203 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kato.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/SRCOMP.dll" /pdbtype:sept /libpath:"..\..\..\..\sdk\lib\i386" /libpath:"..\..\source\common\lib" /libpath:"..\common\lib" /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "SRCOMP - Win32 Release" +# Name "SRCOMP - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "Test Module" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\srenginecompliance.cpp +# End Source File +# End Group +# Begin Group "Grammar" + +# PROP Default_Filter "*.xml" +# Begin Source File + +SOURCE=..\resources\snork.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\snork.xml + +"..\resources\snork.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\snork.xml + +"..\resources\snork.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\snork_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\snork_j.xml + +"..\resources\snork_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\snork_j.xml + +"..\resources\snork_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_exprule.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_exprule.xml + +"..\resources\tag_exprule.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_exprule.xml + +"..\resources\tag_exprule.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_exprule_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_exprule_j.xml + +"..\resources\tag_exprule_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_exprule_j.xml + +"..\resources\tag_exprule_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_l.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_l.xml + +"..\resources\tag_l.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_l.xml + +"..\resources\tag_l.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_l_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_l_j.xml + +"..\resources\tag_l_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_l_j.xml + +"..\resources\tag_l_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_o.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_o.xml + +"..\resources\tag_o.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_o.xml + +"..\resources\tag_o.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_o_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_o_j.xml + +"..\resources\tag_o_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_o_j.xml + +"..\resources\tag_o_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p1.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_p1.xml + +"..\resources\tag_p1.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_p1.xml + +"..\resources\tag_p1.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p1_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_p1_j.xml + +"..\resources\tag_p1_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_p1_j.xml + +"..\resources\tag_p1_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p2.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_p2.xml + +"..\resources\tag_p2.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_p2.xml + +"..\resources\tag_p2.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p2_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_p2_j.xml + +"..\resources\tag_p2_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_p2_j.xml + +"..\resources\tag_p2_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_rule.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_rule.xml + +"..\resources\tag_rule.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_rule.xml + +"..\resources\tag_rule.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_rule_j.xml + +!IF "$(CFG)" == "SRCOMP - Win32 Release" + +# Begin Custom Build +InputPath=..\resources\tag_rule_j.xml + +"..\resources\tag_rule_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "SRCOMP - Win32 Debug" + +# Begin Custom Build +InputPath=..\resources\tag_rule_j.xml + +"..\resources\tag_rule_j.cfg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ..\..\..\bin\gc $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# End Group +# Begin Source File + +SOURCE=.\SRCOMP.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\def\srcomp.def +# End Source File +# Begin Source File + +SOURCE=.\SRCOMP.rc +# End Source File +# Begin Source File + +SOURCE=..\Common\cpp\TUXDLL.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\srenginecompliance.h +# End Source File +# Begin Source File + +SOURCE=.\srtests1.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=..\resources\snork.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_EXPRULE.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_exprule_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_L.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_l_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_O.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_o_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p1.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p1_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p2.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_p2_j.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_RULE.cfg +# End Source File +# Begin Source File + +SOURCE=..\resources\tag_rule_j.cfg +# End Source File +# End Group +# Begin Source File + +SOURCE=..\resources\snork_j.cfg +# End Source File +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Tools/Comp/SR/srcomp.cpp b/sp/src/utils/sapi51/Tools/Comp/SR/srcomp.cpp new file mode 100644 index 00000000..4159f459 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/SR/srcomp.cpp @@ -0,0 +1,111 @@ +#include "SRTests1.h" + +// BASE is a unique value assigned to a given tester or component. This value, +// when combined with each of the following test's unique IDs, allows every +// test case within the entire team to be uniquely identified. + +#define BASE_REQUIRED 0x00010000 +#define BASE_OPTIONAL 0x00020000 + +TCHAR ptszCustomizedDirectory[MAX_PATH] = _T(""); + +// Our function table that we pass to Tux +FUNCTION_TABLE_ENTRY g_lpFTE[] = { + TEXT("Required" ), 0, 0, 0, NULL, + TEXT("Events" ), 1, 0, 0, NULL, + TEXT("Single Event" ), 2, 0, 0, NULL, + TEXT( "SoundStart" ), 3, 0, BASE_REQUIRED + 0x0101, t_CheckEvent_SoundStart, + TEXT( "SoundEnd" ), 3, 0, BASE_REQUIRED + 0x0102, t_CheckEvent_SoundEnd, + TEXT( "FalseRecognition" ), 3, 0, BASE_REQUIRED + 0x0103, t_CheckEvent_FalseRecognition, + TEXT( "PhraseStart" ), 3, 0, BASE_REQUIRED + 0x0104, t_CheckEvent_PhraseStart, + TEXT( "Recognition" ), 3, 0, BASE_REQUIRED + 0x0105, t_CheckEvent_Recognition, + TEXT("Multi Events" ), 2, 0, 0, NULL, + TEXT( "SoundStart -> SoundEnd order" ), 3, 0, BASE_REQUIRED + 0x0106, t_CheckEvent_SoundStartEnd, + TEXT( "PhraseStart -> Recognition order" ), 3, 0, BASE_REQUIRED + 0x0107, t_CheckEvent_PhraseStartRecognitionOrder, + TEXT( "Events Offset" ), 3, 0, BASE_REQUIRED + 0x0108, t_CheckEvent_EventsSequences, + + TEXT("Lexicon" ), 1, 0, 0, NULL, + TEXT("User Lexicon" ), 2, 0, 0, NULL, + TEXT( "Synchronize before loading Command & Control grammar" ), 3, 0, BASE_REQUIRED + 0x0201, t_UserLexSynchBeforeCfgLoad, + TEXT( "Synchronize Command & Control grammar after loading engine" ), 3, 0, BASE_REQUIRED + 0x0202, t_UserLexSynchAfterGrammarLoad, + TEXT( "Application Lexicon for Command & Control" ), 2, 0, BASE_REQUIRED + 0x0203, t_AppLex, + TEXT( "Uses user lexicon before application lexicon for Command & Control" ), 2, 0, BASE_REQUIRED + 0x0204, t_UserLexBeforeAppLex, + TEXT( "Case sensitive lexicon" ), 2, 0, BASE_REQUIRED + 0x0205, t_CaseSensitiveLexicon, + + TEXT("Grammar" ), 1, 0, 0, NULL, + TEXT( "L tag" ), 2, 0, BASE_REQUIRED + 0x0301, t_GrammarListTag, + TEXT( "Expected Rule" ), 2, 0, BASE_REQUIRED + 0x0302, t_GrammarExpRuleTag, + TEXT( "P[hrase] tag" ), 2, 0, BASE_REQUIRED + 0x0303, t_GrammarPTag, + TEXT( "O[ptional] tag" ), 2, 0, BASE_REQUIRED + 0x0304, t_GrammarOTag, + TEXT( "RULE and RULEREF tags" ), 2, 0, BASE_REQUIRED + 0x0305, t_GrammarRuleTag, + TEXT( "/Disp/lex/pron" ), 2, 0, BASE_REQUIRED + 0x0306, t_CustomPron, + TEXT( "Case sensitive grammar" ), 2, 0, BASE_REQUIRED + 0x0307, t_CaseSensitiveGrammar, + + TEXT("Other" ), 1, 0, 0, NULL, + TEXT( "SpPhraseElements" ), 2, 0, BASE_REQUIRED + 0x0401, t_SpPhraseElements, + TEXT( "Automatically pause engine on recognition" ), 2, 0, BASE_REQUIRED + 0x0402, t_AutoPause, + TEXT( "Invalidate top level rule" ), 2, 0, BASE_REQUIRED + 0x0403, t_InvalidateToplevelRule, + TEXT( "Invalidate non-top level rule" ), 2, 0, BASE_REQUIRED + 0x0404, t_InvalidateNonToplevelRule, + TEXT( "Multi instances" ), 2, 0, BASE_REQUIRED + 0x0405, t_MultiInstances, + TEXT( "Multiple application contexts [ISpRecoContext]" ), 2, 0, BASE_REQUIRED + 0x0406, t_MultipleRecoContext, + + + TEXT("Optional" ), 0, 0, 0, NULL, + TEXT("Events" ), 1, 0, 0, NULL, + TEXT( "Get: Hypothesis" ), 2, 0, BASE_OPTIONAL + 0x1100, t_CheckEvent_Hypothesis, + TEXT( "Get: Interference" ), 2, 0, BASE_OPTIONAL + 0x1101, t_CheckEvent_Interference, + + TEXT("Dictation" ), 1, 0, 0, NULL, + TEXT("User Lexicon" ), 2, 0, 0, NULL, + TEXT( "Synchronize before loading dictation grammar" ), 3, 0, BASE_OPTIONAL + 0x1200, t_UserLexSynchBeforeDicLoad, + TEXT( "Synchronize Dictation grammar after loading engine" ), 3, 0, BASE_OPTIONAL + 0x1201, t_UserLexSynchAfterDictationLoad, + TEXT( "DICTATION Tag" ), 2, 0, BASE_OPTIONAL + 0x1202, t_DictationTag, + TEXT( "Dictation Alternates" ), 2, 0, BASE_OPTIONAL + 0x001203, t_Alternates_Dictation, + + TEXT("Grammar" ), 1, 0, 0, NULL, + TEXT("Tags" ), 2, 0, 0, NULL, + TEXT( "CFGTextBuffer" ), 3, 0, BASE_OPTIONAL + 0x1301, t_CFGTextBuffer, + TEXT( "WILDCARD Tag" ), 3, 0, BASE_OPTIONAL + 0x1303, t_Wildcard, + TEXT( "Use correct grammar with unambiguous rules" ), 2, 0, BASE_OPTIONAL + 0x1304, t_PickGrammar, + TEXT( "Use most recently activated grammar with ambiguous rules" ), 2, 0, BASE_OPTIONAL + 0x1305, t_UseLastActivatedGrammar, + + + TEXT("Other" ), 1, 0, 0, NULL, + TEXT( "Recognition with Inverse Text Normalization" ), 2, 0, BASE_OPTIONAL + 0x1500, t_GetITNResult, + TEXT( "Engine Numeric Properties" ), 2, 0, BASE_OPTIONAL + 0x1501, t_RequiredPropertyNum, + TEXT( "Engine Text Properties" ), 2, 0, BASE_OPTIONAL + 0x1502, t_RequiredPropertyString, + TEXT( "Command&Control Alternates" ), 2, 0, BASE_OPTIONAL + 0x1503, t_Alternates_Cfg, + + + + NULL , 0, 0, 0, NULL // marks end of list +}; + +HRESULT SetCurrentDirToDllDir() +{ + TCHAR tszPath[MAX_PATH]; + HRESULT hr = E_FAIL; + if (::GetModuleFileName(g_pShellInfo->hLib, tszPath, MAX_PATH)) + { + TCHAR *psLast = ::_tcsrchr(tszPath, '\\'); + if (psLast) + *psLast = _T('\0'); + + if (::SetCurrentDirectory(tszPath)) + { + + hr = S_OK; + } + } + + return hr; + +} + +HRESULT PreTestSetup(void) { + return SetCurrentDirToDllDir(); +} + +HRESULT PostTestCleanup(void) { + return S_OK; +} diff --git a/sp/src/utils/sapi51/Tools/Comp/SR/srcomp.rc b/sp/src/utils/sapi51/Tools/Comp/SR/srcomp.rc new file mode 100644 index 00000000..357bb805 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/SR/srcomp.rc @@ -0,0 +1,562 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_RULE_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_rule_j.cfg" +IDR_L_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_l_j.cfg" +IDR_O_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_o_j.cfg" +IDR_P1_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_p1_j.cfg" +IDR_P2_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_p2_j.cfg" +IDR_EXPRULE_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_exprule_j.cfg" +IDR_SNORK_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\snork_j.cfg" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft\0" + VALUE "FileDescription", "SRCOMP\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SRCOMP\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "SRCOMP.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft SRCOMP\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_RECO_SYNCH_BEFORE_LOAD L"\x3059\x304f\x3046\x304d" + IDS_RECO_SYNCH_AFTER_DICT L"\x3059\x304f\x3046\x304d" + IDS_RECO_SYNCH_AFTER_GRAM L"\x3059\x304f\x3046\x304d" + IDS_RECO_L_TAG L"\x7f6e\x304f" + IDS_RECO_P_TAG L"\x767d" + IDS_RECO_O_TAG_1 L"\x4e0b\x3055\x3044" + IDS_RECO_O_TAG_2 L"\x6b69\x3044\x3066" + IDS_RECO_O_TAG_3 L"\x3086\x3063\x304f\x308a" + IDS_RECO_RULE_TAG L"\x4e03\x3092\x52d5\x304b\x3057\x3066" + IDS_RESOURCE_LOCATION1 "..\\resources\\" + IDS_RESOURCE_LOCATION2 "..\\..\\..\\resources\\" + IDS_UNEXPECTED_ERR "recieved an unexpected error" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_UNEXPECTED_EVENT "recieved an unexpected event" + IDS_ERR_AUDIOFORMAT_TOMANY "Too many audio formats" + IDS_ERR_AUDIOFORMAT_UNSUPPORTED "unsupported audio format returned" + IDS_ERR_AUDIOFORMAT_NOTENOUGH "no formats returned" + IDS_ERR_SOUNDSTART_NOEVENT "failed to recieve sound_start event" + IDS_ERR_STREAMEND_NOEVENT "failed to recieve stream_end event" + IDS_ERR_SOUNDEND_NOEVENT "failed to recieve sound_end event" + IDS_ERR_SOUNDSTART_BADPOSITION1 "sound_start postion after sound_end" + IDS_ERR_SOUNDSTART_BADPOSITION2 "sound_start not in last third of audio" + IDS_ERR_SOUNDEND_BADPOSITION1 "sound_end postion after stream_end" + IDS_ERR_SOUNDEND_BADPOSITION2 "sound_end not in first third of audio" + IDS_ERR_SOUNDSTARTEND_NOEVENT + "failed to recieve both sound_start and sound_end events" + IDS_ERR_SOUNDSTARTEND_WRONGORDER + "sound_start and sound_end events recieved in wrong order" + IDS_ERR_PHRASESTART_NOEVENT "failed to recieve phrase_start event" + IDS_ERR_RECOGNITION_NOEVENT "failed to recieve recognition event" + IDS_ERR_RECOGNITION_EVENTONSILENCE + "received a Recognition event for silence" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERR_RECOGNITION_WRONGORDER + "recoginition event recieved in wrong order" + IDS_ERR_HYPOTHESIS_NOEVENT "failed to recieve hypothesis event" + IDS_ERR_HYPOTHESIS_WRONGORDER "hypothesis event recieved in wrong order" + IDS_ERR_RESULT_WRONGWORD "failed to recieve expected result" + IDS_ERR_LEX_REMOVEUSER "failed to remove user" + IDS_ERR_LEX_EXPECTNOWORD "should not get word from empty user lexicon" + IDS_RECO_NEWWORD_PRON L"\x30b9\x30ce\x30fc\x30af" + IDS_ERR_FALSERECOGNITION_NOEVENT + "failed to recieve false recognition event" + IDS_AUTOPAUSE_DYNAMICWORD1 L"\x3057\x308d" + IDS_AUTOPAUSE_DYNAMICWORD2 L"\x304f\x308d" + IDS_AUTOPAUSE_DYNAMICRULE1 "action" + IDS_AUTOPAUSE_DYNAMICRULE2 "color" + IDS_WAV_AUTOPAUSE "multireco_j.wav" + IDS_INVALIDATETOPLEVEL_DYNAMICWORDS L"\x30aa\x30fc\x30dc\x30a8\x3092\x6f14\x594f\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_INVALIDATETOPLEVEL_DYNAMICRULE "play" + IDS_WAV_INVALIDATETOPLEVEL_OLD "tag_exprule_j.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_SOUNDSTART "tag_l_j.wav" + IDS_WAV_SOUNDEND "tag_l_j.wav" + IDS_WAV_SOUNDSTARTEND "tag_l_j.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_PHRASESTART "tag_l_j.wav" + IDS_WAV_RECOGNITION_1 "tag_l_j.wav" + IDS_WAV_HYPOTHESIS "tag_exprule_j.wav" + IDS_WAV_SYNCH_BEFORE_LOAD "lexicon_j.wav" + IDS_WAV_SYNCH_AFTER_DICT "lexicon_j.wav" + IDS_WAV_SYNCH_AFTER_GRAM "lexicon_j.wav" + IDS_WAV_L_TAG "tag_l_j.wav" + IDS_WAV_MULT_RECO "multireco_j.wav" + IDS_WAV_EXPRULE_TAG "tag_exprule_j.wav" + IDS_WAV_P_TAG "multireco_j.wav" + IDS_WAV_O_TAG_1 "tag_o1_j.wav" + IDS_WAV_O_TAG_2 "tag_o2_j.wav" + IDS_WAV_O_TAG_3 "tag_o3_j.wav" + IDS_WAV_RULE_TAG "tag_rule_j.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INVALIDATETOPLEVEL_DYNAMICNEWWORDS L"\x4e03\x3092\x52d5\x304b\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_ERR_INVALIDATETOPLEVEL + "Engine failed to invalidate the toplevel rule." + IDS_WAV_INVALIDATETOPLEVEL_NEW "tag_rule_j.wav" + IDS_INVALIDATENONTOPLEVEL_RULE1 "option" + IDS_INVALIDATENONTOPLEVEL_RULE2 "thing" + IDS_INVALIDATENONTOPLEVEL_TOPLEVELRULE "play" + IDS_INVALIDATENONTOPLEVEL_OLDWORD1 L"\x30aa\x30fc\x30dc\x30a8" + IDS_INVALIDATENONTOPLEVEL_OLDWORD2 L"\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_INVALIDATENONTOPLEVEL_NEWWORD2 " " + IDS_INVALIDATENONTOPLEVEL_TOPLEVELWORDS L"\x3092\x6f14\x594f" + IDS_WAV_INVALIDATENONTOPLEVEL_OLD "tag_exprule_j.wav" + IDS_WAV_INVALIDATENONTOPLEVEL_NEW "invalidaterule_j.wav" + IDS_WAV_CFGTEXTBUFFER "tag_exprule_j.wav" + IDS_CFGTEXTBUFFER_WORDS L"\x30aa\x30fc\x30dc\x30a8" + IDS_CFGTEXTBUFFER_BUFFERWORD L"\x3092\x6f14\x594f\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_CFGTEXTBUFFER_RULE "play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DICTATIONTAG_RULE "play" + IDS_WAV_DICTATIONTAG "tag_exprule_j.wav" + IDS_WILDCARD_WORDS L"\x30aa\x30fc\x30dc\x30a8" + IDS_WILDCARD_RULE "play" + IDS_WAV_WILDCARD "tag_exprule_j.wav" + IDS_APPLEX_WORD L"\x3059\x304f\x3046\x304d" + IDS_APPLEX_PROP L"\x30b9\x30ce\x30fc\x30af" + IDS_USERLEXBEFOREAPPLEX_WORD L"\x3059\x304f\x3046\x304d" + IDS_USERLEXBEFOREAPPLEX_USERPROP L"\x30b9\x30ce\x30fc\x30af" + IDS_USERLEXBEFOREAPPLEX_APPPROP L"\x30c6\x30ec\x30d3" + IDS_WAV_APPLEX "lexicon_j.wav" + IDS_WAV_USERLEXBEFOREAPPLEX "lexicon_j.wav" + IDS_INVALIDATENONTOPLEVEL_NEWWORD1 L"\x30d4\x30a2\x30ce" + IDS_RESOURCE_LOCATION3 "..\\..\\resources\\" + IDS_RECO_EXPRULE_FIRSTRULE "firstrule" + IDS_RECO_EXPRULE_SECONDRULE "secondrule" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_ALTERMATESCFG "tag_rule_j.wav" + IDS_ALTERNATESCFG_BESTWORD L"\x4e03" + IDS_ALTERNATESCFG_ALTERNATE1 L"\x751f" + IDS_ALTERNATESCFG_ALTERNATE2 L"\x5948\x826f" + IDS_ALTERNATESCFG_WORDS L"\x3092\x52d5\x304b\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_ALTERNATESCFG_RULE "play" + IDS_ERR_INTERFERENCE_NOEVENT "failed to receive the interference event" + IDS_WAV_INTERFERENCE "tag_l_j.wav" + IDS_WAV_GETITNRESULT "tag_rule_j.wav" + IDS_RECO_GETITNRESULT L"7\x3092\x52d5\x304b\x3057\x3066\x304f\x3060\x3055\x3044" + IDS_CUSTOMPROP_NEWWORD_PRON L"\x30b9\x30ce\x30fc\x30af" + IDS_CUSTOMPROP_RULE "play" + IDS_WAV_CUSTOMPROP "lexicon_j.wav" + IDS_CUSTOMPROP_NEWWORD_DISP L"\x6f14\x594f" + IDS_CUSTOMPROP_NEWWORD_LEX L"\x3048\x3093\x305d\x3046" + IDS_DICTATIONTAG_WORDS L"\x30aa\x30fc\x30dc\x30a8\x3092\x6f14\x594f" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CASESENSITIVEGRAMMAR_RULENAME " " + IDS_CASESENSITIVEGRAMMAR_LEX1 " " + IDS_CASESENSITIVEGRAMMAR_PRON1 " " + IDS_CASESENSITIVEGRAMMAR_LEX2 " " + IDS_CASESENSITIVEGRAMMAR_PRON2 " " + IDS_CASESENSITIVEGRAMMAR_WAVE " " + IDS_CASESENSITIVEGRAMMAR_DISP1 " " + IDS_CASESENSITIVEGRAMMAR_DISP2 " " + IDS_CASESENSITIVELEXICON_WORD1 " " + IDS_CASESENSITIVELEXICON_SYMBOL1 " " + IDS_CASESENSITIVELEXICON_WORD2 " " + IDS_CASESENSITIVELEXICON_SYMBOL2 " " + IDS_CASESENSITIVELEXICON_WAVE " " + IDS_CASESENSITIVELEXICON_RULENAME " " + IDS_CFGTEXTBUFFER_NOTINTERESTEDWORDS L"\x304a\x9858\x3044\x3057\x307e\x3059" +END + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// SRGRAMMAR +// + +IDR_RULE_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_rule.cfg" +IDR_L_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_l.cfg" +IDR_O_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_o.cfg" +IDR_P1_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_p1.cfg" +IDR_P2_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_p2.cfg" +IDR_EXPRULE_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\tag_exprule.cfg" +IDR_SNORK_GRAMMAR SRGRAMMAR DISCARDABLE "..\\resources\\snork.cfg" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft\0" + VALUE "FileDescription", "SRCOMP\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SRCOMP\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "SRCOMP.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft SRCOMP\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_RECO_SYNCH_BEFORE_LOAD "skooky" + IDS_RECO_SYNCH_AFTER_DICT "skooky" + IDS_RECO_SYNCH_AFTER_GRAM "skooky" + IDS_RECO_L_TAG "put" + IDS_RECO_P_TAG "white" + IDS_RECO_O_TAG_1 "please" + IDS_RECO_O_TAG_2 "walk" + IDS_RECO_O_TAG_3 "slowly" + IDS_RECO_RULE_TAG "seven" + IDS_RESOURCE_LOCATION1 "..\\resources\\" + IDS_RESOURCE_LOCATION2 "..\\..\\..\\resources\\" + IDS_UNEXPECTED_ERR "recieved an unexpected error" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_UNEXPECTED_EVENT "recieved an unexpected event" + IDS_ERR_AUDIOFORMAT_TOMANY "Too many audio formats" + IDS_ERR_AUDIOFORMAT_UNSUPPORTED "unsupported audio format returned" + IDS_ERR_AUDIOFORMAT_NOTENOUGH "no formats returned" + IDS_ERR_SOUNDSTART_NOEVENT "failed to recieve sound_start event" + IDS_ERR_STREAMEND_NOEVENT "failed to recieve stream_end event" + IDS_ERR_SOUNDEND_NOEVENT "failed to recieve sound_end event" + IDS_ERR_SOUNDSTART_BADPOSITION1 "sound_start postion after sound_end" + IDS_ERR_SOUNDSTART_BADPOSITION2 "sound_start not in last third of audio" + IDS_ERR_SOUNDEND_BADPOSITION1 "sound_end postion after stream_end" + IDS_ERR_SOUNDEND_BADPOSITION2 "sound_end not in first third of audio" + IDS_ERR_SOUNDSTARTEND_NOEVENT + "failed to recieve both sound_start and sound_end events" + IDS_ERR_SOUNDSTARTEND_WRONGORDER + "sound_start and sound_end events recieved in wrong order" + IDS_ERR_PHRASESTART_NOEVENT "failed to recieve phrase_start event" + IDS_ERR_RECOGNITION_NOEVENT "failed to recieve recognition event" + IDS_ERR_RECOGNITION_EVENTONSILENCE + "received a Recognition event for silence" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ERR_RECOGNITION_WRONGORDER + "recoginition event recieved in wrong order" + IDS_ERR_HYPOTHESIS_NOEVENT "failed to recieve hypothesis event" + IDS_ERR_HYPOTHESIS_WRONGORDER "hypothesis event recieved in wrong order" + IDS_ERR_RESULT_WRONGWORD "failed to recieve expected result" + IDS_ERR_LEX_REMOVEUSER "failed to remove user" + IDS_ERR_LEX_EXPECTNOWORD "should not get word from empty user lexicon" + IDS_RECO_NEWWORD_PRON "s n ao 1 r k" + IDS_ERR_FALSERECOGNITION_NOEVENT + "failed to recieve false recognition event" + IDS_AUTOPAUSE_DYNAMICWORD1 "put" + IDS_AUTOPAUSE_DYNAMICWORD2 "red" + IDS_AUTOPAUSE_DYNAMICRULE1 "action" + IDS_AUTOPAUSE_DYNAMICRULE2 "color" + IDS_WAV_AUTOPAUSE "autopause.wav" + IDS_INVALIDATETOPLEVEL_DYNAMICWORDS "play the oboe" + IDS_INVALIDATETOPLEVEL_DYNAMICRULE "play" + IDS_WAV_INVALIDATETOPLEVEL_OLD "tag_exprule.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_SOUNDSTART "tag_l.wav" + IDS_WAV_SOUNDEND "tag_l.wav" + IDS_WAV_SOUNDSTARTEND "tag_l.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_PHRASESTART "tag_l.wav" + IDS_WAV_RECOGNITION_1 "tag_l.wav" + IDS_WAV_HYPOTHESIS "tag_exprule.wav" + IDS_WAV_SYNCH_BEFORE_LOAD "lexicon.wav" + IDS_WAV_SYNCH_AFTER_DICT "lexicon.wav" + IDS_WAV_SYNCH_AFTER_GRAM "lexicon.wav" + IDS_WAV_L_TAG "tag_l.wav" + IDS_WAV_MULT_RECO "multireco.wav" + IDS_WAV_EXPRULE_TAG "tag_exprule.wav" + IDS_WAV_P_TAG "tag_p.wav" + IDS_WAV_O_TAG_1 "tag_o1.wav" + IDS_WAV_O_TAG_2 "tag_o2.wav" + IDS_WAV_O_TAG_3 "tag_o3.wav" + IDS_WAV_RULE_TAG "tag_rule.wav" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INVALIDATETOPLEVEL_DYNAMICNEWWORDS "please play the seven" + IDS_ERR_INVALIDATETOPLEVEL + "Engine failed to invalidate the toplevel rule." + IDS_WAV_INVALIDATETOPLEVEL_NEW "tag_rule.wav" + IDS_INVALIDATENONTOPLEVEL_RULE1 "option" + IDS_INVALIDATENONTOPLEVEL_RULE2 "thing" + IDS_INVALIDATENONTOPLEVEL_TOPLEVELRULE "play" + IDS_INVALIDATENONTOPLEVEL_OLDWORD1 " " + IDS_INVALIDATENONTOPLEVEL_OLDWORD2 "oboe" + IDS_INVALIDATENONTOPLEVEL_NEWWORD2 "seven" + IDS_INVALIDATENONTOPLEVEL_TOPLEVELWORDS "play the " + IDS_WAV_INVALIDATENONTOPLEVEL_OLD "tag_exprule.wav" + IDS_WAV_INVALIDATENONTOPLEVEL_NEW "tag_rule.wav" + IDS_WAV_CFGTEXTBUFFER "tag_exprule.wav" + IDS_CFGTEXTBUFFER_WORDS "play the " + IDS_CFGTEXTBUFFER_BUFFERWORD "oboe" + IDS_CFGTEXTBUFFER_RULE "play" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_WAV_ALTERMATESCFG "tag_exprule.wav" + IDS_ALTERNATESCFG_BESTWORD "play" + IDS_ALTERNATESCFG_ALTERNATE1 "played" + IDS_ALTERNATESCFG_ALTERNATE2 "pay" + IDS_ALTERNATESCFG_WORDS "the oboe" + IDS_ALTERNATESCFG_RULE "play" + IDS_ERR_INTERFERENCE_NOEVENT "failed to receive the interference event" + IDS_WAV_INTERFERENCE "tag_l.wav" + IDS_WAV_GETITNRESULT "tag_rule.wav" + IDS_RECO_GETITNRESULT "please play the 7" + IDS_CUSTOMPROP_NEWWORD_PRON "s n ao 1 r k" + IDS_CUSTOMPROP_RULE "play" + IDS_WAV_CUSTOMPROP "lexicon.wav" + IDS_CUSTOMPROP_NEWWORD_DISP "abc" + IDS_CUSTOMPROP_NEWWORD_LEX "play" + IDS_DICTATIONTAG_WORDS "play the" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DICTATIONTAG_RULE "play" + IDS_WAV_DICTATIONTAG "tag_exprule.wav" + IDS_WILDCARD_WORDS "please play" + IDS_WILDCARD_RULE "play" + IDS_WAV_WILDCARD "tag_rule.wav" + IDS_APPLEX_WORD "skooky" + IDS_APPLEX_PROP "s n ao 1 r k" + IDS_USERLEXBEFOREAPPLEX_WORD "skooky" + IDS_USERLEXBEFOREAPPLEX_USERPROP "s n ao 1 r k" + IDS_USERLEXBEFOREAPPLEX_APPPROP "p l ey" + IDS_WAV_APPLEX "lexicon.wav" + IDS_WAV_USERLEXBEFOREAPPLEX "lexicon.wav" + IDS_INVALIDATENONTOPLEVEL_NEWWORD1 "please " + IDS_RESOURCE_LOCATION3 "..\\..\\resources\\" + IDS_RECO_EXPRULE_FIRSTRULE "firstrule" + IDS_RECO_EXPRULE_SECONDRULE "secondrule" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CASESENSITIVEGRAMMAR_RULENAME "rule" + IDS_CASESENSITIVEGRAMMAR_LEX1 "skooky" + IDS_CASESENSITIVEGRAMMAR_PRON1 "p uh t" + IDS_CASESENSITIVEGRAMMAR_LEX2 "SKOOKY" + IDS_CASESENSITIVEGRAMMAR_PRON2 "w ay t" + IDS_CASESENSITIVEGRAMMAR_WAVE "tag_p.wav" + IDS_CASESENSITIVEGRAMMAR_DISP1 "skooky" + IDS_CASESENSITIVEGRAMMAR_DISP2 "SKOOKY" + IDS_CASESENSITIVELEXICON_WORD1 "skooky" + IDS_CASESENSITIVELEXICON_SYMBOL1 "p uh t" + IDS_CASESENSITIVELEXICON_WORD2 "SKOOKY" + IDS_CASESENSITIVELEXICON_SYMBOL2 "w ay t" + IDS_CASESENSITIVELEXICON_WAVE "tag_p.wav" + IDS_CASESENSITIVELEXICON_RULENAME "rule" + IDS_CFGTEXTBUFFER_NOTINTERESTEDWORDS "please " +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.cpp b/sp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.cpp new file mode 100644 index 00000000..68c035f2 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.cpp @@ -0,0 +1,5470 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// srenginecompliance.cpp +// +// Test module for srenginecompliance +//****************************************************************************** +#include "SRTests1.h" +#include "resource.h" +#include "srenginecompliance.h" +#include "sphelper.h" +#include "sapiddk.h" +#include +#include +#include +#include + +//****************************************************************************** +//***** Globals +//****************************************************************************** +extern SPS_SHELL_INFO *g_pShellInfo; +extern CRITICAL_SECTION g_csProcess; + + +//****************************************************************************** +//***** Internal Functions and helper classes +//****************************************************************************** + +// called before dll is unloaded +void CleanupTest(void) +{ + // nothing to do at this time +}; + + + + + + + + + +// get string from resource +void GetWStrFromRes(UINT id, WCHAR* szwStr) +{ + EnterCriticalSection (&g_csProcess); + + HRSRC hResInfo = NULL; + HANDLE hStringSeg = NULL; + LPWSTR lpsz = NULL; + int cch = 0; + int cchBufferMax = MAX_PATH; + + // String Tables are broken up into 16 string segments. Find the segment + // containing the string we are interested in. + if (hResInfo = FindResourceEx(g_pShellInfo->hLib, (LPCTSTR)RT_STRING, + (LPCTSTR)((LONG)(((USHORT)id >> 4) + 1)), + ::GetDefaultEnginePrimaryLangId())) + { + // Load that segment. + hStringSeg = LoadResource(g_pShellInfo->hLib, hResInfo); + + // Lock the resource. + if (hStringSeg && (lpsz = (LPWSTR)LockResource(hStringSeg)) != NULL) + { + // Move past the other strings in this segment. + // (16 strings in a segment -> & 0x0F) + id &= 0x0F; + while (TRUE) + { + cch = *((WORD *)lpsz++); // PASCAL like string count + // first UTCHAR is count if TCHARs + if (id-- == 0) break; + lpsz += cch; // Step to start if next string + } + + // Account for the NULL + cchBufferMax--; + + // Don't copy more than the max allowed. + if (cch > cchBufferMax) + cch = cchBufferMax-1; + + // Copy the string into the buffer. + CopyMemory(szwStr, lpsz, cch*sizeof(WCHAR)); + + // Attach Null terminator. + szwStr[cch] = 0; + } + } + + LeaveCriticalSection (&g_csProcess); + +} + +inline WCHAR* GetDefaultPronunciation(const WCHAR* szSymbol = NULL, LANGID LangID = ::GetDefaultEnginePrimaryLangId()) +{ + + + HRESULT hr = S_OK; + + WCHAR szPronSymbol[MAX_PATH] = L""; + CComPtr cpPhoneConverter; + static SPPHONEID pphoneId[MAX_PATH] = L""; + + if (szSymbol) + { + wcscpy(szPronSymbol, szSymbol); + } + else + { + GetWStrFromRes(IDS_RECO_NEWWORD_PRON, szPronSymbol); + } + + + hr = SpCreatePhoneConverter(LangID, NULL, NULL, &cpPhoneConverter); + + if (SUCCEEDED(hr)) + { + hr = cpPhoneConverter->PhoneToId(CSpDynamicString(szPronSymbol), pphoneId); + } + + + return pphoneId; + +} + + + +HRESULT GetFullPath(WCHAR* wszFileName, WCHAR* wszPathName) +{ + WCHAR wszLocation[MAX_PATH] = L""; + + if (wszFileName && _waccess(wszFileName, 0) == 0) // file exists + { + wcscpy(wszPathName, wszFileName); + return S_OK; + } + else + { + GetWStrFromRes(IDS_RESOURCE_LOCATION1, wszLocation); + wcscat(wszLocation, wszFileName); + if (wszLocation && _waccess(wszLocation, 0) == 0) + { + wcscpy(wszPathName, wszLocation); + return S_OK; + } + else + { + GetWStrFromRes(IDS_RESOURCE_LOCATION2, wszLocation); + wcscat(wszLocation, wszFileName); + if (wszLocation && _waccess(wszLocation, 0) == 0) + { + wcscpy(wszPathName, wszLocation); + return S_OK; + } + } + } + + return E_FAIL; + +} + +// open wav file +HRESULT OpenWavFile(UINT uID, ISpStream ** ppStream, ULONGLONG ullEventInterest = SPFEI_ALL_EVENTS) +{ + EnterCriticalSection (&g_csProcess); + + HRESULT hr = S_OK; + WCHAR wszLocation[MAX_PATH] = L""; + WCHAR wszWavFile[MAX_PATH] = L""; + + GetWStrFromRes(uID, wszWavFile); + + // check location of process + + //check the customized location first + if (_tcslen(ptszCustomizedDirectory)) + { + wcscpy(wszLocation, CSpDynamicString(ptszCustomizedDirectory)); + wcscat(wszLocation, wszWavFile); + hr = SPBindToFile(wszLocation, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + else + { + hr = SPERR_NOT_FOUND; + } + + if (FAILED(hr)) + { + hr = SPBindToFile(wszWavFile, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + + // check other resource locations + if (FAILED(hr)) + { + GetWStrFromRes(IDS_RESOURCE_LOCATION1, wszLocation); + wcscat(wszLocation, wszWavFile); + hr = SPBindToFile(wszLocation, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + + // check second location + if (FAILED(hr)) + { + GetWStrFromRes(IDS_RESOURCE_LOCATION2, wszLocation); + wcscat(wszLocation, wszWavFile); + hr = SPBindToFile(wszLocation, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + + // check third location + if (FAILED(hr)) + { + GetWStrFromRes(IDS_RESOURCE_LOCATION3, wszLocation); + wcscat(wszLocation, wszWavFile); + hr = SPBindToFile(wszLocation, SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + } + + if (FAILED(hr)) + { + TCHAR tszFileName[MAX_PATH] = _T(""); + TCHAR tszFilterName[MAX_PATH] = _T(""); + TCHAR* tszTem = NULL; + OPENFILENAME ofn; + CSpTString SpTString(wszWavFile); + ZeroMemory(&ofn, sizeof(ofn)); + + + ofn.lStructSize = sizeof(OPENFILENAME); + ofn. hwndOwner = g_pShellInfo->hWnd; + ofn.hInstance = g_pShellInfo->hInstance; + + //construct the filter, like "Compliance Wave Input (tag_l.wav)\0tag_l.wav\0\0" + _tcscpy(tszFilterName, _T("Compliance Wave Input (")); + _tcscat(tszFilterName, SpTString); + _tcscat(tszFilterName, _T(")")); + tszTem = _tcscpy(tszFilterName + _tcslen(tszFilterName) + 1, SpTString); + _tcscpy(tszTem + _tcslen(tszTem) + 1, _T("")); + + ofn.lpstrFilter = tszFilterName; + + _tcscpy(tszFileName, SpTString); + ofn.lpstrFile = tszFileName; + ofn.nMaxFile = MAX_PATH; + + if (_tcslen(ptszCustomizedDirectory)) + ofn.lpstrInitialDir = ptszCustomizedDirectory; + else + ofn.lpstrInitialDir = NULL; + + ofn.lpstrTitle = _T("Please choose the resource directory"); + ofn.Flags = OFN_FILEMUSTEXIST | OFN_READONLY; + + BOOL fSuccess = GetOpenFileName(&ofn); + if (fSuccess) + { + _tcscpy(ptszCustomizedDirectory, ofn.lpstrFile); + hr = SPBindToFile(CSpDynamicString(ptszCustomizedDirectory), SPFM_OPEN_READONLY, ppStream, NULL, NULL, ullEventInterest); + + TCHAR* tszTem = _tcsrchr(ptszCustomizedDirectory, _T('\\')); + *(tszTem+1) = NULL; + } + else + { + //the user cancels the dialog box + } + } + + LeaveCriticalSection (&g_csProcess); + + return hr; +}; + +void Comment(UINT uID) +{ + USES_CONVERSION; + EnterCriticalSection (&g_csProcess); + + // for string from resource and comment + static WCHAR wszMessage[MAX_PATH] = L""; + + GetWStrFromRes(uID, wszMessage); + + g_pKato->Comment(5, W2A(wszMessage)); + + LeaveCriticalSection (&g_csProcess); + +}; + +void Comment(WCHAR* wszMessage) +{ + USES_CONVERSION; + EnterCriticalSection (&g_csProcess); + + // for string from resource and comment + + if (wszMessage) + g_pKato->Comment(5, W2A(wszMessage)); + + LeaveCriticalSection (&g_csProcess); + +}; + +BOOL IsMatchingAttribute(WCHAR* pwszAttribute, WCHAR* pwszValue = NULL) +{ + CComPtr cpResMgr; + CComPtr cpObjectToken; + BOOL IsMatching = FALSE; + + HRESULT hr = S_OK; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOGNIZERS, &cpObjectToken, FALSE); + if (hr == S_OK) + { + CComPtr cpAttributeKey; + hr = cpObjectToken->OpenKey(L"Attributes", &cpAttributeKey); + if (hr == S_OK) + { + CSpDynamicString dsValue; + hr = cpAttributeKey->GetStringValue(pwszAttribute, &dsValue); + if (hr == S_OK) + { + if (pwszValue) + { + const WCHAR pwszTem[] = L" ;"; + const WCHAR* pwszTemToken = wcstok(dsValue, pwszTem); + while (pwszTemToken && (!IsMatching)) + { + if (!wcscmp(pwszTemToken, pwszValue)) + { + IsMatching = TRUE; + } + else + { + pwszTemToken = wcstok(NULL, pwszTem); + } + } + } + else + //If pwszValue == NULL, it means we don't care about the value. We are just interested in the attribute. + { + IsMatching = TRUE; + } + } + } + } + + return IsMatching; + +} + +LANGID GetDefaultEnginePrimaryLangId() +{ + LANGID LangId = 0; + CComPtr cpRecognizer; + HRESULT hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + if (SUCCEEDED(hr)) + { + SPRECOGNIZERSTATUS SpRecognizerStatus; + ZeroMemory(&SpRecognizerStatus, sizeof(SpRecognizerStatus)); + hr = cpRecognizer->GetStatus(&SpRecognizerStatus); + if (SUCCEEDED(hr) && SpRecognizerStatus.cLangIDs) + { + LangId = SpRecognizerStatus.aLangID[0]; + } + } + return LangId; +} + +SPWORDPRONUNCIATIONLIST spPronList; +SPWORDPRONUNCIATION* psppron = NULL; + +// internal helper function for the Lexicon test cases +HRESULT HlpAddCustomWord(CComPtr &cpLexicon, WCHAR *wszCustomWord, WCHAR *wszPron = NULL) +{ + HRESULT hr; + WCHAR szPronunciation[MAX_PATH] = L""; + LANGID LangID = ::GetDefaultEnginePrimaryLangId(); + + // first, delete the word if it exists + ZeroMemory(&spPronList, sizeof(spPronList)); + hr = cpLexicon->GetPronunciations(wszCustomWord, LangID, eLEXTYPE_USER, &spPronList); + + if (hr == SPERR_NOT_IN_LEX || hr == SP_WORD_EXISTS_WITHOUT_PRONUNCIATION) + { + hr = S_OK; + } + else if (SUCCEEDED(hr)) + { + //Comment(IDS_ERR_LEX_EXPECTNOWORD); + hr = cpLexicon->RemovePronunciation(wszCustomWord, LangID, SPPS_Unknown, NULL); + } + + + // next, get pronunciation from resource string and make it official + wcscpy(szPronunciation, GetDefaultPronunciation(wszPron)); + + if ( wcslen(szPronunciation) ) + { + hr = cpLexicon->AddPronunciation(wszCustomWord, LangID, SPPS_Noun, szPronunciation); + } + + + + return hr; +} + +// internal helper function for the Lexicon test cases +HRESULT HlpRemoveCustomWord(CComPtr &cpLexicon, WCHAR *wszCustomWord) +{ + HRESULT hr; + WCHAR szPronunciation[MAX_PATH] = L""; + LANGID LangID = ::GetDefaultEnginePrimaryLangId(); + + // first, delete the word if it exists + hr = cpLexicon->RemovePronunciation(wszCustomWord, LangID, SPPS_Unknown, NULL); + + + //Comment(IDS_ERR_LEX_EXPECTNOWORD); + for(psppron = spPronList.pFirstWordPronunciation; psppron && SUCCEEDED(hr) && (hr != SP_ALREADY_IN_LEX); psppron = psppron->pNextWordPronunciation) + { + hr = cpLexicon->RemovePronunciation(wszCustomWord, psppron->LangID, psppron->ePartOfSpeech, psppron->szPronunciation); + } + + if (spPronList.pvBuffer) ::CoTaskMemFree(spPronList.pvBuffer); + + return hr; +} + + + +HRESULT HlpCheckResult(RESULTVECTOR& vector_RecoResult, WCHAR* pszText) +{ + HRESULT hr = E_FAIL; + int count = vector_RecoResult.size(); + bool bFound = false; + + for (int i=0; iGetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &wpszTem, NULL); + if (SUCCEEDED(hr) && wcsstr(wpszTem, pszText)) + { + bFound = true; + break; + } + } + + (bFound) ? hr = S_OK : hr = S_FALSE; + + + return hr; +} + +// HlpGetRecoResult() - called by several of the test functions that follow; +// it activates a given grammar and waits for the recognition results to +// come in and generate the recoreusult vector. +HRESULT HlpGetRecoResult( + CComPtr & cpRecoCtxt, + RESULTVECTOR& vector_RecoResult + ) +{ + USES_CONVERSION; + HRESULT hr = S_OK; + + // Clear out the list of results from any previous test + vector_RecoResult.clear(); + + bool bDone = false; + // get and check result + while (!bDone && (cpRecoCtxt->WaitForNotifyEvent(TESTEVENT_TIMEOUT)) == S_OK) + { + CSpEvent event; + + while (event.GetFrom(cpRecoCtxt) == S_OK) + { + + if (event.eEventId == SPEI_END_SR_STREAM) + bDone = true; + else if (event.eEventId == SPEI_RECOGNITION) + { + vector_RecoResult.push_back(event.RecoResult()); + } // else if (event.eEventId == SPEI_RECO) + } // while + + } + + if ( !vector_RecoResult.size()) + hr = E_FAIL; + + return hr; +} + + + + +/* +CEventList is a class used to record the events generated by a speech +recognition pass over a wave file. It uses the CEventRecord class for +its nodes; it records the event type, the stream offset, and the rule +name in case of recognition events. + +These two classes are used by the HlpGatherEvents function. +*/ +class CEventRecord +{ +public: + SPEVENTENUM m_eEventId; + ULONGLONG m_ullOffset; + CSpDynamicString m_dstrRuleName; + CSpDynamicString m_dstrRecoResult; + CEventRecord * m_pNext; + + CEventRecord() { m_pNext = NULL; } + ~CEventRecord() { m_dstrRuleName.Clear(); } + CEventRecord(CSpEvent &e) + { + m_eEventId = e.eEventId; + m_ullOffset = e.ullAudioStreamOffset; + if (m_eEventId == SPEI_RECOGNITION) + { + SPPHRASE *pPhrase = NULL; + e.RecoResult()->GetPhrase(&pPhrase); + m_dstrRuleName = pPhrase->Rule.pszName; + if (pPhrase) CoTaskMemFree(pPhrase); + e.RecoResult()->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &m_dstrRecoResult, NULL); + } + m_pNext = NULL; + } +}; + +class CEventList +{ +public: + CEventRecord *m_pHead; + CEventList() { m_pHead = NULL; } + void Append(CSpEvent &e) + { + CEventRecord **p = &m_pHead; + while (*p) + p = &((*p)->m_pNext); + *p = new CEventRecord(e); + } + void Release() + { + CEventRecord *q, *p = m_pHead; + while (q = p) + { + p = q->m_pNext; + delete(q); + } + m_pHead = NULL; + } + ~CEventList() { Release(); } +}; + +const char *HlpEventToString(SPEVENTENUM eId) +{ + switch (eId) + { + case SPEI_UNDEFINED : return "?"; + case SPEI_END_SR_STREAM : return "EndStrm"; + case SPEI_SOUND_START : return "SndSt"; + case SPEI_SOUND_END : return "SndEnd"; + case SPEI_PHRASE_START : return "PhrSt"; + case SPEI_RECOGNITION : return "Reco"; + case SPEI_HYPOTHESIS : return "Hyp"; + case SPEI_FALSE_RECOGNITION : return "FReco"; + case SPEI_INTERFERENCE : return "Intf"; + default : return "Misc"; + } +} + +HRESULT HlpGatherEvents(ULONGLONG Events, ULONGLONG QueuedEvents, + UINT uWaveFileId, CEventList &EventList, UINT idGrammar = 0) +{ + HRESULT hr = S_OK; + + // speech + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + Events | SPFEI(SPEI_END_SR_STREAM), + QueuedEvents | SPFEI(SPEI_END_SR_STREAM)); + + + // open wav file for sound start test + if (SUCCEEDED(hr)) + hr = OpenWavFile(uWaveFileId, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return E_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load and activate the default grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if (!idGrammar) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadDictation(/* topic name */ NULL, SPLO_STATIC); + + if (SUCCEEDED(hr)) + hr = cpGrammar->SetDictationState(SPRS_ACTIVE); + } + else + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(idGrammar), + L"SRGRAMMAR", GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + + + + + bool bDone = false; + DWORD dwWait = 0; + + while ( !bDone && (hr = cpRecoCtxt->WaitForNotifyEvent(WAIT_TIME)) == S_OK ) + { + CSpEvent event; + int numEvents = 0; + + while (event.GetFrom(cpRecoCtxt) == S_OK) + { + numEvents++; + if (event.eEventId == SPEI_END_SR_STREAM) + bDone = true; + EventList.Append(event); + } // while GetEvents + } + + + return hr; +} + + +TESTPROCAPI t_CheckEvent_SoundStart(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_SOUND_START), SPFEI(SPEI_SOUND_START), + IDS_WAV_SOUNDSTART, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *peSoundStart = NULL; + CEventRecord *peStreamEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_SOUND_START: + if (!peSoundStart) + peSoundStart = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + case SPEI_RECOGNITION: + //recognition is set as a default event by SAPI + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peSoundStart) + { + Comment(IDS_ERR_SOUNDSTART_NOEVENT); + tpr = TPR_FAIL; + } + + if (!peStreamEnd) + { + Comment(IDS_ERR_STREAMEND_NOEVENT); + tpr = TPR_FAIL; + } + + // check ullAudioStreamOffset for position + if (peSoundStart && peStreamEnd) + { + // check that sound start comes before stream end + if (peSoundStart->m_ullOffset > peStreamEnd->m_ullOffset) + { + Comment(IDS_ERR_SOUNDSTART_BADPOSITION1); + tpr = TPR_FAIL; + } + } + } + else + // cleanup + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + +TESTPROCAPI t_CheckEvent_Interference(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CEventList eventList; + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_INTERFERENCE), SPFEI(SPEI_INTERFERENCE), + IDS_WAV_INTERFERENCE, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *peInterference = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_INTERFERENCE: + if (!peInterference) + peInterference = p; + break; + case SPEI_END_SR_STREAM: + case SPEI_RECOGNITION: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_UNSUPPORTED; + } + } + + if (!peInterference) + { + Comment(IDS_ERR_INTERFERENCE_NOEVENT); + tpr = TPR_UNSUPPORTED; + } + + } + else + // cleanup + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_UNSUPPORTED; + } + + return tpr; +} + +TESTPROCAPI t_GetITNResult(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CEventList eventList; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + RESULTVECTOR vector_RecoResult; + WCHAR pwszText[MAX_PATH] = L""; + + + + GetWStrFromRes(IDS_RECO_GETITNRESULT, pwszText); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_GETITNRESULT, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_RULE_GRAMMAR), + L"SRGRAMMAR", GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (vector_RecoResult.size()) + { + CSpDynamicString dsText; + hr = vector_RecoResult[0]->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dsText, NULL); + if (SUCCEEDED(hr) &&!wcscmp(dsText, pwszText)) + { + } + else + { + tpr = TPR_UNSUPPORTED; + } + } + else + { + tpr = TPR_UNSUPPORTED; + } + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_SoundEnd(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_SOUND_END), SPFEI(SPEI_SOUND_END), + IDS_WAV_SOUNDEND, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *peSoundEnd = NULL; + CEventRecord *peStreamEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_SOUND_END: + peSoundEnd = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peSoundEnd) + { + Comment(IDS_ERR_SOUNDEND_NOEVENT); + tpr = TPR_FAIL; + } + + if (!peStreamEnd) + { + Comment(IDS_ERR_STREAMEND_NOEVENT); + tpr = TPR_FAIL; + } + + // check ullAudioStreamOffset for position + if (peSoundEnd && peStreamEnd) + { + // check that sound start comes before stream end + if (peSoundEnd->m_ullOffset > peStreamEnd->m_ullOffset) + { + Comment(IDS_ERR_SOUNDEND_BADPOSITION1); + tpr = TPR_FAIL; + } + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_SoundStartEnd(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END), + SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END), + IDS_WAV_SOUNDSTARTEND, eventList, IDR_L_GRAMMAR); + + //stream positions + BOOL fInSound = FALSE; + CEventRecord *peSoundStart = NULL; + CEventRecord *peSoundEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_SOUND_START: + { + if (!fInSound) + { + peSoundStart = p; + fInSound = TRUE; + } + else + { + tpr = TPR_FAIL; + peSoundStart = NULL; + } + } + break; + case SPEI_SOUND_END: + { + if (fInSound) + { + fInSound = FALSE; + peSoundEnd = p; + } + else + { + tpr = TPR_FAIL; + peSoundEnd = NULL; + } + } + break; + case SPEI_END_SR_STREAM: + case SPEI_RECOGNITION: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + //We need to make sure that sound start and sound end are pairs of events + if (!(peSoundStart && peSoundEnd && (!fInSound))) + { + Comment(IDS_ERR_SOUNDSTARTEND_WRONGORDER); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_PhraseStart(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_PHRASE_START), SPFEI(SPEI_PHRASE_START), + IDS_WAV_PHRASESTART, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *pePhraseStart = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_PHRASE_START: + pePhraseStart = p; + break; + case SPEI_END_SR_STREAM: + case SPEI_RECOGNITION: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!pePhraseStart) + { + Comment(IDS_ERR_PHRASESTART_NOEVENT); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_Recognition(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION), + IDS_WAV_RECOGNITION_1, eventList, IDR_L_GRAMMAR); + + CEventRecord *peRecognition = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_RECOGNITION: + peRecognition = p; + break; + case SPEI_END_SR_STREAM: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peRecognition) + { + Comment(IDS_ERR_RECOGNITION_NOEVENT); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + // repeat with wav file with silence and insure that no recognition occurs. + eventList.Release(); + + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_PhraseStartRecognitionOrder(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_FALSE_RECOGNITION), + SPFEI(SPEI_PHRASE_START) | SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_FALSE_RECOGNITION), + IDS_WAV_RECOGNITION_1, eventList, IDR_L_GRAMMAR); + + //stream positions + BOOL fInPhrase = FALSE; + CEventRecord *pePhraseStart = NULL; + CEventRecord *peRecognition = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_PHRASE_START: + { + if (!fInPhrase) + { + pePhraseStart = p; + fInPhrase = TRUE; + } + else + { + tpr = TPR_FAIL; + pePhraseStart = NULL; + } + } + break; + case SPEI_RECOGNITION: + case SPEI_FALSE_RECOGNITION: + { + if (fInPhrase) + { + fInPhrase = FALSE; + peRecognition = p; + } + else + { + tpr = TPR_FAIL; + peRecognition = NULL; + } + } + break; + case SPEI_END_SR_STREAM: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!(pePhraseStart && peRecognition && (!fInPhrase))) + { + Comment(L"incorrect phrasestart and recognition/false recognition event order"); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + // repeat with wav file with silence and insure that no recognition occurs. + eventList.Release(); + + + return tpr; +} + + + +TESTPROCAPI t_CheckEvent_FalseRecognition(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_FALSE_RECOGNITION), SPFEI(SPEI_FALSE_RECOGNITION), + IDS_WAV_RECOGNITION_1, eventList, IDR_RULE_GRAMMAR); + + //stream positions + CEventRecord *peFalseRecognition = NULL; + CEventRecord *peStreamEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_RECOGNITION: + Comment(L"Recognition event shouldn't be recieved"); + tpr = TPR_FAIL; + break; + case SPEI_FALSE_RECOGNITION: + peFalseRecognition = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peFalseRecognition) + { + Comment(IDS_ERR_FALSERECOGNITION_NOEVENT); + tpr = TPR_FAIL; + } + + if (!peStreamEnd) + { + Comment(IDS_ERR_STREAMEND_NOEVENT); + tpr = TPR_FAIL; + } + } + + // repeat with wav file with silence and insure that no recognition occurs. + eventList.Release(); + + + + + return tpr; +} + + + +TESTPROCAPI t_CheckEvent_EventsSequences(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | SPFEI(SPEI_PHRASE_START), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_SOUND_START) | SPFEI(SPEI_SOUND_END) | SPFEI(SPEI_PHRASE_START), + IDS_WAV_RECOGNITION_1, eventList, IDR_L_GRAMMAR); + + //stream positions + CEventRecord *peSoundStart = NULL; + CEventRecord *pePhraseStart = NULL; + CEventRecord *peRecognition = NULL; + CEventRecord *peSoundEnd = NULL; + CEventRecord *peStreamEnd = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_SOUND_START: + peSoundStart = p; + break; + case SPEI_PHRASE_START: + pePhraseStart = p; + break; + case SPEI_RECOGNITION: + peRecognition = p; + break; + case SPEI_SOUND_END: + peSoundEnd = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (peSoundStart && pePhraseStart && peRecognition && peSoundEnd && peStreamEnd) + { + if (peSoundStart->m_ullOffset <= pePhraseStart->m_ullOffset && + pePhraseStart->m_ullOffset <= peRecognition->m_ullOffset && + peRecognition->m_ullOffset <= peSoundEnd->m_ullOffset && + peSoundEnd->m_ullOffset <= peStreamEnd->m_ullOffset) + { + } + else + { + Comment(L"incorrect event sequence"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"failed to receive some events."); + tpr = TPR_FAIL; + } + + } + else + // cleanup + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + + + + +TESTPROCAPI t_SpPhraseElements(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + // speech + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + CComPtr cpRecoResult; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION)); + + + // open wav file for sound start test + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_RULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load and activate the default grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(0, &cpGrammar); + + if (SUCCEEDED(hr)) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_RULE_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + } + + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + + + + + + bool bDone = false; + DWORD dwWait = 0; + + while ((hr = cpRecoCtxt->WaitForNotifyEvent(WAIT_TIME)) == S_OK) + { + CSpEvent event; + int numEvents = 0; + + while (event.GetFrom(cpRecoCtxt) == S_OK) + { + numEvents++; + if (event.eEventId == SPEI_RECOGNITION) + { + bDone = true; + break; + } + } // while GetEvents + + if (bDone) + { + cpRecoResult = event.RecoResult(); + if (cpRecoResult) + { + SPPHRASE* pPhrase; + hr = cpRecoResult->GetPhrase(&pPhrase); + if (SUCCEEDED(hr)) + { + for (ULONG i=0; iRule.ulCountOfElements-1; i++) + { + if (pPhrase->pElements[i].ulAudioStreamOffset >= pPhrase->pElements[i+1].ulAudioStreamOffset) + { + tpr = TPR_FAIL; + break; + } + } + } + } + break; + } + } + + + + return tpr; +} + + +TESTPROCAPI t_CheckEvent_Hypothesis(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + if (!IsMatchingAttribute(L"Hypotheses")) + { + return TPR_UNSUPPORTED; + } + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CEventList eventList; + + + // get events + hr = HlpGatherEvents(SPFEI(SPEI_HYPOTHESIS), SPFEI(SPEI_HYPOTHESIS), + IDS_WAV_HYPOTHESIS, eventList, IDR_EXPRULE_GRAMMAR); + + //stream positions + CEventRecord *peHypothesis = NULL; + CEventRecord *peStreamEnd = NULL; + + if (SUCCEEDED(hr)) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_HYPOTHESIS: + peHypothesis = p; + break; + case SPEI_END_SR_STREAM: + peStreamEnd = p; + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_UNSUPPORTED; + } + } + + if (!peHypothesis) + { + Comment(IDS_ERR_HYPOTHESIS_NOEVENT); + tpr = TPR_UNSUPPORTED; + } + + if (!peStreamEnd) + { + Comment(IDS_ERR_STREAMEND_NOEVENT); + tpr = TPR_UNSUPPORTED; + } + } + + // cleanup + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_UNSUPPORTED; + } + + + return tpr; +} + + + +class CAppLexicon { +private: + SPWORDPRONUNCIATIONLIST spPronList; + HRESULT hr; + CComPtr cpConlexicon; + CSpDynamicString dsWord; + +public: + CAppLexicon (WCHAR* wszWord, WCHAR* wszAppSymbol, WCHAR* wszUserSymbol, HRESULT* phr) + { + CComPtr cpLexiconApp; + hr = S_OK; + dsWord = CSpDynamicString(wszWord); + LANGID LangID = ::GetDefaultEnginePrimaryLangId(); + + RemoveTestAppLexicon(L"SRCompliance;AppLexTest"); + + if (SUCCEEDED(hr)) + { + //Create a test app lexicon + hr = CreateAppLexicon( + L"App lex test", + LangID, + L"App Lex test", + L"SRCompliance;AppLexTest", + &cpLexiconApp); + } + + if (SUCCEEDED(hr)) + { + // add a new word pronunciation to the new created app lexicon + hr = cpLexiconApp->AddPronunciation(dsWord, LangID, SPPS_Noun, GetDefaultPronunciation(wszAppSymbol)); + } + + cpLexiconApp.Release(); + + + //the following is to erase the pronunciations of the new word in User's lexicon + memset(&spPronList, 0, sizeof(spPronList) ); + + if (SUCCEEDED(hr)) + hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon); + + if (SUCCEEDED(hr)) + { + //get the pronounciation of the new word from the User's lexicon + hr = cpConlexicon->GetPronunciations(dsWord, LangID, eLEXTYPE_USER, &spPronList); + if (SUCCEEDED(hr)) + { + //remove all the pronunciations of the new word in User lexicon + hr = cpConlexicon->RemovePronunciation(dsWord, LangID, SPPS_Unknown, NULL); + } + else if (hr == SPERR_NOT_IN_LEX || hr == SP_WORD_EXISTS_WITHOUT_PRONUNCIATION) + { + hr = S_OK; + } + } + + if (SUCCEEDED(hr) && wszUserSymbol) + { + hr = cpConlexicon->AddPronunciation(dsWord, LangID, SPPS_Noun, GetDefaultPronunciation(wszUserSymbol)); + } + + + *phr = hr; + } + + ~CAppLexicon() + { + SPWORDPRONUNCIATION *psppron = NULL; + + if (cpConlexicon) + { + //remove the pronounciation. We don't care about the HRESULT. + hr = cpConlexicon->RemovePronunciation(dsWord, ::GetDefaultEnginePrimaryLangId(), SPPS_Unknown, NULL); + } + + //restore the pronounciation of the new word to User's lexicon + for(psppron = spPronList.pFirstWordPronunciation; psppron && SUCCEEDED(hr) && (hr != SP_ALREADY_IN_LEX); psppron = psppron->pNextWordPronunciation) + { + hr = cpConlexicon -> AddPronunciation(dsWord, psppron->LangID, psppron->ePartOfSpeech, psppron->szPronunciation ); + } + ::CoTaskMemFree(spPronList.pvBuffer); + + cpConlexicon.Release(); + + hr = RemoveTestAppLexicon(L"SRCompliance;AppLexTest"); + + } +}; + +enum UserlexTestType +{ + ItUserLexSynchBeforeDictLoad, + ItUserLexSynchBeforeCfgLoad, + ItUserLexSynchAfterDictLoad, + ItUserLexSynchAfterCfgLoad, +}; + +int HlpLexiconTest(UserlexTestType lt) +{ + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + // it is assumed that this work is in no vendors lexicon and the pronunciation for it is unigue + WCHAR wszNewWord[MAX_PATH] = L""; + + CComPtr cpLexicon; + CComPtr cpGrammar; + CComPtr cpProfileToken; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + CComPtr cpStream; + UINT idWavFile; + RESULTVECTOR vector_RecoResult; + + // get the word from the resource file + switch (lt) + { + case ItUserLexSynchBeforeDictLoad : + case ItUserLexSynchBeforeCfgLoad: + GetWStrFromRes(IDS_RECO_SYNCH_BEFORE_LOAD, wszNewWord); + idWavFile = IDS_WAV_SYNCH_BEFORE_LOAD; + break; + case ItUserLexSynchAfterDictLoad : + GetWStrFromRes(IDS_RECO_SYNCH_AFTER_DICT, wszNewWord); + idWavFile = IDS_WAV_SYNCH_AFTER_DICT; + break; + case ItUserLexSynchAfterCfgLoad : + GetWStrFromRes(IDS_RECO_SYNCH_AFTER_GRAM, wszNewWord); + idWavFile = IDS_WAV_SYNCH_AFTER_GRAM; + break; + } + + + // create a new token object + if (SUCCEEDED(hr)) + hr = SpCreateNewToken(SPCAT_RECOPROFILES, L"LexProfile", &cpProfileToken); + + // create a random user name + if (SUCCEEDED(hr)) + { + WCHAR wszName[MAX_PATH] = L""; + srand(GetCurrentThreadId() + GetTickCount()); + UINT uiRandom = rand(); + swprintf(wszName, L"TestName:%d", uiRandom); + + // set token to this new user + SpSetDescription(cpProfileToken, wszName); + } + + // add word to lexicon + if (lt == ItUserLexSynchBeforeDictLoad || lt == ItUserLexSynchBeforeCfgLoad) + { + // Get the lexicon + if (SUCCEEDED(hr)) + hr = cpLexicon.CoCreateInstance(CLSID_SpLexicon); + + if (SUCCEEDED(hr)) + hr = HlpAddCustomWord(cpLexicon, wszNewWord); + } + + // load the engine and make sure new word is recognized + // create engine + if (SUCCEEDED(hr)) + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // point to our user + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetRecoProfile(cpProfileToken); + + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(idWavFile, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load and activate the default grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if ((lt == ItUserLexSynchBeforeDictLoad) || (lt == ItUserLexSynchAfterDictLoad)) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadDictation(NULL, SPLO_STATIC); + } + else + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_SNORK_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + } + + // add word to lexicon + if ((lt == ItUserLexSynchAfterDictLoad) || (lt == ItUserLexSynchAfterCfgLoad)) + { + // Get the lexicon + hr = cpLexicon.CoCreateInstance(CLSID_SpLexicon); + + if (SUCCEEDED(hr)) + hr = HlpAddCustomWord(cpLexicon, wszNewWord); + } + + // activate dictation or cfg grammar + if ((lt == ItUserLexSynchBeforeDictLoad) || (lt == ItUserLexSynchAfterDictLoad)) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->SetDictationState(SPRS_ACTIVE); + } + else + { + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + // perform SR; get results and see if our word is inside the result string + CSpDynamicString dstrText; + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszNewWord) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + hr = HlpRemoveCustomWord(cpLexicon, wszNewWord); + + // remove the random user that was created for this test + if (cpProfileToken && SUCCEEDED(hr)) + { + hr = cpProfileToken->Remove(NULL); + if (hr == SPERR_TOKEN_IN_USE) + { + //we can't remove the token because SR Engine is using the token + //we try to set the original default token to be the current token + CComPtr cpDefaultProfileToken; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOPROFILES, &cpDefaultProfileToken); + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetRecoProfile(cpDefaultProfileToken); + } + + if (SUCCEEDED(hr)) + { + hr = cpProfileToken->Remove(NULL); + } + } + else if (FAILED(hr)) + { + Comment(IDS_ERR_LEX_REMOVEUSER); + } + } + + if (lt == ItUserLexSynchBeforeDictLoad || lt == ItUserLexSynchAfterDictLoad) + { + tpr = (tpr == TPR_PASS) ? TPR_SUPPORTED: TPR_UNSUPPORTED; + } + + return tpr; +} + + +TESTPROCAPI t_UserLexSynchBeforeDicLoad(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + if (!IsMatchingAttribute(L"Dictation")) + { + return TPR_UNSUPPORTED; + } + + + + // run the test + int tpr = HlpLexiconTest(ItUserLexSynchBeforeDictLoad); + + + return tpr; +} + + +TESTPROCAPI t_UserLexSynchBeforeCfgLoad(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + // run the test + int tpr = HlpLexiconTest(ItUserLexSynchBeforeCfgLoad); + + return tpr; +} + +TESTPROCAPI t_UserLexSynchAfterDictationLoad(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + if (!IsMatchingAttribute(L"Dictation")) + { + return TPR_FAIL; + } + + + // run the test + int tpr = HlpLexiconTest(ItUserLexSynchAfterDictLoad); + + + return tpr; +} + + +TESTPROCAPI t_UserLexSynchAfterGrammarLoad(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + // run the test + int tpr = HlpLexiconTest(ItUserLexSynchAfterCfgLoad); + + + return tpr; +} + + +TESTPROCAPI t_AppLex(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + CEventList eventList; + + WCHAR wszWord[MAX_PATH] = L""; + WCHAR wszSymbol[MAX_PATH] = L""; + + GetWStrFromRes(IDS_APPLEX_WORD, wszWord); + GetWStrFromRes(IDS_APPLEX_PROP, wszSymbol); + + CAppLexicon LexObject(wszWord, wszSymbol, NULL, &hr); + + if (hr == SPERR_APPLEX_READ_ONLY) + { + Comment(L"app lexicon already exists as read only, can't add new word."); + return TPR_FAIL; + } + else if (FAILED(hr)) + { + Comment(L"other app lexicon setup failure."); + return TPR_FAIL; + } + + hr = HlpGatherEvents(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION), + IDS_WAV_APPLEX, eventList, IDR_SNORK_GRAMMAR); + + + CEventRecord *peRecognition = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_RECOGNITION: + peRecognition = p; + break; + case SPEI_END_SR_STREAM: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peRecognition) + { + Comment(IDS_ERR_RECOGNITION_NOEVENT); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + eventList.Release(); + + return tpr; +} + + +TESTPROCAPI t_UserLexBeforeAppLex(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + CEventList eventList; + + WCHAR wszWord[MAX_PATH] = L""; + WCHAR wszUserSymbol[MAX_PATH] = L""; + WCHAR wszAppSymbol[MAX_PATH] = L""; + + GetWStrFromRes(IDS_USERLEXBEFOREAPPLEX_WORD, wszWord); + GetWStrFromRes(IDS_USERLEXBEFOREAPPLEX_USERPROP, wszUserSymbol); + GetWStrFromRes(IDS_USERLEXBEFOREAPPLEX_APPPROP, wszAppSymbol); + + CAppLexicon LexObject(wszWord, wszAppSymbol, wszUserSymbol, &hr); + + if (FAILED(hr)) + { + Comment(L"app lexicon setup failed."); + return TPR_FAIL; + } + + hr = HlpGatherEvents(SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION), + IDS_WAV_USERLEXBEFOREAPPLEX, eventList, IDR_SNORK_GRAMMAR); + + CEventRecord *peRecognition = NULL; + + if (hr == S_OK) + { + for (CEventRecord *p = eventList.m_pHead; p != NULL; p = p->m_pNext) + { + switch (p->m_eEventId) + { + case SPEI_RECOGNITION: + peRecognition = p; + break; + case SPEI_END_SR_STREAM: + break; + default: + Comment(IDS_UNEXPECTED_EVENT); + tpr = TPR_FAIL; + } + } + + if (!peRecognition) + { + Comment(IDS_ERR_RECOGNITION_NOEVENT); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + + return tpr; +} + + +// This test uses the P tag data +TESTPROCAPI t_MultipleRecoContext(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + bool bSuccess1, bSuccess2; + + + // speech + CComPtr cpGrammar1; + CComPtr cpGrammar2; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt1; + CComPtr cpRecoCtxt2; + + WCHAR wszWord[MAX_PATH] = L""; + GetWStrFromRes(IDS_RECO_P_TAG, wszWord); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create first recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt1); + + // create second recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt2); + + // pointer the first reco context at our notify object + if (SUCCEEDED(hr)) + hr = cpRecoCtxt1->SetNotifyWin32Event(); + + // pointer the second reco context at our notify object + if (SUCCEEDED(hr)) + hr = cpRecoCtxt2->SetNotifyWin32Event(); + + // tell the first reco context that we're interested in getting + // recognition and eos notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt1->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // same as second + if (SUCCEEDED(hr)) + hr = cpRecoCtxt2->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_MULT_RECO, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load the first grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt1->CreateGrammar(GRAM_ID, &cpGrammar1); + + if (SUCCEEDED(hr)) + hr = cpGrammar1->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_P1_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // load the second grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt2->CreateGrammar(GRAM_ID, &cpGrammar2); + + if (SUCCEEDED(hr)) + hr = cpGrammar2->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_P2_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // activate the grammars + if (SUCCEEDED(hr)) + hr = cpGrammar1->SetRuleState(NULL, NULL, SPRS_ACTIVE); + if (SUCCEEDED(hr)) + hr = cpGrammar2->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + // wait for EOS + if (SUCCEEDED(hr)) + hr = cpRecoCtxt1->WaitForNotifyEvent(WAIT_TIME); + + if (SUCCEEDED(hr)) + hr = cpRecoCtxt2->WaitForNotifyEvent(WAIT_TIME); + + bSuccess1 = bSuccess2 = false; + + // process all recognized phrases for first context + bool bDone = false; + while (SUCCEEDED(hr) && !bDone) + { + CComPtr pResult; + CSpEvent event; + while(event.GetFrom(cpRecoCtxt1) == S_OK) + { + if (event.eEventId == SPEI_END_SR_STREAM) + bDone = true; + else if (pResult = event.RecoResult()) + { + CSpDynamicString dstrText; + if (SUCCEEDED(pResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, NULL))) + { + if (wcsstr(wszWord, dstrText)) + bSuccess1 = true; + } + pResult.Release(); + } + } + cpRecoCtxt1->WaitForNotifyEvent(WAIT_TIME); + } + + if (SUCCEEDED(hr) && !bSuccess1) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + // process all recognized phrases for second context + bDone = false; + while (SUCCEEDED(hr) && !bDone) + { + CComPtr pResult; + CSpEvent event; + while(event.GetFrom(cpRecoCtxt2) == S_OK) + { + if (event.eEventId == SPEI_END_SR_STREAM) + bDone = true; + else if (pResult = event.RecoResult()) + { + CSpDynamicString dstrText; + if (SUCCEEDED(pResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dstrText, NULL))) + { + bSuccess2 = true; + } + pResult.Release(); + } + } + cpRecoCtxt1->WaitForNotifyEvent(WAIT_TIME); + } + + if (SUCCEEDED(hr) && !bSuccess2) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + + return tpr; +} + + +int HlpGrammarTest(UINT idWord, UINT idWavFile, UINT idGrammar, WCHAR* pszRuleName = NULL) +{ + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + SPSTATEHANDLE hState; + + WCHAR wszWord[MAX_PATH] = L""; + GetWStrFromRes(idWord, wszWord); + RESULTVECTOR vector_RecoResult; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(idWavFile, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load the first grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if (idGrammar) + { + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(idGrammar), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + } + else + { + //Dynamic Grammar + if (SUCCEEDED(hr)) + hr = cpGrammar->ResetGrammar(::GetDefaultEnginePrimaryLangId()); + + if (SUCCEEDED( hr )) + { + if (pszRuleName) + { + hr = cpGrammar->GetRule(pszRuleName, 0, SPRAF_Dynamic, TRUE, &hState); + } + else + { + hr = cpGrammar->GetRule(L"color", 0, SPRAF_Dynamic, TRUE, &hState); + } + + } + + if (SUCCEEDED( hr )) + hr = cpGrammar->AddWordTransition(hState, NULL, wszWord, L" ", SPWT_LEXICAL, 1.0, NULL); + } + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(pszRuleName, NULL, SPRS_ACTIVE); + + CSpDynamicString dstrText; + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (SUCCEEDED(hr)) + { + if (HlpCheckResult(vector_RecoResult, wszWord) != S_OK) + { + // USES_CONVERSION; + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + return tpr; +} + + +TESTPROCAPI t_GrammarListTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = HlpGrammarTest(IDS_RECO_L_TAG, IDS_WAV_L_TAG, IDR_L_GRAMMAR); + + return tpr; +} + + +TESTPROCAPI t_GrammarExpRuleTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + // words in grammar expected to be recognized + WCHAR wszFirstRule[MAX_PATH] = L""; + WCHAR wszSecondRule[MAX_PATH] = L""; + + GetWStrFromRes(IDS_RECO_EXPRULE_FIRSTRULE, wszFirstRule); + GetWStrFromRes(IDS_RECO_EXPRULE_SECONDRULE, wszSecondRule); + + // speech + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + RESULTVECTOR vector_RecoResult; + BOOL bFirstRuleReco = FALSE; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_EXPRULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load the grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_EXPRULE_GRAMMAR), + L"SRGRAMMAR",::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // activate the grammar + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(wszFirstRule, NULL, SPRS_ACTIVE); + + // deactivate the second rule + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(wszSecondRule, NULL, SPRS_INACTIVE); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if( FAILED(hr) || !vector_RecoResult.size() ) + { + Comment(L"failed to get recognition"); + return TPR_FAIL; + } + else + { + SPPHRASE* pPhrase = NULL; + ULONG ulCount = 0; + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if (!wcscmp(pPhrase->Rule.pszName, wszFirstRule)) + bFirstRuleReco = TRUE; + } + + ::CoTaskMemFree(pPhrase); + } + + + if (SUCCEEDED(hr)) + { + // The first rule should be used. + // The second rule shouldn't be used. + if (!bFirstRuleReco) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + // deactivate the rule + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(wszFirstRule, NULL, SPRS_INACTIVE); + + // release the input wave file + if (SUCCEEDED(hr)) + cpStream.Release(); + + // use same wave file and make sure that words from first rule are not recognized + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_EXPRULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // activate the other rule + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(wszSecondRule, NULL, SPRS_ACTIVE); + + // wait for EOS + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->WaitForNotifyEvent(TESTEVENT_TIMEOUT); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if( FAILED(hr) || !vector_RecoResult.size() ) + { + Comment(L"failed to get recognition"); + return TPR_FAIL; + } + else + { + SPPHRASE* pPhrase = NULL; + ULONG ulCount = 0; + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if (!wcscmp(pPhrase->Rule.pszName, wszSecondRule)) + bFirstRuleReco = FALSE; + } + + ::CoTaskMemFree(pPhrase); + } + + if (SUCCEEDED(hr)) + { + // The first rule shouldn't be used. + // The second rule should be used. + if (bFirstRuleReco) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + return tpr; +} + + +TESTPROCAPI t_GrammarPTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + int tpr = HlpGrammarTest(IDS_RECO_P_TAG, IDS_WAV_P_TAG, IDR_P1_GRAMMAR); + + return tpr; +} + + +TESTPROCAPI t_GrammarOTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + USES_CONVERSION; + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoCtxt; + RESULTVECTOR vector_RecoResult; + + WCHAR wszFirstOptionalWord[MAX_PATH] = L""; + WCHAR wszWord[MAX_PATH] = L""; + WCHAR wszSecondOptionalWord[MAX_PATH] = L""; + + GetWStrFromRes(IDS_RECO_O_TAG_1, wszFirstOptionalWord); + GetWStrFromRes(IDS_RECO_O_TAG_2, wszWord); + GetWStrFromRes(IDS_RECO_O_TAG_3, wszSecondOptionalWord); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create first recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoCtxt); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_O_TAG_1, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // load the grammar + if (SUCCEEDED(hr)) + hr = cpRecoCtxt->CreateGrammar(GRAM_ID, &cpGrammar); + + if (SUCCEEDED(hr)) + hr = cpGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_O_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // perform SR; get results and compare to our word + if (SUCCEEDED(hr)) + hr = cpGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (SUCCEEDED(hr)) + if (HlpCheckResult(vector_RecoResult, wszFirstOptionalWord) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + // part 2: check that second optional word is recognized + if (SUCCEEDED(hr)) + cpStream.Release(); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_O_TAG_2, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // perform SR; get results and compare to our word + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (SUCCEEDED(hr)) + if (HlpCheckResult(vector_RecoResult, wszSecondOptionalWord) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + // part 3: check that only main word is recognized + if (SUCCEEDED(hr)) + cpStream.Release(); + + // open wav file + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_O_TAG_3, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + // perform SR; get results and compare to our word + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoCtxt, vector_RecoResult); + + if (SUCCEEDED(hr)) + if (HlpCheckResult(vector_RecoResult, wszWord) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + + // end test + if (FAILED(hr)) + { + Comment(IDS_UNEXPECTED_ERR); + tpr = TPR_FAIL; + } + + return tpr; +} + + +TESTPROCAPI t_GrammarRuleTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + int tpr = HlpGrammarTest(IDS_RECO_RULE_TAG, IDS_WAV_RULE_TAG, IDR_RULE_GRAMMAR); + + return tpr; +} + + + + + + +TESTPROCAPI t_Alternates_Dictation(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"Alternates", L"Dictation")) + { + return TPR_UNSUPPORTED; + } + + + HRESULT hr; + int tpr = TPR_SUPPORTED; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + + CComPtr cpRecoResult; + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpPhraseAlt; + RESULTVECTOR vector_RecoResult; + + hr = cpRecognizer.CoCreateInstance( CLSID_SpInprocRecognizer ); + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + hr = OpenWavFile(IDS_WAV_EXPRULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_UNSUPPORTED; + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->LoadDictation(NULL, SPLO_STATIC); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoContext->SetInterest(SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoGrammar->SetDictationState(SPRS_ACTIVE); + } + + + + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if( FAILED(hr) || !vector_RecoResult.size() ) + { + Comment(L"failed to get recognition"); + return TPR_UNSUPPORTED; + } + else + { + SPPHRASE* pPhrase = NULL; + ULONG ulCount = 0; + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + hr = vector_RecoResult[0]->GetAlternates(pPhrase->Rule.ulFirstElement, + pPhrase->Rule.ulCountOfElements, + 1, + &cpPhraseAlt, + &ulCount); + if (hr== S_OK && cpPhraseAlt && ulCount ==1) + { + CSpDynamicString dsString; + hr = cpPhraseAlt->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dsString, NULL); + if (SUCCEEDED(hr)) + { + hr = cpPhraseAlt->Commit(); + } + } + ::CoTaskMemFree(pPhrase); + } + else + { + tpr = TPR_UNSUPPORTED; + } + } + + if (FAILED(hr)) + { + tpr = TPR_UNSUPPORTED; + } + + + return tpr; +} + +TESTPROCAPI t_Alternates_Cfg(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"Alternates", L"CC")) + { + return TPR_UNSUPPORTED; + } + + HRESULT hr; + int tpr = TPR_SUPPORTED; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + + CComPtr cpRecoResult; + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpPhraseAlt; + + WCHAR wszAlternates[3][MAX_PATH] = {L""}; + WCHAR wszWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + RESULTVECTOR vector_RecoResult; + + SPSTATEHANDLE hInit; + SPSTATEHANDLE hAfterAlternates; + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_ALTERNATESCFG_BESTWORD, wszAlternates[0]); + GetWStrFromRes(IDS_ALTERNATESCFG_ALTERNATE1, wszAlternates[1]); + GetWStrFromRes(IDS_ALTERNATESCFG_ALTERNATE2, wszAlternates[2]); + GetWStrFromRes(IDS_ALTERNATESCFG_WORDS, wszWords); + GetWStrFromRes(IDS_ALTERNATESCFG_RULE, wszRule); + + hr = cpRecognizer.CoCreateInstance( CLSID_SpInprocRecognizer ); + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + hr = OpenWavFile(IDS_WAV_ALTERMATESCFG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetMaxAlternates(1); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hInit); + if (FAILED(hr)) + { + Comment(L"create the first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hInit, &hAfterAlternates); + } + + for (ULONG ul=0; ulAddWordTransition(hInit, hAfterAlternates, wszAlternates[ul] , L" ", SPWT_LEXICAL, 1.0, NULL); + } + } + + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hAfterAlternates, NULL, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoContext->SetInterest(SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if( FAILED(hr) || !vector_RecoResult.size() ) + { + Comment(L"failed to get recognition"); + return TPR_UNSUPPORTED; + } + else + { + SPPHRASE* pPhrase = NULL; + ULONG ulCount = 0; + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + hr = vector_RecoResult[0]->GetAlternates(pPhrase->Rule.ulFirstElement, + pPhrase->Rule.ulCountOfElements, + 1, + &cpPhraseAlt, + &ulCount); + if (hr== S_OK && cpPhraseAlt && ulCount ==1) + { + CSpDynamicString dsString; + hr = cpPhraseAlt->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, + &dsString, NULL); + if (SUCCEEDED(hr)) + hr = cpPhraseAlt->Commit(); + } + else + { + tpr = TPR_UNSUPPORTED; + } + ::CoTaskMemFree(pPhrase); + } + else + { + tpr = TPR_UNSUPPORTED; + } + } + + if (FAILED(hr)) + { + tpr = TPR_UNSUPPORTED; + Comment(L"Alternate failed."); + } + + + + + return tpr; +} + +TESTPROCAPI t_PickGrammar(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpFirstGrammar; + CComPtr cpSecondGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + + WCHAR wszWord[MAX_PATH] = L""; + GetWStrFromRes(IDS_RECO_RULE_TAG, wszWord); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoContext->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_RULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + + + // We pause so that we can load the grammar atomically. + if (SUCCEEDED(hr)) + hr = cpRecoContext->Pause(NULL); + + // load the first grammar + if (SUCCEEDED(hr)) + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpFirstGrammar); + + if (SUCCEEDED(hr)) + hr = cpFirstGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_L_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpFirstGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + // load the second grammar + if (SUCCEEDED(hr)) + hr = cpRecoContext->CreateGrammar(GRAM_ID+1, &cpSecondGrammar); + + if (SUCCEEDED(hr)) + hr = cpSecondGrammar->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_RULE_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpSecondGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + // We resume after we finish. + if (SUCCEEDED(hr)) + hr = cpRecoContext->Resume(NULL); + + + + + while ((hr = cpRecoContext->WaitForNotifyEvent(TESTEVENT_TIMEOUT)) == S_OK) + { + CSpEvent event; + while ((hr = event.GetFrom(cpRecoContext)) == S_OK) + { + if (event.eEventId == SPEI_RECOGNITION) + { + cpRecoResult = event.RecoResult(); + } + } + } + + if( !cpRecoResult ) + { + hr = E_FAIL; + } + else + { + CSpDynamicString dsString; + hr = cpRecoResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, + &dsString, NULL); + if (SUCCEEDED(hr) && wcsstr(dsString, wszWord)) + { + } + else + { + tpr = TPR_UNSUPPORTED; + Comment(L"The first word is not right."); + } + } + cpRecoResult.Release(); + + + return tpr; + +} + + + +TESTPROCAPI t_UseLastActivatedGrammar(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpGrammar[NUMOFRECOCONTEXTS]; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext[NUMOFRECOCONTEXTS]; + CComPtr cpRecoResult; + BOOL fSuccess[NUMOFRECOCONTEXTS]; + + WCHAR wszWord[MAX_PATH] = L""; + GetWStrFromRes(IDS_RECO_RULE_TAG, wszWord); + ULONG ul; + + + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // open wav file, it is correspondent to IDR_RULE_GRAMMAR. + if (SUCCEEDED(hr)) + hr = OpenWavFile(IDS_WAV_RULE_TAG, &cpStream, NULL); + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + hr = cpRecognizer->SetInput(cpStream, TRUE); + + + + + if (SUCCEEDED(hr)) + { + for (ul=0; ul < NUMOFRECOCONTEXTS; ul++) + { + fSuccess[ul] = TRUE; + // create recognition context + if (SUCCEEDED(hr)) + hr = cpRecognizer->CreateRecoContext(&cpRecoContext[ul]); + } + } + + // We pause so that we can load the grammar atomically. + if (SUCCEEDED(hr)) + hr = cpRecoContext[0]->Pause(NULL); + + if (SUCCEEDED(hr)) + { + for (ul=0; ul < NUMOFRECOCONTEXTS; ul++) + { + + // get event notification + if (SUCCEEDED(hr)) + hr = cpRecoContext[ul]->SetNotifyWin32Event(); + + // specify events we want to see + if (SUCCEEDED(hr)) + hr = cpRecoContext[ul]->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + + // load the first grammar + if (SUCCEEDED(hr)) + hr = cpRecoContext[ul]->CreateGrammar(GRAM_ID+ul, &cpGrammar[ul]); + + if (SUCCEEDED(hr)) + hr = cpGrammar[ul]->LoadCmdFromResource(g_pShellInfo->hLib, + (const WCHAR*)MAKEINTRESOURCE(IDR_RULE_GRAMMAR), + L"SRGRAMMAR", ::GetDefaultEnginePrimaryLangId(), SPLO_STATIC); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpGrammar[ul]->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + } + } + + // We resume after we finish. + if (SUCCEEDED(hr)) + hr = cpRecoContext[0]->Resume(NULL); + + + + if (SUCCEEDED(hr)) + { + for (ul = 0; ul < NUMOFRECOCONTEXTS; ul++) + { + + while ((hr = cpRecoContext[ul]->WaitForNotifyEvent(TESTEVENT_TIMEOUT)) == S_OK) + { + CSpEvent event; + while ((hr = event.GetFrom(cpRecoContext[ul])) == S_OK) + { + if (event.eEventId == SPEI_RECOGNITION) + { + if (ul != NUMOFRECOCONTEXTS - 1) + fSuccess[ul] = FALSE; + else + cpRecoResult = event.RecoResult(); + } + } + } + } + } + + if( !cpRecoResult ) + { + tpr = TPR_UNSUPPORTED; + } + else + { + CSpDynamicString dsString; + hr = cpRecoResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, FALSE, + &dsString, NULL); + if (SUCCEEDED(hr) && wcsstr(dsString, wszWord)) + { + } + else + { + tpr = TPR_UNSUPPORTED; + Comment(L"The first word is not right."); + } + } + cpRecoResult.Release(); + + for (ul=0; ul cpRecognizer; + + WCHAR wszPropertyName[] = L"Non support property string"; //No engine is going to support this property. + WCHAR wszPropertyValue[] = L"Non support property value"; + + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + hr = cpRecognizer->SetPropertyString(wszPropertyName, wszPropertyValue); + if (hr == S_FALSE) + { + CSpDynamicString dsString; + hr = cpRecognizer->GetPropertyString(wszPropertyName, &dsString); + if (hr == S_FALSE) + { + tpr = TPR_SUPPORTED; + } + else + { + tpr = TPR_UNSUPPORTED; + } + } + else + { + tpr = TPR_UNSUPPORTED; + } + + return tpr; +} + +TESTPROCAPI t_RequiredPropertyNum(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpRecognizer; + + BOOL fSuccess = TRUE; + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + for (ULONG ul =0; ul SetPropertyNum(PropertyNumTable[ul].pPropertyNumNames, lValueSet); + if (hr == S_OK) + { + LONG lReturnNum = 0; + WCHAR pwszResult[MAX_PATH] = L""; + hr = cpRecognizer->GetPropertyNum(PropertyNumTable[ul].pPropertyNumNames, &lReturnNum); + if (lReturnNum == lValueSet) + { + swprintf(pwszResult, L"SetPropertyNum for %s is successful", PropertyNumTable[ul].pPropertyNumNames); + Comment(pwszResult); + } + else + { + swprintf(pwszResult, L"SetPropertyNum for %s fails", PropertyNumTable[ul].pPropertyNumNames); + Comment(pwszResult); + fSuccess = FALSE; + } + } + } + + if (!fSuccess) + { + tpr = TPR_UNSUPPORTED; + } + + return tpr; +} + + +HRESULT HlpClearandAddTextBuffer(CComPtr& cpRecognizer, CComPtr& cpStream, CComPtr& cpRecoGrammar, SPSTATEHANDLE hInit, WCHAR* wszTextBuffer, ULONG ulSize, SPTEXTSELECTIONINFO* pts = NULL) +{ + HRESULT hr = S_OK; + + LARGE_INTEGER li; + li.QuadPart = 0; + hr = cpStream->Seek(li, STREAM_SEEK_SET, NULL); + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->ClearRule(hInit); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddRuleTransition(hInit, NULL, SPRULETRANS_TEXTBUFFER, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetWordSequenceData(wszTextBuffer, ulSize, pts); + } + + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + return hr; +} + +TESTPROCAPI t_CFGTextBuffer(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"WordSequences")) + { + return TPR_UNSUPPORTED; + } + + HRESULT hr; + int tpr = TPR_SUPPORTED; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + + CComPtr cpRecoResult; + CComPtr cpRecoGrammar; + CComPtr cpStream; + WCHAR wszExpectedResult[MAX_PATH] = L""; + WCHAR wszFirstPart[MAX_PATH] = L""; + WCHAR wszSecondPart[MAX_PATH] = L""; + WCHAR wszNotInterestedPart[MAX_PATH] = L""; + WCHAR wszLongWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + RESULTVECTOR vector_RecoResult; + + SPSTATEHANDLE hInit; + SPSTATEHANDLE hBeforeTextBuffer; + + SPTEXTSELECTIONINFO ts; + ZeroMemory(&ts, sizeof(ts)); + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_CFGTEXTBUFFER_WORDS, wszFirstPart); + GetWStrFromRes(IDS_CFGTEXTBUFFER_BUFFERWORD, wszSecondPart); + GetWStrFromRes(IDS_CFGTEXTBUFFER_RULE, wszRule); + GetWStrFromRes(IDS_CFGTEXTBUFFER_NOTINTERESTEDWORDS, wszNotInterestedPart); + + wcscpy(wszExpectedResult, wszFirstPart); + wcscat(wszExpectedResult, wszSecondPart); + + + hr = cpRecognizer.CoCreateInstance( CLSID_SpInprocRecognizer ); + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_CFGTEXTBUFFER, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + + //Scenario 1, whole buffer + Comment(L"Start scenario 1, whole buffer"); + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hInit); + if (FAILED(hr)) + { + Comment(L"create dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hInit, &hBeforeTextBuffer); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hInit, hBeforeTextBuffer, wszFirstPart , L" ", SPWT_LEXICAL, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddRuleTransition(hBeforeTextBuffer, NULL, SPRULETRANS_TEXTBUFFER, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetWordSequenceData(wszSecondPart, wcslen(wszSecondPart) + 2, NULL); + } + + if (SUCCEEDED(hr)) + hr = cpRecoContext->SetNotifyWin32Event(); + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK ) + { + if (HlpCheckResult(vector_RecoResult, wszExpectedResult) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_UNSUPPORTED; + } + else + { + Comment(L"pass"); + } + } + else + { + tpr = TPR_UNSUPPORTED; + Comment(L"No recognition"); + } + Comment(L"End scenario 1"); + + + + //Scenario 2, no recognition across different groups + Comment(L"Start scenario 2, no recognition across different groups"); + wcscpy(wszFirstPart + wcslen(wszFirstPart) + 1, wszSecondPart); + + hr = HlpClearandAddTextBuffer(cpRecognizer, cpStream, cpRecoGrammar, hInit, wszFirstPart, wcslen(wszFirstPart) + wcslen(wszSecondPart) + 3); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK && HlpCheckResult(vector_RecoResult, wszExpectedResult) == S_OK) + { + Comment(L"failed"); + tpr = TPR_UNSUPPORTED; + } + else + { + //no receiving any result is compliant + Comment(L"pass"); + hr = S_OK; + } + Comment(L"End start scenario 2"); + + + + //Scenario 3, the expected result is a subset of the second group in the text buffer + Comment(L"Start scenario 3, the expected result is a subset of the second group in the text buffer"); + wcscpy(wszLongWords, wszNotInterestedPart); + wcscat(wszLongWords, wszFirstPart); + wcscat(wszLongWords, wszSecondPart); + + wcscpy(wszNotInterestedPart + wcslen(wszNotInterestedPart) + 1, wszLongWords); + + hr = HlpClearandAddTextBuffer(cpRecognizer, cpStream, cpRecoGrammar, hInit, wszNotInterestedPart, wcslen(wszNotInterestedPart) + wcslen(wszLongWords) + 3); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszExpectedResult) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_UNSUPPORTED; + } + else + { + Comment(L"pass"); + } + } + else + { + tpr = TPR_UNSUPPORTED; + Comment(L"No recognition"); + } + Comment(L"End scenario 3"); + + + + //Scenario 4, no recognition for noncontinous words + Comment(L"Start scenario 4, no recognition for noncontinous words"); + wcscpy(wszLongWords, wszFirstPart); + wcscat(wszLongWords, wszNotInterestedPart); + wcscat(wszLongWords, wszSecondPart); + + hr = HlpClearandAddTextBuffer(cpRecognizer, cpStream, cpRecoGrammar, hInit, wszLongWords, wcslen(wszLongWords) + 2); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK && HlpCheckResult(vector_RecoResult, wszExpectedResult) == S_OK) + { + Comment(L"Noncontinous words shouldn't be recognized"); + tpr = TPR_UNSUPPORTED; + } + else + { + //no receiving any result is compliant + Comment(L"pass"); + hr = S_OK; + } + Comment(L"End scenario 4"); + + + //Scenario 5, only words in textselection are recognizable + Comment(L"Start scenario 5, only words in textselection are recognizable"); + wcscpy(wszLongWords, wszFirstPart); + wcscat(wszLongWords, wszSecondPart); + + + //only the second part is active + ts.ulStartActiveOffset = wcslen(wszFirstPart); + ts.cchActiveChars = wcslen(wszSecondPart); + + hr = HlpClearandAddTextBuffer(cpRecognizer, cpStream, cpRecoGrammar, hInit, wszLongWords, wcslen(wszLongWords) + 2, &ts); + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK && HlpCheckResult(vector_RecoResult, wszExpectedResult) == S_OK) + { + Comment(L"Words not in the active textselection shouldn't be recognized"); + tpr = TPR_UNSUPPORTED; + } + else + { + //no receiving any result is compliant + Comment(L"pass"); + hr = S_OK; + } + Comment(L"End scenario 5"); + + + if (FAILED(hr)) + { + tpr = TPR_UNSUPPORTED; + } + + + + + + + + return tpr; +} + +void RunAndReport(TESTPROC pTest, WCHAR* pszLog, int* ptpr) +{ + + WCHAR pwszThreadId[MAX_PATH] = L""; + swprintf(pwszThreadId, L"Thread Id: %x ", ::GetCurrentThreadId()); + CSpDynamicString dsResult; + dsResult.Clear(); + dsResult.Append(pwszThreadId); + dsResult.Append(pszLog); + if (*ptpr != TPR_PASS && *ptpr != TPR_SKIP) + { + dsResult.Append(L" skipped as failure in the previous test"); + } + else + { + *ptpr = pTest(TPM_EXECUTE, NULL, NULL); + dsResult.Append((*ptpr == TPR_PASS) ? L" pass" : (*ptpr == TPR_SKIP) ? L" skip" : L" fail"); + } + Comment(dsResult); + +} + + + +TESTPROCAPI t_MultiInstances(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + int tpr = TPR_PASS; + HRESULT hr = S_OK; + CSpDynamicString dsResult; + + if (uMsg == TPM_QUERY_THREAD_COUNT) + { + ((TPS_QUERY_THREAD_COUNT*)tpParam)->dwThreadCount = 3; + return TPR_HANDLED; + } + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + else + { + srand(reinterpret_cast(tpParam)->dwRandomSeed); + } + + + UINT uiCaseWeight[] = { + 1, // t_CheckEvent_SoundStart + 1, // t_CheckEvent_SoundEnd + 1, // t_CheckEvent_PhraseStart + 1, // t_CheckEvent_Recognition + 1, // t_UserLexSynchBeforeCfgLoad + 1, // t_MultipleRecoContext + 1, // t_GrammarPTag + 1, // t_InvalidateToplevelRule + 0 // t_GrammarOTag + }; + + + + + // scale Weight array + for(UINT uiCount=0; uiCount<(sizeof(uiCaseWeight)/sizeof(uiCaseWeight[0]) - 1); uiCount++) + { + uiCaseWeight[uiCount+1] += uiCaseWeight[uiCount]; + } + + UINT uiRand; + for(uiCount=0; uiCount= uiCaseWeight[0] && uiRand < uiCaseWeight[1]) + { + RunAndReport(t_CheckEvent_SoundEnd, L"SoundEnd Test", &tpr); + } + + if (uiRand >= uiCaseWeight[1] && uiRand < uiCaseWeight[2]) + { + RunAndReport(t_CheckEvent_PhraseStart, L"PhraseStart Test", &tpr); + } + + if (uiRand >= uiCaseWeight[2] && uiRand < uiCaseWeight[3]) + { + RunAndReport(t_CheckEvent_Recognition, L"Recognition Test", &tpr); + } + + if (uiRand >= uiCaseWeight[3] && uiRand < uiCaseWeight[4]) + { +// RunAndReport(t_UserLexSynchBeforeCfgLoad, L"t_UserLexSynchBeforeCfgLoad Test", &tpr); + } + + if (uiRand >= uiCaseWeight[4] && uiRand < uiCaseWeight[5]) + { + RunAndReport(t_MultipleRecoContext, L"MultipleRecoContext Test", &tpr); + } + + if (uiRand >= uiCaseWeight[5] && uiRand < uiCaseWeight[6]) + { + RunAndReport(t_GrammarPTag, L"GrammarPTag Test", &tpr); + } + + if (uiRand >= uiCaseWeight[6] && uiRand < uiCaseWeight[7]) + { +// RunAndReport(t_InvalidateToplevelRule, L"InvalidateToplevelRule Test", &tpr); + } + + if (uiRand >= uiCaseWeight[7] && uiRand < uiCaseWeight[8]) + { + RunAndReport(t_GrammarOTag, L"GrammarOTag Test", &tpr); + } + + } + + return tpr; +} + + +TESTPROCAPI t_AutoPause(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + + WCHAR wszFirstWord[MAX_PATH] = L""; + WCHAR wszSecondWord[MAX_PATH] = L""; + WCHAR wszFirstRule[MAX_PATH] = L""; + WCHAR wszSecondRule[MAX_PATH] = L""; + + SPSTATEHANDLE hFirstInit; + SPSTATEHANDLE hSecondInit; + + BOOL fFirstReco = FALSE; + BOOL fSecondReco = FALSE; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_AUTOPAUSE_DYNAMICWORD1, wszFirstWord); + GetWStrFromRes(IDS_AUTOPAUSE_DYNAMICWORD2, wszSecondWord); + GetWStrFromRes(IDS_AUTOPAUSE_DYNAMICRULE1, wszFirstRule); + GetWStrFromRes(IDS_AUTOPAUSE_DYNAMICRULE2, wszSecondRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_AUTOPAUSE, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //first rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszFirstRule, 0, SPRAF_TopLevel, TRUE, &hFirstInit); + if (FAILED(hr)) + { + Comment(L"create the first dynamic rule failed"); + } + } + + + //second rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszSecondRule, 0, SPRAF_TopLevel, TRUE, &hSecondInit); + if (FAILED(hr)) + { + Comment(L"create the second dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, wszFirstWord , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition on first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, wszSecondWord , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L"AddWordTransition on the second dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(wszFirstRule, NULL, SPRS_ACTIVE_WITH_AUTO_PAUSE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + while((!fEndofStream)&&(hr = cpRecoContext->WaitForNotifyEvent(TESTEVENT_TIMEOUT)) == S_OK) + { + CSpEvent event; + while((hr = event.GetFrom(cpRecoContext)) == S_OK) + { + switch (event.eEventId) + { + case SPEI_RECOGNITION: + { + cpRecoResult = event.RecoResult(); + //We get the auto pause flag and call resume so that engine can continue to process the audio + + CComPtr cpRecoResult = event.RecoResult(); + if (cpRecoResult) + { + CSpDynamicString dsText; + cpRecoResult->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dsText, NULL); + if (!wcscmp(dsText, wszFirstWord)) + { + fFirstReco = TRUE; + } + else if (!wcscmp(dsText, wszSecondWord)) + { + fSecondReco = TRUE; + break; + } + } + if (event.IsPaused()) + { + hr = cpRecoGrammar->SetRuleState(wszFirstRule, NULL, SPRS_INACTIVE); + if (SUCCEEDED(hr)) + { + //activate the second rule + hr = cpRecoGrammar->SetRuleState( wszSecondRule, NULL, SPRS_ACTIVE); + if (SUCCEEDED(hr)) + hr = cpRecoContext->Resume(NULL); + } + } + break; + } + case SPEI_END_SR_STREAM: + fEndofStream = TRUE; + } + } + } + + if (!(fFirstReco && fSecondReco)) + { + tpr = TPR_FAIL; + } + + return tpr; + +} + + +TESTPROCAPI t_InvalidateToplevelRule(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + + SPSTATEHANDLE hToplevelInit; + + BOOL fFirstReco = FALSE; + BOOL fSecondReco = FALSE; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_INVALIDATETOPLEVEL_DYNAMICWORDS, wszWords); + GetWStrFromRes(IDS_INVALIDATETOPLEVEL_DYNAMICRULE, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_INVALIDATETOPLEVEL_OLD, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition on first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + + + /************************************************ + //It is the first rule and using the first wave file before we invalidate the rule by reloading the same rule with different words. + ************************************************/ + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszWords) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_INACTIVE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->ClearRule(hToplevelInit); + } + + if (SUCCEEDED(hr)) + { + GetWStrFromRes(IDS_INVALIDATETOPLEVEL_DYNAMICNEWWORDS, wszWords); + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + if (SUCCEEDED(hr)) + { + LARGE_INTEGER li; + li.QuadPart = 0; + hr = cpStream->Seek(li, STREAM_SEEK_SET, NULL); + } + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + + + /************************************************ + The wave file and the grammar are not matching. We shouldn't get recognition. + ************************************************/ + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + for (ULONG ul = 0; ul < vector_RecoResult.size(); ul++) + { + CSpDynamicString dsText; + hr = vector_RecoResult[ul]->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &dsText, NULL); + if (SUCCEEDED(hr)) + { + dsText .Append(L" shouldn't be received"); + Comment(dsText); + } + } + Comment(IDS_ERR_INVALIDATETOPLEVEL); + return TPR_FAIL; + } + + + hr = S_OK; + + /************************************************ + Change to a matching wave file for the new grammar and we should receive the recognition event + ************************************************/ + cpStream.Release(); + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_INACTIVE); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_INVALIDATETOPLEVEL_NEW, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszWords) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + + return tpr; + +} + + + +TESTPROCAPI t_InvalidateNonToplevelRule(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszRule1[MAX_PATH] = L""; + WCHAR wszRule2[MAX_PATH] = L""; + WCHAR wszTopRule[MAX_PATH] = L""; + WCHAR wszWord1[MAX_PATH] = L""; + WCHAR wszWord2[MAX_PATH] = L""; + WCHAR wszTopWords[MAX_PATH] = L""; + WCHAR wszWords[MAX_PATH] = L""; + + SPSTATEHANDLE hFirstInit; + SPSTATEHANDLE hSecondInit; + SPSTATEHANDLE hToplevelInit; + SPSTATEHANDLE hToplevelAfterRule1; + SPSTATEHANDLE hToplevelBeforeRule2; + + BOOL fFirstReco = FALSE; + BOOL fSecondReco = FALSE; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_RULE1, wszRule1); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_RULE2, wszRule2); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_TOPLEVELRULE, wszTopRule); + + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_OLDWORD1, wszWord1); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_OLDWORD2, wszWord2); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_TOPLEVELWORDS, wszTopWords); + + wcscpy(wszWords, wszTopWords); + wcscat(wszWords, wszWord2); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_INVALIDATENONTOPLEVEL_OLD, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule1, 0, 0, TRUE, &hFirstInit); + if (FAILED(hr)) + { + Comment(L"create the first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule2, 0, 0, TRUE, &hSecondInit); + if (FAILED(hr)) + { + Comment(L"create the second dynamic rule failed"); + } + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszTopRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //create two new rule states + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hToplevelInit, &hToplevelAfterRule1); + if (FAILED(hr)) + { + Comment(L"add new rule state failed"); + } + else + { + hr = cpRecoGrammar->CreateNewState(hToplevelInit, &hToplevelBeforeRule2); + if (FAILED(hr)) + { + Comment(L"add new rule failed"); + } + } + } + + //add rulereference for the first rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddRuleTransition(hToplevelInit, hToplevelAfterRule1, hFirstInit, 1.0, NULL); + } + + //add words between two rules in the toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelAfterRule1, hToplevelBeforeRule2, wszTopWords , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition on the toplevel dynamic rule failed"); + } + } + + //add rulereference for the second rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddRuleTransition(hToplevelBeforeRule2, NULL, hSecondInit, 1.0, NULL); + } + + + //Fill in the first rule. + + if (SUCCEEDED(hr)) + { + //we add the word only when the word is empty + if (!wcslen(CSpDynamicString(wszWord1).LTrim())) + { + //When the word is empty, we need to add epsilon transition. + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, NULL , L" ", SPWT_LEXICAL, 1.0, NULL); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, wszWord1 , L" ", SPWT_LEXICAL, 1.0, NULL); + } + if (FAILED(hr)) + { + Comment(L" AddWordTransition on the toplevel dynamic rule failed"); + } + } + + + if (SUCCEEDED(hr)) + { + if (!wcslen(CSpDynamicString(wszWord2).LTrim())) + { + //When the word is empty, we need to add epsilon transition. + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, NULL , L" ", SPWT_LEXICAL, 1.0, NULL); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, wszWord2 , L" ", SPWT_LEXICAL, 1.0, NULL); + } + if (FAILED(hr)) + { + Comment(L" AddWordTransition failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + + + /************************************************ + //It is the first rule and using the first wave file before we invalidate the rule by reloading the same rule with different words. + ************************************************/ + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszWords) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + else + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } +/************************************ +************************************/ + + + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_INACTIVE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->ClearRule(hFirstInit); + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_NEWWORD1, wszWord1); + if (!wcslen(CSpDynamicString(wszWord1).LTrim())) + { + //When the word is empty, we need to add epsilon transition. + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, NULL , L" ", SPWT_LEXICAL, 1.0, NULL); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hFirstInit, NULL, wszWord1, L" ", SPWT_LEXICAL, 1.0, NULL); + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->ClearRule(hSecondInit); + if (SUCCEEDED(hr)) + { + GetWStrFromRes(IDS_INVALIDATENONTOPLEVEL_NEWWORD2, wszWord2); + if (!wcslen(CSpDynamicString(wszWord2).LTrim())) + { + //When the word is empty, we need to add epsilon transition. + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, NULL , L" ", SPWT_LEXICAL, 1.0, NULL); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hSecondInit, NULL, wszWord2 , L" ", SPWT_LEXICAL, 1.0, NULL); + } + } + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->Commit(NULL); + } + + wcscpy(wszWords, wszWord1); + wcscat(wszWords, wszTopWords); + wcscat(wszWords, CSpDynamicString(wszWord2).RTrim()); + + if (SUCCEEDED(hr)) + { + LARGE_INTEGER li; + li.QuadPart = 0; + hr = cpStream->Seek(li, STREAM_SEEK_SET, NULL); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + + + /************************************************ + The wave file and the grammar are not matching. We shouldn't get recognition. + ************************************************/ + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + Comment(IDS_ERR_INVALIDATETOPLEVEL); + return TPR_FAIL; + } + + + + + /************************************************ + Change to a matching wave file for the new grammar and we should receive the recognition event + ************************************************/ + cpStream.Release(); + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_INACTIVE); + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_INVALIDATENONTOPLEVEL_NEW, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + if (HlpCheckResult(vector_RecoResult, wszWords) != S_OK) + { + Comment(IDS_ERR_RESULT_WRONGWORD); + tpr = TPR_FAIL; + } + } + + + return tpr; + +} + + + + +TESTPROCAPI t_DictationTag(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"DictationInCFG")) + { + return TPR_UNSUPPORTED; + } + + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + + SPSTATEHANDLE hToplevelInit; + SPSTATEHANDLE hBeforeDictation; + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_DICTATIONTAG_WORDS, wszWords); + GetWStrFromRes(IDS_DICTATIONTAG_RULE, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_DICTATIONTAG, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_UNSUPPORTED; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hToplevelInit, &hBeforeDictation); + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, hBeforeDictation, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + + if (SUCCEEDED(hr)) + { +// hr = cpRecoGrammar->AddWordTransition(hBeforeDictation, NULL, L"*" , L" ", SPWT_LEXICAL, 1.0, NULL); + hr = cpRecoGrammar->AddRuleTransition(hBeforeDictation, NULL, SPRULETRANS_DICTATION, 1.0, NULL); + } + + if (FAILED(hr)) + { + Comment(L" AddWordTransition failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_UNSUPPORTED; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + } + else + { + Comment(L"no recognition"); + tpr = TPR_UNSUPPORTED; + } + + + + return tpr; + +} + + +TESTPROCAPI t_Wildcard(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + if (!IsMatchingAttribute(L"WildcardInCFG")) + { + return TPR_UNSUPPORTED; + } + + int tpr = TPR_SUPPORTED; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszWords[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + + SPSTATEHANDLE hToplevelInit; + SPSTATEHANDLE hBeforeWildcard; + + BOOL fWildCard = FALSE; + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_WILDCARD_WORDS, wszWords); + GetWStrFromRes(IDS_WILDCARD_RULE, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_WILDCARD, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->CreateNewState(hToplevelInit, &hBeforeWildcard); + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, hBeforeWildcard, wszWords , L" ", SPWT_LEXICAL, 1.0, NULL); + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->AddRuleTransition(hBeforeWildcard, NULL, SPRULETRANS_WILDCARD, 1.0, NULL); + + if (FAILED(hr)) + { + Comment(L"AddWordTransition failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_UNSUPPORTED; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + SPPHRASE *pPhrase = NULL; + if (vector_RecoResult.size()) + { + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + for (ULONG ul = 0; ul < pPhrase->Rule.ulCountOfElements; ul++) + { + if (!wcscmp(pPhrase->pElements[ul].pszDisplayText, WILDCARDTEXT) && + !wcscmp(pPhrase->pElements[ul].pszLexicalForm, WILDCARDTEXT)) + { + fWildCard = TRUE; + break; + } + } + + if (!fWildCard) + { + tpr = TPR_UNSUPPORTED; + } + } + else + { + Comment(L"no phrase"); + tpr = TPR_UNSUPPORTED; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_UNSUPPORTED; + } + + } + else + { + Comment(L"no recognition"); + tpr = TPR_UNSUPPORTED; + } + + + + return tpr; + +} + + + +TESTPROCAPI t_CustomPron(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + BOOL fEndofStream = FALSE; + RESULTVECTOR vector_RecoResult; + + WCHAR wszSymbol[MAX_PATH] = L""; + WCHAR wszDisplay[MAX_PATH] = L""; + WCHAR wszLexicon[MAX_PATH] = L""; + WCHAR wszWord[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + + SPSTATEHANDLE hToplevelInit; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_CUSTOMPROP_NEWWORD_PRON, wszSymbol); + GetWStrFromRes(IDS_CUSTOMPROP_NEWWORD_DISP, wszDisplay); + GetWStrFromRes(IDS_CUSTOMPROP_NEWWORD_LEX, wszLexicon); + + wcscat(wszWord, L"/"); + wcscat(wszWord, wszDisplay); + wcscat(wszWord, L"/"); + wcscat(wszWord, wszLexicon); + wcscat(wszWord, L"/"); + wcscat(wszWord, wszSymbol); + wcscat(wszWord, L";"); + + GetWStrFromRes(IDS_CUSTOMPROP_RULE, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_WAV_CUSTOMPROP, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition on first dynamic rule failed"); + } + } + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + SPPHRASE *pPhrase = NULL; + if (vector_RecoResult.size()) + { + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if (wcscmp(pPhrase->pElements[0].pszDisplayText, wszDisplay)) + { + Comment(L"The display form is incorrect"); + tpr = TPR_FAIL; + } + if ( wcscmp(pPhrase->pElements[0].pszLexicalForm, wszLexicon )) + { + Comment(L"The lexicon form is incorrect"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no phrase"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + + + + return tpr; + +} + + + +TESTPROCAPI t_CaseSensitiveGrammar(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + LANGID LangId; + + if ((LangId = GetDefaultEnginePrimaryLangId()) == 0x411 || LangId == 0x804) + { + return tpr; + } + + CComPtr cpRecoGrammar; + CComPtr cpStream; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpRecoResult; + RESULTVECTOR vector_RecoResult; + + WCHAR wszSymbol1[MAX_PATH] = L""; + WCHAR wszDisplay1[MAX_PATH] = L""; + WCHAR wszLexicon1[MAX_PATH] = L""; + WCHAR wszWord1[MAX_PATH] = L""; + + WCHAR wszSymbol2[MAX_PATH] = L""; + WCHAR wszDisplay2[MAX_PATH] = L""; + WCHAR wszLexicon2[MAX_PATH] = L""; + WCHAR wszWord2[MAX_PATH] = L""; + + WCHAR wszRule[MAX_PATH] = L""; + SPSTATEHANDLE hToplevelInit; + + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_PRON1, wszSymbol1); + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_DISP1, wszDisplay1); + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_LEX1, wszLexicon1); + + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_PRON2, wszSymbol2); + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_DISP2, wszDisplay2); + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_LEX2, wszLexicon2); + + wcscat(wszWord1, L"/"); + wcscat(wszWord1, wszDisplay1); + wcscat(wszWord1, L"/"); + wcscat(wszWord1, wszLexicon1); + wcscat(wszWord1, L"/"); + wcscat(wszWord1, wszSymbol1); + wcscat(wszWord1, L";"); + + wcscat(wszWord2, L"/"); + wcscat(wszWord2, wszDisplay2); + wcscat(wszWord2, L"/"); + wcscat(wszWord2, wszLexicon2); + wcscat(wszWord2, L"/"); + wcscat(wszWord2, wszSymbol2); + wcscat(wszWord2, L";"); + + GetWStrFromRes(IDS_CASESENSITIVEGRAMMAR_RULENAME, wszRule); + + // create engine + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + //This wave file is for word2 + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_CASESENSITIVEGRAMMAR_WAVE, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord1 , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L" AddWordTransition failed"); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord2 , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L"AddWordTransition failed"); + } + } + } + + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + SPPHRASE *pPhrase = NULL; + if (vector_RecoResult.size()) + { + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if (wcscmp(pPhrase->pElements[0].pszDisplayText, wszDisplay2)) + { + Comment(L"The display form is incorrect"); + tpr = TPR_FAIL; + } + if ( wcscmp(pPhrase->pElements[0].pszLexicalForm, wszLexicon2 )) + { + Comment(L"The lexicon form is incorrect"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no phrase"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + + + return tpr; +} + + + +TESTPROCAPI t_CaseSensitiveLexicon(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // Message check + if (uMsg != TPM_EXECUTE) + return TPR_NOT_HANDLED; + + + int tpr = TPR_PASS; + HRESULT hr = S_OK; + LANGID LangId; + + if ((LangId = GetDefaultEnginePrimaryLangId()) == 0x411 || LangId == 0x804) + { + return tpr; + } + + CComPtr cpLexicon; + CComPtr cpRecoGrammar; + CComPtr cpProfileToken; + CComPtr cpRecognizer; + CComPtr cpRecoContext; + CComPtr cpStream; + + WCHAR wszSymbol1[MAX_PATH] = L""; + WCHAR wszWord1[MAX_PATH] = L""; + WCHAR wszSymbol2[MAX_PATH] = L""; + WCHAR wszWord2[MAX_PATH] = L""; + WCHAR wszRule[MAX_PATH] = L""; + RESULTVECTOR vector_RecoResult; + SPSTATEHANDLE hToplevelInit; + + //Get the rule names and words information from the resource + GetWStrFromRes(IDS_CASESENSITIVELEXICON_SYMBOL1, wszSymbol1); + GetWStrFromRes(IDS_CASESENSITIVELEXICON_WORD1, wszWord1); + + GetWStrFromRes(IDS_CASESENSITIVELEXICON_SYMBOL2, wszSymbol2); + GetWStrFromRes(IDS_CASESENSITIVELEXICON_WORD2, wszWord2); + + + GetWStrFromRes(IDS_CASESENSITIVELEXICON_RULENAME, wszRule); + + + //Set up user lexicon + + // create a new token object + if (SUCCEEDED(hr)) + hr = SpCreateNewToken(SPCAT_RECOPROFILES, L"LexProfile", &cpProfileToken); + + // create a random user name + if (SUCCEEDED(hr)) + { + WCHAR wszName[MAX_PATH] = L""; + srand(GetCurrentThreadId() + GetTickCount()); + UINT uiRandom = rand(); + swprintf(wszName, L"TestName:%d", uiRandom); + + // set token to this new user + SpSetDescription(cpProfileToken, wszName); + } + + if (SUCCEEDED(hr)) + hr = cpLexicon.CoCreateInstance(CLSID_SpLexicon); + + if (SUCCEEDED(hr)) + hr = HlpAddCustomWord(cpLexicon, wszWord1, wszSymbol1); + + if (SUCCEEDED(hr)) + hr = HlpAddCustomWord(cpLexicon, wszWord2, wszSymbol2); + + + // create engine + if (SUCCEEDED(hr)) + { + hr = cpRecognizer.CoCreateInstance(CLSID_SpInprocRecognizer); + } + + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetRecoProfile(cpProfileToken); + } + // create recognition context + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->CreateRecoContext(&cpRecoContext); + } + + // get event notification + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetNotifyWin32Event(); + } + + // specify events we want to see + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->SetInterest( + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM), + SPFEI(SPEI_RECOGNITION) | SPFEI(SPEI_END_SR_STREAM)); + } + + //This wave file is for word2 + if (SUCCEEDED(hr)) + { + hr = OpenWavFile(IDS_CASESENSITIVELEXICON_WAVE, &cpStream, NULL); + } + + if (STG_E_FILENOTFOUND == hr) + return TPR_FAIL; + + // set the input to the wav file stream + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetInput(cpStream, TRUE); + } + + // load the first grammar + if (SUCCEEDED(hr)) + { + hr = cpRecoContext->CreateGrammar(GRAM_ID, &cpRecoGrammar); + } + + //toplevel rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->GetRule(wszRule, 0, SPRAF_TopLevel | SPRAF_Active, TRUE, &hToplevelInit); + if (FAILED(hr)) + { + Comment(L"create the toplevel dynamic rule failed"); + } + } + + //fill in the rule + if (SUCCEEDED(hr)) + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord1 , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L"AddWordTransition failed"); + } + else + { + hr = cpRecoGrammar->AddWordTransition(hToplevelInit, NULL, wszWord2 , L" ", SPWT_LEXICAL, 1.0, NULL); + if (FAILED(hr)) + { + Comment(L"AddWordTransition failed"); + } + } + } + + + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->Commit(NULL); + + // perform SR; get results and see if our word is inside the result string + if (SUCCEEDED(hr)) + hr = cpRecoGrammar->SetRuleState(NULL, NULL, SPRS_ACTIVE); + + if (FAILED(hr)) + { + Comment(L"initialization failed."); + return TPR_FAIL; + } + + if (SUCCEEDED(hr)) + hr = HlpGetRecoResult(cpRecoContext, vector_RecoResult); + + if (hr == S_OK) + { + SPPHRASE *pPhrase = NULL; + if (vector_RecoResult.size()) + { + hr = vector_RecoResult[0]->GetPhrase(&pPhrase); + if (SUCCEEDED(hr) && pPhrase) + { + if ( wcscmp(pPhrase->pElements[0].pszLexicalForm, wszWord2 )) + { + Comment(L"The result is incorrect"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no phrase"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + } + else + { + Comment(L"no recognition"); + tpr = TPR_FAIL; + } + + if (SUCCEEDED(hr)) + hr = HlpRemoveCustomWord(cpLexicon, wszWord1); + + if (SUCCEEDED(hr)) + HlpRemoveCustomWord(cpLexicon, wszWord2); + + // remove the random user that was created for this test + if (cpProfileToken && SUCCEEDED(hr)) + { + hr = cpProfileToken->Remove(NULL); + if (hr == SPERR_TOKEN_IN_USE) + { + //we can't remove the token because SR Engine is using the token + //we try to set the original default token to be the current token + CComPtr cpDefaultProfileToken; + hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOPROFILES, &cpDefaultProfileToken); + if (SUCCEEDED(hr)) + { + hr = cpRecognizer->SetRecoProfile(cpDefaultProfileToken); + } + + if (SUCCEEDED(hr)) + { + hr = cpProfileToken->Remove(NULL); + } + } + else if (FAILED(hr)) + { + Comment(IDS_ERR_LEX_REMOVEUSER); + } + } + + + return tpr; +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.h b/sp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.h new file mode 100644 index 00000000..502a4162 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/SR/srenginecompliance.h @@ -0,0 +1,154 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// srenginecompliance.h +// +//****************************************************************************** +#ifndef _srenginecompliance_h_ +#define _srenginecompliance_h_ +#include "sapi.h" + +#include +typedef std::vector > RESULTVECTOR; + +#ifdef _WIN32_WINNT +#undef _WIN32_WINNT +#endif +#define _WIN32_WINNT 0x0400 + +#define WILDCARDTEXT L"..." +#define WAIT_TIME 25000 +#define TEST_CASES 20 +#define NUMOFRECOCONTEXTS 2 +#define INTERATIONS 1 +#define TESTEVENT_WAIT 250 + +template +class CSpTString +{ +#ifdef _UNICODE +private: + WCHAR m_wString[i]; +public: + CSpTString(const WCHAR * psz){ + wcscpy(m_wString, psz); + } + operator const WCHAR *() { return m_wString; } + WCHAR * operator =(const WCHAR * psz) { + wcscpy(m_wString, psz); + return m_wString; + } +#else +private: + char m_aString[i]; +public: + CSpTString(const WCHAR * psz) + { + ::WideCharToMultiByte(CP_ACP, 0, psz, -1, m_aString, i, NULL, NULL); + } + operator const char *() { return m_aString; } + const char * operator =(const WCHAR * psz) + { + ::WideCharToMultiByte(CP_ACP, 0, psz, -1, m_aString, i, NULL, NULL); + return m_aString; + } +#endif +}; + + +HRESULT RegRecursiveCopyKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, HKEY hkeyDest, LPCTSTR szSubKeyDest, BOOL fClearDest = FALSE); +HRESULT RegRecursiveDeleteKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, BOOL fKeepEmptyRoot = FALSE); + +LANGID GetDefaultEnginePrimaryLangId(); + +struct PropertyNum +{ + const WCHAR* pPropertyNumNames; + LONG ulLowLimit; + LONG ulHighLimit; +}; + +const PropertyNum PropertyNumTable[] = +{ + {SPPROP_RESOURCE_USAGE, 0, 100}, + {SPPROP_HIGH_CONFIDENCE_THRESHOLD, 0, 100}, + {SPPROP_NORMAL_CONFIDENCE_THRESHOLD, 0, 100}, + {SPPROP_LOW_CONFIDENCE_THRESHOLD, 0, 100}, + {SPPROP_RESPONSE_SPEED, 0, 10000}, + {SPPROP_COMPLEX_RESPONSE_SPEED, 0, 10000}, + {SPPROP_ADAPTATION_ON, 0, 1} +}; + + + +inline HRESULT CreateAppLexicon( + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + WCHAR* pwszAttributes, + ISpLexicon** ppLexicon) +{ + HRESULT hr = S_OK; + + CComPtr cpToken; + CComPtr cpDataKeyAttribs; + if(SUCCEEDED(hr)) + { + hr = SpCreateNewTokenEx(SPCAT_APPLEXICONS, pszLangIndependentName, &CLSID_SpUnCompressedLexicon, pszLangIndependentName, langid, pszLangDependentName, &cpToken, &cpDataKeyAttribs); + } + if(SUCCEEDED(hr)) + { + CSpDynamicString str(pwszAttributes); // make a copy of the pwszAttributes + WCHAR* p = wcstok(str, L";"); + while(SUCCEEDED(hr) && p) + { + if(WCHAR* pe = wcschr(p, L'=')) + { + *(pe++) = L'\0'; + hr = cpDataKeyAttribs->SetStringValue(p, pe); + } + else + { + hr = cpDataKeyAttribs->SetStringValue(p, L""); + } + p = wcstok(NULL, L";"); + } + } + if(SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(cpToken, ppLexicon); + } + + return hr; +} + + + +inline HRESULT RemoveTestAppLexicon(WCHAR* pwszAttributes) +{ + + HRESULT hr = S_OK; + CComPtr cpEnum; + + CComPtr cpSpObjectToken; + + + if( SUCCEEDED( hr ) ) + { + // Get tts test engine voice + hr = SpEnumTokens(SPCAT_APPLEXICONS, pwszAttributes, NULL, &cpEnum); + } + if( hr == S_OK ) + { + hr = cpEnum->Next(1, &cpSpObjectToken, NULL); + } + if( hr == S_OK ) + { + hr = cpSpObjectToken->Remove(NULL); + + } + + return hr; +} + + +#endif // _srenginecompliance_h_ \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/SR/srtests1.h b/sp/src/utils/sapi51/Tools/Comp/SR/srtests1.h new file mode 100644 index 00000000..a6f757c9 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/SR/srtests1.h @@ -0,0 +1,90 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// srtests1.h +// +//****************************************************************************** +#ifndef __SRTRESTS1_H__ +#define __SRTRESTS1_H__ + +#include +#include +#include +#include +#include +#include "sapi.h" +#include "sapiddk.h" +#include + +#define GRAM_ID 123 + +// Added for logging across .cpp files +extern CKato *g_pKato; + +extern TCHAR ptszCustomizedDirectory[]; + +// Engine compliance through SAPI API's +TESTPROCAPI t_CheckEvent_SoundStart (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_SoundEnd (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_SoundStartEnd (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_PhraseStart (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_Recognition (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_FalseRecognition (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_EventsSequences (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_PhraseStartRecognitionOrder (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +TESTPROCAPI t_CheckEvent_Hypothesis (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEvent_Interference (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +//TESTPROCAPI t_CheckEvent_PhraseHypReco (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexSynchBeforeDicLoad (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexSynchBeforeCfgLoad (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexSynchAfterDictationLoad (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexSynchAfterGrammarLoad (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_AppLex (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UserLexBeforeAppLex (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CaseSensitiveLexicon (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + + +TESTPROCAPI t_GrammarListTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GrammarExpRuleTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GrammarPTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GrammarOTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GrammarRuleTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CustomPron (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CaseSensitiveGrammar (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +TESTPROCAPI t_DictationTag (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_Wildcard (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CFGTextBuffer (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +TESTPROCAPI t_MultipleRecoContext (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_GetITNResult (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_Alternates_Dictation (UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE); +TESTPROCAPI t_Alternates_Cfg (UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE); +TESTPROCAPI t_SpPhraseElements (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_AutoPause (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_PickGrammar (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_UseLastActivatedGrammar (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_RequiredPropertyString (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_RequiredPropertyNum (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_InvalidateToplevelRule (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_InvalidateNonToplevelRule (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_MultiInstances (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + + + + + + + +#define TESTEVENT_TIMEOUT 20000 + +extern SPS_SHELL_INFO *g_pShellInfo; // need this to get handle to dll + + + + + + + +#endif // __SRTRESTS1_H__ \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/SR/version.rc2 b/sp/src/utils/sapi51/Tools/Comp/SR/version.rc2 new file mode 100644 index 00000000..7c64a121 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/SR/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Microsoft SRCOMP\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SRCOMP\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "srcomp.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/audiostate.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/audiostate.cpp new file mode 100644 index 00000000..2dcd5795 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/audiostate.cpp @@ -0,0 +1,275 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// audiostate.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** +inline HRESULT SpGetLanguageFromVoiceToken(ISpObjectToken * pToken, LANGID * plangid) +{ + + HRESULT hr = S_OK; + CComPtr cpDataKeyAttribs; + hr = pToken->OpenKey(L"Attributes", &cpDataKeyAttribs); + + CSpDynamicString dstrLanguage; + if (SUCCEEDED(hr)) + { + hr = cpDataKeyAttribs->GetStringValue(L"Language", &dstrLanguage); + } + + + LANGID langid; + if (SUCCEEDED(hr)) + { + if (!swscanf(dstrLanguage, L"%hx", &langid)) + { + hr = E_UNEXPECTED; + } + } + + if (SUCCEEDED(hr)) + { + *plangid = langid; + } + + SPDBG_REPORT_ON_FAIL(hr); + return hr; +} /* SpGetLanguageFromVoiceToken */ + +HRESULT SpGetLanguageIdFromDefaultVoice(LANGID *plangid) +{ + HRESULT hr = S_OK; + + CComPtr cpVoiceToken; + LANGID langid; + // Find the best voice + if( SUCCEEDED( hr ) ) + { + hr = SpGetDefaultTokenFromCategoryId( SPCAT_VOICES, &cpVoiceToken ); + } + if( SUCCEEDED( hr ) ) + { + hr = SpGetLanguageFromVoiceToken(cpVoiceToken, &langid); + } + *plangid = langid; + + return hr; +} + +HRESULT GetWStrFromRes( UINT id, WCHAR* szwStr, int cchBufferMax ) +{ + HRSRC hResInfo = NULL; + HANDLE hStringSeg = NULL; + LPWSTR lpsz = NULL; + int cch = 0; + HRESULT hr = S_OK; + LANGID Language; + + hr = SpGetLanguageIdFromDefaultVoice(&Language); + if (FAILED (hr ) ) + return hr; + + // String Tables are broken up into 16 string segments. Find the segment + // containing the string we are interested in. + if (hResInfo = FindResourceExW( g_pShellInfo->hLib, (LPCWSTR)RT_STRING, + MAKEINTRESOURCEW(((USHORT)id >> 4) + 1), + Language) ) + { + // Load that segment. + hStringSeg = LoadResource( g_pShellInfo->hLib, hResInfo ); + + // Lock the resource. + if( lpsz = (LPWSTR)LockResource(hStringSeg) ) + { + // Move past the other strings in this segment. + // (16 strings in a segment -> & 0x0F) + id &= 0x0F; + while( TRUE ) + { + cch = *((WORD *)lpsz++); // PASCAL like string count + // first UTCHAR is count if TCHARs + if (id-- == 0) break; + lpsz += cch; // Step to start if next string + } + + // Account for the NULL + cchBufferMax--; + + // Don't copy more than the max allowed. + if (cch > cchBufferMax) + cch = cchBufferMax-1; + + // Copy the string into the buffer. + CopyMemory( szwStr, lpsz, cch*sizeof(WCHAR) ); + + // Attach Null terminator. + szwStr[cch] = 0; + } + } + + return cch ? S_OK : HRESULT_FROM_WIN32(ERROR_RESOURCE_NAME_NOT_FOUND); +} +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** +/*****************************************************************************/ + +//************************************************************************************* +TESTPROCAPI t_SpeakStop(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test uses the default audio object to speak pause and speak a stream. It checks +// to make sure a TTS engine is paying attention to these states by stopping the stream +// part way through and counting the number of word events ( these must be less than the +// total number in the string. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_SpeakStop_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_SpeakStop_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) + +{ + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + int cEventsReceived = 0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + CSpEvent Event; + + hr = cpVoice->SetOutput(NULL, TRUE); + CHECKHRGOTOId( hr, tpr, IDS_STRING60); + + //clean up the event queue. + while (Event.GetFrom(cpVoice) == S_OK); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + DOCHECKHRGOTO ( hr = cpVoice->SetInterest( SPFEI(SPEI_WORD_BOUNDARY), SPFEI(SPEI_WORD_BOUNDARY) ); ); + + DOCHECKHRGOTO ( hr = GetWStrFromRes( IDS_STRING1, szwSpeakStr );); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC, NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + //wait for the first word boundry event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, " t_SpeakStop_Test"); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, " t_SpeakStop_Test"); + } + + + Sleep (500); + + //purges all data, close the audio and set action flag to SPVES_ABORT + hr = cpVoice->Speak( NULL, SPF_PURGEBEFORESPEAK, 0 ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, " t_SpeakStop_Test"); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, " t_SpeakStop_Test"); + } + + while (S_OK == hr ) + { + hr = Event.GetFrom(cpVoice); + + if( hr == S_OK ) + { + // count how many word boundry events we got + cEventsReceived++; + } + + } + + //Make sure the entire first speak call did not finish + //Note - The sentence contains 20 words, so normally we can receive 20 word + //boundary events. + CHECKASSERTId(( cEventsReceived < 20 ), tpr, IDS_STRING5); + + // Logging info + CHECKHRId( hr, tpr, IDS_STRING5 ); + +EXIT: + return tpr; +} + +//************************************************************************************* +TESTPROCAPI t_SpeakDestroy(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test starts a long Speak call and destroys the stream before completion. It +// expects engines to clean-up correctly and not fault. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CComPtr cpVoice; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpVoice.CoCreateInstance( CLSID_SpVoice );); + + //get the bookmark string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING6, szwSpeakStr );); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC, NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + cpVoice.Release(); + + // Logging info + CHECKHRId( hr, tpr, IDS_STRING7 ); + +EXIT: + return tpr; +} + diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/compevents.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/compevents.cpp new file mode 100644 index 00000000..1b361403 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/compevents.cpp @@ -0,0 +1,281 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// compevents.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** + + +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + +TESTPROCAPI t_CheckEventsSAPI(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This is a SAPI5 required test. It checks if the bookmark, word, and sentence + // boundary events are fired by TTS engine. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_CheckEventsSAPI_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_CheckEventsSAPI_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + //This is a SAPI5 required test. It checks if the bookmark, word, and sentence + // boundary events are fired by TTS engine. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + ULONGLONG ullFlags = SPFEI(SPEI_WORD_BOUNDARY) | + SPFEI(SPEI_SENTENCE_BOUNDARY) | + SPFEI(SPEI_TTS_BOOKMARK); + BOOL bGetEvents = true; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwBMarkStr[MAX_PATH]=L""; + LONGLONG ullEventsRetrieved = 0; + LANGID LangID; + + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING20, szwSpeakStr );); + + //get the bookmark string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING21, szwBMarkStr );); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest( ullFlags, ullFlags ); ); + + //clean up the event queue + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + } + CHECKHRId( hr, tpr, IDS_STRING120 ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML , NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + hr = cpVoice->WaitUntilDone(TTS_WAITTIME); + CHECKASSERTGOTOId( (hr == S_OK), tpr, IDS_STRING61); + + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + + if( hr == S_OK ) + { + // save the events retrieved + ullEventsRetrieved |= SPFEI(Event.eEventId); + if ( Event.eEventId == SPEI_TTS_BOOKMARK) + { + //verify bookmark string (lparam and wparam) + CHECKASSERTId(( !wcscmp( (WCHAR*)Event.lParam, szwBMarkStr ) ), tpr, IDS_STRING9); + CHECKASSERTId(( Event.wParam == _wtol(szwBMarkStr) ), tpr, IDS_STRING9); + continue; + } + + switch (LangID) + { + case 2052: + if ( Event.eEventId == SPEI_WORD_BOUNDARY) + { + //position will be 1 (leading space), 3, 29, and 30 + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 3 ) \ + || ( Event.lParam == 29 ) || ( Event.lParam == 30 )), + tpr, IDS_STRING9); + //length of word will be 1, or 2 if "ceshi" as one word + CHECKASSERTId( ( Event.wParam == 1 ) || + ( Event.wParam == 2 ), tpr, IDS_STRING9); + } + else if ( Event.eEventId == SPEI_SENTENCE_BOUNDARY) + { + //position will 1 (leading space), 3, and 29 + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 3 ) \ + || ( Event.lParam == 29 )), tpr, IDS_STRING9); + //length of sentence will be either 2 including period, and + //3 if "ce shi" as a word. + CHECKASSERTId( ( Event.wParam == 2 ) || ( Event.wParam == 3 ), + tpr, IDS_STRING9); + + } + break; + + case 1041: + if ( Event.eEventId == SPEI_WORD_BOUNDARY) + { + //lparam position:1, 4, 32 + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 4 ) \ + || ( Event.lParam == 32 ) ), + tpr, IDS_STRING9); + //wparm length of word: 3 or 6 + CHECKASSERTId( ( Event.wParam == 3 ) || ( Event.wParam == 6 ) + , tpr, IDS_STRING9); + } + else if ( Event.eEventId == SPEI_SENTENCE_BOUNDARY) + { + //lparam position:1, 32, + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 32 )), + tpr, IDS_STRING9); + //wparm length: 7 and 4 + //Note: punctuation should be included + CHECKASSERTId( (( Event.wParam == 7 ) || ( Event.wParam == 4)), + tpr, IDS_STRING9); + } + + break; + + case 1033: + default: + + if ( Event.eEventId == SPEI_WORD_BOUNDARY) + { + //position will be 1 for book (leading space), 6 for mark, 36 for test1. + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 7 ) \ + || ( Event.lParam == 36 ) ), + tpr, IDS_STRING9); + + //lengths of word are either 4 ( book, mark) or 5 (test1) + CHECKASSERTId( ( Event.wParam == 5 ) || ( Event.wParam == 4 ), tpr, IDS_STRING9); + + } + else if ( Event.eEventId == SPEI_SENTENCE_BOUNDARY) + { + + //position will be 1 for book (leading spaces), 7 for mark), + //and 36 for test1 + CHECKASSERTId((( Event.lParam == 1 ) || ( Event.lParam == 7 ) + || ( Event.lParam == 36 )), tpr, IDS_STRING9); + + //length will be 5 for (book. and mark.) and 6 for (test1.) + CHECKASSERTId( (( Event.wParam == 5 ) || ( Event.wParam == 6)), + tpr, IDS_STRING9); + + } + + break; + } + } + } + + // Logging info + CHECKHRGOTOId( hr, tpr, IDS_STRING9 ); + + // Make sure correct events were retrieved + CHECKASSERTId(((ullEventsRetrieved & ullFlags) == ullFlags), tpr, IDS_STRING9 ); +EXIT: + return tpr; +} + +TESTPROCAPI t_CheckEventsNotRequire(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test creates an Event Sink and asks a TTS engine to forward Events to it. It checks +// to make sure that all the expected Events are fired. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CComPtr cpVoice; + + ULONGLONG ullFlags = SPFEI(SPEI_PHONEME) | + SPFEI(SPEI_VISEME); + BOOL bGetEvents = true; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + ULONGLONG ullEventsRetrieved = 0; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpVoice.CoCreateInstance( CLSID_SpVoice );); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING10, szwSpeakStr );); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest( ullFlags, ullFlags ); ); + + //clean up the event queue + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + } + CHECKHRId( hr, tpr, IDS_STRING120 ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML , NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME ); + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, "in t_CheckEventsSAPI"); + + + while( hr == S_OK ) + { + CSpEvent Event; + + hr = Event.GetFrom(cpVoice); + + if( hr == S_OK ) + { + // Record the events retrieved in dwFlagsRetrieved + ullEventsRetrieved |= SPFEI(Event.eEventId); + } + + } + + // Logging info + CHECKHRGOTOId( hr, tpr, IDS_STRING15 ); + + // Make sure correct events were retrieved + CHECKISSUPPORTEDId(( ullEventsRetrieved == ullFlags ), tpr, IDS_STRING15); + +EXIT: + return tpr; +} diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/f0.h b/sp/src/utils/sapi51/Tools/Comp/TTS/f0.h new file mode 100644 index 00000000..40f7d6a1 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/f0.h @@ -0,0 +1,44 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// f0.h +// +//****************************************************************************** + +#ifndef _F0_H_ +#define _F0_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct F0_Data* F0Data; + +typedef struct { + float f0; + float rms; + /* float voicing; + */ +} F0Out; + + +F0Data F0_NewF0Obj (void); + +void F0_DeleteF0Obj (F0Data* f0Obj); + +int F0_ParseParameter (F0Data f0Obj, const char* str); + +float F0_ParameterValue (F0Data f0Obj, const char* str); + +int F0_Init (F0Data f0Obj, double sampFreq, int* buffsize, int* buffStep); + +int F0_AddDataFrame (F0Data f0Obj, float* data, int nData); + +int F0_OutputLength (F0Data f0Obj); + +F0Out F0_GetOutputFrame (F0Data f0Obj, int idx); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/ispttsengine.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/ispttsengine.cpp new file mode 100644 index 00000000..79d68702 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/ispttsengine.cpp @@ -0,0 +1,825 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// ispttsengine.cpp +// +//****************************************************************************** + +#include "TTSComp.h" +#include + +//****************************************************************************** +//***** Globals +//****************************************************************************** + +//****************************************************************************** +//***** Internal Functions and helper classes +//****************************************************************************** + +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_Speak(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test tests the ISpTTSEngine::Speak through the ISpVoice::Speak method. +// It does simple, normal usage tests. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_ISpTTSEngine_Speak_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_Speak_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) + +{ + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CComPtr cpStream; + + ULONG ulStreamNum; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + WCHAR szwInitDebug[MAX_PATH]=L""; + WCHAR szwNonAscii[] = {0x65e5, 0x672c, 0}; // non-ascii text + CSpStreamFormat InFmt; + + + + if( SUCCEEDED( hr ) ) + { + hr = InFmt.AssignFormat(SPSF_22kHz16BitMono); + } + + if( SUCCEEDED( hr ) ) + { + hr = SPCreateStreamOnHGlobal( NULL, true, InFmt.FormatId(), InFmt.WaveFormatExPtr(), &cpStream ); + } + + // Set the output to memory so we don't hear every speak call + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetOutput( cpStream, FALSE); + } + + if( SUCCEEDED( hr ) ) + { + // Logging info + hr = GetWStrFromRes( IDS_STRING13, szwDebug ); + + } + + // Logging info + CHECKHRGOTOId( hr, tpr, IDS_STRING12 ); + + /******* Valid Cases *******/ + + // + // Test #1 - Normal usage + // + GetWStrFromRes( IDS_STRING10, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_DEFAULT, &ulStreamNum ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + // + // Test #2 - Speak empty string + // + hr = cpVoice->Speak( L"", NULL, 0 ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + // + // Test #3 - Speak a really long string + // + GetWStrFromRes( IDS_STRING11, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, NULL, 0 ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + // + // Test #5 - Speak asyncronously + // + GetWStrFromRes( IDS_STRING10, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC, &ulStreamNum ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME ); + + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, " in Test #5"); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, " in Test #5"); + } + + // + // Test #6 - Purge before speaking + // + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC, 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, " in Test #6, SPF_ASYNC"); + + hr = cpVoice->Speak( szwSpeakStr, SPF_PURGEBEFORESPEAK, 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, " in Test #6, SPF_PURGEBEFORESPEAK"); + + // + // Test #7 - Speak the xml tags + // + GetWStrFromRes( IDS_STRING8, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, 0 ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + // + // Test #9 - Speak punctuation + // + GetWStrFromRes( IDS_STRING8, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_NLP_SPEAK_PUNC, 0 ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + + // + // Test#10 - Speak some non-ASCII text + // + hr = cpVoice->Speak( szwNonAscii, SPF_DEFAULT, NULL ); + CHECKHRId( hr, tpr, IDS_STRING13 ); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_Skip(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // This test tests the ISpTTSEngine::Skip through the ISpVoice::Skip method. + // 0 ulNumItems -> Start at the beginning of current sentence + // 1 ulNumItems -> Start at the next sentence + // -1 ulNumItems -> Start at the previous sentence + // Skip type: sentence + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + tpr = t_ISpTTSEngine_Skip_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_Skip_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + //this method is called by t_ISpTTSEngine_Skip() and Multiple Instance test. + //For Multiple Instance test, we do not check audio output. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + + CComPtr cpStream; + STATSTG Stat; + ULONG sample1 = 0, sample2 = 0, ulNoSkipSample = 0; + ULONG NumSkipped = 0; + const char * TEST_TOPIC = ""; + WCHAR szwSpeakStr[MAX_PATH]=L""; + + //select output format + CSpStreamFormat InFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId( hr, tpr, IDS_STRING84); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING63, szwSpeakStr );); + + + + //====================================================================== + TEST_TOPIC = "Test #1 - Skip forward"; + //====================================================================== + g_pKato->Comment(5, "Skip forward test - Thread Id: %x", GetCurrentThreadId()); + // Create a stream + hr = SPCreateStreamOnHGlobal( NULL, true, InFmt.FormatId(), InFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output to the stream + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + //initialization + sample1 = 0, sample2 = 0, ulNoSkipSample = 0; + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML, NULL ); + CHECKHRGOTOId( hr, tpr, IDS_STRING13); + + //skip 7 sentences + hr = cpVoice->Skip( L"SENTENCE", 7, NULL); + CHECKHRId( hr, tpr, IDS_STRING59); + + hr = cpVoice->WaitUntilDone(TTS_WAITTIME); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + if (!bCalledByMulti ) + { + hr = cpStream->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + sample1 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + + //Speak + hr = t_SpeakTwoStreams(cpVoice, szwSpeakStr, szwSpeakStr, sample2, sample2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //save the sample for later comparision + ulNoSkipSample = sample2; + + //The test will abort if the outputs = 0 + CHECKASSERTGOTOIdEx( ( sample2 > 0 ), tpr, IDS_STRING59, TEST_TOPIC ); + CHECKASSERTGOTOIdEx( ( sample1 > 0 ), tpr, IDS_STRING59, TEST_TOPIC ); + + //compare the output streams. The output stream without Skip should be much + //longer than one with Skip ( 7 ) + + CHECKASSERTIdEx( ( ulNoSkipSample > sample1), tpr, IDS_STRING59, TEST_TOPIC ); + } + cpStream.Release(); + + //====================================================================== + TEST_TOPIC = "Test #2 - Skip backward"; + //====================================================================== + g_pKato->Comment(5, "Skip backward test - Thread Id: %x", GetCurrentThreadId()); + + //initialization + sample1 = 0, sample2 = 0; + + // Create stream + hr = SPCreateStreamOnHGlobal( NULL, true, InFmt.FormatId(), InFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest(SPFEI(SPEI_TTS_BOOKMARK), 0);); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML , NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //for multithreaded case, the event may not come + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //skip backward 7 sentences + hr = cpVoice->Skip( L"SENTENCE", -7, &NumSkipped); + CHECKHRIdEx( hr, tpr, IDS_STRING59, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone(TTS_WAITTIME); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + if (!bCalledByMulti ) + { + hr = cpStream->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + sample1 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + CHECKASSERTIdEx((sample1 != 0), tpr, IDS_STRING59, TEST_TOPIC ); + + //The test will abort if the outputs = 0 + CHECKASSERTGOTOIdEx( ( sample1 > 0 ), tpr, IDS_STRING59, TEST_TOPIC ); + + //compare the output streams. The output stream without Skip should be much + //short than one with Skip ( -7 ) + + CHECKASSERTIdEx( ( ulNoSkipSample < sample1), tpr, IDS_STRING59, TEST_TOPIC ); + } + + cpStream.Release(); + + //====================================================================== + TEST_TOPIC = "Test #3 - Skip 0"; + //====================================================================== + g_pKato->Comment(5, "Skip 0 test - Thread Id: %x", GetCurrentThreadId()); + + //initialization + sample1 = 0, sample2 = 0; + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Create stream + hr = SPCreateStreamOnHGlobal( NULL, true, InFmt.FormatId(), InFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC |SPF_IS_XML , NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //for multithreaded case, the event may not come + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + //skip 0 sentence + hr = cpVoice->Skip( L"SENTENCE", 0, &NumSkipped); + CHECKHRIdEx( hr, tpr, IDS_STRING59, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone(TTS_WAITTIME); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + + if (!bCalledByMulti ) + { + hr = cpStream->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + sample2 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + + //The test will abort if the outputs = 0 + CHECKASSERTIdEx( (sample2 >= ulNoSkipSample ), tpr, IDS_STRING59, TEST_TOPIC ); + } + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_GetOutputFormat(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + // This test tests the ISpTTSEngine::GetOutputFormat method. + // GetOutputFormat() is tested directly and also via SAPI + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + tpr = t_ISpTTSEngine_GetOutputFormat_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_GetOutputFormat_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + WCHAR szwSpeakStr[MAX_PATH]=L""; + CSpStreamFormat OutputFmt; + CSpStreamFormat InputFmt; + WAVEFORMATEX Fmtex; + + const char * TEST_TOPIC = ""; + CComPtr cpStream; + + //Initialize the waveformat structure, this user's format is supported by SAPI5 + Fmtex.wFormatTag = WAVE_FORMAT_PCM; + Fmtex.nSamplesPerSec = 2000; // arbitrary number + Fmtex.wBitsPerSample = 8; + Fmtex.nChannels = 1; + Fmtex.nBlockAlign = 1; + Fmtex.nAvgBytesPerSec = 2000; // arbitrary number + Fmtex.cbSize = 0; + + CComPtr cpVoiceToken; + CComPtr cpTTSEngine; + + + DOCHECKHRGOTO(hr=SpGetDefaultTokenFromCategoryId( SPCAT_VOICES, &cpVoiceToken );); + + DOCHECKHRGOTO(hr = SpCreateObjectFromToken( cpVoiceToken, &cpTTSEngine );); + + DOCHECKHRGOTO (hr = InputFmt.AssignFormat(SPSF_22kHz16BitMono);); + + + //====================================================================== + TEST_TOPIC = "Test #1 - Pass in NULL"; + //====================================================================== + hr = cpTTSEngine->GetOutputFormat( + NULL, + NULL, + &OutputFmt.m_guidFormatId, + &OutputFmt.m_pCoMemWaveFormatEx ); + CHECKHRIdEx( hr, tpr, IDS_STRING14, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #2 - Text format"; + //====================================================================== + hr = cpTTSEngine->GetOutputFormat( + &SPDFID_Text, + NULL, + &OutputFmt.m_guidFormatId, + &OutputFmt.m_pCoMemWaveFormatEx ); + CHECKHRIdEx( hr, tpr, IDS_STRING14, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #3 - wave format"; + //====================================================================== + + hr = cpTTSEngine->GetOutputFormat( + &SPDFID_WaveFormatEx, + &Fmtex, + &OutputFmt.m_guidFormatId, + &OutputFmt.m_pCoMemWaveFormatEx ); + CHECKHRIdEx( hr, tpr, IDS_STRING14, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #4 - Normal usage"; + //====================================================================== + + hr = cpTTSEngine->GetOutputFormat( &InputFmt.m_guidFormatId, + InputFmt.m_pCoMemWaveFormatEx , + &OutputFmt.m_guidFormatId, + &OutputFmt.m_pCoMemWaveFormatEx ); + CHECKHRIdEx( hr, tpr, IDS_STRING14, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #5 - test GetOutputFormat through SetOutPut"; + //====================================================================== + hr = cpVoice->SetOutput( NULL, TRUE); + CHECKHRIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #6 - test GetOutputFormat through Speak"; + //====================================================================== + GetWStrFromRes( IDS_STRING65, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, 0, 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #7 - test GetOutputFormat with user's format"; + //====================================================================== + + hr = SPCreateStreamOnHGlobal( NULL, true, SPDFID_WaveFormatEx, &Fmtex, &cpStream ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output to cpStream + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + //Speak calls GetOutputFormat() and passs in the above defined junk wave format + //as the first two paramters + hr = cpVoice->Speak( szwSpeakStr, 0, 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_SetRate(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test tests the ISpTTSEngine::SetRate method through the ISpVoice::SetRate method. +// It does simple, normal usage tests. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + tpr = t_ISpTTSEngine_SetRate_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_SetRate_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + WCHAR szwDebug[MAX_PATH]=L""; + WCHAR szwSpeakStr[MAX_PATH]=L""; + ULONG cSamples1=0, cSamples2=0, ulHightRateSample=0; + + + // Logging info and abort the test if fails here + CHECKHRGOTOId( hr, tpr, IDS_STRING12 ); + + //get the debug string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING16, szwDebug );); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING10, szwSpeakStr );); + + // + // Test #1 - Set a rate to 5 + // + cSamples1 = 0, cSamples2 = 0; + + hr = cpVoice->SetRate( 5 ); + CHECKHRId( hr, tpr, IDS_STRING16 ); + + //Speak + hr = t_SpeakTwoStreams(cpVoice, szwSpeakStr, szwSpeakStr, cSamples1, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, "SetRate to 5"); + + //save the output for later comparision + ulHightRateSample = cSamples1; + + // + // Test #2 - SetRate to -5 + // + cSamples1 = 0, cSamples2 = 0; + + hr = cpVoice->SetRate( -5 ); + CHECKHRId( hr, tpr, IDS_STRING16 ); + + //Speak + hr = t_SpeakTwoStreams(cpVoice, szwSpeakStr, szwSpeakStr, cSamples1, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, "SetRate to -5" ); + + //In multithreaded case, we do not check audio output + if (!bCalledByMulti ) + { + //The test will abort if the outputs = 0 + CHECKASSERTGOTOId( ( ulHightRateSample > 0 ), tpr, IDS_STRING16); + CHECKASSERTGOTOId( ( cSamples1 > 0 ), tpr, IDS_STRING16); + + //compare the output streams. The output stream when the rate = -5 should be much + //longer than one when the rate = 5. + + CHECKASSERTId( ( ulHightRateSample < cSamples1), tpr, IDS_STRING16); + } + + // + // Test #3 - SetRate to 0 + // + + //set the rate back to the default + hr = cpVoice->SetRate( 0 ); + CHECKHRId( hr, tpr, IDS_STRING16 ); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_SetVolume(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test tests the ISpTTSEngine::SetVolume method through the ISpVoice::SetVolume method. +// It does simple, normal usage tests. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + tpr = t_ISpTTSEngine_SetVolume_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_ISpTTSEngine_SetVolume_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + WCHAR szwSpeakStr[MAX_PATH]=L""; + CComPtr cpStream1; + CComPtr cpStream2; + CSpStreamFormat NewFmt; + ULONG totalAmp1 = 0, totalAmp2 = 0; + const char * TEST_TOPIC = ""; + + + if( SUCCEEDED( hr ) ) + { + hr = NewFmt.AssignFormat(SPSF_22kHz16BitMono); + } + + // Logging info + CHECKHRGOTOId( hr, tpr, IDS_STRING12 ); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING10, szwSpeakStr );); + + //====================================================================== + TEST_TOPIC = "Test #1: SetVolume to 50"; + //====================================================================== + + // + // Test #1 - SetVolume to 50 + // + + //set volume to 50 + hr = cpVoice->SetVolume( 50 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, 0, 0 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + LARGE_INTEGER l; + l.QuadPart = 0; + + // Reset stream to beginning + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream1, &totalAmp1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Test #2: SetVolume to 0"; + //====================================================================== + + // + // Test #2 - SetVolume to 0 + // + hr = cpVoice->SetVolume( 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Test #3: SetVolume to 100"; + //====================================================================== + + // + // Test #3 - SetVolume to 100 + // + hr = cpVoice->SetVolume( 100 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, 0, 0 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //In multithreaded case, we do not check audio output + if (!bCalledByMulti ) + { + // Reset stream to beginning + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream2, &totalAmp2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + //Make sure the amplitudes of stream1 and stream2 are greater than 0 + CHECKASSERTGOTOId( (totalAmp1 > 0), tpr, IDS_STRING35 ); + CHECKASSERTGOTOId( (totalAmp2 > 0), tpr, IDS_STRING35 ); + + //compare the output streams. The amplitude of output stream when the volume = 100 + //should be higher than one when the volume = 50 + + CHECKASSERTId( ( totalAmp1 < totalAmp2), tpr, IDS_STRING18); + } + +EXIT: + return tpr; +} + + +// Release global objects +void CleanupVoiceAndEngine() +{ +} diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/lexicon.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/lexicon.cpp new file mode 100644 index 00000000..565925a4 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/lexicon.cpp @@ -0,0 +1,495 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// lexicon.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** + +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + +//****************************************************************************** +TESTPROCAPI t_UserLexiconTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //this procedure tests the user lexicon by + // . Add a new word pron + // . Remove the word pron + + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CComPtr cpStream1; + CComPtr cpStream2; + CComPtr cpVoice; + CComPtr cpConlexicon; + LANGID LangID; + ULONG cSamples1=0, cSamples2=0; + ULONG cDiff=0; + WCHAR szwNewWord[MAX_PATH]=L""; + WCHAR szwPronStr[MAX_PATH]=L""; + WCHAR szPronunciation[MAX_PATH]=L""; + STATSTG Stat; + + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "User lexicon test: Initialization"; + //====================================================================== + CSpStreamFormat InFormat(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //get new word and its pronounciation + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING76, szwNewWord );); + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING94, szwPronStr );); + + // Create the SAPI voice + DOCHECKHRGOTO(hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); ); + DOCHECKHRGOTO (hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon);); + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + //remove its pron if it exists already in the User lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //Speak the new word + hr = cpVoice->Speak(szwNewWord, 0, 0); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + //save to cSamples1 for later comparation + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + CHECKASSERTGOTOIdEx((cSamples1 > 0 ), tpr, IDS_STRING75, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "User lexicon test: Test #1"; + //====================================================================== + // + //test #1 - Add a word pron + // + cpStream2.Release(); + cSamples2 = 0; + + //create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStr, szPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + //remove its pron if it exists already in the User lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //add the pronounciation of the new word to User's lexicon as verb and noun + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Verb, szPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + hr = cpVoice->Speak(szwNewWord, 0, 0); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + CHECKASSERTGOTOId((cSamples2 > 0 ), tpr, IDS_STRING75); + + //The test assume that cSamples2 should be twice greater than cSamples1 + CHECKASSERTIdEx(( cSamples2 > 2 * cSamples1), tpr, IDS_STRING75, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "User lexicon test: Test #2"; + //====================================================================== + + // + //Test #2 - Remove the word pron + // + cpStream2.Release(); + cSamples2 = 0; + + //remove all pronounciation of the word + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING89, TEST_TOPIC); + + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak(szwNewWord, 0, 0); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + CHECKASSERTGOTOId((cSamples2 > 0 ), tpr, IDS_STRING75); + + //cSamples1 and cSamples2 should be very close + cDiff = abs(cSamples2 - cSamples1); + CHECKASSERTIdEx(( 5 * cDiff < cSamples2), tpr, IDS_STRING75, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "User lexicon test: Test #3"; + //====================================================================== + + //Choose a common word, "Computer", which IS a noun, and it may exist + //in app or vendor lexicion. Now we add its pron to the user lexicon + //as Noun word. Engine should use the pron in the user lexicon. + + cSamples1=0, cSamples2=0; + + //get new word and its pronounciation + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING64, szwNewWord );); + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING71, szwPronStr );); + + //this Speak uses the default pronunciation + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWord, cSamples1, cSamples1); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStr, szPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + //remove its pronounciation if it exists already in the user lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //add the pronounciation of the new word to User's lexicon + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + //This Speak should pick up the new pronounciation in the user lexicon + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWord, cSamples2, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //remove it if it exists already + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //The test assume that cSamples2 should be twice greater than cSamples1 + CHECKASSERTIdEx(( 2 * cSamples1 RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStrLower, szPronunciationLower); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + //remove its pronounciation if it exists already in the user lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWordLower, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //add the pronounciation of the new word to User's lexicon + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + //add the pronounciation of the new word to User's lexicon + hr = cpConlexicon->AddPronunciation(szwNewWordLower, LangID, SPPS_Noun, szPronunciationLower); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING87, TEST_TOPIC); + + //This Speak should pick up the new pronounciation in the user lexicon + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWordLower, cSamples1, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //remove it if it exists already + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //remove it if it exists already + hr = cpConlexicon->RemovePronunciation(szwNewWordLower, LangID, SPPS_Noun, szPronunciationLower); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //For Chinese/Japanese TTS Engines, the test ignores result check since + //No case Sensitivity in Chinese language + if ( ( LangID != 2052 ) && ( LangID != 1041 )) + { + //The test assume that cSamples1(upper case) should be twice greater than cSamples2 (lower case) + CHECKASSERTIdEx(( 2 * cSamples2 cpVoice; + CComPtr cpConlexicon; + CComPtr cpStream; + LANGID LangID; + WCHAR szwNewWord[MAX_PATH]=L""; + WCHAR szwPronStr[MAX_PATH]=L""; + WCHAR szAppPronunciation[MAX_PATH]=L""; + ULONG sample1 = 0, sample2 = 0; + + SPWORDPRONUNCIATIONLIST spPronList; + SPWORDPRONUNCIATION *psppron = NULL; + CComPtr cpLexiconApp; + + const char * TEST_TOPIC = "App lexicon test"; + + CSpStreamFormat InFormat(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId(hr, tpr, IDS_STRING84); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //get new word and its pronounciation + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING76, szwNewWord );); + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING94, szwPronStr );); + + //remove the test app lexicon if it exists from the last test run + DOCHECKHRGOTO( hr = RemoveTestAppLexicon();); + + //Make a backup of all existing App lexicons + hr = RegRecursiveCopyKey( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\Tokens"), + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\TokensBackup"), + TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING96, TEST_TOPIC ); + + //Disenable/delete exsisting app lexicons + hr = RegRecursiveDeleteKey( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\Tokens"), + TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING97, TEST_TOPIC ); + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); ); + + // Create a lexicon + DOCHECKHRGOTO (hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon); ); + + //the following is to erase the pronunciations of the new word in User's lexicon + ZeroStruct ( spPronList ); + + //get the pronounciation of the new word from the User's lexicon + hr = cpConlexicon->GetPronunciations(szwNewWord, LangID, eLEXTYPE_USER, &spPronList); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING86, TEST_TOPIC); + + //remove all the pronunciations of the new word in User lexicon + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Unknown, NULL); + CHECKHRALTIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //Speak this word before testing app lexicon and save the result to sample1 + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWord, sample1, sample1); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStr, szAppPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + //Create a test app lexicon + hr = CreateAppLexicon( + L"App lex test", + LangID, + L"App Lex test", + L"TTSCompliance;AppLexTest", + &cpLexiconApp); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING98, TEST_TOPIC ); + + // add a new word pronunciation to the new created app lexicon + hr = cpLexiconApp->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szAppPronunciation); + CHECKHRId( hr, tpr, IDS_STRING87); + + hr = cpLexiconApp->AddPronunciation(szwNewWord, LangID, SPPS_Verb, szAppPronunciation); + CHECKHRId( hr, tpr, IDS_STRING87); + + cpLexiconApp.Release(); + + //recreate a voice to make sure that the container lexicon notices the test app leixcon + cpVoice.Release(); + DOCHECKHRGOTO (hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); ); + + //The new pronunciation from the test app lexicon should be used here and + //its output will be saved to sample2 + hr = t_SpeakTwoStreams(cpVoice, szwNewWord, szwNewWord, sample2, sample2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC ); + + //restore the pronounciation of the new word to User's lexicon + for(psppron = spPronList.pFirstWordPronunciation; psppron && SUCCEEDED(hr) && (hr != SP_ALREADY_IN_LEX); psppron = psppron->pNextWordPronunciation) + { + hr = cpConlexicon -> AddPronunciation(szwNewWord, psppron->LangID, psppron->ePartOfSpeech, psppron->szPronunciation ); + } + ::CoTaskMemFree(spPronList.pvBuffer); + CHECKHRALTIdEx( hr, SP_ALREADY_IN_LEX, tpr, IDS_STRING87, TEST_TOPIC); + + cpConlexicon.Release(); + cpVoice.Release(); + + //remove the test app lexicon if it exists from the last test run + DOCHECKHR( hr = RemoveTestAppLexicon();); + + //Now, the test is done, so delete the test app lexicon + // and restore the previous app lexicons + hr = RegRecursiveCopyKey( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\TokensBackup"), + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\Tokens"), + TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING96, TEST_TOPIC ); + + //delete the backups + hr = RegRecursiveDeleteKey( + HKEY_LOCAL_MACHINE, + _T("SOFTWARE\\Microsoft\\Speech\\AppLexicons\\TokensBackup")); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING97, TEST_TOPIC ); + + CHECKASSERTGOTOIdEx( ( sample1 > 0 ), tpr, IDS_STRING74, TEST_TOPIC ); + CHECKASSERTGOTOIdEx( ( sample2 > 0 ), tpr, IDS_STRING74, TEST_TOPIC ); + + // Now compare the values from the 2 streams + // check to ensure the voice uses the new pronounciation in the test app lexicon + // which generates bigger samples than normal. + CHECKASSERTIdEx( (( 2 * sample2) > (3 * sample1)), tpr, IDS_STRING74, TEST_TOPIC ); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_LexiconMulti_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpConlexicon; + CComPtr cpStream; + LANGID LangID; + WCHAR szwNewWord[MAX_PATH]=L""; + WCHAR szwPronStr[MAX_PATH]=L""; + WCHAR szPronunciation[MAX_PATH]=L""; + + + CSpStreamFormat InFormat(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId(hr, tpr, IDS_STRING84); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //new word and its pronounciation + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING76, szwNewWord );); + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING94, szwPronStr );); + + // Create a lexicon + DOCHECKHRGOTO (hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon); ); + + //create stream + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOId( hr, tpr, IDS_STRING81); + + // Set the output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOId( hr, tpr, IDS_STRING60); + + //The new word is stored in szwNewWord and its pronunciation is in szwPronStr. + //First get the pronounciation of the string stored in szwPronStr, + //and then assign the pronounciation to szwNewWord + // + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwPronStr, szPronunciation); + CHECKHRGOTOId(hr, tpr, IDS_STRING77 ); + + //add the pronounciation of the new word to User's lexicon + hr = cpConlexicon->AddPronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRALTId( hr, SP_ALREADY_IN_LEX, tpr, IDS_STRING87); + + hr = cpVoice->Speak(szwNewWord, 0, 0); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, " in t_LexiconMultiTest"); + + hr = cpConlexicon->RemovePronunciation(szwNewWord, LangID, SPPS_Noun, szPronunciation); + CHECKHRALTId(hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89); + +EXIT: + return tpr; +} diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/realtime.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/realtime.cpp new file mode 100644 index 00000000..407c5848 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/realtime.cpp @@ -0,0 +1,623 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// realtime.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Helper class to slow down writes to memory stream. It simply forwards all +//***** calls onto IStream. However these tests write output to memory which is +//***** too fast to get events. The write method here has a Sleep(100) statement +//***** in it to make it closer to real time. +//****************************************************************************** + +class CTestStream : public ISpStream +{ + + /*=== Methods =======*/ + public: + /*--- Constructors/Destructors ---*/ + CTestStream(CSpStreamFormat &Fmt, HRESULT * phr) + : m_ulRef(1) + { + *phr = SPCreateStreamOnHGlobal( NULL, true, Fmt.FormatId(), Fmt.WaveFormatExPtr(), &m_cpStream ); + } + ~CTestStream() { SPDBG_ASSERT(m_ulRef == 0); } + + //--- IUnknown ---------------------------------------------- + STDMETHODIMP QueryInterface(REFIID riid, void ** ppv) + { + if (riid == __uuidof(ISpStream) || + riid == __uuidof(ISpStreamFormat) || + riid == IID_ISequentialStream || // Note: __uuidof() wont work on Windows CE + riid == __uuidof(IUnknown)) + { + *ppv = (ISpStream *)this; + m_ulRef++; + return S_OK; + } + *ppv = NULL; + return E_NOINTERFACE; + } + STDMETHODIMP_(ULONG) AddRef() + { + return ++m_ulRef; + } + STDMETHODIMP_(ULONG) Release() + { + if(--m_ulRef == 0) + { + delete this; + } + return m_ulRef; + } + + //--- ISequentialStream ------------------------------------- + STDMETHOD(Read)( void * pv, ULONG cb, ULONG * pcbRead ) + { return m_cpStream->Read(pv, cb, pcbRead); } + STDMETHOD(Write)( void const* pv, ULONG cb, ULONG * pcbWritten ) + { + ::Sleep( 2 ); + return m_cpStream->Write(pv, cb, pcbWritten); + } + + //--- ISpStream ------------------------------------- + STDMETHOD (GetFormat)(GUID * pFmtId, WAVEFORMATEX ** ppCoMemWaveFormatEx) + { return m_cpStream->GetFormat(pFmtId, ppCoMemWaveFormatEx);}; + + STDMETHOD (SetBaseStream)(IStream * pStream, REFGUID rguidFormat, const WAVEFORMATEX * pWaveFormatEx) + { return m_cpStream->SetBaseStream(pStream, rguidFormat, pWaveFormatEx);}; + + STDMETHOD (GetBaseStream)(IStream ** ppStream) + { return m_cpStream->GetBaseStream(ppStream);}; + STDMETHOD (BindToFile)(const WCHAR * pszFileName, SPFILEMODE eMode, + const GUID * pguidFormatId, const WAVEFORMATEX * pWaveformatEx, + ULONGLONG ullEventInterest) + { return m_cpStream->BindToFile(pszFileName, eMode, pguidFormatId, pWaveformatEx, ullEventInterest);}; + STDMETHOD (Close)() + { return m_cpStream->Close();}; + + //--- IStream -------------------------------------- + STDMETHOD(Seek)( LARGE_INTEGER dlibMove, DWORD dwOrigin, + ULARGE_INTEGER * plibNewPosition ) + { return m_cpStream->Seek(dlibMove, dwOrigin, plibNewPosition); } + STDMETHOD(SetSize)( ULARGE_INTEGER libNewSize ) + { return m_cpStream->SetSize(libNewSize); } + STDMETHOD(CopyTo)( IStream * pstm, ULARGE_INTEGER cb, ULARGE_INTEGER * pcbRead, + ULARGE_INTEGER * pcbWritten ) + { return m_cpStream->CopyTo(pstm, cb, pcbRead, pcbWritten); } + STDMETHOD(Commit)( DWORD grfCommitFlags ) + { return m_cpStream->Commit(grfCommitFlags); } + STDMETHOD(Revert)( void ) + { return m_cpStream->Revert(); } + STDMETHOD(LockRegion)( ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, + DWORD dwLockType ) + { return m_cpStream->LockRegion(libOffset, cb, dwLockType); } + STDMETHOD(UnlockRegion)( ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, + DWORD dwLockType ) + { return m_cpStream->UnlockRegion( libOffset, cb, dwLockType); } + STDMETHOD(Stat)( STATSTG * pstatstg, DWORD grfStatFlag ) + { return m_cpStream->Stat(pstatstg, grfStatFlag); } + STDMETHOD(Clone)( IStream ** ppstm ) + { return m_cpStream->Clone(ppstm); } + + /*=== Member Data ===*/ + protected: + CComPtr m_cpStream; + ULONG m_ulRef; +}; + +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + +/*****************************************************************************/ +TESTPROCAPI t_RealTimeRateChange(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test changes the rate of a TTS driver on the fly and checks to see if +// it actually sped up. +// NOTE - this test uses the SAPI Event Model to get bookmark event and will fail +//if engines have not implemented bookmark event. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_RealTimeRateChange_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +/*****************************************************************************/ +TESTPROCAPI t_RealTimeRateChange_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) + +{ + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0, cSamples3=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId( hr, tpr, IDS_STRING84); + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING53, szwSpeakStr );); + + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest( SPFEI(SPEI_TTS_BOOKMARK), 0);); + + //set the rate to the minimum value + DOCHECKHRGOTO (hr = cpVoice->SetRate( -10 );); + + //====================================================================== + TEST_TOPIC = "t_RealTimeRateChange test: First stream"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetRate to -5 test - Thread Id: %x", GetCurrentThreadId()); + //*** First stream with rate set to -5 below default + + // Create memory stream #1 + CComPtr cpMemStream1; + cpMemStream1.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the output to memory + hr = cpVoice->SetOutput( cpMemStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the rate. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetRate( -5 ); + CHECKHRIdEx( hr, tpr, IDS_STRING16, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Get stream size + hr = cpMemStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + } + //====================================================================== + TEST_TOPIC = "t_RealTimeRateChange test: Second stream"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetRate to 0 test - Thread Id: %x", GetCurrentThreadId()); + //*** Second stream with rate set to default + + CComPtr cpMemStream2; + cpMemStream2.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the output to memory + hr = cpVoice->SetOutput( cpMemStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the rate. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetRate( 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING16, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Get stream size + hr = cpMemStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + } + + //====================================================================== + TEST_TOPIC = "t_RealTimeRateChange test: third stream"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetRate to 10 test - Thread Id: %x", GetCurrentThreadId()); + //*** third stream with rate set to 10 above default + + // Create memory stream #3 + CComPtr cpMemStream3; + cpMemStream3.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the output to memory + hr = cpVoice->SetOutput(cpMemStream3, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the rate. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetRate( 10 ); + CHECKHRIdEx( hr, tpr, IDS_STRING16, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Get stream size + hr = cpMemStream3->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples3 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + } + + //In Multithreaded case, the test only checks to ensure the system does not fail + if (!bCalledByMulti ) + { + // Now compare the values from the 3 streams + // Note - The higher rate, the shorter the overall stream length + // + CHECKASSERTGOTOId(( cSamples1 > 0 ), tpr, IDS_STRING54); + CHECKASSERTGOTOId(( cSamples2 > 0 ), tpr, IDS_STRING54); + CHECKASSERTGOTOId(( cSamples3 > 0 ), tpr, IDS_STRING54); + + CHECKASSERTId(( cSamples1 > cSamples2 ), tpr, IDS_STRING54); + CHECKASSERTId(( cSamples2 > cSamples3 ), tpr, IDS_STRING54); + } + +EXIT: + //set back to default + cpVoice->SetRate( 0 ); + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_RealTimeVolumeChange(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test changes the volume of a TTS driver on the fly and checks to see if +// it actually got louder. +// NOTE - this test uses the SAPI Event Model to get bookmark event and will fail +//if engines have not implemented bookmark event. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_RealTimeVolumeChange_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +/*****************************************************************************/ +TESTPROCAPI t_RealTimeVolumeChange_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) + +{ + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + WCHAR szwSpeakStr[MAX_PATH]=L""; + ULONG totalAmp1 = 0, totalAmp2 = 0, totalAmp3 = 0; + const char * TEST_TOPIC = ""; + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId( hr, tpr, IDS_STRING84); + + LARGE_INTEGER l; + l.QuadPart = 0; + + //get the speak string + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING53, szwSpeakStr );); + + DOCHECKHRGOTO (hr = cpVoice->SetNotifyWin32Event();); + + //set interest events + DOCHECKHRGOTO (hr = cpVoice->SetInterest( SPFEI(SPEI_TTS_BOOKMARK), 0);); + + //set the start volume to max + DOCHECKHRGOTO (hr = cpVoice->SetVolume( 100 );); + + //====================================================================== + TEST_TOPIC = "t_RealTimeVolumeChangeTest: Stream 1 with Volume 100"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetVolume to 90 test - Thread Id: %x", GetCurrentThreadId()); + + // Create memory for stream #1 + CComPtr cpMemStream1; + cpMemStream1.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the default output format + hr = cpVoice->SetOutput( cpMemStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the volume. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetVolume( 90 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Reset stream to beginning + hr = cpMemStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpMemStream1, &totalAmp1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + } + //====================================================================== + TEST_TOPIC = "t_RealTimeVolumeChangeTest: Stream 2 with Volume 50"; + //====================================================================== + // Create stream #2 + { + g_pKato->Comment(5, "Real time SetVolume to 50 test - Thread Id: %x", GetCurrentThreadId()); + // Create memory for stream #2 + CComPtr cpMemStream2; + cpMemStream2.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the default output format + hr = cpVoice->SetOutput(cpMemStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the volume. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetVolume( 50 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Reset stream to beginning + hr = cpMemStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 2 + hr = GetAmpFromSamples (cpMemStream2, &totalAmp2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + } + + //====================================================================== + TEST_TOPIC = "t_RealTimeVolumeChangeTest: Stream 3 with Volume 1"; + //====================================================================== + { + g_pKato->Comment(5, "Real time SetVolume to 1 test - Thread Id: %x", GetCurrentThreadId()); + // Create memory for stream #3 + CComPtr cpMemStream3; + cpMemStream3.p = new CTestStream(NewFmt, &hr); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + //clean up the event queue + while(S_OK == cpVoice->WaitForNotifyEvent(0)); + + // Set the default output format + hr = cpVoice->SetOutput( cpMemStream3, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + //wait for bookmark event + hr = cpVoice->WaitForNotifyEvent(TTS_WAITTIME); + if (bCalledByMulti ) + { + //In Multi threaded case + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING62, TEST_TOPIC); + } + else + { + //normal case + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING62, TEST_TOPIC); + } + + //set the volume. At this time, the engine is busying in processing Speak call + hr = cpVoice->SetVolume( 1 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME_LONG ); + if (!bCalledByMulti ) + { + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, TEST_TOPIC); + } + else + { + CHECKHRIdEx( hr, tpr, IDS_STRING61, TEST_TOPIC); + } + + // Reset stream to beginning + hr = cpMemStream3->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 3 + hr = GetAmpFromSamples (cpMemStream3, &totalAmp3 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + } + + if (!bCalledByMulti ) + { + // Now compare the values from the 3 streams + + CHECKASSERTGOTOId(( totalAmp1 > 0 ), tpr, IDS_STRING55); + CHECKASSERTGOTOId(( totalAmp2 > 0 ), tpr, IDS_STRING55); + CHECKASSERTGOTOId(( totalAmp3 > 0 ), tpr, IDS_STRING55); + + CHECKASSERTId(( totalAmp1 > totalAmp2 ), tpr, IDS_STRING55); + CHECKASSERTId(( totalAmp2 > totalAmp3 ), tpr, IDS_STRING55); + + } + +EXIT: + //set back to default + cpVoice->SetVolume( 100 ); + return tpr; +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/resource.h b/sp/src/utils/sapi51/Tools/Comp/TTS/resource.h new file mode 100644 index 00000000..eab9e0a8 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/resource.h @@ -0,0 +1,137 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by ttscomp.rc +// +#define IDS_STRING1 1 +#define IDS_STRING2 2 +#define IDS_STRING3 3 +#define IDS_STRING4 4 +#define IDS_STRING5 5 +#define IDS_STRING6 6 +#define IDS_STRING7 7 +#define IDS_STRING8 8 +#define IDS_STRING9 9 +#define IDS_STRING10 10 +#define IDS_STRING11 11 +#define IDS_STRING12 12 +#define IDS_STRING13 13 +#define IDS_STRING14 14 +#define IDS_STRING15 15 +#define IDS_STRING16 16 +#define IDS_STRING17 17 +#define IDS_STRING18 18 +#define IDS_STRING19 19 +#define IDS_STRING20 20 +#define IDS_STRING21 21 +#define IDS_STRING22 22 +#define IDS_STRING23 23 +#define IDS_STRING24 24 +#define IDS_STRING25 25 +#define IDS_STRING26 26 +#define IDS_STRING27 27 +#define IDS_STRING28 28 +#define IDS_STRING29 29 +#define IDS_STRING30 30 +#define IDS_STRING31 31 +#define IDS_STRING32 32 +#define IDS_STRING33 33 +#define IDS_STRING34 34 +#define IDS_STRING35 35 +#define IDS_STRING36 36 +#define IDS_STRING37 37 +#define IDS_STRING38 38 +#define IDS_STRING39 39 +#define IDS_STRING40 40 +#define IDS_STRING41 41 +#define IDS_STRING42 42 +#define IDS_STRING43 43 +#define IDS_STRING44 44 +#define IDS_STRING45 45 +#define IDS_STRING46 46 +#define IDS_STRING47 47 +#define IDS_STRING48 48 +#define IDS_STRING49 49 +#define IDS_STRING50 50 +#define IDS_STRING51 51 +#define IDS_STRING52 52 +#define IDS_STRING53 53 +#define IDS_STRING54 54 +#define IDS_STRING55 55 +#define IDS_STRING56 56 +#define IDS_STRING57 57 +#define IDS_STRING58 58 +#define IDS_STRING59 59 +#define IDS_STRING60 60 +#define IDS_STRING61 61 +#define IDS_STRING62 62 +#define IDS_STRING63 63 +#define IDS_STRING64 64 +#define IDS_STRING65 65 +#define IDS_STRING66 66 +#define IDS_STRING67 67 +#define IDS_STRING68 68 +#define IDS_STRING69 69 +#define IDS_STRING70 70 +#define IDS_STRING71 71 +#define IDS_STRING72 72 +#define IDS_STRING73 73 +#define IDS_STRING74 74 +#define IDS_STRING75 75 +#define IDS_STRING76 76 +#define IDS_STRING77 77 +#define IDS_STRING78 78 +#define IDS_STRING79 79 +#define IDS_STRING81 81 +#define IDS_STRING82 82 +#define IDS_STRING83 83 +#define IDS_STRING84 84 +#define IDS_STRING85 85 +#define IDS_STRING86 86 +#define IDS_STRING87 87 +#define IDS_STRING88 88 +#define IDS_STRING89 89 +#define IDS_STRING90 90 +#define IDS_STRING91 91 +#define IDS_STRING92 92 +#define IDS_STRING93 93 +#define IDS_STRING94 94 +#define IDS_STRING95 95 +#define IDS_STRING96 96 +#define IDS_STRING97 97 +#define IDS_STRING98 98 +#define IDS_STRING99 99 +#define IDS_STRING100 100 +#define IDS_STRING101 101 +#define IDS_STRING102 102 +#define IDD_DIALOG1 102 +#define IDS_STRING103 103 +#define IDS_STRING104 104 +#define IDS_STRING105 105 +#define IDS_STRING106 106 +#define IDS_STRING107 107 +#define IDS_STRING108 108 +#define IDS_STRING109 109 +#define IDS_STRING110 110 +#define IDS_STRING111 111 +#define IDS_STRING112 112 +#define IDS_STRING113 113 +#define IDS_STRING114 114 +#define IDS_STRING115 115 +#define IDS_STRING116 116 +#define IDS_STRING117 117 +#define IDS_STRING118 118 +#define IDS_STRING119 119 +#define IDS_STRING120 120 +#define IDS_STRING121 121 +#define IDS_STRING122 122 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.cpp new file mode 100644 index 00000000..7cb08134 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.cpp @@ -0,0 +1,176 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// spgeterrormsg.cpp +// +//****************************************************************************** + +#include "ttscomp.h" + +#pragma warning (disable : 4786) +#include + +typedef std::map HRMAP; +typedef HRMAP::value_type HRPAIR; + +void InitSpErrorMsg(HRMAP& rhrmap); + +inline LPCSTR SpGetErrorMsg(HRESULT hr) +{ + static char szMessageBuffer[MAX_PATH]; + static bool s_fInit; + static HRMAP s_hrmap; + + if(!s_fInit) + { + InitSpErrorMsg(s_hrmap); + s_fInit = true; + } + + HRMAP::iterator it = s_hrmap.find(hr); + if(it != s_hrmap.end()) + { + return it->second; + } + else if(FAILED(hr)) // FormatMessage will treat SUCCEEDED(hr) as Win32 error code + { + DWORD cbWrite = ::FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), szMessageBuffer, 256, NULL); + if(cbWrite > 0) + { + // truncate the ending CRLF + szMessageBuffer[strlen(szMessageBuffer) - 2] = 0; + return szMessageBuffer; + } + } + + sprintf(szMessageBuffer, "0x%08x", hr); + return szMessageBuffer; +} + +inline void InitSpErrorMsg(HRMAP& rhrmap) +{ +#define ADD_HR_PAIR(hr) rhrmap.insert(HRPAIR(hr, #hr)) +#define ADD_WIN32_PAIR(errno) rhrmap.insert(HRPAIR(SpHrFromWin32(errno), "SpHrFromWin32("#errno")")) + ADD_HR_PAIR(S_OK); + ADD_HR_PAIR(S_FALSE); + + // If we have two names for the same hr, the first one inserted will count. + // So the SAPI names are put before standard names. + + // The following error codes are based on sperror.h#10 + // Note: Please update the version number above when new codes added. + ADD_HR_PAIR(SPERR_UNINITIALIZED); + ADD_HR_PAIR(SPERR_ALREADY_INITIALIZED); + ADD_HR_PAIR(SPERR_UNSUPPORTED_FORMAT); + ADD_HR_PAIR(SPERR_INVALID_FLAGS); + ADD_HR_PAIR(SP_END_OF_STREAM); + ADD_HR_PAIR(SPERR_DEVICE_BUSY); + ADD_HR_PAIR(SPERR_DEVICE_NOT_SUPPORTED); + ADD_HR_PAIR(SPERR_DEVICE_NOT_ENABLED); + ADD_HR_PAIR(SPERR_NO_DRIVER); + ADD_HR_PAIR(SPERR_FILE_MUST_BE_UNICODE); + ADD_HR_PAIR(SP_INSUFFICIENT_DATA); + ADD_HR_PAIR(SPERR_INVALID_PHRASE_ID); + ADD_HR_PAIR(SPERR_BUFFER_TOO_SMALL); + ADD_HR_PAIR(SPERR_FORMAT_NOT_SPECIFIED); + ADD_HR_PAIR(SPERR_AUDIO_STOPPED); + ADD_HR_PAIR(SP_AUDIO_PAUSED); + ADD_HR_PAIR(SPERR_RULE_NOT_FOUND); + ADD_HR_PAIR(SPERR_TTS_ENGINE_EXCEPTION); + ADD_HR_PAIR(SPERR_TTS_NLP_EXCEPTION); + ADD_HR_PAIR(SPERR_ENGINE_BUSY); + ADD_HR_PAIR(SP_AUDIO_CONVERSION_ENABLED); + ADD_HR_PAIR(SP_NO_HYPOTHESIS_AVAILABLE); + ADD_HR_PAIR(SPERR_CANT_CREATE); + ADD_HR_PAIR(SP_ALREADY_IN_LEX); + ADD_HR_PAIR(SPERR_NOT_IN_LEX); + ADD_HR_PAIR(SP_LEX_NOTHING_TO_SYNC); + ADD_HR_PAIR(SPERR_LEX_VERY_OUT_OF_SYNC); + ADD_HR_PAIR(SPERR_UNDEFINED_FORWARD_RULE_REF); + ADD_HR_PAIR(SPERR_EMPTY_RULE); + ADD_HR_PAIR(SPERR_GRAMMAR_COMPILER_INTERNAL_ERROR); + ADD_HR_PAIR(SPERR_RULE_NOT_DYNAMIC); + ADD_HR_PAIR(SPERR_DUPLICATE_RULE_NAME); + ADD_HR_PAIR(SPERR_DUPLICATE_RESOURCE_NAME); + ADD_HR_PAIR(SPERR_TOO_MANY_GRAMMARS); + ADD_HR_PAIR(SPERR_CIRCULAR_REFERENCE); + ADD_HR_PAIR(SPERR_INVALID_IMPORT); + ADD_HR_PAIR(SPERR_INVALID_WAV_FILE); + ADD_HR_PAIR(SP_REQUEST_PENDING); + ADD_HR_PAIR(SPERR_ALL_WORDS_OPTIONAL); + ADD_HR_PAIR(SPERR_INSTANCE_CHANGE_INVALID); + ADD_HR_PAIR(SPERR_RULE_NAME_ID_CONFLICT); + ADD_HR_PAIR(SPERR_NO_RULES); + ADD_HR_PAIR(SPERR_CIRCULAR_RULE_REF); + ADD_HR_PAIR(SP_NO_PARSE_FOUND); + ADD_HR_PAIR(SPERR_INVALID_HANDLE); + ADD_HR_PAIR(SPERR_REMOTE_CALL_TIMED_OUT); + ADD_HR_PAIR(SPERR_AUDIO_BUFFER_OVERFLOW); + ADD_HR_PAIR(SPERR_NO_AUDIO_DATA); + ADD_HR_PAIR(SPERR_DEAD_ALTERNATE); + ADD_HR_PAIR(SPERR_HIGH_LOW_CONFIDENCE); + ADD_HR_PAIR(SPERR_INVALID_FORMAT_STRING); + ADD_HR_PAIR(SP_UNSUPPORTED_ON_STREAM_INPUT); + ADD_HR_PAIR(SPERR_APPLEX_READ_ONLY); + ADD_HR_PAIR(SPERR_NO_TERMINATING_RULE_PATH); + ADD_HR_PAIR(SP_WORD_EXISTS_WITHOUT_PRONUNCIATION); + ADD_HR_PAIR(SPERR_STREAM_CLOSED); + ADD_HR_PAIR(SPERR_NO_MORE_ITEMS); + ADD_HR_PAIR(SPERR_NOT_FOUND); + ADD_HR_PAIR(SPERR_INVALID_AUDIO_STATE); + ADD_HR_PAIR(SPERR_GENERIC_MMSYS_ERROR); + ADD_HR_PAIR(SPERR_MARSHALER_EXCEPTION); + ADD_HR_PAIR(SPERR_NOT_DYNAMIC_GRAMMAR); + ADD_HR_PAIR(SPERR_AMBIGUOUS_PROPERTY); + ADD_HR_PAIR(SPERR_INVALID_REGISTRY_KEY); + ADD_HR_PAIR(SPERR_INVALID_TOKEN_ID); + ADD_HR_PAIR(SPERR_XML_BAD_SYNTAX); + ADD_HR_PAIR(SPERR_XML_RESOURCE_NOT_FOUND); + ADD_HR_PAIR(SPERR_TOKEN_IN_USE); + ADD_HR_PAIR(SPERR_TOKEN_DELETED); + ADD_HR_PAIR(SPERR_MULTI_LINGUAL_NOT_SUPPORTED); + ADD_HR_PAIR(SPERR_EXPORT_DYNAMIC_RULE); + ADD_HR_PAIR(SPERR_STGF_ERROR); + ADD_HR_PAIR(SPERR_WORDFORMAT_ERROR); + ADD_HR_PAIR(SPERR_STREAM_NOT_ACTIVE); + ADD_HR_PAIR(SPERR_ENGINE_RESPONSE_INVALID); + ADD_HR_PAIR(SPERR_SR_ENGINE_EXCEPTION); + ADD_HR_PAIR(SPERR_STREAM_POS_INVALID); + ADD_HR_PAIR(SP_RECOGNIZER_INACTIVE); + ADD_HR_PAIR(SPERR_REMOTE_CALL_ON_WRONG_THREAD); + ADD_HR_PAIR(SPERR_REMOTE_PROCESS_TERMINATED); + ADD_HR_PAIR(SPERR_REMOTE_PROCESS_ALREADY_RUNNING); + ADD_HR_PAIR(SPERR_LANGID_MISMATCH); + ADD_HR_PAIR(SP_PARTIAL_PARSE_FOUND); + ADD_HR_PAIR(SPERR_NOT_TOPLEVEL_RULE); + ADD_HR_PAIR(SP_NO_RULE_ACTIVE); + ADD_HR_PAIR(SPERR_LEX_REQUIRES_COOKIE); + ADD_HR_PAIR(SP_STREAM_UNINITIALIZED); + ADD_HR_PAIR(SPERR_UNSUPPORTED_LANG); + ADD_HR_PAIR(SPERR_VOICE_PAUSED); + ADD_HR_PAIR(SPERR_AUDIO_BUFFER_UNDERFLOW); + ADD_HR_PAIR(SPERR_AUDIO_STOPPED_UNEXPECTEDLY); + ADD_HR_PAIR(SPERR_NO_WORD_PRONUNCIATION); + ADD_HR_PAIR(SPERR_ALTERNATES_WOULD_BE_INCONSISTENT); + + // These are standard error codes: + ADD_HR_PAIR(E_NOTIMPL); + ADD_HR_PAIR(E_UNEXPECTED); + ADD_HR_PAIR(E_OUTOFMEMORY); + ADD_HR_PAIR(E_INVALIDARG); + ADD_HR_PAIR(E_NOINTERFACE); + ADD_HR_PAIR(E_POINTER); + ADD_HR_PAIR(E_HANDLE); + ADD_HR_PAIR(E_ABORT); + ADD_HR_PAIR(E_FAIL); + ADD_HR_PAIR(E_ACCESSDENIED); + ADD_HR_PAIR(REGDB_E_CLASSNOTREG); + ADD_HR_PAIR(REGDB_E_IIDNOTREG); + + ADD_WIN32_PAIR(ERROR_BAD_EXE_FORMAT); + ADD_WIN32_PAIR(ERROR_RESOURCE_DATA_NOT_FOUND); + ADD_WIN32_PAIR(ERROR_RESOURCE_TYPE_NOT_FOUND); + ADD_WIN32_PAIR(ERROR_RESOURCE_NAME_NOT_FOUND); + ADD_WIN32_PAIR(ERROR_RESOURCE_LANG_NOT_FOUND); +#undef ADD_HR_PAIR +#undef ADD_WIN32_PAIR +} \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.h b/sp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.h new file mode 100644 index 00000000..f869a169 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/spgeterrormsg.h @@ -0,0 +1,9 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// spgeterrormsg.h +// +//****************************************************************************** + +#include + +extern LPCSTR SpGetErrorMsg(HRESULT hr); diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/stress.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/stress.cpp new file mode 100644 index 00000000..8362a023 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/stress.cpp @@ -0,0 +1,186 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// stress.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** +extern CRITICAL_SECTION g_csProcess; + +#define NUM_STRESS_RUNS 20 +//****************************************************************************** +//***** TestProc()'s +//****************************************************************************** + + +/*****************************************************************************/ +TESTPROCAPI t_MultiInstanceTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ +// This test randomly calls all the other functions contained in this dll. This +// function will be called on multiple threads and each thread has its own voice +// Object. + + + // Message check + if (uMsg == TPM_QUERY_THREAD_COUNT) + { + CleanupVoiceAndEngine(); + ((LPTPS_QUERY_THREAD_COUNT)tpParam)->dwThreadCount = 4; + return TPR_HANDLED; + } + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + else + { + srand(reinterpret_cast(tpParam)->dwRandomSeed); + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + int iRand, i; + CComPtr cpLocalVoice; + + + //create a SAPI voice, each thread has its own voice + hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice ); + CHECKHRGOTOId( hr, tpr, IDS_STRING85 ); + + for( i=0; iComment(5, TEXT("Test #0 - Enter t_ISpTTSEngine_Speak - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_Speak_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #0 - Exit t_ISpTTSEngine_Speak - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 1: + g_pKato->Comment(5, TEXT("Test #1 - Enter t_ISpTTSEngine_Skip - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_Skip_Test ( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #1 - Exit t_ISpTTSEngine_Skip - Thread Id: %x"), GetCurrentThreadId()); + + break; + + case 2: + g_pKato->Comment(5, TEXT("Test #2 - Enter t_ISpTTSEngine_GetOutputFormat - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_GetOutputFormat_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #2 - Exit t_ISpTTSEngine_GetOutputFormat - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 3: + g_pKato->Comment(5, TEXT("Test #3 - Enter t_ISpTTSEngine_SetRate - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_SetRate_Test( uMsg, tpParam, NULL , cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #3 - Exit t_ISpTTSEngine_SetRate - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 4: + g_pKato->Comment(5, TEXT("Test #4 - Enter t_ISpTTSEngine_SetVolume - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_ISpTTSEngine_SetVolume_Test( uMsg, tpParam, NULL , cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #4 - Exit t_ISpTTSEngine_SetVolume - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 5: + g_pKato->Comment(5, TEXT("Test #5 - Enter t_CheckEventsSAPI - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_CheckEventsSAPI_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #5 - Exit t_CheckEventsSAPI - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 6: + g_pKato->Comment(5, TEXT("Test #6 - Enter t_XMLBookmarkTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLBookmark_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #6 - Exit t_XMLBookmarkTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 7: + g_pKato->Comment(5, TEXT("Test #7 - Enter t_XMLSilenceTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLSilence_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #7 - Exit t_XMLSilenceTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 8: + g_pKato->Comment(5, TEXT("Test #8 - Enter t_XMLSpellTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLSpell_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #8 - Exit t_XMLSpellTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 9: + g_pKato->Comment(5, TEXT("Test #9 - Enter t_XMLPronounceTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLPronounce_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #9 - Exit t_XMLPronounceTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 10: + g_pKato->Comment(5, TEXT("Test #10 - Enter t_XMLRateTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLRate_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #10 - Exit t_XMLRateTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 11: + g_pKato->Comment(5, TEXT("Test #11 - Enter t_XMLVolumeTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLVolume_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #11 - Exit t_XMLVolumeTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 12: + g_pKato->Comment(5, TEXT("Test #12 - Enter t_XMLPitchTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLPitch_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #12 - Exit t_XMLPitchTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 13: + g_pKato->Comment(5, TEXT("Test #13 - Enter t_RealTimeRateChangeTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_RealTimeRateChange_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #13 - Exit t_RealTimeRateChangeTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 14: + g_pKato->Comment(5, TEXT("Test #14 - Enter t_RealTimeVolumeChangeTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_RealTimeVolumeChange_Test( uMsg, tpParam, NULL , cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #14 - Exit t_RealTimeVolumeChangeTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 15: + g_pKato->Comment(5, TEXT("Test #15 - Enter t_SpeakStop_Test - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_SpeakStop_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #15 - Exit t_SpeakStop_Test - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 16: + g_pKato->Comment(5, TEXT("Test #16 - Enter t_LexiconMultiTest Test - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_LexiconMulti_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #16 - Exit t_LexiconMultiTest Test - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 17: + g_pKato->Comment(5, TEXT("Test #17 - Enter t_XMLSAPIMarkupTest - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLSAPIMarkup_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #17 - Exit t_XMLSAPIMarkupTest - Thread Id: %x"), GetCurrentThreadId()); + break; + + case 18: + g_pKato->Comment(5, TEXT("Test #18 - Enter t_XMLContext_Test - Thread Id: %x"), GetCurrentThreadId()); + tpr = t_XMLContext_Test( uMsg, tpParam, NULL, cpLocalVoice, true ); + g_pKato->Comment(5, TEXT("Test #18 - Exit t_XMLContext_Test - Thread Id: %x"), GetCurrentThreadId()); + break; + } + + if( tpr != TPR_PASS ) + { + return tpr; + } + } + +EXIT: + return tpr; +} diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/tts.dsp b/sp/src/utils/sapi51/Tools/Comp/TTS/tts.dsp new file mode 100644 index 00000000..f3a7bf40 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/tts.dsp @@ -0,0 +1,156 @@ +# Microsoft Developer Studio Project File - Name="ttscomp" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=ttscomp - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tts.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tts.mak" CFG="ttscomp - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ttscomp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "ttscomp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ttscomp - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TTSCOMP_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\common\include" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TTSCOMP_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 f0r.lib urlmon.lib kato.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /machine:I386 /out:"Release/ttscomp.dll" /pdbtype:sept /libpath:"..\common\lib" /libpath:"..\..\..\lib\i386" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "ttscomp - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TTSCOMP_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\common\include" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TTSCOMP_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 f0d.lib urlmon.lib kato.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/ttscomp.dll" /pdbtype:sept /libpath:"..\common\lib" /libpath:"..\..\..\lib\i386" + +!ENDIF + +# Begin Target + +# Name "ttscomp - Win32 Release" +# Name "ttscomp - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "Test Modules" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\audiostate.cpp +# End Source File +# Begin Source File + +SOURCE=.\compevents.cpp +# End Source File +# Begin Source File + +SOURCE=.\ispttsengine.cpp +# End Source File +# Begin Source File + +SOURCE=.\lexicon.cpp +# End Source File +# Begin Source File + +SOURCE=.\realtime.cpp +# End Source File +# Begin Source File + +SOURCE=.\stress.cpp +# End Source File +# Begin Source File + +SOURCE=.\ttsmarkup.cpp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\spgeterrormsg.cpp +# End Source File +# Begin Source File + +SOURCE=.\ttscomp.cpp +# End Source File +# Begin Source File + +SOURCE=.\ttscomp.rc +# End Source File +# Begin Source File + +SOURCE=..\Common\def\ttscomp.def +# End Source File +# Begin Source File + +SOURCE=..\Common\cpp\TUXDLL.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.cpp new file mode 100644 index 00000000..57339304 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.cpp @@ -0,0 +1,69 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// ttscomp.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +// BASE is a unique value assigned to a given tester or component. This value, +// when combined with each of the following test's unique IDs, allows every +// test case within the entire team to be uniquely identified. + +#define BASE 0x000A4000 + + +// Our function table that we pass to Tux +FUNCTION_TABLE_ENTRY g_lpFTE[] = { +TEXT("TTS Compliance Test" ), 0, 0, 0, NULL, + TEXT("ISpTTSEngine" ), 1, 0, 0, NULL, + TEXT( "Speak" ), 2, 0, BASE+ 1, t_ISpTTSEngine_Speak, + TEXT( "Skip" ), 2, 0, BASE+ 2, t_ISpTTSEngine_Skip, + TEXT( "GetOutputFormat" ), 2, 0, BASE+ 3, t_ISpTTSEngine_GetOutputFormat, + TEXT( "SetRate" ), 2, 0, BASE+ 4, t_ISpTTSEngine_SetRate, + TEXT( "SetVolume" ), 2, 0, BASE+ 5, t_ISpTTSEngine_SetVolume, + TEXT( "Eventing" ), 1, 0, 0, NULL, + TEXT( "Check SAPI required Events" ), 2, 0, BASE+ 101, t_CheckEventsSAPI, + TEXT("TTS XML Markup" ), 1, 0, 0, NULL, + TEXT( "Bookmark" ), 2, 0, BASE+ 201, t_XMLBookmark, + TEXT( "Silence" ), 2, 0, BASE+ 202, t_XMLSilence, + TEXT( "Spell" ), 2, 0, BASE+ 203, t_XMLSpell, + TEXT( "Pronounce" ), 2, 0, BASE+ 204, t_XMLPronounce, + TEXT( "Rate" ), 2, 0, BASE+ 205, t_XMLRate, + TEXT( "Volume" ), 2, 0, BASE+ 206, t_XMLVolume, + TEXT( "Pitch" ), 2, 0, BASE+ 207, t_XMLPitch, + TEXT( "Non-SAPI tags" ), 2, 0, BASE+ 208, t_XMLNonSapiTagsTest, + TEXT( "Context" ), 2, 0, BASE+ 212, t_XMLContext, + TEXT("Real Time Rate/Vol Tests" ), 1, 0, 0, NULL, + TEXT( "Real time rate change" ), 2, 0, BASE+ 301, t_RealTimeRateChange, + TEXT( "Real time volume change" ), 2, 0, BASE+ 302, t_RealTimeVolumeChange, + TEXT("Audio State Tests" ), 1, 0, 0, NULL, + TEXT( "Speak Stop" ), 2, 0, BASE+ 402, t_SpeakStop, + TEXT( "Speak Destroy" ), 2, 0, BASE+ 403, t_SpeakDestroy, + TEXT("Lexicon Tests" ), 1, 0, 0, NULL, + TEXT( "User Lexicon Test" ), 2, 0, BASE+ 501, t_UserLexiconTest, + TEXT( "App Lexicon Test" ), 2, 0, BASE+ 502, t_AppLexiconTest, + TEXT("Multiple Instance Test" ), 1, 0, 0, NULL, + TEXT( "Multiple-Instance Test" ), 2, 0, BASE+ 601, t_MultiInstanceTest, + TEXT("Features" ), 0, 0, 0, NULL, + TEXT( "Emph" ), 1, 0, BASE+ 801, t_XMLEmphTest, + TEXT( "Phoneme & Viseme Events" ), 1, 0, BASE+ 805, t_CheckEventsNotRequire, + TEXT( "PartOfSp" ), 1, 0, BASE+ 806, t_XMLPartOfSpTest, + + NULL , 0, 0, 0, NULL // marks end of list +}; + + +// Stub function for cleaning up globals before dll is unloaded +void CleanupTest() +{ + CleanupVoiceAndEngine(); +} + +HRESULT PreTestSetup(void) { + return S_OK; +} + +HRESULT PostTestCleanup(void) { + return S_OK; +} diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.h b/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.h new file mode 100644 index 00000000..614c7e98 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.h @@ -0,0 +1,1012 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// ttscomp.h +// +//****************************************************************************** + +#ifndef __TTSCOMP_H__ +#define __TTSCOMP_H__ + +#include + +#include +#define ATLASSERT(expr) SPDBG_ASSERT(expr) +// Replace ATLASSERT with SPDBG_ASSERT. +// If the compiler says macro redefinition at this line, you need to remove any +// #include before include this file +#include + +#include +#include +#include +#include +#include +#include "sapi.h" +#include "sapiddk.h" +#include +#include +#include "spgeterrormsg.h" +#include "resource.h" +#include +#include + + +// Added for logging across .cpp files +extern CKato *g_pKato; +extern SPS_SHELL_INFO *g_pShellInfo; + +//************* Helper function prototypes ************* +HRESULT GetWStrFromRes( UINT id, WCHAR* szwStr, int cchBufferMax = MAX_PATH); +HRESULT RegRecursiveCopyKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, HKEY hkeyDest, LPCTSTR szSubKeyDest, BOOL fClearDest = FALSE); +HRESULT RegRecursiveDeleteKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, BOOL fKeepEmptyRoot = FALSE); +void CleanupVoiceAndEngine(); +HRESULT GetFreqFromSamples (ISpStream * pStream, int sampFreq, ULONG &length, ULONG * pAverage ); +int ComputeF0 (float* data, int nData, int sampFreq, int minF0, int maxF0, int feaSampFreq, + float** f0, int* nF0, float **pRms, int *nRms); +HRESULT SpGetLanguageIdFromDefaultVoice(LANGID *plangid); +HRESULT SPCreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, REFGUID rguidFormatId, + const WAVEFORMATEX * pwfex, ISpStream ** ppStream ); + +#define TTS_WAITTIME 30000 //30 seconds +#define TTS_WAITTIME_LONG 90000 //90 seconds + +// Useful macros and definitions +#define ZeroStruct(structvar) memset(&(structvar),0,sizeof(structvar)) +#define SP_IS_BAD_WRITE_PTR(p) ( SPIsBadWritePtr( p, sizeof(*(p)) )) + +inline BOOL SPIsBadWritePtr( void* pMem, UINT Size ) +{ +#ifdef _DEBUG + BOOL bIsBad = ::IsBadWritePtr( pMem, Size ); + SPDBG_ASSERT(!bIsBad); + return bIsBad; +#else + return ::IsBadWritePtr( pMem, Size ); +#endif +} + +template +class CAutoReleaseComPtr: public CComPtr +{ +public: + T ** operator&() + { + Release(); + return CComPtr::operator &(); + } +}; + +#define DOCHECKHRGOTO(statement) statement CHECKHRGOTO(hr, tpr, #statement); +#define DOCHECKHR(statement) statement CHECKHR(hr, tpr, #statement); + +inline LPCSTR CatMsg( LPCSTR psz1, LPCSTR psz2 = NULL, LPCSTR psz3 = NULL, LPCSTR psz4 = NULL, LPCSTR psz5 = NULL) +{ + static std::string s_str; + + { // make a new copy so that it works for CatMsg(CatMsg(str1, ...), str2, ...); + std::string str = psz1; + if(psz2) str += psz2; + if(psz3) str += psz3; + if(psz4) str += psz4; + if(psz5) str += psz5; + s_str = str; + } + + return s_str.c_str(); +} + +#define CHECKHRALTId( hr, althr, tpr, id ) \ +{ \ + if( FAILED( hr ) && (hr != althr) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if(SUCCEEDED(GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + } \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRALTIdEx( hr, althr, tpr, id, topic ) \ +{ \ + \ + if( FAILED( hr ) && (hr != althr) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + g_pKato->Comment(10, CatMsg(SpGetErrorMsg(hr), " in ", topic)); \ + } \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRALTGOTOIdEx( hr, althr, tpr, id, topic ) \ +{ \ + \ + if( FAILED( hr ) && (hr != althr) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + g_pKato->Comment(10, CatMsg(SpGetErrorMsg(hr), " in ", topic)); \ + } \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} +// for more general asserts. +// will not output error message based on hr +#define CHECKASSERTGOTOId( cond, tpr, id ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed")); \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} + +#define CHECKASSERTGOTOIdEx( cond, tpr, id, topic ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed in ", topic)); \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} + +#define CHECKASSERTId( cond, tpr, id ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed")); \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKISSUPPORTEDId( cond, tpr, id ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed")); \ + tpr = TPR_UNSUPPORTED; \ + } \ +} + +#define CHECKASSERTIdEx( cond, tpr, id, topic ) \ +{ \ + \ + if( !(cond) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg("Condition: ", #cond, " Failed in ", topic)); \ + tpr = TPR_FAIL; \ + } \ +} +// Useful macros and definitions +#define CHECKHRId( hr, tpr, id ) \ +{ \ + if( FAILED( hr ) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + } \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRIdEx( hr, tpr, id, topic ) \ +{ \ + \ + if( FAILED( hr ) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg(SpGetErrorMsg(hr), " in ", topic )); \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRGOTOId( hr, tpr, id) \ +{ \ + if( FAILED( hr ) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} + +#define CHECKHRGOTOIdEx( hr, tpr, id, topic ) \ +{ \ + if( FAILED( hr ) ) \ + { \ + { \ + WCHAR szwDebug[MAX_PATH]=L""; \ + if (SUCCEEDED (GetWStrFromRes( id, szwDebug ))) \ + { \ + USES_CONVERSION; \ + g_pKato->Comment(5, W2T(szwDebug)); \ + } \ + } \ + g_pKato->Comment(10, CatMsg (SpGetErrorMsg(hr), " in ", topic)); \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} +// Useful macros and definitions +#define CHECKHR( hr, tpr, szError ) \ +{ \ + if( FAILED( hr ) ) \ + { \ + if( szError) \ + { \ + g_pKato->Comment(5, szError); \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + } \ + tpr = TPR_FAIL; \ + } \ +} + +#define CHECKHRGOTO( hr, tpr, szError ) \ +{ \ + if( FAILED( hr ) ) \ + { \ + if( szError ) \ + { \ + g_pKato->Comment(5, szError); \ + g_pKato->Comment(10, SpGetErrorMsg(hr)); \ + } \ + tpr = TPR_ABORT; \ + goto EXIT; \ + } \ +} + +// Get a random number between min and max +#define GET_RANDOM( min, max ) ((rand() % (int)(((max) + 1) - (min))) + (min)) + + +/***** Helper Classes *****/ +class CEventingTest : public ISpNotifyCallback +{ + /*=== Methods =======*/ + public: + STDMETHODIMP NotifyCallback(WPARAM wParam, LPARAM lParam) { m_bCallbackNotified = true; return S_OK; } + + BOOL m_bCallbackNotified; + + CEventingTest() { m_bCallbackNotified = false; } +}; + +//speak two streams: stream1 and stream2, and return back samples: sample1 and sample2 +inline HRESULT t_SpeakTwoStreams(ISpVoice *cpVoice, WCHAR *stream1, + WCHAR *stream2, ULONG &sample1, ULONG &sample2) +{ + + HRESULT hr = S_OK; + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + + CSpStreamFormat InFormat(SPSF_22kHz16BitMono, &hr); + + // Create stream #1 + if( SUCCEEDED( hr ) ) + { + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream1 ); + } + // Set the default output format + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetOutput( cpStream1, TRUE); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->Speak(stream1, 0, 0); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + sample1 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + } + + // Create stream #2 + if( SUCCEEDED( hr ) ) + { + hr = SPCreateStreamOnHGlobal( NULL, true, InFormat.FormatId(), InFormat.WaveFormatExPtr(), &cpStream2 ); + } + + // Set the default output format + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetOutput( cpStream2, TRUE); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->Speak(stream2, 0, 0); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + sample2 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + } + + return hr; +} + +inline HRESULT GetFreqFromSamples (ISpStream * pStream, int sampFreq, ULONG &length, ULONG * pAverage ) +{ + //this is a help function to get Frequency from the wav stream. The test allocates a + // buffer with length * sizeof (BUCKET) bytes. + + //Note: The application uses 16 bits wave stream. + + HRESULT hr = S_OK; + ULONG cbActuallyRead = 0; + ULONG cSamples = 0; + ULONG freq =0; + BOOL bPositive = FALSE; + + typedef short BUCKET; //use 16 bits + BUCKET *buff = NULL, *buffHead = NULL; + float *afUnfilteredBuffer = NULL, *afUnfilteredBufferHead = NULL; + + int feaSampFreq = 100; //sample rate + int minF0 = 30; //low freq Range of frequences interested + int maxF0 = 500; //high freq + + float *f0 = NULL; + int nF0 = 0; + + float *pRms = NULL; + int nRms = 0; + *pAverage = 0; + float *pAverageRms =0; + int NumRms =0; + + buff = (BUCKET *)::CoTaskMemAlloc ( length * sizeof (BUCKET) ); + if(!buff) + { + return E_OUTOFMEMORY; + } + + afUnfilteredBuffer = (float *)::CoTaskMemAlloc ( length * sizeof ( float) ); + if(!afUnfilteredBuffer) + { + return E_OUTOFMEMORY; + } + + pAverageRms = (float *)::CoTaskMemAlloc ( length * sizeof ( float) ); + if(!pAverageRms) + { + return E_OUTOFMEMORY; + } + + //save the head pointer + buffHead = buff; + afUnfilteredBufferHead = afUnfilteredBuffer; + + // Read stream into a buffer until EOF + if( SUCCEEDED( hr ) ) + { + hr = pStream->Read( buff, length * sizeof (BUCKET), &cbActuallyRead); + } + + cSamples = cbActuallyRead / sizeof(BUCKET); + + // Create a low frequency filter and run the samples through + if( SUCCEEDED( hr ) ) + { + for( ULONG i=0; i< cSamples; i++ ) + { + afUnfilteredBuffer[i] = (float)buff[i]; + } + } + + if (!ComputeF0 (afUnfilteredBuffer, cSamples, sampFreq, minF0, maxF0, + feaSampFreq, &f0, &nF0, &pRms, &nRms)) + { + hr = E_FAIL; + return hr; + } + *pAverage = 0; + for( ULONG i=0; i < nF0; i++ ) + { + if( f0[i] >0 ) + { + *pAverage += (ULONG)f0[i]; + freq++; + } + } + + *pAverageRms = 0; + for( ULONG j=0; j < nRms; j++ ) + { + if( pRms[j] >0 ) + { + *pAverageRms += (ULONG)pRms[j]; + NumRms++; + } + } + if (NumRms > 0 ) + *pAverageRms /= NumRms; + + if (freq > 0 ) + *pAverage /= freq; + + ::CoTaskMemFree (buffHead); + ::CoTaskMemFree (afUnfilteredBufferHead); + ::CoTaskMemFree (pAverageRms); + if ( f0 ) + { + free (f0); + f0 = NULL; + } + if ( pRms ) + { + free (pRms); + pRms = NULL; + } + return hr; +} + +inline HRESULT GetAmpFromSamples (ISpStream * pStream, ULONG * pamp ) +{ + //this is a help function to get amplitude from the stream. The test assume that + // the max of the buffer for Read is 1000 X 2 bytes, i.e. everytime Read gets called, at most + // 2000 bytes are readed. + + //Note: The application uses 16 bits wave stream. + + HRESULT hr = S_OK; + + ULONG cbActuallyRead = 1; + ULONG nRead = 1000; + ULONG totalAmp = 0, average = 0; + + typedef short BUCKET; + BUCKET *buff = NULL, *buffHead = NULL; + + buff = (BUCKET *)::CoTaskMemAlloc ( nRead * sizeof (BUCKET) ); + if(!buff) + { + return E_OUTOFMEMORY; + } + + //save the head pointer + buffHead = buff; + + // Read stream into a buffer until EOF + while ( cbActuallyRead && SUCCEEDED( hr ) ) + { + if( SUCCEEDED( hr ) ) + { + hr = pStream->Read( buff, nRead * sizeof (BUCKET), &cbActuallyRead); + } + + // Sum abs value of amplitude + if( SUCCEEDED( hr ) ) + { + average += (cbActuallyRead / sizeof(BUCKET)); + + for( ULONG i=0; i < cbActuallyRead / sizeof(BUCKET); i++ ) + { + + if( buff[i] < 0 ) + { + buff[i] = -(buff[i]); + } + totalAmp += buff[i]; + } + } + } + + if ( average > 0) + *pamp = totalAmp/average; + + ::CoTaskMemFree (buffHead); + return hr; +} + + +inline HRESULT TTSSymToPhoneId(LANGID langid, WCHAR* pszSym, WCHAR* pszPhoneId) +{ + CComPtr cpPhoneConv; + CComPtr cpToken; + CComPtr cpEnum; + HRESULT hr = S_OK; + + if(SUCCEEDED(hr)) + { + hr = SpCreatePhoneConverter(langid, NULL, NULL, &cpPhoneConv); + } + if(SUCCEEDED(hr)) + { + hr = cpPhoneConv->PhoneToId(pszSym, pszPhoneId); + } + return hr; +} + +inline HRESULT CreateAppLexicon( + const WCHAR * pszLangIndependentName, + LANGID langid, + const WCHAR * pszLangDependentName, + WCHAR* pwszAttributes, + ISpLexicon** ppLexicon) +{ + HRESULT hr = S_OK; + + CComPtr cpToken; + CComPtr cpDataKeyAttribs; + if(SUCCEEDED(hr)) + { + hr = SpCreateNewTokenEx(SPCAT_APPLEXICONS, pszLangIndependentName, &CLSID_SpUnCompressedLexicon, pszLangIndependentName, langid, pszLangDependentName, &cpToken, &cpDataKeyAttribs); + } + if(SUCCEEDED(hr)) + { + CSpDynamicString str(pwszAttributes); // make a copy of the pwszAttributes + WCHAR* p = wcstok(str, L";"); + while(SUCCEEDED(hr) && p) + { + if(WCHAR* pe = wcschr(p, L'=')) + { + *(pe++) = L'\0'; + hr = cpDataKeyAttribs->SetStringValue(p, pe); + } + else + { + hr = cpDataKeyAttribs->SetStringValue(p, L""); + } + p = wcstok(NULL, L";"); + } + } + if(SUCCEEDED(hr)) + { + hr = SpCreateObjectFromToken(cpToken, ppLexicon); + } + + return hr; +} + +inline HRESULT RegRecursiveDeleteKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, BOOL fKeepEmptyRoot) +{ + HRESULT hr = S_OK; + LONG l; + HKEY hkey; + + // try to use RegDeleteKey. On Win95/98 this will be enough. + l = ::RegDeleteKey(hkeySrc, szSubKeySrc); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + if(SUCCEEDED(hr)) + { + if(fKeepEmptyRoot) + { + HKEY hkey; + l = ::RegCreateKeyEx(hkeySrc, szSubKeySrc, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &hkey, NULL); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + if(SUCCEEDED(hr)) + { + ::RegCloseKey(hkey); + } + } + return hr; + } + + l = ::RegOpenKeyEx(hkeySrc, szSubKeySrc, 0, KEY_ALL_ACCESS, &hkey); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + if(SUCCEEDED(hr)) // open hkey + { + TCHAR szName[MAX_PATH]; + DWORD cbName; + + // recursively copy the subkeys + if(SUCCEEDED(hr)) + { + for(DWORD i = 0; SUCCEEDED(hr); i++) + { + cbName = MAX_PATH; + + // always enum the first subkey because the old one has been deleted + l = ::RegEnumKeyEx(hkey, 0, szName, &cbName, NULL, NULL, NULL, NULL); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + + if(SUCCEEDED(hr)) + { + hr = RegRecursiveDeleteKey(hkey, szName); + } + } + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = S_OK; + } + + ::RegCloseKey(hkey); + } + + if(SUCCEEDED(hr) && !fKeepEmptyRoot) + { + l = ::RegDeleteKey(hkeySrc, szSubKeySrc); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + } + + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = SPERR_NO_MORE_ITEMS; + if(hr == SpHrFromWin32(ERROR_FILE_NOT_FOUND)) hr = SPERR_NOT_FOUND; + return hr; +} + +inline HRESULT RegRecursiveCopyKey(HKEY hkeySrc, LPCTSTR szSubKeySrc, HKEY hkeyDest, LPCTSTR szSubKeyDest, BOOL fClearDest) +{ + HRESULT hr = S_OK; + LONG l; + HKEY hkey1, hkey2; + + l = ::RegOpenKeyEx(hkeySrc, szSubKeySrc, 0, KEY_ALL_ACCESS, &hkey1); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + + if(SUCCEEDED(hr)) + { + if(fClearDest) + { + hr = RegRecursiveDeleteKey(hkeyDest, szSubKeyDest); + if(hr == SPERR_NOT_FOUND) + { + hr = S_OK; + } + } + + if(SUCCEEDED(hr)) + { + l = ::RegCreateKeyEx(hkeyDest, szSubKeyDest, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey2, NULL); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + } + + if(SUCCEEDED(hr)) + { + TCHAR szName[MAX_PATH]; + BYTE data[MAX_PATH]; + DWORD cbName, cbData, dwType; + + // copy the values + if(SUCCEEDED(hr)) + { + for(DWORD i = 0; SUCCEEDED(hr); i++) + { + BYTE* _data = data; + cbName = cbData = MAX_PATH; + l = ::RegEnumValue(hkey1, i, szName, &cbName, NULL, &dwType, data, &cbData); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + if(hr == HRESULT_FROM_WIN32(ERROR_MORE_DATA)) // buffer is not large enough to hold the data + { + _data = new BYTE[cbData]; + if(_data) + { + l = ::RegEnumValue(hkey1, i, szName, &cbName, NULL, &dwType, _data, &cbData); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + } + } + if(SUCCEEDED(hr)) + { + l = ::RegSetValueEx(hkey2, szName, NULL, dwType, _data, cbData); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + } + if(_data && _data != data) + { + delete[] _data; + } + } + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = S_OK; + } + + // recursively copy the subkeys + if(SUCCEEDED(hr)) + { + for(DWORD i = 0; SUCCEEDED(hr); i++) + { + cbName = MAX_PATH; + l = ::RegEnumKeyEx(hkey1, i, szName, &cbName, NULL, NULL, NULL, NULL); + hr = (l == ERROR_SUCCESS) ? S_OK : HRESULT_FROM_WIN32(l); + + if(SUCCEEDED(hr)) + { + hr = RegRecursiveCopyKey(hkey1, szName, hkey2, szName); + } + } + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = S_OK; + } + + ::RegCloseKey(hkey2); + } + + ::RegCloseKey(hkey1); + } + + if(hr == SpHrFromWin32(ERROR_NO_MORE_ITEMS)) hr = SPERR_NO_MORE_ITEMS; + if(hr == SpHrFromWin32(ERROR_FILE_NOT_FOUND)) hr = SPERR_NOT_FOUND; + return hr; +} + +inline HRESULT RemoveTestAppLexicon() +{ + + HRESULT hr = S_OK; + CComPtr cpEnum; + CComPtr cpSpObjectToken; + + if( SUCCEEDED( hr ) ) + { + // Get tts test engine voice + hr = SpEnumTokens(SPCAT_APPLEXICONS, L"TTSCompliance", NULL, &cpEnum); + } + + if( hr == S_OK ) + { + CAutoReleaseComPtr cpToken; + hr = cpEnum->Next(1, &cpToken, NULL); + while(hr == S_OK) + { + hr = cpToken->RemoveStorageFileName(CLSID_SpUnCompressedLexicon, L"DataFile", TRUE); + if(( hr == S_OK ) || (hr == SPERR_NOT_FOUND)) + { + hr = cpToken->Remove(NULL); // remove the token itself + } + if(SUCCEEDED(hr)) + { + hr = cpEnum->Next(1, &cpToken, NULL); + } + } + } + + return hr; +} + + +//*****************************************************************************/ +//Similar to CreateStreamOnHGlobal Win32 API, but allows a stream to be created +inline HRESULT SPCreateStreamOnHGlobal( + HGLOBAL hGlobal, //Memory handle for the stream object + BOOL fDeleteOnRelease, //Whether to free memory when the object is released + REFGUID rguidFormatId, //Format ID for stream + const WAVEFORMATEX * pwfex, //WaveFormatEx for stream + ISpStream ** ppStream) //Address of variable to receive ISpStream pointer +{ + HRESULT hr; + IStream * pMemStream; + *ppStream = NULL; + hr = ::CreateStreamOnHGlobal(hGlobal, fDeleteOnRelease, &pMemStream); + if (SUCCEEDED(hr)) + { + hr = ::CoCreateInstance(CLSID_SpStream, NULL, CLSCTX_ALL, __uuidof(*ppStream), (void **)ppStream); + if (SUCCEEDED(hr)) + { + hr = (*ppStream)->SetBaseStream(pMemStream, rguidFormatId, pwfex); + if (FAILED(hr)) + { + (*ppStream)->Release(); + *ppStream = NULL; + } + } + pMemStream->Release(); + } + return hr; +} + + +/************* Test function prototypes (TestProc's) *************/ +// ISpTTSEngine Tests +TESTPROCAPI t_ISpTTSEngine_Speak (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_ISpTTSEngine_Skip (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_ISpTTSEngine_GetOutputFormat (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_ISpTTSEngine_SetRate (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_ISpTTSEngine_SetVolume (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// Eventing Tests +TESTPROCAPI t_CheckEventsSAPI (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_CheckEventsNotRequire (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// TTS Markup Tests +TESTPROCAPI t_XMLBookmark (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLSilence (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLSpell (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLPronounce (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLRate (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLVolume (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLPitch (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLNonSapiTagsTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLEmphTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLPartOfSpTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_XMLContext (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// Real Time Rate/Vol Tests +TESTPROCAPI t_RealTimeRateChange (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_RealTimeVolumeChange (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +//Multiple Instances test +TESTPROCAPI t_MultiInstanceTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// Audio State Tests +TESTPROCAPI t_SpeakStop (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_SpeakDestroy (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +// Lexicon test +TESTPROCAPI t_UserLexiconTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); +TESTPROCAPI t_AppLexiconTest (UINT, TPPARAM, LPFUNCTION_TABLE_ENTRY); + +//the following are used in Multiple instance tests + +TESTPROCAPI t_ISpTTSEngine_Skip_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false); +TESTPROCAPI t_ISpTTSEngine_Speak_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false); +TESTPROCAPI t_ISpTTSEngine_GetOutputFormat_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false); +TESTPROCAPI t_ISpTTSEngine_SetRate_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false) ; +TESTPROCAPI t_ISpTTSEngine_SetVolume_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti=false) ; +TESTPROCAPI t_RealTimeRateChange_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_RealTimeVolumeChange_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_SpeakStop_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_CheckEventsSAPI_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) ; +TESTPROCAPI t_LexiconMulti_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLSAPIMarkup_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLContext_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLBookmark_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLSilence_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLPronounce_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLRate_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLVolume_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLPitch_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); +TESTPROCAPI t_XMLSpell_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti); + +#endif //__TTSCOMP_H__ \ No newline at end of file diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.rc b/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.rc new file mode 100644 index 00000000..9af2fc71 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/ttscomp.rc @@ -0,0 +1,532 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +#ifdef _WIN32 +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING1 "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20" + IDS_STRING5 "SpeakStop Ž¸”s" + IDS_STRING6 "‚±‚Ì’·‚¢•¶Žš—ñ‚ÍI—¹‚³‚¹‚È‚¢‚Å‚­‚¾‚³‚¢BŽŸ‚̃R[ƒh‚Å•ú‚½‚ê‚Ü‚·BƒGƒ“ƒWƒ“‚͊ԈႢ‚È‚­³‚µ‚­Á‹Ž‚·‚é‚Í‚¸‚Å‚·B" + IDS_STRING7 "SpeakDestroy Ž¸”s" + IDS_STRING8 "‚Ý‚È‚³‚ñ ‚±‚ñ‚É‚¿‚Í" + IDS_STRING9 "SAPI required Eventing Ž¸”s" + IDS_STRING10 "‚±‚ê‚̓eƒXƒg‚Å‚·B" + IDS_STRING11 "‰½‚Æ‚©‚©‚ñ‚Æ‚©B‰½‚Æ‚©‚©‚ñ‚Æ‚©B‰½‚Æ‚©‚©‚ñ‚Æ‚©B B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚© B‰½‚Æ‚©‚©‚ñ‚Æ‚©" + IDS_STRING12 "Initialization function Ž¸”s" + IDS_STRING13 "ISpVoice::Speak Ž¸”s" + IDS_STRING14 "ISpTTSEngine::GetOutputFormat Ž¸”s" + IDS_STRING15 "SAPI feature(optional) events Ž¸”s" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING16 "ISpVoice::SetRate Ž¸”s" + IDS_STRING17 "ISpVoice::GetRate Ž¸”s" + IDS_STRING18 "ISpVoice::SetVolume Ž¸”s" + IDS_STRING19 "ISpVoice::GetVolume Ž¸”s" + IDS_STRING20 " ƒuƒbƒNƒ}[ƒNB ƒeƒXƒgB" + IDS_STRING21 "123" + IDS_STRING22 "Engine bookmark Ž¸”s" + IDS_STRING23 "‚Ý‚È‚³‚ñ‚±‚ñ‚É‚¿‚Í" + IDS_STRING24 "‚Ý‚È‚³‚ñ ‚±‚ñ‚É‚¿‚Í" + IDS_STRING25 "Engine Silence tag Ž¸”s" + IDS_STRING26 "ENGLISH LANGUAGE" + IDS_STRING27 "ENGLISH LANGUAGE" + IDS_STRING28 "Engine Spell Ž¸”s" + IDS_STRING29 "Engine Pronounce Ž¸”s" + IDS_STRING30 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING31 "‚±‚ñ‚É‚¿‚Í" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING32 "Engine rate Ž¸”s" + IDS_STRING33 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING34 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING35 "Engine volumeE Ž¸”s" + IDS_STRING36 "±‚ñ‚É‚¿‚Í" + IDS_STRING37 "±‚ñ‚É‚¿‚Í" + IDS_STRING38 "±‚ñ‚É‚¿‚Í" + IDS_STRING39 "Engine pitch Ž¸”s" + IDS_STRING41 "‚Ý‚È‚³‚ñ ‚±‚ñ‚É‚¿‚Í" + IDS_STRING42 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING43 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING44 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING45 "‚±‚ñ‚É‚¿‚Í" + IDS_STRING46 "‚±‚ñ‚É‚¿‚Í" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING48 "ƒNƒCƒŠƒŠƒ‰" + IDS_STRING49 "%s" + IDS_STRING50 "%s" + IDS_STRING51 "Engine partofspeech Ž¸”s" + IDS_STRING52 "ƒ\ƒ‰ƒ‚ƒZƒiƒJƒCƒXƒgƒ‰ƒnƒJƒeƒ`ƒXƒCƒ}ƒ`ƒZƒ`ƒ~ƒCƒgƒCƒJƒCƒTƒJƒJƒ‰ƒgƒZƒCƒCƒ\ƒCƒ~ƒLƒjƒ~ƒC" + IDS_STRING53 " ‚±‚Ì•¶Žš—ñ‚̓ŠƒAƒ‹ƒ^ƒCƒ€‚Ì‘¬“x‚Ɖ¹—ʃeƒXƒg‚ÅŽg‚¢‚Ü‚·B‘¬“x‚Ɖ¹—Ê‚Í’†‚ɇ‚킹‚Ü‚·BƒGƒ“ƒWƒ“‚ÍA‚±‚̕ω»‚ð“Ç‚ÝŽæ‚è‚Ü‚·B" + IDS_STRING54 "Real time SetRate Ž¸”s" + IDS_STRING55 "Real time SetVolume Ž¸”s" + IDS_STRING56 "“Œ" + IDS_STRING57 "“Œ" + IDS_STRING59 "ISpVoice::Skip Ž¸”s" + IDS_STRING60 "ISpVoice::SetOutput Ž¸”s" + IDS_STRING61 "ISpVoice::WaitUntilDone Ž¸”s" + IDS_STRING62 "ISpVoice::WaitForNotifyEvent Ž¸”s" + IDS_STRING63 "‚¢‚¿B ‚ÉB ‚³‚ñB ‚æ‚ñB ‚²B ‚ë‚­B ‚µ‚¿B ‚Í‚¿B ‚«‚イB ‚¶‚イBB‚¢‚¿B ‚ÉB ‚³‚ñB ‚æ‚ñB ‚²B ‚ë‚­B ‚µ‚¿B ‚Í‚¿B ‚«‚イB ‚¶‚イB" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING64 "ƒRƒ“ƒsƒ…[ƒ^" + IDS_STRING65 "This is the TTS Compliance " + IDS_STRING66 "Non-SAPI tags Ž¸”s" + IDS_STRING67 " Non-SAPI tags " + IDS_STRING68 "•·‚±‚¦‚Ü‚·‚©H@‚Ü‚·‚©H" + IDS_STRING69 "•·‚±‚¦‚Ü‚·‚©H@‚Ü‚·‚©H" + IDS_STRING70 "Engine Emph tag Ž¸”s" + IDS_STRING71 "ƒ“ƒ‰ƒiƒ`ƒXƒCƒiƒgƒjƒ~ƒLƒ}ƒ`ƒZƒ`ƒ~ƒCƒgƒCƒJƒCƒ~ƒLƒjƒ~ƒCƒ`ƒ~ƒVƒJƒCƒgƒJƒjƒ~ƒLƒZƒXƒ‰ƒ~ƒiƒ~ƒ\ƒjƒ`ƒJƒjƒ‰ƒ~" + IDS_STRING74 "App Lexicon Ž¸”s" + IDS_STRING75 "User Lexicon Ž¸”s" + IDS_STRING76 "ƒnƒ‹" + IDS_STRING77 "TTSSymToPhoneId Ž¸”s" + IDS_STRING78 "Out of memory!" + IDS_STRING79 "ISpStream::Seek Ž¸”s" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING81 "SPCreateStreamOnHGlobal or create CTestStream Ž¸”s" + IDS_STRING82 "GetAmpFromSamples Ž¸”s" + IDS_STRING83 "GetWStrFromRes Ž¸”s" + IDS_STRING84 "new CSpStreamFormat or AssignFormat Ž¸”s" + IDS_STRING85 "CoCreateInstance Ž¸”s" + IDS_STRING86 "GetPronunciations Ž¸”s" + IDS_STRING87 "AddPronunciation Ž¸”s" + IDS_STRING88 "t_SpeakTwoStreams Ž¸”s" + IDS_STRING89 "RemovePronunciation Ž¸”s" + IDS_STRING90 "Get stream size Ž¸”s" + IDS_STRING91 "GetFreqFromSamples Ž¸”s" + IDS_STRING93 "SPBindToFile Ž¸”s" + IDS_STRING94 "ƒNƒCƒŠƒŠƒ‰ƒNƒCƒŠƒŠƒ‰ƒeƒ‰ƒXƒŠƒVƒ“ƒ‰ƒiƒ`ƒXƒCƒiƒgƒjƒ~ƒLƒ}ƒ`ƒZƒ`ƒ~ƒCƒgƒCƒJƒCƒ~ƒLƒjƒ~ƒCƒ`ƒ~ƒVƒJƒCƒgƒJƒjƒ~ƒLƒZƒXƒ‰ƒ~ƒiƒ~ƒ\ƒjƒ`ƒJƒjƒ‰ƒ~" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING96 "RegRecursiveCopyKey Ž¸”s" + IDS_STRING97 "RegRecursiveDeleteKey Ž¸”s" + IDS_STRING98 "CreateAppLexicon Ž¸”s" + IDS_STRING99 "12/21/9912.21.00 12-21-9999" + IDS_STRING100 "21/12/0021.12.3321-12-1999" + IDS_STRING101 "99/12/2199.12.21 1999-12-21" + IDS_STRING102 "99-121999.1299/12" + IDS_STRING103 "12-9912.199912/99" + IDS_STRING104 "21.12 21-12 21/12""" + IDS_STRING105 "12-21 12.21 12/21" + IDS_STRING106 " 1999 2001" + IDS_STRING107 "12:30:1012:301'21""" + IDS_STRING108 "3432" + IDS_STRING109 "3432" + IDS_STRING110 "3/15" + IDS_STRING111 "423.12433" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING112 "(425)706-2693" + IDS_STRING113 " \\ 12312.91" + IDS_STRING114 "http://www.Microsoft.com" + IDS_STRING115 "bob@microsoft.com" + IDS_STRING116 "—X•Ö”Ô†@996-8890@“Œ‹ž“s`‹æ˜Z–{–Ø@1-5-6 " + IDS_STRING117 " A2C 4X5 " + IDS_STRING118 "ƒeƒXƒg" + IDS_STRING119 "MSN ƒ[ƒ‹ƒ}ƒKƒWƒ“‚ÆMSN ƒ[ƒŠƒ“ƒOƒŠƒXƒg‚̃T[ƒrƒXŠJŽn‚É‚æ‚èAƒ†[ƒU[‚ÍA16,000Ž‚ð‰z‚¦‚éƒ[ƒ‹ƒ}ƒKƒWƒ“‚ÆA11,000ˆÈã‚̃[ƒŠƒ“ƒOƒŠƒXƒg‚Ìî•ñ‚ðAMSNã‚Å—˜—p‚Å‚«‚é‚悤‚É‚È‚è‚Ü‚·B My name is Frances Sandy Joseph Hill Alam Jr. I was born in 12/1/2006, 12:30:11pm on 123 St., St. Luis. I weight 6.23456789 lb I got my B.S., M.S., and Ph.D from Flintstone Univ. in Mars planet. I have created many 3D pictures. I have to pay $123123123123.5 tax every year. It costs about 85% of my income. Anyway, life is a box of M & M chocolate. Usually I watch DVD and listen MTV on VH1 between 3pm to 12am w/o Mathew. If you like, Go to http://www.DoesNotExist.com/ and send your comments to ttsengines@hotmail.com or call me at (888)888-CONTEXT, or mail to: 1845666 9th Ave. NE Earth, WA 98188 ." + IDS_STRING120 "GetEvents Ž¸”s" + IDS_STRING121 "ƒ“ƒ‰ƒiƒ`ƒXƒCƒiƒgƒjƒ~ƒLƒ}ƒ`ƒZƒ`ƒ~ƒCƒgƒCƒJƒCƒ~ƒLƒjƒ~ƒCƒ`ƒ~ƒVƒJƒCƒgƒJƒjƒ~ƒLƒZƒXƒ‰ƒ~ƒiƒ~ƒ\ƒjƒ`ƒJƒjƒ‰ƒ~" + IDS_STRING122 "ƒNƒCƒŠƒŠƒ‰" +END + +#endif // Japanese resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Chinese (P.R.C.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) +#ifdef _WIN32 +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +#pragma code_page(936) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING1 "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20" + IDS_STRING5 "SpeakStop ²âÊÔʧ°Ü¡£" + IDS_STRING6 "ÕâÊÇÒ»¸ö²»»á±»Íê³ÉµÄ³¤×Ö·û´®£¬ÒòΪÎÒÃÇÔÚÏÂÒ»ÐгÌÐòÀïÊÍ·ÅÁËËü¡£ÎÒÃÇÆÚÍûÒýÇæÄÜÕýÈ·µØÇåÀí¡£" + IDS_STRING7 "SpeakDestroy ²âÊÔʧ°Ü¡£" + IDS_STRING8 "ÄãºÃ ÊÀ½ç¡£" + IDS_STRING9 "SAPI required Events ²âÊÔʧ°Ü£¡" + IDS_STRING10 "ÕâÊÇÒ»¸ö²âÊÔ¡£" + IDS_STRING11 "ºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃºÃ" + IDS_STRING12 "³õʼ»¯º¯Êýʧ°Ü¡£" + IDS_STRING13 "ISpVoice::Speak ʧ°Ü¡£" + IDS_STRING14 "ISpTTSEngine::GetOutputFormat ʧ°Ü¡£" + IDS_STRING15 "SAPI feature(optional) events ²âÊÔʧ°Ü£¡" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING16 "ISpVoice::SetRate ʧ°Ü¡£" + IDS_STRING17 "ISpVoice::GetRate ʧ°Ü¡£" + IDS_STRING18 "ISpVoice::SetVolume ʧ°Ü¡£" + IDS_STRING19 "ISpVoice::GetVolume ʧ°Ü¡£" + IDS_STRING20 " Ê顣ǩ¡£ ²âÊÔ¡£" + IDS_STRING21 "123" + IDS_STRING22 "Engine BOOKMARK ²âÊÔʧ°Ü£¡" + IDS_STRING23 "ÄãºÃ£¬ÊÀ½ç¡£" + IDS_STRING24 "ÄãºÃ ÊÀ½ç¡£" + IDS_STRING25 "Engine Silence tag ²âÊÔʧ°Ü£¡" + IDS_STRING26 "ENGLISH LANGUAGE" + IDS_STRING27 "ENGLISH LANGUAGE" + IDS_STRING28 "Engine Spell tag ²âÊÔʧ°Ü£¡" + IDS_STRING29 "Engine Pron tag ²âÊÔʧ°Ü£¡" + IDS_STRING30 "ÄãºÃÊÀ½ç" + IDS_STRING31 "ÄãºÃÊÀ½ç" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING32 "Engine Rate ²âÊÔʧ°Ü£¡" + IDS_STRING33 "ÄãºÃ" + IDS_STRING34 "ÄãºÃ" + IDS_STRING35 "Engine Volume ²âÊÔʧ°Ü£¡" + IDS_STRING36 "ÄãºÃ" + IDS_STRING37 "ÄãºÃ" + IDS_STRING38 "ÄãºÃ" + IDS_STRING39 "Engine Pitch ²âÊÔʧ°Ü£¡" + IDS_STRING41 "ÄãºÃ ÊÀ½ç¡£" + IDS_STRING42 "ÄãºÃ" + IDS_STRING43 "ÄãºÃ" + IDS_STRING44 "ÄãºÃ" + IDS_STRING45 "ÄãºÃ" + IDS_STRING46 "ÄãºÃ" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING48 "hao 3 kuai 4" + IDS_STRING49 "%s" + IDS_STRING50 "%s" + IDS_STRING51 "Engine Part Of Speech ²âÊÔʧ°Ü£¡" + IDS_STRING52 "shou 3 shu 4 mu 4 lu 4 di 4 zhei 5 wo 3 wu 2 lun 4 xi 1 fang 1 xiao 3 xie 3 she 2 ma 3 mao 1 meng 4 shao 4 nian 2" + IDS_STRING53 "Õâ ¸ö×Ö·û´®±»ÓÃ×öʵʱÊýÂʺÍÒôÁ¿²âÊÔ¡£ËüµÄÊýÂʺÍÒôÁ¿ÔÚÖм䱻µ÷Õû¡£ÒýÇæÒò¸ÃʵÐÐÕâЩµ÷Õû¡£" + IDS_STRING54 "Engine Real time SetRate ²âÊÔʧ°Ü£¡" + IDS_STRING55 "Engine Real time SetVolume ²âÊÔʧ°Ü£¡" + IDS_STRING56 "Äã" + IDS_STRING57 "Äã" + IDS_STRING59 "ISpVoice::Skip ʧ°Ü" + IDS_STRING60 "ISpVoice::SetOutput ʧ°Ü" + IDS_STRING61 "ISpVoice::WaitUntilDone ʧ°Ü" + IDS_STRING62 "ISpVoice::WaitForNotifyEvent ʧ°Ü" + IDS_STRING63 "¾ä×ÓÒ»¡£¾ä×Ó¶þ¡£¾ä×ÓÈý¡£¾ä×ÓËÄ¡£¾ä×ÓÎå¡£¾ä×ÓÁù¡£¾ä×ÓÆß¡£¾ä×Ó°Ë¡£¾ä×Ӿš£ ¾ä×ÓÊ®¡£ ¡£ ¾ä×ÓÒ»¡£¾ä×Ó¶þ¡£¾ä×ÓÈý¡£¾ä×ÓËÄ¡£¾ä×ÓÎå¡£¾ä×ÓÁù¡£¾ä×ÓÆß¡£¾ä×Ó°Ë¡£¾ä×Ó¡£ ¾ä×ÓÊ®¡£ " +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING64 "Äã" + IDS_STRING65 "ÕâÊÇÒ»¸öÔĶÁÈí¼þÒ»ÖÂÐԵIJâÊÔ" + IDS_STRING66 "Engine Non SAPI tags ²âÊÔʧ°Ü£¡" + IDS_STRING67 "ÕâÊÇÒ»¸ö·Ç±ê×¼²âÊÔ" + IDS_STRING68 "ÄãÄÜÌý¼ûÎÒÂð?" + IDS_STRING69 "ÄãÄÜÌý¼ûÎÒÂð?" + IDS_STRING70 "Engine EMPH ²âÊÔʧ°Ü£¡" + IDS_STRING71 "jian 3 cha 2 chan 3 ye 4 shou 3 shu 4 mu 4 lu 4 di 4 zhei 5 wo 3 wu 2 lun 4 xi 1 fang 1 xiao 3 xie 3 she 2 ma 3 mao 1 meng 4 shao 4 nian 2 fo 2 chuang 4 ye 4 lun 2 chuan 2 fu 4 qin 1 kan 4 fei 1 fan 4 er 3 nu 3 li 4 a 1 fei 1 lu 4 di 4" + IDS_STRING74 "App Lexicon ²âÊÔʧ°Ü£¡" + IDS_STRING75 "User Lexicon ²âÊÔʧ°Ü£¡" + IDS_STRING76 "×ö" + IDS_STRING77 "TTSSymToPhoneId ʧ°Ü" + IDS_STRING78 "ÄÚ´æ²»¹»!" + IDS_STRING79 "ISpStream::Seek ʧ°Ü" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING81 "SPCreateStreamOnHGlobal or create CTestStream ʧ°Ü" + IDS_STRING82 "GetAmpFromSamples ʧ°Ü" + IDS_STRING83 "GetWStrFromRes ʧ°Ü" + IDS_STRING84 "CSpStreamFormat or AssignFormat ʧ°Ü" + IDS_STRING85 "CoCreateInstance ʧ°Ü" + IDS_STRING86 "GetPronunciation ʧ°Ü" + IDS_STRING87 "AddPronunciation ʧ°Ü" + IDS_STRING88 "t_SpeakTwoStreams ʧ°Ü" + IDS_STRING89 "RemovePronunciation ʧ°Ü" + IDS_STRING90 "Get stream size ʧ°Ü" + IDS_STRING91 "GetFreqFromSamples ʧ°Ü" + IDS_STRING93 "SPBindToFile ʧ°Ü" + IDS_STRING94 "fei 1 fei 1 shu 4 mu 4 lu 4 di 4 zhei 5 wo 3 wu 2 lun 4 xi 1 fang 1 xiao 3 xie 3 she 2 ma 3 mao 1 meng 4 ga 1 ma 3 gan 1 jing 4 tie 3 qi 4 ni 3 hao 3 hao 3" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING96 "RegRecursiveCopyKey ʧ°Ü" + IDS_STRING97 "RegRecursiveDeleteKey ʧ°Ü" + IDS_STRING98 "CreateAppLexicon ʧ°Ü" + IDS_STRING99 "12/21/9912.21.00 12-21-9999" + IDS_STRING100 "21/12/0021.12.3321-12-1999" + IDS_STRING101 "99/12/2199.12.21 1999-12-21" + IDS_STRING102 "99-121999.1299/12" + IDS_STRING103 "12-9912.199912/99" + IDS_STRING104 "21.12 21-12 21/12""" + IDS_STRING105 "12-21 12.21 12/21" + IDS_STRING106 " 1999 2001" + IDS_STRING107 "12:30:1012:301'21""" + IDS_STRING108 "3432" + IDS_STRING109 "3432" + IDS_STRING110 "3/15" + IDS_STRING111 "423.12433" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING112 "(425)706-2693" + IDS_STRING113 " £¤ 12312.91" + IDS_STRING114 "http://www.Microsoft.com" + IDS_STRING115 "bob@microsoft.com" + IDS_STRING116 "ÖйúÉϺ£ÊÐÄϾ©Â·178ºÅ 3 Ū 4 ÊÒ ÓÊÕþ±àÂë 203203 " + IDS_STRING117 "A2C 4X5 " + IDS_STRING118 "ÄãºÃ" + IDS_STRING119 "ÎÒµÄÃû×ֽдóɽ¡£ ÎÒ³öÉíÓÚ12/1/2006 12:30:11pm ±±¾©ÊÐÕÒ²»µ½´ó½Ö¡£ÎÒÓÐ 6.23456789lb¡£ÎÒÓÐ B.S. M.S. ºÍ Ph.D. ÎÒÿÄêÒª¸¶³ö £¤123123123123.5 µÄË°¡£ÕâÊÇ ´óÔ¼Õ¼85%ÎÒµÄÊÕÈë¡£ÎÞÂÛÈçºÎ£¬ÉúÃü¾ÍÏñÒ»ºÐ M&M ÇÉ¿ËÁ¦¡£Í¨³£ÎÒ¿´DVD´Ó3pmµ½12pm¡£Èç¹ûÄãÏ룬Çë¿´ÍøÂç http://www.DoesNotExist.com¡£ ͬʱÇëÀ´µç×ÓÓʼþµ½£ºttsengines@hotmial.com£¬ »òÔòÀ´µç (888)888-CONTEXT £¬ »òÔòÀ´ÐÅÇë¼Ä Öйú±±¾©Óöµ½´ó½Ö20ºÅ£¬µØÇò£¬Ì«Ñôϵ 98008¡£" + IDS_STRING120 "GetEvents ʧ°Ü" + IDS_STRING121 "fei 1 fei 1 shu 4 mu 4 lu 4 di 4 zhei 5 wo 3 wu 2 lun 4 xi 1 fang 1 xiao 3 xie 3 she 2 ma 3 mao 1 meng 4 ga 1 ma 3 gan 1 jing 4 tie 3 qi 4 ni 3 hao 3 hao 3" + IDS_STRING122 "fei 1 fei 1 shu 4 mu 4 lu 4 di 4" +END + +#endif // Chinese (P.R.C.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""version.rc2""\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING1 "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20" + IDS_STRING5 "SpeakStop test failed." + IDS_STRING6 "This is a long string of text that will not complete because we release it in the next line of code. We expect the engine to clean-up correctly and not fault." + IDS_STRING7 "SpeakDestroy test failed." + IDS_STRING8 "Hello world." + IDS_STRING9 "SAPI required Eventing test failed!" + IDS_STRING10 "This is a test." + IDS_STRING11 "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah." + IDS_STRING12 "Initialization function failed. Skipping tests." + IDS_STRING13 "ISpVoice::Speak failed" + IDS_STRING14 "ISpTTSEngine::GetOutputFormat failed" + IDS_STRING15 "SAPI feature Eventing test failed!" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING16 "ISpVoice::SetRate failed" + IDS_STRING17 "ISpVoice::GetRate failed" + IDS_STRING18 "ISpVoice::SetVolume failed" + IDS_STRING19 "ISpVoice::GetVolume failed" + IDS_STRING20 " Book. mark. test1." + IDS_STRING21 "123" + IDS_STRING22 "Engine bookmark test failed." + IDS_STRING23 "Hello world." + IDS_STRING24 "Hello world." + IDS_STRING25 "Engine Silence tag test failed!" + IDS_STRING26 "ENGLISH LANGUAGE" + IDS_STRING27 "ENGLISH LANGUAGE" + IDS_STRING28 "Engine Spell test failed!" + IDS_STRING29 "Engine Pronounce test failed!" + IDS_STRING30 "hello world" + IDS_STRING31 "hello world" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING32 "Engine rate test failed!" + IDS_STRING33 "hello" + IDS_STRING34 "hello" + IDS_STRING35 "Engine volume test failed!" + IDS_STRING36 "a" + IDS_STRING37 "a" + IDS_STRING38 "a" + IDS_STRING39 "Engine pitch test failed!" + IDS_STRING41 "Hello world." + IDS_STRING42 "hello" + IDS_STRING43 "hello" + IDS_STRING44 "hello" + IDS_STRING45 "hello" + IDS_STRING46 "hello" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING48 "h l ow" + IDS_STRING49 "%s" + IDS_STRING50 "%s" + IDS_STRING51 "Engine partofspeech test failed!" + IDS_STRING52 "n ow n p r ow n ow aa ae ah ao aw b ch eh er" + IDS_STRING53 "This string is used in the real time rate and volume tests. It's rate and volume are adjusted mid stream. Engines should pick these changes up." + IDS_STRING54 "Real time SetRate test failed!" + IDS_STRING55 "Real time SetVolume test failed." + IDS_STRING56 "a" + IDS_STRING57 "a" + IDS_STRING59 "ISpVoice::Skip failed" + IDS_STRING60 "ISpVoice::SetOutput failed" + IDS_STRING61 "ISpVoice::WaitUntilDone failed" + IDS_STRING62 "ISpVoice::WaitForNotifyEvent failed" + IDS_STRING63 "one. two. three. four. five. six. seven. eight. nine. ten. bookmark event. one. two. three. four. five. six. seven. eight. nine. ten. " +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING64 "Computer" + IDS_STRING65 "This is the TTS Compliance Test" + IDS_STRING66 "Non-SAPI tags Test Failed" + IDS_STRING67 " Non-SAPI tags test " + IDS_STRING68 "Do you hear me?" + IDS_STRING69 "Do you hearme?" + IDS_STRING70 "Engine Emph tag test failed" + IDS_STRING71 "dh aa n th ow p ow l ow jh iy aa n th ow p ow l ow jh iy aa n th ow p ow l ow jh ch ow ao ah ow ow p ow l ow jh ch ow ao ah ow" + IDS_STRING74 "App Lexicon test failed" + IDS_STRING75 "User Lexicon test failed!" + IDS_STRING76 "test" + IDS_STRING77 "TTSSymToPhoneId failed" + IDS_STRING78 "Out of memory!" + IDS_STRING79 "ISpStream::Seek failed" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING81 "SPCreateStreamOnHGlobal or create CTestStream failed" + IDS_STRING82 "GetAmpFromSamples failed" + IDS_STRING83 "GetWStrFromRes failed" + IDS_STRING84 "new CSpStreamFormat or AssignFormat failed" + IDS_STRING85 "CoCreateInstance failed" + IDS_STRING86 "GetPronunciations failed" + IDS_STRING87 "AddPronunciation failed" + IDS_STRING88 "t_SpeakTwoStreams failed" + IDS_STRING89 "RemovePronunciation failed" + IDS_STRING90 "Get stream size failed" + IDS_STRING91 "GetFreqFromSamples failed" + IDS_STRING93 "SPBindToFile failed" + IDS_STRING94 "h eh l ow w er l d h eh l ow w er l d h eh l ow w er l d h eh l ow w er l d" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING96 "RegRecursiveCopyKey failed" + IDS_STRING97 "RegRecursiveDeleteKey failed" + IDS_STRING98 "CreateAppLexicon failed" + IDS_STRING99 "12/21/9912.21.00 12-21-9999" + IDS_STRING100 "21/12/0021.12.3321-12-1999" + IDS_STRING101 "99/12/2199.12.21 1999-12-21" + IDS_STRING102 "99-121999.1299/12" + IDS_STRING103 "12-9912.199912/99" + IDS_STRING104 "21.12 21-12 21/12""" + IDS_STRING105 "12-21 12.21 12/21" + IDS_STRING106 " 1999 2001" + IDS_STRING107 "12:30:1012:301'21""" + IDS_STRING108 "3432" + IDS_STRING109 "3432" + IDS_STRING110 "3/15" + IDS_STRING111 "423.12433" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING112 "(425)706-2693" + IDS_STRING113 "$12312.90" + IDS_STRING114 "http://www.Microsoft.com" + IDS_STRING115 "bob@microsoft.com" + IDS_STRING116 "One Microsoft Way, Redmond, WA, 98052 " + IDS_STRING117 " A2C 4X5 " + IDS_STRING118 " text " + IDS_STRING119 "My name is Frances Sandy Joseph Hill Alam Jr. I was born in 12/1/2006, 12:30:11pm on 123 St., St. Luis. I weight 6.23456789 lb I got my B.S., M.S., and Ph.D from Flintstone Univ. in Mars planet. I have created many 3D pictures. I have to pay $123123123123.5 tax every year. It costs about 85% of my income. Anyway, life is a box of M & M chocolate. Usually I watch DVD and listen MTV on VH1 between 3pm to 12am w/o Mathew. If you like, Go to http://www.DoesNotExist.com/ and send your comments to ttsengines@hotmail.com or call me at (888)888-CONTEXT, or mail to: 1845666 9th Ave. NE Earth, WA 98188 ." + IDS_STRING120 "GetEvents failed" + IDS_STRING121 "aa dh aa n th ow p ow l ow jh iy aa n th ow p ow l ow jh iy aa n th ow p ow l ow jh ch ow ao ah ow ow p ow l ow jh ch ow ao ah ow" + IDS_STRING122 "aa dh aa n th ow" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/ttsmarkup.cpp b/sp/src/utils/sapi51/Tools/Comp/TTS/ttsmarkup.cpp new file mode 100644 index 00000000..c015b5cb --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/ttsmarkup.cpp @@ -0,0 +1,1726 @@ +//****************************************************************************** +// Copyright (c) Microsoft Corporation. All rights reserved. +// ttsmarkup.cpp +// +//****************************************************************************** + +#include "TTSComp.h" + +//****************************************************************************** +//***** Internal Functions +//****************************************************************************** +#include "f0.h" +int +ComputeF0 (float* data, int nData, int sampFreq, int minF0, int maxF0, int feaSampFreq, + float** f0, int* nF0, float **pRms, int *nRms) +{ + char parStr[128]; + F0Data f0Obj = NULL; + F0Out f0Frame; + int buffSize; + int buffStep; + int nFrames; + int remainder; + int nOutput; + int outSampNum; + int i; + int j; + +// assert (data); + // assert (nData>0); + // assert (sampFreq); + // assert (feaSampFreq); + // assert (f0); + + /* + * Create and initialize the f0 object + */ + if ((f0Obj = F0_NewF0Obj ()) == NULL) { + goto error; + } + + sprintf (parStr ,"frame_step=%f", 1.0/feaSampFreq); + if (!F0_ParseParameter (f0Obj, parStr)) { + goto error; + } + + sprintf (parStr ,"min_f0=%f", (float)minF0); + if (!F0_ParseParameter (f0Obj, parStr)) { + goto error; + } + + sprintf (parStr ,"max_f0=%f", (float)maxF0); + if (!F0_ParseParameter (f0Obj, parStr)) { + goto error; + } + + if (!F0_Init (f0Obj, sampFreq, &buffSize, &buffStep)) { + goto error; + } + + /* + * Prepare memory for output + */ + *nF0 = *nRms = (int) (((nData / (float)sampFreq) * feaSampFreq) + 0.5); + + *f0 = NULL; + *pRms = NULL; + if ( (*f0 = (float *) malloc(*nF0 * sizeof(**f0))) == NULL) + { + goto error; + } + if ( (*pRms = (float *) malloc(*nRms * sizeof(**pRms))) == NULL) + { + goto error; + } + + /* + * Start processing + */ + nFrames = (nData - buffSize) / buffStep + 1; + remainder = nData - nFrames*buffStep; + + outSampNum = 0; + + /* Iterate over number of frames*/ + for (i = 0; i cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLBookmark_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLBookmark_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test passes a Bookmark through XML marked up text to a TTS engine and checks +// to make sure a SPFEI_BOOKMARK event has fired. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + BOOL bGetEvents = true; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + DWORD dwEventsRetrieved = 0; + WCHAR szwBmk[MAX_PATH]=L""; + + + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetNotifyWin32Event(); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->SetInterest( SPFEI(SPEI_TTS_BOOKMARK), SPFEI(SPEI_TTS_BOOKMARK) ); + } + + //clean up the event queue + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + } + CHECKHRId( hr, tpr, IDS_STRING120 ); + + if( SUCCEEDED( hr ) ) + { + GetWStrFromRes( IDS_STRING20, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_ASYNC | SPF_IS_XML, NULL ); + } + + if( SUCCEEDED( hr ) ) + { + hr = cpVoice->WaitUntilDone( TTS_WAITTIME ); + CHECKASSERTGOTOIdEx( (hr == S_OK), tpr, IDS_STRING61, " in t_XMLBookmarkTest"); + } + + while( hr == S_OK ) + { + SPEVENT Event; + + hr = cpVoice->GetEvents (1, &Event, NULL); + + if( hr == S_OK ) + { + // Record the events retrieved in dwFlagsRetrieved + dwEventsRetrieved |= (DWORD)Event.eEventId; + + if (Event.eEventId == SPEI_TTS_BOOKMARK ) + { + //swprintf( szwBmk, L"%s, %d", (WCHAR*)Event.lParam, Event.wParam ); + //g_pKato->Comment(10, szwBmk); + + //verify bookmark string (lparam and wparam) + GetWStrFromRes( IDS_STRING21, szwDebug ); + CHECKASSERTGOTOId(( !wcscmp( (WCHAR*)Event.lParam, szwDebug ) ), tpr, IDS_STRING22); + CHECKASSERTGOTOId(( Event.wParam == _wtol(szwDebug) ), tpr, IDS_STRING22); + + break; + } + } + + } + + + // Logging info + CHECKHRId( hr, tpr, IDS_STRING22 ); + + // Make sure correct events were retrieved + CHECKASSERTGOTOId(((dwEventsRetrieved & SPEI_TTS_BOOKMARK) == SPEI_TTS_BOOKMARK), tpr, IDS_STRING22); + + +EXIT: + + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLSilence(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLSilence_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLSilence_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test speaks 2 streams. One with a Silence pause and one without. It analyzes +//the two streams to make sure a change has occured. This tests SILENCE tag. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with no SILENCE tag"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING23, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples1 > 0), tpr, IDS_STRING25, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 2 with SILENCE tag"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING24, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples2 > 0), tpr, IDS_STRING25, TEST_TOPIC ); + + // Now compare the length of the 2 streams + // Note - check to ensure cSamples2 is at least twice greater than cSamples1. + CHECKASSERTId((cSamples2 > 2 * cSamples1), tpr, IDS_STRING25); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLSpell(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLSpell_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLSpell_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test generates two streams. One that says English as a single word and one that +// spells it out. It analyzes the produced .wav forms to make sure that the second streams +// overall size is greater. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + LANGID LangID; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with no Spell tag"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING26, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + + //====================================================================== + TEST_TOPIC = "Stream 2 with Spell tag"; + //====================================================================== + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING27, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + + //For Chinese/Japanese TTS Engines, the test ignores result check since + //Spell tag can be ignored in those languages + + if ( ( LangID != 2052 ) && ( LangID != 1041 )) + { + CHECKASSERTGOTOIdEx((cSamples2 != 0), tpr, IDS_STRING28, TEST_TOPIC ); + CHECKASSERTGOTOIdEx((cSamples1 != 0), tpr, IDS_STRING28, TEST_TOPIC ); + + // Now compare the values from the 2 streams. + // Note - check to ensure cSamples2 is at least 4/3 greater than cSamples1. + CHECKASSERTId(((3 * cSamples2 )> (4 * cSamples1)), tpr, IDS_STRING28); + } +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLPronounce(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLPronounce_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLPronounce_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test generates two streams. One that says "a" as a single word. The next stream +// says "a" but tells the engine to pronounce it as a random long word. It analyzes the +// produced .wav forms to make sure that the second stream's overall size is greater. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with no PRON tag"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + // short string + hr = GetWStrFromRes( IDS_STRING56, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples1 != 0), tpr, IDS_STRING29, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 2 with PRON tag"; + //====================================================================== + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + // short string pronounced as a long string + hr = GetWStrFromRes( IDS_STRING57, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples2 != 0), tpr, IDS_STRING29, TEST_TOPIC ); + + // Now compare the values from the 2 streams + // Note - check to ensure cSamples2 is at least twice greater than cSamples1. + CHECKASSERTId((cSamples2> (2 * cSamples1)), tpr, IDS_STRING29); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLRate(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLRate_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLRate_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test changes the rate of a TTS engine twice through XML and analyzes the +// .wav form to make sure a change has occured. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with rate set to -5"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING30, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples1 != 0), tpr, IDS_STRING32, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 2 with rate set to 5"; + //====================================================================== + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING31, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(WCHAR); + CHECKASSERTGOTOIdEx((cSamples2 != 0), tpr, IDS_STRING32, TEST_TOPIC ); + + // Now compare the values from the 2 streams + // 1. First check ensures low rate has bigger cSamples than higher rate + // 2. Secondly check ensures cSamples1 and cSamples2 has enough distance + // + CHECKASSERTId((cSamples1 > cSamples2 ), tpr, IDS_STRING32); + +EXIT: + + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLVolume(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLVolume_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLVolume_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test changes the volume of a TTS engine twice through XML and analyzes the +// .wav form to make sure a change has occured. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + CComPtr cpStream1; + CComPtr cpStream2; + ULONG cSamples=0; + ULONG ulRatio=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + ULONG totalAmp1 = 0, totalAmp2 = 0; + WCHAR szwDebug[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId( hr, tpr, IDS_STRING84 ); + + //====================================================================== + TEST_TOPIC = "Stream 1 with Volume 100"; + //====================================================================== + + //*** First stream with volume set to 100 + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING33, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + LARGE_INTEGER l; + l.QuadPart = 0; + + // Reset stream to beginning + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream1, &totalAmp1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream 2 with Volume 1"; + //====================================================================== + + //*** Second stream with volume set to 1 + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING60, TEST_TOPIC); + + hr = GetWStrFromRes( IDS_STRING34, szwSpeakStr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC); + + // Reset stream to beginning + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING79, TEST_TOPIC); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream2, &totalAmp2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + //Make sure the amplitudes of stream1 and stream2 are greater than 0 + CHECKASSERTGOTOId( (totalAmp1 > 0), tpr, IDS_STRING35 ); + CHECKASSERTGOTOId( (totalAmp2 > 0), tpr, IDS_STRING35 ); + + // Note - The test assumes that the overall amplitude from stream 1 will + // be at least 3 times that of stream 2 + + ulRatio = totalAmp1/totalAmp2; + + CHECKASSERTId( (ulRatio>1), tpr, IDS_STRING35 ); + +EXIT: + + return tpr; +} + +//******************************************************************************** +TESTPROCAPI t_XMLPitch(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLPitch_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} +//******************************************************************************** +TESTPROCAPI t_XMLPitch_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ +// This test changes the pitch of a TTS engine twice through XML and analyzes the +// .wav form to make sure a change has occured. It first speaks a sentence at +// normal pitch and finds the average of the positive amplitude. The average positive +// amplitude is then used as a threshhold above which peak detection is measured. It +// is expected that a higher pitch wav form will have more peaks above the threshhold +// then a lower pitch wav form will. +// NOTE - wav samples are run through a low frequency filter to generate a smother +// wav form. + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + + CComPtr cpStream1; + CComPtr cpStream2; + STATSTG Stat; + ULONG cSamples = 0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwDebug[MAX_PATH]=L""; + ULONG freq1=0, freq2=0; + float fratio = 0; + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); //sampFreq = 22050; + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + hr = cpVoice->SetVolume( 100 ); + CHECKHRIdEx( hr, tpr, IDS_STRING18, TEST_TOPIC); + + hr = cpVoice->SetRate( 0 ); + CHECKHRIdEx( hr, tpr, IDS_STRING16, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Stream # 1 with low pitch"; + //====================================================================== + + // Create stream #1 with low pitch + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + hr = GetWStrFromRes( IDS_STRING37, szwSpeakStr ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING83, TEST_TOPIC ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC ); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples = (ULONG)Stat.cbSize.QuadPart / sizeof(short); + CHECKASSERTGOTOIdEx((cSamples != 0), tpr, IDS_STRING39, TEST_TOPIC ); + + LARGE_INTEGER l; + l.QuadPart = 0; + + // Reset stream to beginning + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + hr = GetFreqFromSamples (cpStream1, 22050, cSamples, &freq1); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING91, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream # 2 with high pitch"; + //====================================================================== + + // Create stream #2 with high pitch + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + hr = GetWStrFromRes( IDS_STRING38, szwSpeakStr ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING83, TEST_TOPIC ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC ); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING90, TEST_TOPIC ); + + cSamples = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + CHECKASSERTGOTOIdEx((cSamples != 0), tpr, IDS_STRING39, TEST_TOPIC ); + + // Reset stream to beginning + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + hr = GetFreqFromSamples (cpStream2, 22050, cSamples, &freq2); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING91, TEST_TOPIC ); + + { + //debug + TCHAR szDInfo[MAX_PATH]=TEXT(""); + _stprintf( szDInfo, TEXT("freq1 = %d, freq2 = %d"), freq1, freq2 ); + g_pKato->Comment(10, szDInfo); + } + + // Now compare the frequencies of the audio output streams + // Note - Average freqencey with high pitch has at least 1.2 times higher than + // low pitch + CHECKASSERTId((freq1 > 0), tpr, IDS_STRING39 ); + CHECKASSERTId((freq2 > 0), tpr, IDS_STRING39 ); + fratio = (float)freq2/(float)freq1; + CHECKASSERTId((fratio > 1.2 ), tpr, IDS_STRING39 ); + +EXIT: + + return tpr; +} + +//*************************************************************************************** +TESTPROCAPI t_XMLNonSapiTagsTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with an arbitrary non-sapi tag. In this case, SAPI supplys the + //SPVA_ParseUnknownTag text fragment state to the tts engine. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + CComPtr cpVoice; + CComPtr cpStream; + WCHAR szwSpeakStr[MAX_PATH]=L""; + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId(hr, tpr, IDS_STRING84); + + //create a SAPI voice + hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); + CHECKHRGOTOId( hr, tpr, IDS_STRING85 ); + + hr = GetWStrFromRes( IDS_STRING67, szwSpeakStr ); + CHECKHRGOTOId(hr, tpr, IDS_STRING83); + + // Create a generic stream to send the audio data to so we don't have to listen to it + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOId(hr, tpr, IDS_STRING81 ); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOId(hr, tpr, IDS_STRING60 ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRId(hr, tpr, IDS_STRING13); + +EXIT: + return tpr; +} + +//********************************************************************************* +TESTPROCAPI t_XMLEmphTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with EMPH tag. Test uses Pitch, Rate and volume to measure + //the output streams. The test assume that the output stream of EMPH is different + //in Rate, or Volume, or pitch from one without emph. If engines implement EMPH in + //other different way, rather than use pitch, rate, or volume, then this test will + //fail. And the test result will be "Not Supported". + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + CComPtr cpVoice; + CComPtr cpStream1; + CComPtr cpStream2; + ULONG ulRatio=0; + STATSTG Stat; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStr[MAX_PATH]=L""; + ULONG totalAmp1 = 0, totalAmp2 = 0; + ULONG freq1=0, freq2=0; + + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + hr = GetWStrFromRes( IDS_STRING69, szwSpeakStr ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING83, TEST_TOPIC ); + + // Create the SAPI voice + hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING85, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream #1 without Emph"; + //====================================================================== + + // Create stream #1 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the output format + hr = cpVoice->SetOutput( cpStream1, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + //no Emph + hr = GetWStrFromRes( IDS_STRING68, szwSpeakStr ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING83, TEST_TOPIC ); + + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC ); + + // Get stream size + hr = cpStream1->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples1 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + + LARGE_INTEGER l; + l.QuadPart = 0; + + // Reset stream to beginning + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + // get the sum of the amplitude from the stream 1 + hr = GetAmpFromSamples (cpStream1, &totalAmp1 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82, TEST_TOPIC ); + + // Reset stream to beginning again + hr = cpStream1->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + //get frequency + hr = GetFreqFromSamples (cpStream1, 22050, cSamples1, &freq1); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING91, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Stream #2 with Emph"; + //====================================================================== + + // Create stream #2 + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the output format + hr = cpVoice->SetOutput( cpStream2, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + GetWStrFromRes( IDS_STRING69, szwSpeakStr ); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC ); + + // Get stream size + hr = cpStream2->Stat( &Stat, STATFLAG_NONAME ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING90, TEST_TOPIC); + + cSamples2 = (ULONG)Stat.cbSize.QuadPart / sizeof(SHORT); + + // Reset stream to beginning + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + // get the sum of the amplitude from the stream 2 + hr = GetAmpFromSamples (cpStream2, &totalAmp2 ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING82 , TEST_TOPIC ); + + // Reset stream to beginning again + hr = cpStream2->Seek( l, SEEK_SET, NULL ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING79, TEST_TOPIC ); + + hr = GetFreqFromSamples (cpStream2, 22050, cSamples2, &freq2); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING91, TEST_TOPIC ); + + //Compare the two streams by Pitch, volume, and Rate. + //The output streams should be different in pitch, or volume, or Rate. + + //Rate measurement + + CHECKISSUPPORTEDId( (cSamples2 > 0), tpr, IDS_STRING70 ); + CHECKISSUPPORTEDId( (cSamples1 > 0), tpr, IDS_STRING70 ); + + //Volume measurement + CHECKISSUPPORTEDId( (totalAmp1 > 0), tpr, IDS_STRING70 ); + CHECKISSUPPORTEDId( (totalAmp2 > 0), tpr, IDS_STRING70 ); + + // Pitch measurement + CHECKISSUPPORTEDId( (freq2 > 0), tpr, IDS_STRING70 ); + CHECKISSUPPORTEDId( (freq1 > 0), tpr, IDS_STRING70 ); + + CHECKISSUPPORTEDId( (freq2 != freq1 ) || (cSamples2 != cSamples1 ) || (totalAmp2 != totalAmp1) , tpr, IDS_STRING70 ); + +EXIT: + return tpr; +} + +//******************************************************************************** +TESTPROCAPI t_XMLContext(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpLocalVoice; + + // Create the SAPI voice + DOCHECKHRGOTO (hr = cpLocalVoice.CoCreateInstance( CLSID_SpVoice );); + + tpr = t_XMLContext_Test(uMsg, tpParam, lpFTE, cpLocalVoice, false); + +EXIT: + return tpr; +} + +//******************************************************************************** +TESTPROCAPI t_XMLContext_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + //This test Speaks with CONTEXT tag. + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + CComPtr cpStream; + const char * TEST_TOPIC = ""; + WCHAR szwSpeakStr[1024]=L""; + + //====================================================================== + TEST_TOPIC = "Context: Initialization"; + //====================================================================== + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING84, TEST_TOPIC ); + + // Create stream + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC ); + + // Set the output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#1a - date_mdy"; + //====================================================================== + + //Date in mdy format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING99, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#1b - date_dmy"; + //====================================================================== + + //Date in date_dmy format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING100, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#1c - date_ymd"; + //====================================================================== + + //Date in date_ymd format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING101, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2a - date_ym"; + //====================================================================== + + //Date in date_ym format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING102, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2b - date_my"; + //====================================================================== + + //Date in date_my format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING103, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2c - date_dm"; + //====================================================================== + + //Date in date_dm format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING104, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2d - date_md"; + //====================================================================== + + //Date in date_md format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING105, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#2e - date_md"; + //====================================================================== + + //Date in date_year format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING106, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#3 - time"; + //====================================================================== + + //Time in time_hms format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING107, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#4a - number_cardinal"; + //====================================================================== + + //Number in number_cardinal format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING108, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#4b - number_digit"; + //====================================================================== + + //Number in number_digit format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING109, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#4c - number_fraction"; + //====================================================================== + + //Number in number_fraction format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING110, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#4d - number_decimal"; + //====================================================================== + + //Number in number_decimal format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING111, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#5 - phone_number"; + //====================================================================== + + // phone_number format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING112, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#6 - currency"; + //====================================================================== + + // currency format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING113, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#7 - web"; + //====================================================================== + + // web format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING114, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#8 - email_address"; + //====================================================================== + + // email address format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING115, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#9 - address"; + //====================================================================== + + // address format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING116, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#10 - address_postal"; + //====================================================================== + + // address postal format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING117, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Context: Test#11 - my context tests"; + //====================================================================== + // + // ms context format + DOCHECKHRGOTO( hr = GetWStrFromRes( IDS_STRING118, szwSpeakStr );); + hr = cpVoice->Speak( szwSpeakStr, SPF_IS_XML, NULL ); + CHECKHRIdEx( hr, tpr, IDS_STRING13, TEST_TOPIC ); + +EXIT: + return tpr; +} + +//************************************************************************************* +TESTPROCAPI t_XMLPartOfSpTest(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) +{ + //This test is trying to Speak with PartOfSP tags. + //Currently it is in the feature list. The test result will be "Supported" + // or "Unsupported". + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + + HRESULT hr = S_OK; + int tpr = TPR_SUPPORTED; + + CComPtr cpVoice; + CComPtr cpConlexicon; + LANGID LangID; + ULONG cSamples1=0, cSamples2=0; + WCHAR szwSpeakStrNoun[MAX_PATH]=L""; + WCHAR szwSpeakStrVerb[MAX_PATH]=L""; + WCHAR szNewWord[MAX_PATH]=L""; + WCHAR szwSpeakstr[MAX_PATH]=L""; + WCHAR szVPronunciation[MAX_PATH]=L""; + WCHAR szNPronunciation[MAX_PATH]=L""; + + const char * TEST_TOPIC = ""; + + //====================================================================== + TEST_TOPIC = "Initialization"; + //====================================================================== + + hr = GetWStrFromRes( IDS_STRING76, szNewWord ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + DOCHECKHRGOTO( hr = SpGetLanguageIdFromDefaultVoice(&LangID); ); + + //create a SAPI voice + hr = cpVoice.CoCreateInstance( CLSID_SpVoice ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING85, TEST_TOPIC ); + + hr = cpConlexicon.CoCreateInstance(CLSID_SpLexicon); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING85, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Add verb pronunciation to a word"; + //====================================================================== + + hr = GetWStrFromRes( IDS_STRING48, szwSpeakStrVerb ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwSpeakStrVerb, szVPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + hr = cpConlexicon->RemovePronunciation(szNewWord, LangID, SPPS_Verb, szVPronunciation); + CHECKHRALTGOTOIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //Assign the verb pronunciation of the new word + hr = cpConlexicon->AddPronunciation(szNewWord, LangID, SPPS_Verb, szVPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING87, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Add noun pronunciation to a word"; + //====================================================================== + + hr = GetWStrFromRes( IDS_STRING52, szwSpeakStrNoun ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + //get phoneid + hr = TTSSymToPhoneId ( LangID, szwSpeakStrNoun, szNPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING77, TEST_TOPIC ); + + hr = cpConlexicon->RemovePronunciation(szNewWord, LangID, SPPS_Noun, szNPronunciation); + CHECKHRALTGOTOIdEx( hr, SPERR_NOT_IN_LEX, tpr, IDS_STRING89, TEST_TOPIC); + + //add the word in noun pronunciation to Lexicon + hr = cpConlexicon->AddPronunciation(szNewWord, LangID, SPPS_Noun, szNPronunciation); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING87, TEST_TOPIC ); + + //====================================================================== + TEST_TOPIC = "Speak two streams with PartOfSp"; + //====================================================================== + + //speak two streams + hr = GetWStrFromRes( IDS_STRING49, szwSpeakstr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + swprintf( szwSpeakStrNoun, szwSpeakstr, szNewWord ); + + hr = GetWStrFromRes( IDS_STRING50, szwSpeakstr ); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING83, TEST_TOPIC); + + swprintf( szwSpeakStrVerb, szwSpeakstr, szNewWord ); + + hr = t_SpeakTwoStreams(cpVoice, szwSpeakStrNoun, szwSpeakStrVerb, cSamples1, cSamples2); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING88, TEST_TOPIC); + + hr = cpConlexicon->RemovePronunciation(szNewWord, LangID, SPPS_Noun, szNPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING89, TEST_TOPIC); + + hr = cpConlexicon->RemovePronunciation(szNewWord, LangID, SPPS_Verb, szVPronunciation); + CHECKHRGOTOIdEx( hr, tpr, IDS_STRING89, TEST_TOPIC); + + CHECKISSUPPORTEDId((cSamples1 > 0 ), tpr, IDS_STRING51); + CHECKISSUPPORTEDId((cSamples2 > 0 ), tpr, IDS_STRING51); + + //This test assumes that second stream should be twice shorter than the first one. + CHECKISSUPPORTEDId( ( 2* cSamples2 < cSamples1), tpr, IDS_STRING51); + +EXIT: + return tpr; +} + +//************************************************************************************** +TESTPROCAPI t_XMLSAPIMarkup_Test(UINT uMsg, + TPPARAM tpParam, + LPFUNCTION_TABLE_ENTRY lpFTE, + ISpVoice *cpVoice, + bool bCalledByMulti) +{ + // This test expects TTS engines to handle all possible spec'ed out combinations + //of the XML tags. + + + HRESULT hr = S_OK; + int tpr = TPR_PASS; + + // Message check + if (uMsg != TPM_EXECUTE) + { + return TPR_NOT_HANDLED; + } + else if(lpFTE) // called by SpComp directly. It is NULL in multiInstance test. + { + srand(reinterpret_cast(tpParam)->dwRandomSeed); + } + + CComPtr cpStream; + + WCHAR szwSpeakStr[MAX_PATH]=L""; + WCHAR szwXMLString[MAX_PATH]=L""; + const char * TEST_TOPIC = ""; + + CSpStreamFormat NewFmt(SPSF_22kHz16BitMono, &hr); + CHECKHRGOTOId(hr, tpr, IDS_STRING84); + + //====================================================================== + TEST_TOPIC = "Markup Test: Initialization"; + //====================================================================== + + // Create a generic stream to send the audio data to so we don't have to listen to it + hr = SPCreateStreamOnHGlobal( NULL, true, NewFmt.FormatId(), NewFmt.WaveFormatExPtr(), &cpStream ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING81, TEST_TOPIC); + + // Set the default output format + hr = cpVoice->SetOutput( cpStream, TRUE); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING60, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Bookmark"; + //====================================================================== + + // Bookmark + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING8, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Silence"; + //====================================================================== + + // Silence + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING41, szwSpeakStr );); + swprintf( szwXMLString, szwSpeakStr, GET_RANDOM(0, 2000) ); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Spell"; + //====================================================================== + + // Spell + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING27, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Pron"; + //====================================================================== + + // Pronounce + + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING43, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Rate"; + //====================================================================== + + // Rate + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING44, szwSpeakStr );); + swprintf( szwXMLString, szwSpeakStr, GET_RANDOM(-10, 10) ); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + //====================================================================== + TEST_TOPIC = "Markup Test: Volume"; + //====================================================================== + + // Volume + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING45, szwSpeakStr );); + swprintf( szwXMLString, szwSpeakStr, GET_RANDOM(0, 100) ); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Pitch"; + //====================================================================== + + // Pitch + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING46, szwSpeakStr );); + swprintf( szwXMLString, szwSpeakStr, GET_RANDOM(-10, 10) ); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Non-Sapi"; + //====================================================================== + //Non-Sapi + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING67, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + //====================================================================== + TEST_TOPIC = "Markup Test: Context"; + //====================================================================== + + //Context + DOCHECKHRGOTO (hr = GetWStrFromRes( IDS_STRING119, szwXMLString );); + hr = cpVoice->Speak( szwXMLString, SPF_ASYNC | SPF_IS_XML, NULL ); + CHECKHRIdEx(hr, tpr, IDS_STRING13, TEST_TOPIC); + + hr = cpVoice->WaitUntilDone( TTS_WAITTIME ); + CHECKHRGOTOIdEx(hr, tpr, IDS_STRING61, " in t_XMLBookmarkTest"); + + +EXIT: + return tpr; +} + + + diff --git a/sp/src/utils/sapi51/Tools/Comp/TTS/version.rc2 b/sp/src/utils/sapi51/Tools/Comp/TTS/version.rc2 new file mode 100644 index 00000000..10937ef2 --- /dev/null +++ b/sp/src/utils/sapi51/Tools/Comp/TTS/version.rc2 @@ -0,0 +1,44 @@ +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "Microsoft Corp.\0" + VALUE "FileDescription", "Microsoft TTS Compliance Test Tool\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "ttscomp\0" + VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved.\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "ttscomp.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Microsoft Corp. SAPI5 samples\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC